mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 05:50:31 +00:00
Merge pull request #662 from LuisAntonRebollo/cmake_missing_modules
Fixes #625 - Cmake missing modules
This commit is contained in:
commit
76b70365e7
6 changed files with 191 additions and 6 deletions
|
|
@ -61,6 +61,32 @@ macro(addDebugDef def)
|
|||
set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG "${def}")
|
||||
endmacro()
|
||||
|
||||
# adds a required definition. Are processed on addExecutable or addStaticLib
|
||||
macro(addRequiredDefinition def)
|
||||
#message(STATUS "${PROJECT_NAME} : add def : ${def}")
|
||||
LIST( APPEND ${PROJECT_NAME}_required_definition ${def} )
|
||||
endmacro()
|
||||
# adds a required debug definition. Are processed on addExecutable or addStaticLib
|
||||
macro(addRequiredDebugDefinition def)
|
||||
#message(STATUS "${PROJECT_NAME} : add def : ${def}")
|
||||
LIST( APPEND ${PROJECT_NAME}_required_debug_definition ${def} )
|
||||
endmacro()
|
||||
|
||||
# add definitions to project
|
||||
macro( _processProjectDefinition )
|
||||
foreach( def ${${PROJECT_NAME}_required_definition} )
|
||||
addDef( ${def} )
|
||||
endforeach()
|
||||
|
||||
foreach( def ${${PROJECT_NAME}_required_debug_definition} )
|
||||
addDebugDef( ${def} )
|
||||
endforeach()
|
||||
|
||||
#clear required defs
|
||||
set( ${PROJECT_NAME}_required_definition )
|
||||
set( ${PROJECT_NAME}_required_debug_definition )
|
||||
endmacro()
|
||||
|
||||
# adds an include path
|
||||
macro(addInclude incPath)
|
||||
#message(STATUS "${PROJECT_NAME} : add include path : ${incPath}")
|
||||
|
|
@ -73,6 +99,53 @@ macro(addLib lib)
|
|||
target_link_libraries(${PROJECT_NAME} "${lib}")
|
||||
endmacro()
|
||||
|
||||
# adds a library dependency. Are processed on addExecutable or addStaticLib
|
||||
macro(addRequiredLibrary lib)
|
||||
#message(STATUS "${PROJECT_NAME} : add lib : ${lib}")
|
||||
LIST( APPEND ${PROJECT_NAME}_required_library ${lib} )
|
||||
endmacro()
|
||||
|
||||
# adds a link dependency. Are processed on addExecutable or addStaticLib
|
||||
macro(addRequiredLink lib)
|
||||
#message(STATUS "${PROJECT_NAME} : add lib : ${lib}")
|
||||
LIST( APPEND ${PROJECT_NAME}_required_link ${lib} )
|
||||
endmacro()
|
||||
|
||||
macro( _processProjectLibrary )
|
||||
# Append currect project to PROJECT_STACK
|
||||
LIST( APPEND PROJECT_STACK "${PROJECT_NAME}" )
|
||||
|
||||
foreach( lib ${${PROJECT_NAME}_required_library} )
|
||||
#message( "adding library dependency: ${lib}" )
|
||||
include( ${lib} )
|
||||
endforeach()
|
||||
|
||||
#clear required libraries
|
||||
set( ${PROJECT_NAME}_required_library )
|
||||
|
||||
# pop currect project form PROJECT_STACK
|
||||
LIST(REMOVE_AT PROJECT_STACK -1)
|
||||
|
||||
# get currect project form stack
|
||||
if( PROJECT_STACK )
|
||||
LIST(GET PROJECT_STACK -1 TEMP_PROJECT)
|
||||
project( ${TEMP_PROJECT} )
|
||||
endif()
|
||||
|
||||
|
||||
endmacro()
|
||||
|
||||
macro( _processProjectLinks )
|
||||
#message( "_processProjectLinks: ${PROJECT_NAME}" )
|
||||
foreach( lib ${${PROJECT_NAME}_required_link} )
|
||||
addLib( ${lib} )
|
||||
endforeach()
|
||||
|
||||
#clear required libraries
|
||||
set( ${PROJECT_NAME}_required_link )
|
||||
endmacro()
|
||||
|
||||
|
||||
# adds a path to search for libs
|
||||
macro(addLibPath dir)
|
||||
link_directories(${dir})
|
||||
|
|
@ -146,6 +219,10 @@ macro(addStaticLib)
|
|||
#foreach(dir ${${PROJECT_NAME}_paths})
|
||||
addInclude("${firstDir}")
|
||||
#endforeach()
|
||||
|
||||
_processProjectLinks()
|
||||
_processProjectLibrary()
|
||||
_processProjectDefinition()
|
||||
endmacro()
|
||||
|
||||
# macro to add an executable
|
||||
|
|
@ -161,6 +238,10 @@ macro(addExecutable)
|
|||
add_executable("${PROJECT_NAME}" WIN32 ${${PROJECT_NAME}_files})
|
||||
# omg - only use the first folder ... otehrwise we get lots of header name collisions
|
||||
addInclude("${firstDir}")
|
||||
|
||||
_processProjectLinks()
|
||||
_processProjectLibrary()
|
||||
_processProjectDefinition()
|
||||
endmacro()
|
||||
|
||||
macro(setupVersionNumbers)
|
||||
|
|
|
|||
18
Tools/CMake/libraries/library_recast.cmake
Normal file
18
Tools/CMake/libraries/library_recast.cmake
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Recast library
|
||||
project(recast)
|
||||
|
||||
# Source
|
||||
addPathRec( "${libDir}/recast/DebugUtils/Source" )
|
||||
addPathRec( "${libDir}/recast/Recast/Source" )
|
||||
addPathRec( "${libDir}/recast/Detour/Source" )
|
||||
addPathRec( "${libDir}/recast/DetourCrowd/Source" )
|
||||
addPathRec( "${libDir}/recast/DetourTileCache/Source" )
|
||||
|
||||
# Additional includes
|
||||
include_directories( "${libDir}/recast/DebugUtils/Include" )
|
||||
include_directories( "${libDir}/recast/Recast/Include" )
|
||||
include_directories( "${libDir}/recast/Detour/Include" )
|
||||
include_directories( "${libDir}/recast/DetourTileCache/Include" )
|
||||
include_directories( "${libDir}/recast/DetourCrowd/Include" )
|
||||
|
||||
addStaticLib()
|
||||
19
Tools/CMake/modules/module_hydra.cmake
Normal file
19
Tools/CMake/modules/module_hydra.cmake
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# module OculusVR
|
||||
|
||||
# Source
|
||||
addPathRec( "${srcDir}/platform/input/razerHydra" )
|
||||
|
||||
# Includes
|
||||
include_directories( "${TORQUE_RAZERHYDRA_SDK_PATH}/include" )
|
||||
|
||||
# Install
|
||||
if( WIN32 )
|
||||
# File Copy for Release
|
||||
INSTALL(FILES "${TORQUE_RAZERHYDRA_SDK_PATH}/bin/win32/release_dll/sixense.dll" DESTINATION "${projectOutDir}")
|
||||
|
||||
# File Copy for Debug
|
||||
INSTALL(FILES "${TORQUE_RAZERHYDRA_SDK_PATH}/bin/win32/debug_dll/sixensed.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Debug" )
|
||||
# Only needed by the debug sixense library
|
||||
INSTALL(FILES "${TORQUE_RAZERHYDRA_SDK_PATH}/samples/win32/sixense_simple3d/DeviceDLL.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Debug" )
|
||||
endif()
|
||||
|
||||
16
Tools/CMake/modules/module_navigation.cmake
Normal file
16
Tools/CMake/modules/module_navigation.cmake
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Navigation module
|
||||
|
||||
addRequiredDefinition( "TORQUE_NAVIGATION_ENABLED" )
|
||||
addRequiredLibrary( "libraries/library_recast.cmake" )
|
||||
addRequiredLink( "recast" )
|
||||
|
||||
# files
|
||||
addPathRec( "${srcDir}/navigation" )
|
||||
|
||||
# include paths
|
||||
include_directories( "${libDir}/recast/DebugUtils/Include" )
|
||||
include_directories( "${libDir}/recast/Recast/Include" )
|
||||
include_directories( "${libDir}/recast/Detour/Include" )
|
||||
include_directories( "${libDir}/recast/DetourTileCache/Include" )
|
||||
include_directories( "${libDir}/recast/DetourCrowd/Include" )
|
||||
|
||||
15
Tools/CMake/modules/module_oculusVR.cmake
Normal file
15
Tools/CMake/modules/module_oculusVR.cmake
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# module OculusVR
|
||||
|
||||
# Source
|
||||
addPathRec( "${srcDir}/platform/input/oculusVR" )
|
||||
|
||||
# Includes
|
||||
include_directories( "${TORQUE_OCULUSVR_SDK_PATH}/LibOVR/Include" )
|
||||
include_directories( "${TORQUE_OCULUSVR_SDK_PATH}/LibOVR/Src" )
|
||||
|
||||
# Libs
|
||||
if( WIN32 )
|
||||
link_directories( "${TORQUE_OCULUSVR_SDK_PATH}/LibOVR/Lib/Win32" )
|
||||
addRequiredLink( "libovr.lib" )
|
||||
addRequiredLink( "libovrd.lib" )
|
||||
endif()
|
||||
|
|
@ -21,6 +21,26 @@ option(TORQUE_HIFI "HIFI? support" OFF)
|
|||
mark_as_advanced(TORQUE_HIFI)
|
||||
option(TORQUE_EXTENDED_MOVE "Extended move support" OFF)
|
||||
mark_as_advanced(TORQUE_EXTENDED_MOVE)
|
||||
option(TORQUE_NAVIGATION "Enable Navigation module" OFF)
|
||||
#mark_as_advanced(TORQUE_NAVIGATION)
|
||||
|
||||
#Oculus VR
|
||||
option(TORQUE_OCULUSVR "Enable OCULUSVR module" OFF)
|
||||
mark_as_advanced(TORQUE_OCULUSVR)
|
||||
if(TORQUE_OCULUSVR)
|
||||
set(TORQUE_OCULUSVR_SDK_PATH "" CACHE PATH "OCULUSVR library path" FORCE)
|
||||
else() # hide variable
|
||||
set(TORQUE_OCULUSVR_SDK_PATH "" CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
||||
#Hydra
|
||||
option(TORQUE_HYDRA "Enable HYDRA module" OFF)
|
||||
mark_as_advanced(TORQUE_HYDRA)
|
||||
if(TORQUE_HYDRA)
|
||||
set(TORQUE_HYDRA_SDK_PATH "" CACHE PATH "HYDRA library path" FORCE)
|
||||
else() # hide variable
|
||||
set(TORQUE_HYDRA_SDK_PATH "" CACHE INTERNAL "" FORCE)
|
||||
endif()
|
||||
|
||||
###############################################################################
|
||||
# options
|
||||
|
|
@ -224,6 +244,18 @@ else()
|
|||
addPath("${srcDir}/T3D/gameBase/std")
|
||||
endif()
|
||||
|
||||
if(TORQUE_NAVIGATION)
|
||||
include( "modules/module_navigation.cmake" )
|
||||
endif()
|
||||
|
||||
if(TORQUE_OCULUSVR)
|
||||
include( "modules/module_oculusVR.cmake" )
|
||||
endif()
|
||||
|
||||
if(TORQUE_HYDRA)
|
||||
include( "modules/module_hydra.cmake" )
|
||||
endif()
|
||||
|
||||
###############################################################################
|
||||
# platform specific things
|
||||
###############################################################################
|
||||
|
|
@ -448,10 +480,14 @@ endif()
|
|||
###############################################################################
|
||||
# Installation
|
||||
###############################################################################
|
||||
INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game" DESTINATION "${projectDir}")
|
||||
if(WIN32)
|
||||
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/cleanShaders.bat" DESTINATION "${projectDir}")
|
||||
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeleteCachedDTSs.bat" DESTINATION "${projectDir}")
|
||||
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeleteDSOs.bat" DESTINATION "${projectDir}")
|
||||
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeletePrefs.bat" DESTINATION "${projectDir}")
|
||||
|
||||
if(TORQUE_TEMPLATE)
|
||||
message("Prepare Template(${TORQUE_TEMPLATE}) install...")
|
||||
INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game" DESTINATION "${projectDir}")
|
||||
if(WIN32)
|
||||
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/cleanShaders.bat" DESTINATION "${projectDir}")
|
||||
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeleteCachedDTSs.bat" DESTINATION "${projectDir}")
|
||||
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeleteDSOs.bat" DESTINATION "${projectDir}")
|
||||
INSTALL(FILES "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/DeletePrefs.bat" DESTINATION "${projectDir}")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue