* Feature: Begin working the new engine module system.

This commit is contained in:
Robert MacGregor 2022-05-17 20:42:35 -04:00
parent 9901fa76b4
commit dfc03da9d9
10 changed files with 133 additions and 28 deletions

View file

@ -90,10 +90,10 @@ mark_as_advanced(TORQUE_USE_ZENITY)
option(TORQUE_SHOW_LEGACY_FILE_FIELDS "If on, shows legacy direct file path fields in the inspector." OFF)
mark_as_advanced(TORQUE_SHOW_LEGACY_FILE_FIELDS)
include("${CMAKE_SOURCE_DIR}/Tools/CMake/basics.cmake")
setupVersionNumbers()
# Install Torque template
if(NOT TORQUE_TEMPLATE)
set(TORQUE_TEMPLATE "BaseGame" CACHE STRING "the template to use")
endif()

View file

@ -3,9 +3,6 @@
set(BUILD_SHARED_LIBS off CACHE STRING "")
add_subdirectory(assimp ${CMAKE_BINARY_DIR}/temp/assimp EXCLUDE_FROM_ALL)
set(BUILD_CPU_DEMOS off CACHE STRING "")
set(BUILD_BULLET2_DEMOS off CACHE STRING "")
add_subdirectory(bullet ${CMAKE_BINARY_DIR}/temp/bullet EXCLUDE_FROM_ALL)
add_subdirectory(sdl ${CMAKE_BINARY_DIR}/temp/sdl2 EXCLUDE_FROM_ALL)
# FIXME: For now we force-on Neon
@ -18,10 +15,6 @@ add_subdirectory(tinyxml ${CMAKE_BINARY_DIR}/temp/tinyxml EXCLUDE_FROM_ALL)
add_subdirectory(opcode ${CMAKE_BINARY_DIR}/temp/opcode EXCLUDE_FROM_ALL)
set(ALSOFT_EXAMPLES off CACHE STRING "")
set(ALSOFT_UPDATE_BUILD_VERSION off CACHE STRING "")
add_subdirectory(openal-soft ${CMAKE_BINARY_DIR}/temp/openal-soft EXCLUDE_FROM_ALL)
add_subdirectory(zlib ${CMAKE_BINARY_DIR}/temp/zlib EXCLUDE_FROM_ALL)
add_subdirectory(pcre ${CMAKE_BINARY_DIR}/temp/pcre EXCLUDE_FROM_ALL)
add_subdirectory(convexDecomp ${CMAKE_BINARY_DIR}/temp/convexDecomp EXCLUDE_FROM_ALL)

View file

