From 31509971a2eac670b58005a6a245d269573e4083 Mon Sep 17 00:00:00 2001 From: cryham Date: Fri, 15 Nov 2024 01:48:23 +0100 Subject: [PATCH] CMake renamed for Linux --- {CMakeManual => CMake}/Boost.cmake | 0 CMake/Bootstrap.cmake | 88 ++-- .../Dependencies/OGRE.cmake | 0 CMake/DependenciesConfig.cmake | 125 +++++- .../DependenciesFunctions.cmake | 0 {CMakeManual => CMake}/FindBULLET.cmake | 0 {CMakeManual => CMake}/FindENet.cmake | 0 CMake/FindMyGUI.cmake | 4 +- {CMakeManual => CMake}/FindOGG.cmake | 0 {CMakeManual => CMake}/FindRapidjson.cmake | 0 CMake/Macros.cmake | 34 -- .../OgreConfigTargets.cmake | 0 .../OgreFindFrameworks.cmake | 0 {CMakeManual => CMake}/OgreGetVersion.cmake | 0 {CMakeManual => CMake}/conan.cmake | 0 .../dependencies-helpers/Boost.cmake | 0 .../dependencies-helpers/OpenAL.cmake | 0 {CMake => CMakeCI}/AddMissingTargets.cmake | 0 CMakeCI/Bootstrap.cmake | 52 +++ .../CheckBulletPrecision.cmake | 0 CMakeCI/DependenciesConfig.cmake | 17 + {CMake => CMakeCI}/FindBullet.cmake | 0 {CMakeManual => CMakeCI}/FindMyGUI.cmake | 4 +- {CMake => CMakeCI}/FindOgg.cmake | 0 {CMakeManual => CMakeCI}/FindOpenAL.cmake | 0 .../FindPackageHandleStandardArgs.cmake | 0 {CMakeManual => CMakeCI}/FindPkgMacros.cmake | 0 {CMakeManual => CMakeCI}/FindSDL2.cmake | 0 {CMakeManual => CMakeCI}/FindTinyxml2.cmake | 0 {CMakeManual => CMakeCI}/FindVorbis.cmake | 0 {CMake => CMakeCI}/Findenet.cmake | 0 {CMake => CMakeCI}/FixupBundle.cmake | 0 {CMakeManual => CMakeCI}/Macros.cmake | 34 ++ .../PreprocessorUtils.cmake | 0 .../Templates/Plugins.cfg.in | 0 .../Templates/Resources.cfg.in | 0 {CMakeManual => CMakeCI}/iOS.cmake | 0 CMakeLists-CI.txt | 265 ++++++++++++ CMakeLists-Debian.txt | 375 ----------------- CMakeLists.txt | 380 +++++++++++------- CMakeManual/Bootstrap.cmake | 52 --- CMakeManual/DependenciesConfig.cmake | 114 ------ 42 files changed, 772 insertions(+), 772 deletions(-) rename {CMakeManual => CMake}/Boost.cmake (100%) rename {CMakeManual => CMake}/Dependencies/OGRE.cmake (100%) rename {CMakeManual => CMake}/DependenciesFunctions.cmake (100%) rename {CMakeManual => CMake}/FindBULLET.cmake (100%) rename {CMakeManual => CMake}/FindENet.cmake (100%) rename {CMakeManual => CMake}/FindOGG.cmake (100%) rename {CMakeManual => CMake}/FindRapidjson.cmake (100%) rename {CMakeManual => CMake}/OgreConfigTargets.cmake (100%) rename {CMakeManual => CMake}/OgreFindFrameworks.cmake (100%) rename {CMakeManual => CMake}/OgreGetVersion.cmake (100%) rename {CMakeManual => CMake}/conan.cmake (100%) rename {CMakeManual => CMake}/dependencies-helpers/Boost.cmake (100%) rename {CMakeManual => CMake}/dependencies-helpers/OpenAL.cmake (100%) rename {CMake => CMakeCI}/AddMissingTargets.cmake (100%) create mode 100644 CMakeCI/Bootstrap.cmake rename {CMakeManual => CMakeCI}/CheckBulletPrecision.cmake (100%) create mode 100644 CMakeCI/DependenciesConfig.cmake rename {CMake => CMakeCI}/FindBullet.cmake (100%) rename {CMakeManual => CMakeCI}/FindMyGUI.cmake (93%) rename {CMake => CMakeCI}/FindOgg.cmake (100%) rename {CMakeManual => CMakeCI}/FindOpenAL.cmake (100%) rename {CMakeManual => CMakeCI}/FindPackageHandleStandardArgs.cmake (100%) rename {CMakeManual => CMakeCI}/FindPkgMacros.cmake (100%) rename {CMakeManual => CMakeCI}/FindSDL2.cmake (100%) rename {CMakeManual => CMakeCI}/FindTinyxml2.cmake (100%) rename {CMakeManual => CMakeCI}/FindVorbis.cmake (100%) rename {CMake => CMakeCI}/Findenet.cmake (100%) rename {CMake => CMakeCI}/FixupBundle.cmake (100%) rename {CMakeManual => CMakeCI}/Macros.cmake (85%) rename {CMakeManual => CMakeCI}/PreprocessorUtils.cmake (100%) rename {CMakeManual => CMakeCI}/Templates/Plugins.cfg.in (100%) rename {CMakeManual => CMakeCI}/Templates/Resources.cfg.in (100%) rename {CMakeManual => CMakeCI}/iOS.cmake (100%) create mode 100644 CMakeLists-CI.txt delete mode 100644 CMakeLists-Debian.txt delete mode 100644 CMakeManual/Bootstrap.cmake delete mode 100644 CMakeManual/DependenciesConfig.cmake diff --git a/CMakeManual/Boost.cmake b/CMake/Boost.cmake similarity index 100% rename from CMakeManual/Boost.cmake rename to CMake/Boost.cmake diff --git a/CMake/Bootstrap.cmake b/CMake/Bootstrap.cmake index 3f0ecca7..cece3cb5 100644 --- a/CMake/Bootstrap.cmake +++ b/CMake/Bootstrap.cmake @@ -1,52 +1,52 @@ -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") +set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG" ) -if (NOT APPLE) - if (CMAKE_BUILD_TYPE STREQUAL "") - set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel." FORCE) - endif () -else () - set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ogre3d.\${PRODUCT_NAME:rfc1034identifier}") -endif () +if( NOT APPLE ) + if( CMAKE_BUILD_TYPE STREQUAL "" ) + set( CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel." FORCE ) + endif() +else() + set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ogre3d.\${PRODUCT_NAME:rfc1034identifier}") +endif() -if (NOT MSVC) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1 -g") - set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual") - #set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-overloaded-virtual" ) -endif () +if( NOT MSVC ) + set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1 -g" ) + set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG" ) + set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG" ) + set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual" ) + #set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-overloaded-virtual" ) +endif() -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-limit-debug-info") -endif () +if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) + set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-limit-debug-info" ) +endif() # Determine if we are compiling for a 32bit or 64bit system -if (NOT APPLE) - include(CheckTypeSize) - CHECK_TYPE_SIZE("void*" ARCH_PTR_SIZE BUILTIN_TYPES_ONLY) - if (ARCH_PTR_SIZE EQUAL 8) - set(PLATFORM_X64 TRUE) - else () - set(PLATFORM_X64 FALSE) - endif () -endif () +if( NOT APPLE ) + include(CheckTypeSize) + CHECK_TYPE_SIZE("void*" ARCH_PTR_SIZE BUILTIN_TYPES_ONLY) + if (ARCH_PTR_SIZE EQUAL 8) + set(PLATFORM_X64 TRUE) + else () + set(PLATFORM_X64 FALSE) + endif () +endif() -if (MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") - if (NOT PLATFORM_X64) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") - endif () - add_definitions(-DUNICODE -D_UNICODE) -endif () +if( MSVC ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + if( NOT PLATFORM_X64 ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") + endif() + add_definitions( -DUNICODE -D_UNICODE ) +endif() -if (APPLE) - macro(add_recursive dir retVal) - file(GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ${dir}/*.mm ${dir}/*.m) - endmacro() -else () - macro(add_recursive dir retVal) - file(GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c) - endmacro() -endif () +if( APPLE ) + macro( add_recursive dir retVal ) + file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ${dir}/*.mm ${dir}/*.m ) + endmacro() +else() + macro( add_recursive dir retVal ) + file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ) + endmacro() +endif() diff --git a/CMakeManual/Dependencies/OGRE.cmake b/CMake/Dependencies/OGRE.cmake similarity index 100% rename from CMakeManual/Dependencies/OGRE.cmake rename to CMake/Dependencies/OGRE.cmake diff --git a/CMake/DependenciesConfig.cmake b/CMake/DependenciesConfig.cmake index aca28eaa..4b231984 100644 --- a/CMake/DependenciesConfig.cmake +++ b/CMake/DependenciesConfig.cmake @@ -1,17 +1,114 @@ -set(CMAKE_THREAD_PREFER_PTHREAD YES) +include(DependenciesFunctions) +set(CMAKE_THREAD_PREFER_PTHREAD YES) find_package(Threads REQUIRED) -find_package(Boost REQUIRED) -find_package(Bullet REQUIRED) -find_package(enet REQUIRED) -find_package(MyGUI REQUIRED) -find_package(Ogg REQUIRED) -find_package(OGRE REQUIRED) -find_package(OpenAL REQUIRED) -find_package(RapidJSON REQUIRED) -find_package(SDL2 REQUIRED) -find_package(tinyxml2 REQUIRED) -find_package(Vorbis REQUIRED) - -include(AddMissingTargets) \ No newline at end of file +# Some pkg-config files are broken, that is why they are commented out + +# fails +#add_external_lib( +# Boost +# boost/1.81.0 +# REQUIRED +# FIND_PACKAGE_OPTIONS COMPONENTS system thread +#) + +#add_external_lib( +# OGRE +# ogre3d/13.4.4@anotherfoxguy/stable +# REQUIRED +# CONAN_PKG_NAME OGRE +# CONAN_OPTIONS ogre3d:nodeless_positioning=True ogre3d:resourcemanager_strict=off +# # uncomment below for Ogre 1.9 +# #PKG_CONFIG "OGRE, OGRE-Terrain, OGRE-Paging, OGRE-Overlay" +# FIND_PACKAGE_OPTIONS CONFIG COMPONENTS Bites Overlay Paging RTShaderSystem MeshLodGenerator Terrain +#) + +add_external_lib( + BULLET + bullet3/3.24 + REQUIRED + FIND_PACKAGE + CONAN_OPTIONS bullet3:extras=True bullet3:network_support=True + INTERFACE_NAME Bullet::Bullet +) + +#add_external_lib( +# SDL2 +# sdl/2.0.20 +# REQUIRED +# PKG_CONFIG "sdl2 >= 2.0" +# FIND_PACKAGE_OPTIONS CONFIG +# CONAN_OPTIONS sdl:sdl2main=False +#) + +#add_external_lib( +# MyGUI +# mygui/3.4.1@anotherfoxguy/stable +# REQUIRED +# # PKG_CONFIG "MYGUI = 3.4.0" +# FIND_PACKAGE +#) + +add_external_lib( + OGG + ogg/1.3.5 + REQUIRED + PKG_CONFIG "ogg >= 1.2" + FIND_PACKAGE +) + +add_external_lib( + VorbisFile + vorbis/1.3.7 + REQUIRED + PKG_CONFIG "vorbis >= 1.2, vorbisfile >= 1.2" + FIND_PACKAGE +) + +# todo: fix Cannot load recipe. +#add_external_lib( +# OpenAL +# openal/1.22.2 +# REQUIRED +# PKG_CONFIG "openal >= 1.18" +# FIND_PACKAGE_OPTIONS CONFIG +#) + +#add_external_lib( +# ENet +# enet/1.3.17 +# REQUIRED +# PKG_CONFIG "libenet >= 1.2" +# FIND_PACKAGE +#) + +add_external_lib( + tinyxml2 + tinyxml2/9.0.0 + REQUIRED + PKG_CONFIG "tinyxml2 >= 6" + FIND_PACKAGE +) + + +set(LIBS + #Boost::Boost # fails + #Threads::Threads + #OGRE::OGRE + #- Bullet::Bullet // fixme? + #SDL2::SDL2 + #MyGUI::MyGUI + VorbisFile::VorbisFile + OGG::OGG + #OpenAL::OpenAL # fails + #ENet::ENet # fails + tinyxml2::tinyxml2 +) + +#set(SERVER_LIBS Boost::Boost ENet::ENet) + + +find_package( ENet REQUIRED ) + +find_package( Boost COMPONENTS system thread REQUIRED ) diff --git a/CMakeManual/DependenciesFunctions.cmake b/CMake/DependenciesFunctions.cmake similarity index 100% rename from CMakeManual/DependenciesFunctions.cmake rename to CMake/DependenciesFunctions.cmake diff --git a/CMakeManual/FindBULLET.cmake b/CMake/FindBULLET.cmake similarity index 100% rename from CMakeManual/FindBULLET.cmake rename to CMake/FindBULLET.cmake diff --git a/CMakeManual/FindENet.cmake b/CMake/FindENet.cmake similarity index 100% rename from CMakeManual/FindENet.cmake rename to CMake/FindENet.cmake diff --git a/CMake/FindMyGUI.cmake b/CMake/FindMyGUI.cmake index a4f4a57f..755798c3 100644 --- a/CMake/FindMyGUI.cmake +++ b/CMake/FindMyGUI.cmake @@ -40,11 +40,11 @@ find_path(MyGUI_INCLUDE_DIR MyGUI.h PATH_SUFFIXES MYGUI) # Find release libraries find_library(MyGUI_MyGUIEngine_LIBRARY_REL MyGUIEngine PATH_SUFFIXES release relwithdebinfo minsizerel) -find_library(MyGUI_OgrePlatform_LIBRARY_REL MyGUI.Ogre2Platform PATH_SUFFIXES release relwithdebinfo minsizerel) +find_library(MyGUI_OgrePlatform_LIBRARY_REL MyGUI.OgrePlatform PATH_SUFFIXES release relwithdebinfo minsizerel) # Find debug libraries find_library(MyGUI_MyGUIEngine_LIBRARY_DBG NAMES MyGUIEngine_d MyGUIEngine PATH_SUFFIXES debug) -find_library(MyGUI_OgrePlatform_LIBRARY_DBG NAMES MyGUIOgre2Platform_d MyGUI.Ogre2Platform PATH_SUFFIXES debug) +find_library(MyGUI_OgrePlatform_LIBRARY_DBG NAMES MyGUI.OgrePlatform_d MyGUI.OgrePlatform PATH_SUFFIXES debug) # set include directories and libraries set(MyGUI_INCLUDE_DIRS ${MyGUI_INCLUDE_DIR}) diff --git a/CMakeManual/FindOGG.cmake b/CMake/FindOGG.cmake similarity index 100% rename from CMakeManual/FindOGG.cmake rename to CMake/FindOGG.cmake diff --git a/CMakeManual/FindRapidjson.cmake b/CMake/FindRapidjson.cmake similarity index 100% rename from CMakeManual/FindRapidjson.cmake rename to CMake/FindRapidjson.cmake diff --git a/CMake/Macros.cmake b/CMake/Macros.cmake index 55c976a2..62daeb39 100644 --- a/CMake/Macros.cmake +++ b/CMake/Macros.cmake @@ -200,37 +200,3 @@ function(cmd_option name desc) set(${name} "${${name}}" PARENT_SCOPE) endfunction() - -# Helper to retrieve the settings returned from pkg_check_modules() -macro(get_package_interface package) - set(INCLUDES ${${package}_INCLUDE_DIRS}) - - set(LINKDIRS ${${package}_LIBDIR}) - - # We resolve the full path of each library to ensure the - # correct one is referenced while linking - foreach (lib ${${package}_LIBRARIES}) - find_library(LIB_${lib} ${lib} HINTS ${LINKDIRS}) - list(APPEND LIBRARIES ${LIB_${lib}}) - endforeach () -endmacro() - -macro(find_with_pkg package interface_name PKG_CONFIG) - pkg_check_modules(${package} ${PKG_CONFIG}) - - if (${package}_FOUND) - message(STATUS "Using '${package}' system library (Found by pkg_config)") - - # Create the target interface library - add_library(${interface_name} INTERFACE IMPORTED GLOBAL) - - # Retrieve the package information - get_package_interface(${package}) - - # And add it to our target - target_include_directories(${interface_name} INTERFACE ${INCLUDES}) - target_link_libraries(${interface_name} INTERFACE ${LIBRARIES}) - - message(STATUS "Added inteface ${interface_name} ${INCLUDES} ${LIBRARIES}") - endif () -endmacro() \ No newline at end of file diff --git a/CMakeManual/OgreConfigTargets.cmake b/CMake/OgreConfigTargets.cmake similarity index 100% rename from CMakeManual/OgreConfigTargets.cmake rename to CMake/OgreConfigTargets.cmake diff --git a/CMakeManual/OgreFindFrameworks.cmake b/CMake/OgreFindFrameworks.cmake similarity index 100% rename from CMakeManual/OgreFindFrameworks.cmake rename to CMake/OgreFindFrameworks.cmake diff --git a/CMakeManual/OgreGetVersion.cmake b/CMake/OgreGetVersion.cmake similarity index 100% rename from CMakeManual/OgreGetVersion.cmake rename to CMake/OgreGetVersion.cmake diff --git a/CMakeManual/conan.cmake b/CMake/conan.cmake similarity index 100% rename from CMakeManual/conan.cmake rename to CMake/conan.cmake diff --git a/CMakeManual/dependencies-helpers/Boost.cmake b/CMake/dependencies-helpers/Boost.cmake similarity index 100% rename from CMakeManual/dependencies-helpers/Boost.cmake rename to CMake/dependencies-helpers/Boost.cmake diff --git a/CMakeManual/dependencies-helpers/OpenAL.cmake b/CMake/dependencies-helpers/OpenAL.cmake similarity index 100% rename from CMakeManual/dependencies-helpers/OpenAL.cmake rename to CMake/dependencies-helpers/OpenAL.cmake diff --git a/CMake/AddMissingTargets.cmake b/CMakeCI/AddMissingTargets.cmake similarity index 100% rename from CMake/AddMissingTargets.cmake rename to CMakeCI/AddMissingTargets.cmake diff --git a/CMakeCI/Bootstrap.cmake b/CMakeCI/Bootstrap.cmake new file mode 100644 index 00000000..3f0ecca7 --- /dev/null +++ b/CMakeCI/Bootstrap.cmake @@ -0,0 +1,52 @@ + +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") + +if (NOT APPLE) + if (CMAKE_BUILD_TYPE STREQUAL "") + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel." FORCE) + endif () +else () + set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ogre3d.\${PRODUCT_NAME:rfc1034identifier}") +endif () + +if (NOT MSVC) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1 -g") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual") + #set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-overloaded-virtual" ) +endif () + +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-limit-debug-info") +endif () + +# Determine if we are compiling for a 32bit or 64bit system +if (NOT APPLE) + include(CheckTypeSize) + CHECK_TYPE_SIZE("void*" ARCH_PTR_SIZE BUILTIN_TYPES_ONLY) + if (ARCH_PTR_SIZE EQUAL 8) + set(PLATFORM_X64 TRUE) + else () + set(PLATFORM_X64 FALSE) + endif () +endif () + +if (MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + if (NOT PLATFORM_X64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") + endif () + add_definitions(-DUNICODE -D_UNICODE) +endif () + +if (APPLE) + macro(add_recursive dir retVal) + file(GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ${dir}/*.mm ${dir}/*.m) + endmacro() +else () + macro(add_recursive dir retVal) + file(GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c) + endmacro() +endif () diff --git a/CMakeManual/CheckBulletPrecision.cmake b/CMakeCI/CheckBulletPrecision.cmake similarity index 100% rename from CMakeManual/CheckBulletPrecision.cmake rename to CMakeCI/CheckBulletPrecision.cmake diff --git a/CMakeCI/DependenciesConfig.cmake b/CMakeCI/DependenciesConfig.cmake new file mode 100644 index 00000000..aca28eaa --- /dev/null +++ b/CMakeCI/DependenciesConfig.cmake @@ -0,0 +1,17 @@ +set(CMAKE_THREAD_PREFER_PTHREAD YES) + +find_package(Threads REQUIRED) + +find_package(Boost REQUIRED) +find_package(Bullet REQUIRED) +find_package(enet REQUIRED) +find_package(MyGUI REQUIRED) +find_package(Ogg REQUIRED) +find_package(OGRE REQUIRED) +find_package(OpenAL REQUIRED) +find_package(RapidJSON REQUIRED) +find_package(SDL2 REQUIRED) +find_package(tinyxml2 REQUIRED) +find_package(Vorbis REQUIRED) + +include(AddMissingTargets) \ No newline at end of file diff --git a/CMake/FindBullet.cmake b/CMakeCI/FindBullet.cmake similarity index 100% rename from CMake/FindBullet.cmake rename to CMakeCI/FindBullet.cmake diff --git a/CMakeManual/FindMyGUI.cmake b/CMakeCI/FindMyGUI.cmake similarity index 93% rename from CMakeManual/FindMyGUI.cmake rename to CMakeCI/FindMyGUI.cmake index 755798c3..a4f4a57f 100644 --- a/CMakeManual/FindMyGUI.cmake +++ b/CMakeCI/FindMyGUI.cmake @@ -40,11 +40,11 @@ find_path(MyGUI_INCLUDE_DIR MyGUI.h PATH_SUFFIXES MYGUI) # Find release libraries find_library(MyGUI_MyGUIEngine_LIBRARY_REL MyGUIEngine PATH_SUFFIXES release relwithdebinfo minsizerel) -find_library(MyGUI_OgrePlatform_LIBRARY_REL MyGUI.OgrePlatform PATH_SUFFIXES release relwithdebinfo minsizerel) +find_library(MyGUI_OgrePlatform_LIBRARY_REL MyGUI.Ogre2Platform PATH_SUFFIXES release relwithdebinfo minsizerel) # Find debug libraries find_library(MyGUI_MyGUIEngine_LIBRARY_DBG NAMES MyGUIEngine_d MyGUIEngine PATH_SUFFIXES debug) -find_library(MyGUI_OgrePlatform_LIBRARY_DBG NAMES MyGUI.OgrePlatform_d MyGUI.OgrePlatform PATH_SUFFIXES debug) +find_library(MyGUI_OgrePlatform_LIBRARY_DBG NAMES MyGUIOgre2Platform_d MyGUI.Ogre2Platform PATH_SUFFIXES debug) # set include directories and libraries set(MyGUI_INCLUDE_DIRS ${MyGUI_INCLUDE_DIR}) diff --git a/CMake/FindOgg.cmake b/CMakeCI/FindOgg.cmake similarity index 100% rename from CMake/FindOgg.cmake rename to CMakeCI/FindOgg.cmake diff --git a/CMakeManual/FindOpenAL.cmake b/CMakeCI/FindOpenAL.cmake similarity index 100% rename from CMakeManual/FindOpenAL.cmake rename to CMakeCI/FindOpenAL.cmake diff --git a/CMakeManual/FindPackageHandleStandardArgs.cmake b/CMakeCI/FindPackageHandleStandardArgs.cmake similarity index 100% rename from CMakeManual/FindPackageHandleStandardArgs.cmake rename to CMakeCI/FindPackageHandleStandardArgs.cmake diff --git a/CMakeManual/FindPkgMacros.cmake b/CMakeCI/FindPkgMacros.cmake similarity index 100% rename from CMakeManual/FindPkgMacros.cmake rename to CMakeCI/FindPkgMacros.cmake diff --git a/CMakeManual/FindSDL2.cmake b/CMakeCI/FindSDL2.cmake similarity index 100% rename from CMakeManual/FindSDL2.cmake rename to CMakeCI/FindSDL2.cmake diff --git a/CMakeManual/FindTinyxml2.cmake b/CMakeCI/FindTinyxml2.cmake similarity index 100% rename from CMakeManual/FindTinyxml2.cmake rename to CMakeCI/FindTinyxml2.cmake diff --git a/CMakeManual/FindVorbis.cmake b/CMakeCI/FindVorbis.cmake similarity index 100% rename from CMakeManual/FindVorbis.cmake rename to CMakeCI/FindVorbis.cmake diff --git a/CMake/Findenet.cmake b/CMakeCI/Findenet.cmake similarity index 100% rename from CMake/Findenet.cmake rename to CMakeCI/Findenet.cmake diff --git a/CMake/FixupBundle.cmake b/CMakeCI/FixupBundle.cmake similarity index 100% rename from CMake/FixupBundle.cmake rename to CMakeCI/FixupBundle.cmake diff --git a/CMakeManual/Macros.cmake b/CMakeCI/Macros.cmake similarity index 85% rename from CMakeManual/Macros.cmake rename to CMakeCI/Macros.cmake index 62daeb39..55c976a2 100644 --- a/CMakeManual/Macros.cmake +++ b/CMakeCI/Macros.cmake @@ -200,3 +200,37 @@ function(cmd_option name desc) set(${name} "${${name}}" PARENT_SCOPE) endfunction() + +# Helper to retrieve the settings returned from pkg_check_modules() +macro(get_package_interface package) + set(INCLUDES ${${package}_INCLUDE_DIRS}) + + set(LINKDIRS ${${package}_LIBDIR}) + + # We resolve the full path of each library to ensure the + # correct one is referenced while linking + foreach (lib ${${package}_LIBRARIES}) + find_library(LIB_${lib} ${lib} HINTS ${LINKDIRS}) + list(APPEND LIBRARIES ${LIB_${lib}}) + endforeach () +endmacro() + +macro(find_with_pkg package interface_name PKG_CONFIG) + pkg_check_modules(${package} ${PKG_CONFIG}) + + if (${package}_FOUND) + message(STATUS "Using '${package}' system library (Found by pkg_config)") + + # Create the target interface library + add_library(${interface_name} INTERFACE IMPORTED GLOBAL) + + # Retrieve the package information + get_package_interface(${package}) + + # And add it to our target + target_include_directories(${interface_name} INTERFACE ${INCLUDES}) + target_link_libraries(${interface_name} INTERFACE ${LIBRARIES}) + + message(STATUS "Added inteface ${interface_name} ${INCLUDES} ${LIBRARIES}") + endif () +endmacro() \ No newline at end of file diff --git a/CMakeManual/PreprocessorUtils.cmake b/CMakeCI/PreprocessorUtils.cmake similarity index 100% rename from CMakeManual/PreprocessorUtils.cmake rename to CMakeCI/PreprocessorUtils.cmake diff --git a/CMakeManual/Templates/Plugins.cfg.in b/CMakeCI/Templates/Plugins.cfg.in similarity index 100% rename from CMakeManual/Templates/Plugins.cfg.in rename to CMakeCI/Templates/Plugins.cfg.in diff --git a/CMakeManual/Templates/Resources.cfg.in b/CMakeCI/Templates/Resources.cfg.in similarity index 100% rename from CMakeManual/Templates/Resources.cfg.in rename to CMakeCI/Templates/Resources.cfg.in diff --git a/CMakeManual/iOS.cmake b/CMakeCI/iOS.cmake similarity index 100% rename from CMakeManual/iOS.cmake rename to CMakeCI/iOS.cmake diff --git a/CMakeLists-CI.txt b/CMakeLists-CI.txt new file mode 100644 index 00000000..d84ae0c7 --- /dev/null +++ b/CMakeLists-CI.txt @@ -0,0 +1,265 @@ + +# This CMake is for CI/CD auto builds in github Actions tab. +# See in docs/Building.md and BuildingVS.md for building from sources. +# Conan is used to get SR deps, or not if using FORCE_SYSTEM_DEPENDENCIES. + + +cmake_minimum_required( VERSION 3.16 ) +# Include path for additional CMake library finding scripts +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/" ${CMAKE_MODULE_PATH}) + +# Add a sensible build type default and warning because empty means no optimization and no debug info. +set(CMAKE_CONFIGURATION_TYPES "Debug" "Release" CACHE STRING "Configuration types") + +if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.22") + cmake_policy(SET CMP0127 OLD) +endif () + +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) + +include(CMakeDependentOption) +include(Macros) +include(FeatureSummary) + +if (NOT WIN32) + find_package(PkgConfig) +endif () + +project( StuntRally3 ) + + +# User Options to disable building components -------- +option(BUILD_GAME "Build the game binary." ON) +option(BUILD_EDITOR "Build the track editor." ON) +option(BUILD_GAME_SERVER "Build the game list server app." ON) +option(BUILD_TRANSL_TOOL "Build the tool for translation updating, it creates .pot" ON) + + +# Linux prefers lower-case exe names +if (WIN32 OR APPLE) + set(GAME_EXE StuntRally3) + set(EDITOR_EXE SR-Editor3) + set(SERVER_EXE SR-GameServer) + set(TRANSL_EXE SR-Translator) +else () + set(GAME_EXE stuntrally3) + set(EDITOR_EXE sr-editor3) + set(SERVER_EXE sr-gameserver) + set(TRANSL_EXE sr-translator) +endif () + + +# Avoid source tree pollution +if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building:\nmkdir build; cd build; cmake ..\nBefore that, remove the files already created:\nrm -rf CMakeCache.txt CMakeFiles") +endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + +# exe path ---- +set( EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}" ) + +# Set CXX compile flags +set(CMAKE_CXX_STANDARD 17) + +if (CMAKE_COMPILER_IS_GNUCXX) + message(STATUS "GCC detected, adding compile flags") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") +endif () + +if (MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + add_definitions(-DUNICODE -D_UNICODE) +endif () + + +# deps ---- + +# Check for dependencies +include(DependenciesConfig) + +macro(add_recursive dir retVal) + file(GLOB GLOB_RESULT ${dir}/*.h ${dir}/*.cpp ${dir}/*.c) + list(APPEND ${retVal} ${GLOB_RESULT}) +endmacro() + +message(STATUS "---------- SR sources") + +# Compiler ---- +set(COMMON_SRC_DIRS + # not really sources + data/gui + data/materials + data/particles + + # libs + ./src/btOgre2 + + # sources + ./src/common + ./src/common/data + ./src/common/MessageBox + ./src/road + ./src/OgreCommon + ./src/OgreCommon/System + ./src/OgreCommon/System/Android + ./src/OgreCommon/System/Desktop + ./src/OgreCommon/Threading + ./src/OgreCommon/Utils + ./src/Terra + ./src/Terra/Hlms + ./src/Terra/Hlms/PbsListener + # both game and ed meh- + #./src/vdriftCommon + ./src/sound + ./src/vdrift + ) + +# game +set( GAME_SRC_DIRS ${COMMON_SRC_DIRS} ) +list( APPEND GAME_SRC_DIRS ./src/game ) +list( APPEND GAME_SRC_DIRS ./src/game/data ) +#list( APPEND GAME_SRC_DIRS ./src/sound ) +#list( APPEND GAME_SRC_DIRS ./src/vdrift ) +list( APPEND GAME_SRC_DIRS ./src/oics ) # libs +list( APPEND GAME_SRC_DIRS ./src/network ) + + +# editor +set( EDITOR_SRC_DIRS ${COMMON_SRC_DIRS} ) +list( APPEND EDITOR_SRC_DIRS ./src/editor ) + + +# exe list game and editor +if (BUILD_GAME) + list( APPEND EXE_LIST ${GAME_EXE} ) +endif () +if (BUILD_EDITOR) + list( APPEND EXE_LIST ${EDITOR_EXE} ) +endif () + +## Executables +##------------------------------------------------------------------------------------------------------ +foreach( EXE ${EXE_LIST} ) + + message(STATUS "Configuring: " ${EXE}) + + # sources ---- + set(EXE_SOURCES "") + + if (${EXE} STREQUAL ${EDITOR_EXE}) # ed + set(SRC_DIRS ${EDITOR_SRC_DIRS}) + else () + set(SRC_DIRS ${GAME_SRC_DIRS}) + endif () + + foreach (subdir ${SRC_DIRS}) + #message( STATUS ${subdir} ) + add_recursive(${subdir} EXE_SOURCES) + endforeach () + + # exe ---- + add_executable(${EXE} WIN32 ${EXE_SOURCES}) + + # Generate source groups for use in IDEs + source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${EXE_SOURCES}) + + foreach (subdir ${SRC_DIRS}) + #message( STATUS ${subdir} ) + target_include_directories(${EXE} PRIVATE ${subdir}) + endforeach () + # pch.h + if (${EXE} STREQUAL ${EDITOR_EXE}) # ed + set_target_properties(${EXE} PROPERTIES COMPILE_FLAGS "-DSR_EDITOR") + target_precompile_headers(${EXE} PRIVATE src/editor/pch.h) + else () + target_precompile_headers(${EXE} PRIVATE src/game/pch.h) + endif () + + target_link_libraries( + ${EXE} + PRIVATE + boost::boost + Bullet::Bullet + enet::enet + MyGUI::MyGUI + Ogg::ogg + OGRE::OGRE + OpenAL::OpenAL + rapidjson + SDL2::SDL2 + Threads::Threads + tinyxml2::tinyxml2 + Vorbis::vorbis + Vorbis::vorbisfile + ) + + if (WIN32) + install(TARGETS ${EXE} DESTINATION .) + + # add a post-build command to copy DLLs beside the executable + add_custom_command( + TARGET ${EXE} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + -DEXECUTABLE="$" + -DBIN_DIR="${CMAKE_BINARY_DIR}" + -DLIB_DIR="$" + -P "${CMAKE_SOURCE_DIR}/CMake/FixupBundle.cmake" + ) + endif () +endforeach () + +## Translations tool +##------------------------------------------------------------------------------------------------------ +if (BUILD_TRANSL_TOOL) + message(STATUS "Configuring: " ${TRANSL_EXE}) + + add_executable(${TRANSL_EXE} WIN32 ./src/transl/main.cpp) + target_include_directories(${TRANSL_EXE} PRIVATE ./src/transl) + + target_precompile_headers(${TRANSL_EXE} PRIVATE src/transl/pch.h) +endif() + +message(STATUS "---------- SR end") + + +# Install targets +# ----------------------- + +if (WIN32) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/data/ DESTINATION . PATTERN ".git/*" EXCLUDE) + install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/ DESTINATION . FILES_MATCHING PATTERN "*.dll" ) + install(FILES ${CMAKE_SOURCE_DIR}/dist/plugins_Windows.cfg DESTINATION . RENAME plugins.cfg) + install(FILES ${CMAKE_SOURCE_DIR}/dist/resources2.cfg DESTINATION .) +endif () + + +# CPack +# ----------------------- +set(CPACK_PACKAGE_NAME "Stunt Rally") +set(CPACK_PACKAGE_FILE_NAME "stunt-rally-${CMAKE_PROJECT_VERSION}") +set(CPACK_PACKAGE_DESCRIPTION "Stunt Rally is a 3D racing game with own Track Editor") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Stunt Rally is a 3D racing game with own Track Editor") +set(CPACK_PACKAGE_VENDOR "Crystal Hammer") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/License.txt") +set(CPACK_PACKAGE_EXECUTABLES "StuntRally3" "Stunt Rally 3") + +if (WIN32) + set(CPACK_GENERATOR INNOSETUP) + set(CPACK_ADD_REMOVE TRUE) + set(CPACK_CREATE_DESKTOP_LINKS "StuntRally3" "Stunt Rally 3") + + set(CPACK_INNOSETUP_ALLOW_CUSTOM_DIRECTORY ON) + set(CPACK_INNOSETUP_USE_MODERN_WIZARD ON) + # set(CPACK_INNOSETUP_ICON_FILE "${CMAKE_CURRENT_SOURCE_DIR}/sr3.ico") + set(CPACK_INNOSETUP_SETUP_AppId "{{67B750C8-691F-4AAB-A79C-7557314B24A4}") + + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") + # set(CPACK_INNOSETUP_SETUP_DiskSpanning True) +else () + set(CPACK_GENERATOR 7Z) +endif () + +include(CPack) + + +feature_summary(WHAT ALL) diff --git a/CMakeLists-Debian.txt b/CMakeLists-Debian.txt deleted file mode 100644 index abb80fc9..00000000 --- a/CMakeLists-Debian.txt +++ /dev/null @@ -1,375 +0,0 @@ -# INFO - -# This config assumes you used sh script to get and build latest Ogre-next from sources -# And your Ogre source code is above, in ../Ogre/ogre-next and ../Ogre/ogre-next-deps - -# This is only for Linux. -# If needed check and comment out or adjust places with: # fix - -# To use: rename this file to CMakeLists.txt and folder CMakeManual\ to CMake\ -# Details in docs\Building.md - -# Tested on GNU/Linux, Debian 11 and 12. -# For Windows use CMakeLists-Windows*.txt file instead. -# See also CMake/DependenciesConfig.cmake -# Conan is not used to get SR deps here. - - -cmake_minimum_required( VERSION 3.16 ) -# Include path for additional CMake library finding scripts -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/" ${CMAKE_MODULE_PATH}) - -message(STATUS "Build DIR: ${CMAKE_BINARY_DIR}") - - -# Include path for additional CMake library finding scripts -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/" ${CMAKE_MODULE_PATH}) - -# Add a sensible build type default and warning because empty means no optimization and no debug info. -set(CMAKE_CONFIGURATION_TYPES "Debug" "Release" CACHE STRING "Configuration types") - -if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.22") - cmake_policy(SET CMP0127 OLD) -endif () - -include(CMakeDependentOption) -include(Macros) -find_package(PkgConfig REQUIRED) -include(FeatureSummary) - - -project( StuntRally3 ) - - -# User Options to disable building components -------- -option(BUILD_GAME "Build the game binary." ON) -option(BUILD_EDITOR "Build the track editor." ON) -option(BUILD_GAME_SERVER "Build the game list server app." ON) -option(BUILD_TRANSL_TOOL "Build the tool for translation updating, it creates .pot" ON) - - -# Linux prefers lower-case exe names -if (WIN32 OR APPLE) - set(GAME_EXE StuntRally3) - set(EDITOR_EXE SR-Editor3) - set(SERVER_EXE SR-GameServer) - set(TRANSL_EXE SR-Translator) -else () - set(GAME_EXE stuntrally3) - set(EDITOR_EXE sr-editor3) - set(SERVER_EXE sr-gameserver) - set(TRANSL_EXE sr-translator) -endif () - -set(_PREFIX "SR_") - -# Test if conan is installed -#- find_program(CONAN_CMD_TEST conan NO_CACHE) // fixme? -#- cmake_dependent_option(USE_PACKAGE_MANAGER "Use conan" ON "NOT CONAN_CMD_TEST STREQUAL CONAN_CMD_TEST-NOTFOUND" OFF) -set(USE_PACKAGE_MANAGER OFF) -message(STATUS "Using conan: ${USE_PACKAGE_MANAGER}") - -# Allow user to globally set the library preference for external libraries -cmd_option(${_PREFIX}LIB_PREFERENCE - "Library preference [SYSTEM (if available), CONAN]" - "CONAN" - STRINGS "SYSTEM" "CONAN" - ) - -# Special mode, that will force dependencies to the packages provided by system unless they were set to conan explicitly. -option(${_PREFIX}FORCE_SYSTEM_DEPENDENCIES "Force the use of system packages") - - -# Avoid source tree pollution -if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) - message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building:\nmkdir build; cd build; cmake ..\nBefore that, remove the files already created:\nrm -rf CMakeCache.txt CMakeFiles") -endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) - - -# exe path ---- -set( EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}" ) - -# Set CXX compile flags -set(CMAKE_CXX_STANDARD 17) -#if( MSVC ) -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") -#else() -# off warnings -if( NOT MSVC ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-comment -Wno-dangling-else -Wno-deprecated-declarations -Wno-parentheses") -endif() - -if (CMAKE_COMPILER_IS_GNUCXX) - message(STATUS "GCC detected, adding compile flags") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") -endif () - -if (MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") - if( NOT PLATFORM_X64 ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") - endif() - add_definitions( -DUNICODE -D_UNICODE ) -endif () - - -# deps ---- - -# Check for dependencies -include(DependenciesConfig) - -#- message( STATUS "---------- resolve_conan_dependencies" ) -#- resolve_conan_dependencies() // no - - -# root dir -message( STATUS "---------- root dir above" ) -get_filename_component( DIR_ONE_ABOVE ../ ABSOLUTE ) -message( STATUS ${DIR_ONE_ABOVE} ) - -set( OGRE_NEXT_DIR ${DIR_ONE_ABOVE}/Ogre/ogre-next ) - -# Fix 1 Ogre -set( OGRE_SOURCE ${OGRE_NEXT_DIR}/ ) - -if ( CMAKE_BUILD_TYPE STREQUAL "Debug" ) - set( OGRE_BINARIES ${OGRE_NEXT_DIR}/build/Debug ) -else() - set( OGRE_BINARIES ${OGRE_NEXT_DIR}/build/Release ) -endif() - -include( CMake/Dependencies/OGRE.cmake ) - - -# This scripts will add all the cpp and h files from src and include folders -message( STATUS "---------- setup Ogre" ) - -setupOgre( OGRE_SOURCE, OGRE_BINARIES, OGRE_LIBRARIES, FALSE, FALSE ) - -# Fix 2 SDL -include_directories( "/usr/include/SDL2" ) -include_directories( ${DIR_ONE_ABOVE}/Ogre/ogre-next-deps/build/ogredeps/include ) #for rapidjson - -# MyGui -include_directories( ${DIR_ONE_ABOVE}/mygui-next/MyGUIEngine/include ) -include_directories( ${DIR_ONE_ABOVE}/mygui-next/Platforms/Ogre2/Ogre2Platform/include ) - - -macro( add_recursive dir retVal ) - file( GLOB GLOB_RESULT ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ) - list( APPEND ${retVal} ${GLOB_RESULT}) -endmacro() - -message( STATUS "---------- SR sources" ) - -# Compiler ---- -set( COMMON_SRC_DIRS - # not really sources - data/gui - data/materials - data/particles - - # libs - ./src/btOgre2 - - # sources - ./src/common - ./src/common/data - ./src/common/MessageBox - ./src/road - ./src/OgreCommon - ./src/OgreCommon/System - ./src/OgreCommon/System/Android - ./src/OgreCommon/System/Desktop - ./src/OgreCommon/Threading - ./src/OgreCommon/Utils - ./src/Terra - ./src/Terra/Hlms - ./src/Terra/Hlms/PbsListener - # both game and ed meh- - #./src/vdriftCommon - ./src/sound - ./src/vdrift -) - -# game -set( GAME_SRC_DIRS ${COMMON_SRC_DIRS} ) -list( APPEND GAME_SRC_DIRS ./src/game ) -list( APPEND GAME_SRC_DIRS ./src/game/data ) -#list( APPEND GAME_SRC_DIRS ./src/sound ) -#list( APPEND GAME_SRC_DIRS ./src/vdrift ) -list( APPEND GAME_SRC_DIRS ./src/oics ) # libs -list( APPEND GAME_SRC_DIRS ./src/network ) - - -# editor -set( EDITOR_SRC_DIRS ${COMMON_SRC_DIRS} ) -list( APPEND EDITOR_SRC_DIRS ./src/editor ) - - -# exe list game and editor -if (BUILD_GAME) - list( APPEND EXE_LIST ${GAME_EXE} ) -endif() -if (BUILD_EDITOR) - list( APPEND EXE_LIST ${EDITOR_EXE} ) -endif() - - - -# fix 4 OpenAL since conan failed - common, meh -find_package( OpenAL REQUIRED ) -include_directories( ${OPENAL_INCLUDE_DIR} ) - -find_package( Threads ) - -find_package( Boost COMPONENTS system thread REQUIRED ) - - -# fix 5 bullet -find_package( Bullet REQUIRED ) - -message( STATUS "--- Bullet: " ${BULLET_FOUND} ) -# message( STATUS "--- Bullet: " ${BULLET_INCLUDE_DIRS} ) -# message( STATUS "--- Bullet: " ${BULLET_LIBRARIES} ) - -# find_package(OGG REQUIRED) -# find_package(Vorbis REQUIRED) - - -## Executables -##------------------------------------------------------------------------------------------------------ -foreach( EXE ${EXE_LIST} ) - - message( STATUS "Configuring: " ${EXE} ) - - # sources ---- - set( EXE_SOURCES "") - - if ( ${EXE} STREQUAL ${EDITOR_EXE} ) # ed - set( SRC_DIRS ${EDITOR_SRC_DIRS} ) - else () - set( SRC_DIRS ${GAME_SRC_DIRS} ) - endif () - - foreach( subdir ${SRC_DIRS} ) - #message( STATUS ${subdir} ) - add_recursive( ${subdir} EXE_SOURCES ) - endforeach () - - # exe ---- - add_executable( ${EXE} WIN32 ${EXE_SOURCES} ) - - - # add includes ---- - foreach( subdir ${SRC_DIRS} ) - #message( STATUS ${subdir} ) - target_include_directories( ${EXE} PRIVATE ${subdir} ) - endforeach () - - target_include_directories( ${EXE} PRIVATE ${BULLET_INCLUDE_DIRS} ) - - # fix 5 ENet since conan fails - # find_package( ENet REQUIRED ) # inside Dep..cmake - if ( ${EXE} STREQUAL ${GAME_EXE} ) # game, once - target_include_directories( ${EXE} PRIVATE ${ENet_INCLUDE_DIRS} ) - target_include_directories( ${EXE} PRIVATE ${Boost_INCLUDE_DIRS} ) - endif () - - - # pch.h - if ( ${EXE} STREQUAL ${EDITOR_EXE} ) # ed - set_target_properties( ${EXE} PROPERTIES COMPILE_FLAGS "-DSR_EDITOR" ) - target_precompile_headers( ${EXE} PRIVATE src/editor/pch.h ) - else () - target_precompile_headers( ${EXE} PRIVATE src/game/pch.h ) - endif () - - # c++ - target_compile_options( ${EXE} PRIVATE -Wswitch ) - #target_compile_features( ${EXE} PRIVATE cxx_std_17 ) - - - # add linker ---- - # threads - target_link_libraries( ${EXE} ${CMAKE_THREAD_LIBS_INIT} ) - - - # OpenAL - target_link_libraries( ${EXE} "${OPENAL_LIBRARY}" ) - - # bullet - target_link_libraries( ${EXE} ${BULLET_LIBRARIES} -lBulletWorldImporter ) - - - # Ogre ---- - target_link_libraries( ${EXE} ${OGRE_LIBRARIES} ) - - # SDL - target_link_libraries( ${EXE} "-lSDL2" ) - - - # MyGui ---- # todo: windows .. - if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") - set(SUFFIX_D "_d") - else () - set(SUFFIX_D "") - endif () - - target_link_libraries( ${EXE} ${DIR_ONE_ABOVE}/mygui-next/build/${CMAKE_BUILD_TYPE}/lib/libMyGUI.Ogre2Platform${SUFFIX_D}.a ) - - if ( ${EXE} STREQUAL ${GAME_EXE} ) # game, once - add_library( libMyGUIEngine SHARED IMPORTED ) - endif() - set_target_properties( libMyGUIEngine PROPERTIES IMPORTED_LOCATION ${DIR_ONE_ABOVE}/mygui-next/build/${CMAKE_BUILD_TYPE}/lib/libMyGUIEngine${SUFFIX_D}.so ) - target_link_libraries( ${EXE} libMyGUIEngine ) - - - # ENet, boost for networking ---- - if ( ${EXE} STREQUAL ${GAME_EXE} ) # game, once - target_link_libraries( ${EXE} ${Boost_LIBRARIES} ) - target_link_libraries( ${EXE} ${ENet_LIBRARIES} ) - endif() - - # rest - #message( STATUS "Libs " ${EXE} " " ${LIBS} ) - target_link_libraries( ${EXE} ${LIBS} ) - -endforeach () - - -## Translations tool -##------------------------------------------------------------------------------------------------------ -if (BUILD_TRANSL_TOOL) - message( STATUS "Configuring: " ${TRANSL_EXE} ) - - add_executable( ${TRANSL_EXE} WIN32 ./src/transl/main.cpp ) - target_include_directories( ${TRANSL_EXE} PRIVATE ./src/transl ) - - target_precompile_headers( ${TRANSL_EXE} PRIVATE src/transl/pch.h ) - # c++ - target_compile_options( ${TRANSL_EXE} PRIVATE -Wswitch ) - #target_compile_features( ${TRANSL_EXE} PRIVATE cxx_std_17 ) - - set_target_properties( ${TRANSL_EXE} PROPERTIES LINKER_LANGUAGE CXX ) -endif () - - -## Game server app -##------------------------------------------------------------------------------------------------------ -if (BUILD_GAME_SERVER) - message( STATUS "Configuring: " ${SERVER_EXE} ) - - add_executable( ${SERVER_EXE} WIN32 ./src/network/game-server/main.cpp ) - target_include_directories( ${SERVER_EXE} PRIVATE ./src/network ) - target_include_directories( ${SERVER_EXE} PRIVATE ./src/vdrift ) - # c++ - target_compile_options( ${SERVER_EXE} PRIVATE -Wswitch ) - #target_compile_features( ${SERVER_EXE} PRIVATE cxx_std_17 ) - set_target_properties( ${SERVER_EXE} PROPERTIES LINKER_LANGUAGE CXX ) - - target_link_libraries( ${SERVER_EXE} ${Boost_LIBRARIES} ) - target_link_libraries( ${SERVER_EXE} ${ENet_LIBRARIES} ) -endif () - -message( STATUS "---------- SR end" ) diff --git a/CMakeLists.txt b/CMakeLists.txt index d84ae0c7..abb80fc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,27 @@ +# INFO -# This CMake is for CI/CD auto builds in github Actions tab. -# See in docs/Building.md and BuildingVS.md for building from sources. -# Conan is used to get SR deps, or not if using FORCE_SYSTEM_DEPENDENCIES. +# This config assumes you used sh script to get and build latest Ogre-next from sources +# And your Ogre source code is above, in ../Ogre/ogre-next and ../Ogre/ogre-next-deps + +# This is only for Linux. +# If needed check and comment out or adjust places with: # fix + +# To use: rename this file to CMakeLists.txt and folder CMakeManual\ to CMake\ +# Details in docs\Building.md + +# Tested on GNU/Linux, Debian 11 and 12. +# For Windows use CMakeLists-Windows*.txt file instead. +# See also CMake/DependenciesConfig.cmake +# Conan is not used to get SR deps here. cmake_minimum_required( VERSION 3.16 ) +# Include path for additional CMake library finding scripts +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/" ${CMAKE_MODULE_PATH}) + +message(STATUS "Build DIR: ${CMAKE_BINARY_DIR}") + + # Include path for additional CMake library finding scripts set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/" ${CMAKE_MODULE_PATH}) @@ -15,15 +32,11 @@ if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.22") cmake_policy(SET CMP0127 OLD) endif () -set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) - include(CMakeDependentOption) include(Macros) +find_package(PkgConfig REQUIRED) include(FeatureSummary) -if (NOT WIN32) - find_package(PkgConfig) -endif () project( StuntRally3 ) @@ -48,17 +61,43 @@ else () set(TRANSL_EXE sr-translator) endif () +set(_PREFIX "SR_") + +# Test if conan is installed +#- find_program(CONAN_CMD_TEST conan NO_CACHE) // fixme? +#- cmake_dependent_option(USE_PACKAGE_MANAGER "Use conan" ON "NOT CONAN_CMD_TEST STREQUAL CONAN_CMD_TEST-NOTFOUND" OFF) +set(USE_PACKAGE_MANAGER OFF) +message(STATUS "Using conan: ${USE_PACKAGE_MANAGER}") + +# Allow user to globally set the library preference for external libraries +cmd_option(${_PREFIX}LIB_PREFERENCE + "Library preference [SYSTEM (if available), CONAN]" + "CONAN" + STRINGS "SYSTEM" "CONAN" + ) + +# Special mode, that will force dependencies to the packages provided by system unless they were set to conan explicitly. +option(${_PREFIX}FORCE_SYSTEM_DEPENDENCIES "Force the use of system packages") + # Avoid source tree pollution if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building:\nmkdir build; cd build; cmake ..\nBefore that, remove the files already created:\nrm -rf CMakeCache.txt CMakeFiles") endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + # exe path ---- set( EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}" ) # Set CXX compile flags set(CMAKE_CXX_STANDARD 17) +#if( MSVC ) +# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") +#else() +# off warnings +if( NOT MSVC ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-comment -Wno-dangling-else -Wno-deprecated-declarations -Wno-parentheses") +endif() if (CMAKE_COMPILER_IS_GNUCXX) message(STATUS "GCC detected, adding compile flags") @@ -67,7 +106,10 @@ endif () if (MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") - add_definitions(-DUNICODE -D_UNICODE) + if( NOT PLATFORM_X64 ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") + endif() + add_definitions( -DUNICODE -D_UNICODE ) endif () @@ -76,42 +118,79 @@ endif () # Check for dependencies include(DependenciesConfig) -macro(add_recursive dir retVal) - file(GLOB GLOB_RESULT ${dir}/*.h ${dir}/*.cpp ${dir}/*.c) - list(APPEND ${retVal} ${GLOB_RESULT}) +#- message( STATUS "---------- resolve_conan_dependencies" ) +#- resolve_conan_dependencies() // no + + +# root dir +message( STATUS "---------- root dir above" ) +get_filename_component( DIR_ONE_ABOVE ../ ABSOLUTE ) +message( STATUS ${DIR_ONE_ABOVE} ) + +set( OGRE_NEXT_DIR ${DIR_ONE_ABOVE}/Ogre/ogre-next ) + +# Fix 1 Ogre +set( OGRE_SOURCE ${OGRE_NEXT_DIR}/ ) + +if ( CMAKE_BUILD_TYPE STREQUAL "Debug" ) + set( OGRE_BINARIES ${OGRE_NEXT_DIR}/build/Debug ) +else() + set( OGRE_BINARIES ${OGRE_NEXT_DIR}/build/Release ) +endif() + +include( CMake/Dependencies/OGRE.cmake ) + + +# This scripts will add all the cpp and h files from src and include folders +message( STATUS "---------- setup Ogre" ) + +setupOgre( OGRE_SOURCE, OGRE_BINARIES, OGRE_LIBRARIES, FALSE, FALSE ) + +# Fix 2 SDL +include_directories( "/usr/include/SDL2" ) +include_directories( ${DIR_ONE_ABOVE}/Ogre/ogre-next-deps/build/ogredeps/include ) #for rapidjson + +# MyGui +include_directories( ${DIR_ONE_ABOVE}/mygui-next/MyGUIEngine/include ) +include_directories( ${DIR_ONE_ABOVE}/mygui-next/Platforms/Ogre2/Ogre2Platform/include ) + + +macro( add_recursive dir retVal ) + file( GLOB GLOB_RESULT ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ) + list( APPEND ${retVal} ${GLOB_RESULT}) endmacro() -message(STATUS "---------- SR sources") +message( STATUS "---------- SR sources" ) # Compiler ---- -set(COMMON_SRC_DIRS - # not really sources - data/gui - data/materials - data/particles - - # libs - ./src/btOgre2 - - # sources - ./src/common - ./src/common/data - ./src/common/MessageBox - ./src/road - ./src/OgreCommon - ./src/OgreCommon/System - ./src/OgreCommon/System/Android - ./src/OgreCommon/System/Desktop - ./src/OgreCommon/Threading - ./src/OgreCommon/Utils - ./src/Terra - ./src/Terra/Hlms - ./src/Terra/Hlms/PbsListener - # both game and ed meh- - #./src/vdriftCommon - ./src/sound - ./src/vdrift - ) +set( COMMON_SRC_DIRS + # not really sources + data/gui + data/materials + data/particles + + # libs + ./src/btOgre2 + + # sources + ./src/common + ./src/common/data + ./src/common/MessageBox + ./src/road + ./src/OgreCommon + ./src/OgreCommon/System + ./src/OgreCommon/System/Android + ./src/OgreCommon/System/Desktop + ./src/OgreCommon/Threading + ./src/OgreCommon/Utils + ./src/Terra + ./src/Terra/Hlms + ./src/Terra/Hlms/PbsListener + # both game and ed meh- + #./src/vdriftCommon + ./src/sound + ./src/vdrift +) # game set( GAME_SRC_DIRS ${COMMON_SRC_DIRS} ) @@ -131,135 +210,166 @@ list( APPEND EDITOR_SRC_DIRS ./src/editor ) # exe list game and editor if (BUILD_GAME) list( APPEND EXE_LIST ${GAME_EXE} ) -endif () +endif() if (BUILD_EDITOR) list( APPEND EXE_LIST ${EDITOR_EXE} ) -endif () +endif() + + + +# fix 4 OpenAL since conan failed - common, meh +find_package( OpenAL REQUIRED ) +include_directories( ${OPENAL_INCLUDE_DIR} ) + +find_package( Threads ) + +find_package( Boost COMPONENTS system thread REQUIRED ) + + +# fix 5 bullet +find_package( Bullet REQUIRED ) + +message( STATUS "--- Bullet: " ${BULLET_FOUND} ) +# message( STATUS "--- Bullet: " ${BULLET_INCLUDE_DIRS} ) +# message( STATUS "--- Bullet: " ${BULLET_LIBRARIES} ) + +# find_package(OGG REQUIRED) +# find_package(Vorbis REQUIRED) + ## Executables ##------------------------------------------------------------------------------------------------------ foreach( EXE ${EXE_LIST} ) - message(STATUS "Configuring: " ${EXE}) + message( STATUS "Configuring: " ${EXE} ) # sources ---- - set(EXE_SOURCES "") + set( EXE_SOURCES "") - if (${EXE} STREQUAL ${EDITOR_EXE}) # ed - set(SRC_DIRS ${EDITOR_SRC_DIRS}) + if ( ${EXE} STREQUAL ${EDITOR_EXE} ) # ed + set( SRC_DIRS ${EDITOR_SRC_DIRS} ) else () - set(SRC_DIRS ${GAME_SRC_DIRS}) + set( SRC_DIRS ${GAME_SRC_DIRS} ) endif () - foreach (subdir ${SRC_DIRS}) + foreach( subdir ${SRC_DIRS} ) #message( STATUS ${subdir} ) - add_recursive(${subdir} EXE_SOURCES) + add_recursive( ${subdir} EXE_SOURCES ) endforeach () # exe ---- - add_executable(${EXE} WIN32 ${EXE_SOURCES}) + add_executable( ${EXE} WIN32 ${EXE_SOURCES} ) - # Generate source groups for use in IDEs - source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${EXE_SOURCES}) - foreach (subdir ${SRC_DIRS}) - #message( STATUS ${subdir} ) - target_include_directories(${EXE} PRIVATE ${subdir}) + # add includes ---- + foreach( subdir ${SRC_DIRS} ) + #message( STATUS ${subdir} ) + target_include_directories( ${EXE} PRIVATE ${subdir} ) endforeach () + + target_include_directories( ${EXE} PRIVATE ${BULLET_INCLUDE_DIRS} ) + + # fix 5 ENet since conan fails + # find_package( ENet REQUIRED ) # inside Dep..cmake + if ( ${EXE} STREQUAL ${GAME_EXE} ) # game, once + target_include_directories( ${EXE} PRIVATE ${ENet_INCLUDE_DIRS} ) + target_include_directories( ${EXE} PRIVATE ${Boost_INCLUDE_DIRS} ) + endif () + + # pch.h - if (${EXE} STREQUAL ${EDITOR_EXE}) # ed - set_target_properties(${EXE} PROPERTIES COMPILE_FLAGS "-DSR_EDITOR") - target_precompile_headers(${EXE} PRIVATE src/editor/pch.h) + if ( ${EXE} STREQUAL ${EDITOR_EXE} ) # ed + set_target_properties( ${EXE} PROPERTIES COMPILE_FLAGS "-DSR_EDITOR" ) + target_precompile_headers( ${EXE} PRIVATE src/editor/pch.h ) else () - target_precompile_headers(${EXE} PRIVATE src/game/pch.h) + target_precompile_headers( ${EXE} PRIVATE src/game/pch.h ) endif () - target_link_libraries( - ${EXE} - PRIVATE - boost::boost - Bullet::Bullet - enet::enet - MyGUI::MyGUI - Ogg::ogg - OGRE::OGRE - OpenAL::OpenAL - rapidjson - SDL2::SDL2 - Threads::Threads - tinyxml2::tinyxml2 - Vorbis::vorbis - Vorbis::vorbisfile - ) - - if (WIN32) - install(TARGETS ${EXE} DESTINATION .) - - # add a post-build command to copy DLLs beside the executable - add_custom_command( - TARGET ${EXE} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - -DEXECUTABLE="$" - -DBIN_DIR="${CMAKE_BINARY_DIR}" - -DLIB_DIR="$" - -P "${CMAKE_SOURCE_DIR}/CMake/FixupBundle.cmake" - ) + # c++ + target_compile_options( ${EXE} PRIVATE -Wswitch ) + #target_compile_features( ${EXE} PRIVATE cxx_std_17 ) + + + # add linker ---- + # threads + target_link_libraries( ${EXE} ${CMAKE_THREAD_LIBS_INIT} ) + + + # OpenAL + target_link_libraries( ${EXE} "${OPENAL_LIBRARY}" ) + + # bullet + target_link_libraries( ${EXE} ${BULLET_LIBRARIES} -lBulletWorldImporter ) + + + # Ogre ---- + target_link_libraries( ${EXE} ${OGRE_LIBRARIES} ) + + # SDL + target_link_libraries( ${EXE} "-lSDL2" ) + + + # MyGui ---- # todo: windows .. + if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set(SUFFIX_D "_d") + else () + set(SUFFIX_D "") endif () -endforeach () -## Translations tool -##------------------------------------------------------------------------------------------------------ -if (BUILD_TRANSL_TOOL) - message(STATUS "Configuring: " ${TRANSL_EXE}) + target_link_libraries( ${EXE} ${DIR_ONE_ABOVE}/mygui-next/build/${CMAKE_BUILD_TYPE}/lib/libMyGUI.Ogre2Platform${SUFFIX_D}.a ) - add_executable(${TRANSL_EXE} WIN32 ./src/transl/main.cpp) - target_include_directories(${TRANSL_EXE} PRIVATE ./src/transl) + if ( ${EXE} STREQUAL ${GAME_EXE} ) # game, once + add_library( libMyGUIEngine SHARED IMPORTED ) + endif() + set_target_properties( libMyGUIEngine PROPERTIES IMPORTED_LOCATION ${DIR_ONE_ABOVE}/mygui-next/build/${CMAKE_BUILD_TYPE}/lib/libMyGUIEngine${SUFFIX_D}.so ) + target_link_libraries( ${EXE} libMyGUIEngine ) - target_precompile_headers(${TRANSL_EXE} PRIVATE src/transl/pch.h) -endif() -message(STATUS "---------- SR end") + # ENet, boost for networking ---- + if ( ${EXE} STREQUAL ${GAME_EXE} ) # game, once + target_link_libraries( ${EXE} ${Boost_LIBRARIES} ) + target_link_libraries( ${EXE} ${ENet_LIBRARIES} ) + endif() + # rest + #message( STATUS "Libs " ${EXE} " " ${LIBS} ) + target_link_libraries( ${EXE} ${LIBS} ) -# Install targets -# ----------------------- +endforeach () -if (WIN32) - install(DIRECTORY ${CMAKE_SOURCE_DIR}/data/ DESTINATION . PATTERN ".git/*" EXCLUDE) - install(DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/ DESTINATION . FILES_MATCHING PATTERN "*.dll" ) - install(FILES ${CMAKE_SOURCE_DIR}/dist/plugins_Windows.cfg DESTINATION . RENAME plugins.cfg) - install(FILES ${CMAKE_SOURCE_DIR}/dist/resources2.cfg DESTINATION .) -endif () +## Translations tool +##------------------------------------------------------------------------------------------------------ +if (BUILD_TRANSL_TOOL) + message( STATUS "Configuring: " ${TRANSL_EXE} ) -# CPack -# ----------------------- -set(CPACK_PACKAGE_NAME "Stunt Rally") -set(CPACK_PACKAGE_FILE_NAME "stunt-rally-${CMAKE_PROJECT_VERSION}") -set(CPACK_PACKAGE_DESCRIPTION "Stunt Rally is a 3D racing game with own Track Editor") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Stunt Rally is a 3D racing game with own Track Editor") -set(CPACK_PACKAGE_VENDOR "Crystal Hammer") -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/License.txt") -set(CPACK_PACKAGE_EXECUTABLES "StuntRally3" "Stunt Rally 3") - -if (WIN32) - set(CPACK_GENERATOR INNOSETUP) - set(CPACK_ADD_REMOVE TRUE) - set(CPACK_CREATE_DESKTOP_LINKS "StuntRally3" "Stunt Rally 3") - - set(CPACK_INNOSETUP_ALLOW_CUSTOM_DIRECTORY ON) - set(CPACK_INNOSETUP_USE_MODERN_WIZARD ON) - # set(CPACK_INNOSETUP_ICON_FILE "${CMAKE_CURRENT_SOURCE_DIR}/sr3.ico") - set(CPACK_INNOSETUP_SETUP_AppId "{{67B750C8-691F-4AAB-A79C-7557314B24A4}") - - set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") - # set(CPACK_INNOSETUP_SETUP_DiskSpanning True) -else () - set(CPACK_GENERATOR 7Z) + add_executable( ${TRANSL_EXE} WIN32 ./src/transl/main.cpp ) + target_include_directories( ${TRANSL_EXE} PRIVATE ./src/transl ) + + target_precompile_headers( ${TRANSL_EXE} PRIVATE src/transl/pch.h ) + # c++ + target_compile_options( ${TRANSL_EXE} PRIVATE -Wswitch ) + #target_compile_features( ${TRANSL_EXE} PRIVATE cxx_std_17 ) + + set_target_properties( ${TRANSL_EXE} PROPERTIES LINKER_LANGUAGE CXX ) endif () -include(CPack) +## Game server app +##------------------------------------------------------------------------------------------------------ +if (BUILD_GAME_SERVER) + message( STATUS "Configuring: " ${SERVER_EXE} ) + + add_executable( ${SERVER_EXE} WIN32 ./src/network/game-server/main.cpp ) + target_include_directories( ${SERVER_EXE} PRIVATE ./src/network ) + target_include_directories( ${SERVER_EXE} PRIVATE ./src/vdrift ) + # c++ + target_compile_options( ${SERVER_EXE} PRIVATE -Wswitch ) + #target_compile_features( ${SERVER_EXE} PRIVATE cxx_std_17 ) + set_target_properties( ${SERVER_EXE} PROPERTIES LINKER_LANGUAGE CXX ) + + target_link_libraries( ${SERVER_EXE} ${Boost_LIBRARIES} ) + target_link_libraries( ${SERVER_EXE} ${ENet_LIBRARIES} ) +endif () -feature_summary(WHAT ALL) +message( STATUS "---------- SR end" ) diff --git a/CMakeManual/Bootstrap.cmake b/CMakeManual/Bootstrap.cmake deleted file mode 100644 index cece3cb5..00000000 --- a/CMakeManual/Bootstrap.cmake +++ /dev/null @@ -1,52 +0,0 @@ - -set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG" ) - -if( NOT APPLE ) - if( CMAKE_BUILD_TYPE STREQUAL "" ) - set( CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel." FORCE ) - endif() -else() - set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ogre3d.\${PRODUCT_NAME:rfc1034identifier}") -endif() - -if( NOT MSVC ) - set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1 -D_DEBUG=1 -g" ) - set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG" ) - set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG" ) - set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual" ) - #set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-overloaded-virtual" ) -endif() - -if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) - set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-limit-debug-info" ) -endif() - -# Determine if we are compiling for a 32bit or 64bit system -if( NOT APPLE ) - include(CheckTypeSize) - CHECK_TYPE_SIZE("void*" ARCH_PTR_SIZE BUILTIN_TYPES_ONLY) - if (ARCH_PTR_SIZE EQUAL 8) - set(PLATFORM_X64 TRUE) - else () - set(PLATFORM_X64 FALSE) - endif () -endif() - -if( MSVC ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") - if( NOT PLATFORM_X64 ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") - endif() - add_definitions( -DUNICODE -D_UNICODE ) -endif() - -if( APPLE ) - macro( add_recursive dir retVal ) - file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ${dir}/*.mm ${dir}/*.m ) - endmacro() -else() - macro( add_recursive dir retVal ) - file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ) - endmacro() -endif() diff --git a/CMakeManual/DependenciesConfig.cmake b/CMakeManual/DependenciesConfig.cmake deleted file mode 100644 index 4b231984..00000000 --- a/CMakeManual/DependenciesConfig.cmake +++ /dev/null @@ -1,114 +0,0 @@ -include(DependenciesFunctions) - -set(CMAKE_THREAD_PREFER_PTHREAD YES) -find_package(Threads REQUIRED) - -# Some pkg-config files are broken, that is why they are commented out - -# fails -#add_external_lib( -# Boost -# boost/1.81.0 -# REQUIRED -# FIND_PACKAGE_OPTIONS COMPONENTS system thread -#) - -#add_external_lib( -# OGRE -# ogre3d/13.4.4@anotherfoxguy/stable -# REQUIRED -# CONAN_PKG_NAME OGRE -# CONAN_OPTIONS ogre3d:nodeless_positioning=True ogre3d:resourcemanager_strict=off -# # uncomment below for Ogre 1.9 -# #PKG_CONFIG "OGRE, OGRE-Terrain, OGRE-Paging, OGRE-Overlay" -# FIND_PACKAGE_OPTIONS CONFIG COMPONENTS Bites Overlay Paging RTShaderSystem MeshLodGenerator Terrain -#) - -add_external_lib( - BULLET - bullet3/3.24 - REQUIRED - FIND_PACKAGE - CONAN_OPTIONS bullet3:extras=True bullet3:network_support=True - INTERFACE_NAME Bullet::Bullet -) - -#add_external_lib( -# SDL2 -# sdl/2.0.20 -# REQUIRED -# PKG_CONFIG "sdl2 >= 2.0" -# FIND_PACKAGE_OPTIONS CONFIG -# CONAN_OPTIONS sdl:sdl2main=False -#) - -#add_external_lib( -# MyGUI -# mygui/3.4.1@anotherfoxguy/stable -# REQUIRED -# # PKG_CONFIG "MYGUI = 3.4.0" -# FIND_PACKAGE -#) - -add_external_lib( - OGG - ogg/1.3.5 - REQUIRED - PKG_CONFIG "ogg >= 1.2" - FIND_PACKAGE -) - -add_external_lib( - VorbisFile - vorbis/1.3.7 - REQUIRED - PKG_CONFIG "vorbis >= 1.2, vorbisfile >= 1.2" - FIND_PACKAGE -) - -# todo: fix Cannot load recipe. -#add_external_lib( -# OpenAL -# openal/1.22.2 -# REQUIRED -# PKG_CONFIG "openal >= 1.18" -# FIND_PACKAGE_OPTIONS CONFIG -#) - -#add_external_lib( -# ENet -# enet/1.3.17 -# REQUIRED -# PKG_CONFIG "libenet >= 1.2" -# FIND_PACKAGE -#) - -add_external_lib( - tinyxml2 - tinyxml2/9.0.0 - REQUIRED - PKG_CONFIG "tinyxml2 >= 6" - FIND_PACKAGE -) - - -set(LIBS - #Boost::Boost # fails - #Threads::Threads - #OGRE::OGRE - #- Bullet::Bullet // fixme? - #SDL2::SDL2 - #MyGUI::MyGUI - VorbisFile::VorbisFile - OGG::OGG - #OpenAL::OpenAL # fails - #ENet::ENet # fails - tinyxml2::tinyxml2 -) - -#set(SERVER_LIBS Boost::Boost ENet::ENet) - - -find_package( ENet REQUIRED ) - -find_package( Boost COMPONENTS system thread REQUIRED )