@ -0,0 +1,13 @@
file(GLOB GLAD_SOURCES "src/*.c")
# TODO EGL support if we ever use EGL instead of GLX
if (WIN32)
file(GLOB GLAD_SOURCES_WGL "src/wgl/*.c")
set(GLAD_SOURCES ${GLAD_SOURCES} ${GLAD_SOURCES_WGL})
elseif (UNIX AND NOT APPLE)
file(GLOB GLAD_SOURCES_GLX "src/glx/*.c")
set(GLAD_SOURCES ${GLAD_SOURCES} ${GLAD_SOURCES_GLX})
endif()
add_library(glad STATIC ${GLAD_SOURCES})
target_include_directories(glad PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")

View file

@ -0,0 +1,6 @@
file(GLOB RECAST_SOURCES "DebugUtils/Source/*.cpp" "Recast/Source/*.cpp" "Detour/Source/*.cpp" "DetourCrowd/Source/*.cpp"
"DetourTileCache/Source/*.cpp")
add_library(recast STATIC ${RECAST_SOURCES})
target_include_directories(recast PUBLIC "DebugUtils/Include" "Recast/Include" "Detour/Include"
"DetourTileCache/Include" "DetourCrowd/Include")

View file

@ -14,7 +14,7 @@ file(GLOB TORQUE_T3D_SOURCES "T3D/fps/*.cpp" "T3D/fx/*.cpp" "T3D/vehicles/*.cpp"
file(GLOB TORQUE_TS_SOURCES "ts/*.cpp" "ts/collada/*.cpp" "ts/assimp/*.cpp" "ts/loader/*.cpp" "ts/arch/*.cpp")
# Handle SFX
file(GLOB TORQUE_SFX_SOURCES "sfx/*.cpp" "sfx/media/*.cpp" "sfx/null/*.cpp" "sfx/openal/*.cpp" "sfx/openal/mac/*.cpp")
file(GLOB TORQUE_SFX_SOURCES "sfx/*.cpp" "sfx/media/*.cpp" "sfx/null/*.cpp")
# Handle GFX
file(GLOB TORQUE_GFX_SOURCES "gfx/*.cpp" "gfx/Null/*.cpp" "gfx/test/*.cpp" "gfx/bitmap/*.cpp" "gfx/bitmap/loaders/*.cpp"
@ -27,8 +27,7 @@ file(GLOB TORQUE_CORE_SOURCES "core/*.cpp" "core/stream/*.cpp" "core/strings/*.c
# Handle GUI
file(GLOB TORQUE_GUI_SOURCES "gui/*.cpp" "gui/buttons/*.cpp" "gui/containers/*.cpp" "gui/controls/*.cpp" "gui/core/*.cpp"
"gui/game/*.cpp" "gui/shiny/*.cpp" "gui/utility/*.cpp" "gui/3d/*.cpp" "gui/editor/*.cpp"
"gui/worldEditor/*.cpp" "gui/worldEditor/tools/*.cpp" "gui/editor/inspector/*.cpp")
"gui/game/*.cpp" "gui/shiny/*.cpp" "gui/utility/*.cpp" "gui/3d/*.cpp")
# Handle postFX
file(GLOB TORQUE_POSTFX_SOURCES "postFx/*.cpp")
@ -113,13 +112,13 @@ file(GLOB TORQUE_PLATFORM_SDL_SOURCES "platformSDL/*.cpp" "platformSDL/threads/*
# Link generic libs
set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} png "-framework Cocoa" "-framework AppKit" "-framework CoreData" "-framework Foundation")
set(TORQUE_COMPILE_DEFINITIONS ICE_NO_DLL PCRE_STATIC TORQUE_ADVANCED_LIGHTING TORQUE_TOOLS TORQUE_SHADERGEN TORQUE_OPENGL TORQUE_OPCODE TORQUE_ASSIMP TORQUE_SDL TORQUE_COLLADA TORQUE_UNICODE)
set(TORQUE_COMPILE_DEFINITIONS ICE_NO_DLL PCRE_STATIC TORQUE_ADVANCED_LIGHTING TORQUE_SHADERGEN TORQUE_OPENGL TORQUE_OPCODE TORQUE_ASSIMP TORQUE_SDL TORQUE_COLLADA TORQUE_UNICODE)
################# Start building libs ###################
# Set common linkages
set(TORQUE_LINK_LIBRARIES tinyxml collada ljpeg squish png_static opcode assimp
SDL2 glad pcre convexDecomp OpenAL)
SDL2 glad pcre convexDecomp)
# Only link Apple frameworks when on an Apple platform
if (APPLE)
@ -153,27 +152,38 @@ foreach (TORQUE_MODULE_PATH ${TORQUE_MODULE_PATHS})
endforeach()
# Final executable
add_executable(Game MACOSX_BUNDLE ${TORQUE_SOURCE_FILES})
if (APPLE)
add_executable(Game MACOSX_BUNDLE ${TORQUE_SOURCE_FILES})
elseif (WIN32)
add_executable(Game WIN32 ${TORQUE_SOURCE_FILES})
else()
add_executable(Game ${TORQUE_SOURCE_FILES})
endif()
target_compile_definitions(Game PUBLIC ${TORQUE_COMPILE_DEFINITIONS})
target_link_libraries(Game ${TORQUE_LINK_LIBRARIES})
target_include_directories(Game PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_BINARY_DIR}/temp")
set(EXECUTABLE_NAME "Game")
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/Tools/CMake/Info.plist.in" "${CMAKE_BINARY_DIR}/temp/Info.plist" COPYONLY)
set_target_properties(Game PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_BINARY_DIR}/temp/Info.plist")
if (APPLE)
set(EXECUTABLE_NAME "Game")
install(TARGETS Game
BUNDLE DESTINATION game COMPONENT Runtime
RUNTIME DESTINATION bin COMPONENT Runtime
)
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/Tools/CMake/Info.plist.in" "${CMAKE_BINARY_DIR}/temp/Info.plist" COPYONLY)
set_target_properties(Game PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_BINARY_DIR}/temp/Info.plist")
# Note Mac specific extension .app
set(APPS "\${CMAKE_INSTALL_PREFIX}/game/Game.app")
install(TARGETS Game
BUNDLE DESTINATION game COMPONENT Runtime
RUNTIME DESTINATION bin COMPONENT Runtime
)
# Directories to look for dependencies
# FIXME: Auto detect?
set(DIRS ${CMAKE_BINARY_DIR}/temp/sdl2 ${CMAKE_BINARY_DIR}/temp/openal-soft ${CMAKE_BINARY_DIR}/temp/assimp/bin)
# Note Mac specific extension .app
set(APPS "\${CMAKE_INSTALL_PREFIX}/game/Game.app")
install(CODE "include(BundleUtilities)
fixup_bundle(\"${APPS}\" \"\" \"${DIRS}\")")
# Directories to look for dependencies
# FIXME: Auto detect?
set(DIRS ${CMAKE_BINARY_DIR}/temp/sdl2 ${CMAKE_BINARY_DIR}/temp/openal-soft ${CMAKE_BINARY_DIR}/temp/assimp/bin)
install(CODE "include(BundleUtilities)
fixup_bundle(\"${APPS}\" \"\" \"${DIRS}\")")
else()
install(TARGETS Game DESTINATION game)
endif (APPLE)

View file

@ -0,0 +1,9 @@
option(TORQUE_AFX_ENABLED "Enable AFX module" ON)
if(TORQUE_AFX_ENABLED)
message("Enabling AFX Module")
file(GLOB_RECURSE TORQUE_SFX_SOURCES "${CMAKE_SOURCE_DIR}/Engine/source/afx/*.cpp")
set(TORQUE_SOURCE_FILES ${TORQUE_SOURCE_FILES} ${TORQUE_SFX_SOURCES})
set(TORQUE_COMPILE_DEFINITIONS ${TORQUE_COMPILE_DEFINITIONS} TORQUE_AFX_ENABLED)
endif()

View file

@ -0,0 +1,19 @@
# Bullet module
option(TORQUE_PHYSICS_BULLET "Use Bullet physics" OFF)
if(TORQUE_PHYSICS_BULLET)
message("Enabling Bullet Module")
file(GLOB TORQUE_BULLET_SOURCES "${CMAKE_SOURCE_DIR}/Engine/source/T3D/physics/bullet/*.cpp")
set(TORQUE_SOURCE_FILES ${TORQUE_SOURCE_FILES} ${TORQUE_NAVIGATION_SOURCES})
set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} BulletSoftBody Bullet3Dynamics BulletInverseDynamics BulletCollision
Bullet2FileLoader BulletDynamics Bullet3OpenCL_clew Bullet3Common
LinearMath Bullet3Geometry Bullet3Collision)
set(TORQUE_COMPILE_DEFINITIONS ${TORQUE_COMPILE_DEFINITIONS} TORQUE_PHYSICS_BULLET TORQUE_PHYSICS_ENABLED)
# Since Bullet lives elsewhere we need to ensure it is known to Torque when providing a link to it
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Bullet Shared Libs" FORCE)
set(BUILD_CPU_DEMOS OFF CACHE BOOL "Bullet CPU Demos" FORCE)
set(BUILD_BULLET2_DEMOS OFF CACHE BOOL "Bullet2 Demos" FORCE)
add_subdirectory("${CMAKE_SOURCE_DIR}/Engine/lib/bullet" ${CMAKE_BINARY_DIR}/temp/bullet EXCLUDE_FROM_ALL)
endif(TORQUE_PHYSICS_BULLET)

View file

@ -0,0 +1,14 @@
# Navigation module
option(TORQUE_NAVIGATION "Enable Navigation module" ON)
if(TORQUE_NAVIGATION)
message("Enabling Navigation Module")
file(GLOB TORQUE_NAVIGATION_SOURCES "${CMAKE_SOURCE_DIR}/Engine/source/navigation/*.cpp")
set(TORQUE_SOURCE_FILES ${TORQUE_SOURCE_FILES} ${TORQUE_NAVIGATION_SOURCES})
set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} recast)
set(TORQUE_COMPILE_DEFINITIONS ${TORQUE_COMPILE_DEFINITIONS} recast TORQUE_NAVIGATION_ENABLED)
# Since recast lives elsewhere we need to ensure it is known to Torque when providing a link to it
add_subdirectory("${CMAKE_SOURCE_DIR}/Engine/lib/recast" ${CMAKE_BINARY_DIR}/temp/recast EXCLUDE_FROM_ALL)
endif(TORQUE_NAVIGATION)

View file

@ -0,0 +1,30 @@
# Bullet module
option(TORQUE_SFX_OPENAL "Use OpenAL SFX" ON)
if(TORQUE_SFX_OPENAL)
message("Enabling OpenAL Module")
file(GLOB TORQUE_OPENAL_SOURCES "${CMAKE_SOURCE_DIR}/Engine/source/sfx/openal/*.cpp")
if (APPLE)
file(GLOB TORQUE_OPENAL_MAC_SOURCES "${CMAKE_SOURCE_DIR}/Engine/source/sfx/openal/mac/*.cpp")
set(TORQUE_OPENAL_SOURCES ${TORQUE_OPENAL_SOURCES} ${TORQUE_OPENAL_MAC_SOURCES})
elseif (WIN32)
file(GLOB TORQUE_OPENAL_WIN_SOURCES "${CMAKE_SOURCE_DIR}/Engine/source/sfx/openal/win32/*.cpp")
set(TORQUE_OPENAL_SOURCES ${TORQUE_OPENAL_SOURCES} ${TORQUE_OPENAL_WIN_SOURCES})
elseif (UNIX)
file(GLOB TORQUE_OPENAL_LINUX_SOURCES "${CMAKE_SOURCE_DIR}/Engine/source/sfx/openal/linux/*.cpp")
set(TORQUE_OPENAL_SOURCES ${TORQUE_OPENAL_SOURCES} ${TORQUE_OPENAL_LINUX_SOURCES})
else()
message(FATAL_ERROR "Unsupported OpenAL platform.")
endif (APPLE)
set(TORQUE_SOURCE_FILES ${TORQUE_SOURCE_FILES} ${TORQUE_OPENAL_SOURCES})
set(TORQUE_LINK_LIBRARIES ${TORQUE_LINK_LIBRARIES} OpenAL)
# Since OpenAL lives elsewhere we need to ensure it is known to Torque when providing a link to it
set(ALSOFT_EXAMPLES OFF CACHE BOOL "OpenAL Examples" FORCE)
set(ALSOFT_UPDATE_BUILD_VERSION OFF CACHE BOOL "Update build Version" UPDATE)
add_subdirectory("${CMAKE_SOURCE_DIR}/Engine/lib/openal-soft" ${CMAKE_BINARY_DIR}/temp/openal-soft EXCLUDE_FROM_ALL)
endif(TORQUE_PHYSICS_BULLET)

View file

@ -0,0 +1,11 @@
# Bullet module
option(TORQUE_TOOLS "Enable Torque Tools" ON)
if(TORQUE_TOOLS)
message("Enabling Torque Tools Module")
file(GLOB TORQUE_TOOLS_SOURCES "gui/editor/*.cpp" "gui/worldEditor/*.cpp" "gui/worldEditor/tools/*.cpp"
"gui/editor/inspector/*.cpp")
set(TORQUE_SOURCE_FILES ${TORQUE_SOURCE_FILES} ${TORQUE_TOOLS_SOURCES})
set(TORQUE_COMPILE_DEFINITIONS ${TORQUE_COMPILE_DEFINITIONS} TORQUE_TOOLS)
endif(TORQUE_PHYSICS_BULLET)