diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml new file mode 100644 index 00000000..759bdb0b --- /dev/null +++ b/.github/workflows/build-game.yml @@ -0,0 +1,123 @@ +--- +name: Build game + +on: [ push, pull_request ] + +jobs: + build-gcc: + name: Linux build on Ubuntu + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.1.0 + with: + submodules: true + + - name: Cache conan + uses: actions/cache@v3.0.11 + with: + key: conan-root-${{ hashFiles('conanfile.txt') }} + path: ~/.conan/ + + - name: Install dependencies + run: | + curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash + sudo apt-get update + sudo apt-get -y install \ + pkg-config \ + ninja-build \ + nvidia-cg-toolkit \ + libsdl2-dev \ + libfreetype6-dev \ + libfreeimage-dev \ + libzzip-dev \ + libois-dev \ + libgl1-mesa-dev \ + libglu1-mesa-dev \ + libx11-dev \ + libxt-dev \ + libxaw7-dev \ + libxrandr-dev \ + libopenjp2-7-dev \ + libbullet-dev \ + libbullet-extras-dev \ + libtinyxml-dev \ + libtinyxml2-dev \ + libenet-dev \ + libboost-system-dev \ + libboost-thread-dev \ + libboost-system-dev \ + libboost-wave-dev + + shell: bash + + - name: Configure + run: | + conan config set general.revisions_enabled=1 + echo "tools.system.package_manager:mode = install" > ~/.conan/global.conf + echo "tools.system.package_manager:sudo = True" >> ~/.conan/global.conf + conan profile new --detect --force default + conan profile update conf.tools.cmake.cmaketoolchain:generator="Ninja" default + conan profile update settings.compiler.libcxx=libstdc++11 default + conan remote add ror-conan https://git.anotherfoxguy.com/api/packages/rorbot/conan -f + mkdir build && cd build + conan install .. -s build_type=Release -b missing -pr:b=default + cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_MASTER_SERVER=ON -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" + shell: bash + + - name: Build + run: | + cd build + ninja + shell: bash + + - name: Clean Conan pkgs + run: conan remove "*" -fsb + shell: bash + + build-msvc: + name: Windows build + runs-on: windows-2019 + env: + BUILD_TOOLS_PATH: C:\apps\build-tools\ + CONAN_USER_HOME_SHORT: None + steps: + - run: echo $env:BUILD_TOOLS_PATH | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - uses: actions/checkout@v3.1.0 + with: + submodules: true + + - name: Install Build tools + shell: cmake -P {0} + run: | + file(MAKE_DIRECTORY $ENV{BUILD_TOOLS_PATH}) + file(DOWNLOAD https://cdn.anotherfoxguy.com/build-tools.zip "$ENV{TMP}/build-tools.zip" SHOW_PROGRESS) + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf "$ENV{TMP}/build-tools.zip" WORKING_DIRECTORY "$ENV{BUILD_TOOLS_PATH}") + + - name: Cache conan packages + uses: actions/cache@v3.0.11 + with: + key: conan-${{ hashFiles('conanfile.txt') }} + path: ~/.conan + + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1.12.0 + + - name: Configure + run: | + conan config set general.revisions_enabled=1 + conan remote add ror-conan https://git.anotherfoxguy.com/api/packages/rorbot/conan -f + mkdir build && cd build + conan install .. -b missing -pr:b=../tools/conan-profiles/vs-19-release-ninja + cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=redist -DBUILD_MASTER_SERVER=ON -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" + shell: cmd + + - name: Build + run: | + cd build + ninja + shell: cmd + + - name: Clean Conan pkgs + run: conan remove "*" -fsb + shell: cmd diff --git a/.gitignore b/.gitignore index a10be77e..315a269f 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ AndroidDependencies/ Build/ EmscriptenDependencies EmscriptenBuild +cmake-build-*/ +.idea/ \ No newline at end of file diff --git a/CMake/Bootstrap.cmake b/CMake/Bootstrap.cmake index cece3cb5..3f0ecca7 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/CMake/Dependencies/OGRE.cmake b/CMake/Dependencies/OGRE.cmake deleted file mode 100644 index a5024a67..00000000 --- a/CMake/Dependencies/OGRE.cmake +++ /dev/null @@ -1,472 +0,0 @@ -#------------------------------------------------------------------- -# The contents of this file are placed in the public domain. Feel -# free to make use of it in any way you like. -#------------------------------------------------------------------- - -# Finds the string "#define RESULT_NAME" in OgreBuildSettings.h -# (provided as a string in an argument) -function( findOgreBuildSetting OGRE_BUILD_SETTINGS_STR RESULT_NAME ) - string( FIND "${OGRE_BUILD_SETTINGS_STR}" "#define ${RESULT_NAME}" TMP_RESULT ) - if( NOT TMP_RESULT EQUAL -1 ) - set( ${RESULT_NAME} 1 PARENT_SCOPE ) - else() - unset( ${RESULT_NAME} PARENT_SCOPE ) - endif() -endfunction() - -#---------------------------------------------------------------------------------------- - -# On Windows it's a regular copy. -# On Apple it does nothing -# On Linux, it copies both libOgreMain.so.2.1 and its symbolic link libOgreMain.so -function( copyWithSymLink SRC DST ) - if( NOT APPLE ) - if( UNIX ) - get_filename_component( RESOLVED_LIB_PATH ${SRC} REALPATH ) - file( COPY ${RESOLVED_LIB_PATH} DESTINATION ${DST} ) - endif() - file( COPY ${SRC} DESTINATION ${DST} ) - endif() -endfunction() - -#---------------------------------------------------------------------------------------- - -# Finds if Ogre has been built a library with LIBRARY_NAME.dll, -# and if so sets the string for Plugins.cfg in CFG_VARIABLE. -macro( findPluginAndSetPath BUILD_TYPE CFG_VARIABLE LIBRARY_NAME ) - set( REAL_LIB_PATH ${LIBRARY_NAME} ) - if( ${BUILD_TYPE} STREQUAL "Debug" ) - set( REAL_LIB_PATH ${REAL_LIB_PATH}_d ) - endif() - - if( WIN32 ) - set( REAL_LIB_PATH "${OGRE_BINARIES}/bin/${BUILD_TYPE}/${REAL_LIB_PATH}.dll" ) - else() - set( REAL_LIB_PATH "${OGRE_BINARIES}/lib/${REAL_LIB_PATH}.so" ) - endif() - - if( EXISTS ${REAL_LIB_PATH} ) - # DLL Exists, set the variable for Plugins.cfg - if( ${BUILD_TYPE} STREQUAL "Debug" ) - set( ${CFG_VARIABLE} "PluginOptional=${LIBRARY_NAME}_d" ) - else() - set( ${CFG_VARIABLE} "PluginOptional=${LIBRARY_NAME}" ) - endif() - - # Copy the DLLs to the folders. - copyWithSymLink( ${REAL_LIB_PATH} "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Plugins" ) - endif() -endmacro() - -#---------------------------------------------------------------------------------------- - -# Outputs TRUE into RESULT_VARIABLE if Ogre was build as OgreNextMain.dll instead of OgreMain.dll -macro( isOgreNext RESULT_VARIABLE ) - if( WIN32 ) - if( EXISTS "${OGRE_BINARIES}/bin/Debug/OgreNextMain_d.dll" OR - EXISTS "${OGRE_BINARIES}/bin/Release/OgreNextMain.dll" OR - EXISTS "${OGRE_BINARIES}/bin/RelWithDebInfo/OgreNextMain.dll" OR - EXISTS "${OGRE_BINARIES}/bin/MinSizeRel/OgreNextMain.dll" OR - EXISTS "${OGRE_BINARIES}/lib/Debug/OgreNextMainStatic_d.lib" OR - EXISTS "${OGRE_BINARIES}/lib/Release/OgreNextMainStatic.lib" OR - EXISTS "${OGRE_BINARIES}/lib/RelWithDebInfo/OgreNextMainStatic.lib" OR - EXISTS "${OGRE_BINARIES}/lib/MinSizeRel/OgreNextMainStatic.lib") - set( ${RESULT_VARIABLE} TRUE ) - else() - set( ${RESULT_VARIABLE} FALSE ) - endif() - else() - set( DEBUG_SUFFIX "" ) - if( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" ) - set( DEBUG_SUFFIX "_d" ) - endif() - if( EXISTS "${OGRE_BINARIES}/lib/libOgreNextMain${DEBUG_SUFFIX}.so" OR - EXISTS "${OGRE_BINARIES}/lib/libOgreNextMainStatic${DEBUG_SUFFIX}.a") - set( ${RESULT_VARIABLE} TRUE ) - else() - set( ${RESULT_VARIABLE} FALSE ) - endif() - endif() -endmacro() - -#---------------------------------------------------------------------------------------- - -# Generates Plugins.cfg file out of user-editable Plugins.cfg.in file. Will automatically disable those plugins -# that were not built -# Copies all relevant DLLs: RenderSystem files, OgreOverlay, Hlms PBS & Unlit. -macro( setupPluginFileFromTemplate BUILD_TYPE OGRE_USE_SCENE_FORMAT OGRE_USE_PLANAR_REFLECTIONS ) - if( CMAKE_BUILD_TYPE ) - if( ${CMAKE_BUILD_TYPE} STREQUAL ${BUILD_TYPE} ) - set( OGRE_BUILD_TYPE_MATCHES 1 ) - endif() - endif() - - # On non-Windows machines, we can only do Plugins for the current build. - if( WIN32 OR OGRE_BUILD_TYPE_MATCHES ) - if( NOT APPLE ) - file( MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Plugins" ) - endif() - - findPluginAndSetPath( ${BUILD_TYPE} OGRE_PLUGIN_RS_D3D11 RenderSystem_Direct3D11 ) - findPluginAndSetPath( ${BUILD_TYPE} OGRE_PLUGIN_RS_GL3PLUS RenderSystem_GL3Plus ) - findPluginAndSetPath( ${BUILD_TYPE} OGRE_PLUGIN_RS_PARTICLE Plugin_ParticleFX ) - ### findPluginAndSetPath( ${BUILD_TYPE} OGRE_PLUGIN_RS_VULKAN RenderSystem_Vulkan ) - - if( ${BUILD_TYPE} STREQUAL "Debug" ) - configure_file( ${CMAKE_SOURCE_DIR}/CMake/Templates/Plugins.cfg.in - ${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/plugins_d.cfg ) - else() - configure_file( ${CMAKE_SOURCE_DIR}/CMake/Templates/Plugins.cfg.in - ${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/plugins.cfg ) - endif() - - # Copy - # "${OGRE_BINARIES}/bin/${BUILD_TYPE}/OgreMain.dll" to "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE} - # and the other DLLs as well. - - # Lists of DLLs to copy - set( OGRE_DLLS - ${OGRE_NEXT}Main - ${OGRE_NEXT}Overlay - ${OGRE_NEXT}HlmsPbs - ${OGRE_NEXT}HlmsUnlit - ) - - if( ${OGRE_USE_SCENE_FORMAT} ) - set( OGRE_DLLS ${OGRE_DLLS} ${OGRE_NEXT}SceneFormat ) - endif() - - # Deal with OS and Ogre naming shenanigans: - # * OgreMain.dll vs libOgreMain.so - # * OgreMain_d.dll vs libOgreMain_d.so in Debug mode. - if( WIN32 ) - set( DLL_OS_PREFIX "" ) - if( ${BUILD_TYPE} STREQUAL "Debug" ) - set( DLL_OS_SUFFIX "_d.dll" ) - else() - set( DLL_OS_SUFFIX ".dll" ) - endif() - else() - set( DLL_OS_PREFIX "lib" ) - if( ${BUILD_TYPE} STREQUAL "Debug" ) - set( DLL_OS_SUFFIX "_d.so" ) - else() - set( DLL_OS_SUFFIX ".so" ) - endif() - endif() - - # On Windows DLLs are in build/bin/Debug & build/bin/Release; - # On Linux DLLs are in build/Debug/lib. - if( WIN32 ) - set( OGRE_DLL_PATH "${OGRE_BINARIES}/bin/${BUILD_TYPE}" ) - else() - set( OGRE_DLL_PATH "${OGRE_BINARIES}/lib/" ) - endif() - - # Do not copy anything if we don't find OgreMain.dll (likely Ogre was not build) - list( GET OGRE_DLLS 0 DLL_NAME ) - if( EXISTS "${OGRE_DLL_PATH}/${DLL_OS_PREFIX}${DLL_NAME}${DLL_OS_SUFFIX}" ) - foreach( DLL_NAME ${OGRE_DLLS} ) - copyWithSymLink( "${OGRE_DLL_PATH}/${DLL_OS_PREFIX}${DLL_NAME}${DLL_OS_SUFFIX}" - "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}" ) - endforeach() - endif() - - unset( OGRE_PLUGIN_RS_D3D11 ) - unset( OGRE_PLUGIN_RS_GL3PLUS ) - unset( OGRE_PLUGIN_RS_PARTICLE ) - ### unset( OGRE_PLUGIN_RS_VULKAN ) - endif() - - unset( OGRE_BUILD_TYPE_MATCHES ) -endmacro() - -#---------------------------------------------------------------------------------------- - -# Creates Resources.cfg out of user-editable CMake/Templates/Resources.cfg.in -function( setupResourceFileFromTemplate ) - message( STATUS "Generating ${CMAKE_SOURCE_DIR}/bin/Data/resources2.cfg from template - ${CMAKE_SOURCE_DIR}/CMake/Templates/Resources.cfg.in" ) - if( APPLE ) - set( OGRE_MEDIA_DIR "Contents/Resources/" ) - elseif( ANDROID ) - set( OGRE_MEDIA_DIR "" ) - else() - set( OGRE_MEDIA_DIR "../../" ) - endif() - configure_file( ${CMAKE_SOURCE_DIR}/CMake/Templates/Resources.cfg.in ${CMAKE_SOURCE_DIR}/bin/Data/resources2.cfg ) -endfunction() - -#---------------------------------------------------------------------------------------- - -function( setupOgreSamplesCommon ) - message( STATUS "Copying OgreSamplesCommon cpp and header files to - ${CMAKE_SOURCE_DIR}/include/OgreCommon - ${CMAKE_SOURCE_DIR}/src/OgreCommon/" ) - include_directories( "${CMAKE_SOURCE_DIR}/include/OgreCommon/" ) - file( COPY "${OGRE_SOURCE}/Samples/2.0/Common/include/" DESTINATION "${CMAKE_SOURCE_DIR}/include/OgreCommon/" ) - file( COPY "${OGRE_SOURCE}/Samples/2.0/Common/src/" DESTINATION "${CMAKE_SOURCE_DIR}/src/OgreCommon/" ) -endfunction() - -#---------------------------------------------------------------------------------------- - -# Main call to setup Ogre. -macro( setupOgre OGRE_SOURCE, OGRE_BINARIES, OGRE_LIBRARIES_OUT, - OGRE_USE_SCENE_FORMAT OGRE_USE_PLANAR_REFLECTIONS ) - -set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Ogre/CMake/Packages" ) - -# Guess the paths. -set( OGRE_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/Ogre" CACHE STRING "Path to OGRE-Next source code (see http://www.ogre3d.org/tikiwiki/tiki-index.php?page=CMake+Quick+Start+Guide)" ) -if( WIN32 ) - set( OGRE_BINARIES "${OGRE_SOURCE}/build" CACHE STRING "Path to OGRE-Next's build folder generated by CMake" ) - link_directories( "${OGRE_BINARIES}/lib/$(ConfigurationName)" ) -elseif( APPLE ) - set( OGRE_BINARIES "${OGRE_SOURCE}/build" CACHE STRING "Path to OGRE-Next's build folder generated by CMake" ) - link_directories( "${OGRE_BINARIES}/lib/$(PLATFORM_NAME)/$(CONFIGURATION)" ) -elseif( ANDROID ) - set( OGRE_BINARIES "${OGRE_SOURCE}/build/Android/${CMAKE_BUILD_TYPE}" CACHE STRING "Path to OGRE-Next's build folder generated by CMake" ) - link_directories( "${OGRE_BINARIES}/lib" ) -else() - set( OGRE_BINARIES "${OGRE_SOURCE}/build/${CMAKE_BUILD_TYPE}" CACHE STRING "Path to OGRE-Next's build folder generated by CMake" ) - link_directories( "${OGRE_BINARIES}/lib" ) -endif() - -isOgreNext( OGRE_USE_NEW_NAME ) -message( STATUS ${OGRE_USE_NEW_NAME} ) -if( ${OGRE_USE_NEW_NAME} ) - set( OGRE_NEXT "OgreNext" ) -else() - set( OGRE_NEXT "Ogre" ) -endif() - -# Ogre config -include_directories( "${OGRE_SOURCE}/OgreMain/include" ) - -# Ogre includes -include_directories( "${OGRE_BINARIES}/include" ) -include_directories( "${OGRE_SOURCE}/Components/Hlms/Common/include" ) -include_directories( "${OGRE_SOURCE}/Components/Hlms/Unlit/include" ) -include_directories( "${OGRE_SOURCE}/Components/Hlms/Pbs/include" ) -include_directories( "${OGRE_SOURCE}/Components/Overlay/include" ) -if( ${OGRE_USE_SCENE_FORMAT} ) - include_directories( "${OGRE_SOURCE}/Components/SceneFormat/include" ) -endif() -if( ${OGRE_USE_PLANAR_REFLECTIONS} ) - include_directories( "${OGRE_SOURCE}/Components/PlanarReflections/include" ) -endif() - -# Parse OgreBuildSettings.h to see if it's a static build -set( OGRE_DEPENDENCY_LIBS "" ) -file( READ "${OGRE_BINARIES}/include/OgreBuildSettings.h" OGRE_BUILD_SETTINGS_STR ) -string( FIND "${OGRE_BUILD_SETTINGS_STR}" "#define OGRE_BUILD_COMPONENT_ATMOSPHERE" OGRE_BUILD_COMPONENT_ATMOSPHERE ) -string( FIND "${OGRE_BUILD_SETTINGS_STR}" "#define OGRE_STATIC_LIB" OGRE_STATIC ) -if( NOT OGRE_STATIC EQUAL -1 ) - message( STATUS "Detected static build of Ogre" ) - set( OGRE_STATIC "Static" ) - - # Static builds must link against its dependencies - addStaticDependencies( OGRE_SOURCE, OGRE_BINARIES, OGRE_BUILD_SETTINGS_STR, OGRE_DEPENDENCY_LIBS ) -else() - message( STATUS "Detected DLL build of Ogre" ) - unset( OGRE_STATIC ) -endif() -findOgreBuildSetting( ${OGRE_BUILD_SETTINGS_STR} OGRE_BUILD_RENDERSYSTEM_GL3PLUS ) -findOgreBuildSetting( ${OGRE_BUILD_SETTINGS_STR} OGRE_BUILD_RENDERSYSTEM_D3D11 ) -findOgreBuildSetting( ${OGRE_BUILD_SETTINGS_STR} OGRE_BUILD_RENDERSYSTEM_METAL ) -findOgreBuildSetting( ${OGRE_BUILD_SETTINGS_STR} OGRE_BUILD_RENDERSYSTEM_VULKAN ) -unset( OGRE_BUILD_SETTINGS_STR ) - -if( NOT APPLE ) - # Create debug libraries with _d suffix - set( OGRE_DEBUG_SUFFIX "_d" ) -endif() - -if( NOT IOS ) - set( CMAKE_PREFIX_PATH "${OGRE_SOURCE}/Dependencies ${CMAKE_PREFIX_PATH}" ) - find_package( SDL2 ) - if( NOT SDL2_FOUND ) - message( "Could not find SDL2. https://www.libsdl.org/" ) - else() - message( STATUS "Found SDL2" ) - include_directories( ${SDL2_INCLUDE_DIR} ) - set( OGRE_DEPENDENCY_LIBS ${OGRE_DEPENDENCY_LIBS} ${SDL2_LIBRARY} ) - endif() -endif() - -if( ${OGRE_USE_SCENE_FORMAT} ) - set( OGRE_LIBRARIES ${OGRE_LIBRARIES} - debug ${OGRE_NEXT}SceneFormat${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - optimized ${OGRE_NEXT}SceneFormat${OGRE_STATIC} - ) -endif() - -if( ${OGRE_USE_PLANAR_REFLECTIONS} ) - set( OGRE_LIBRARIES ${OGRE_LIBRARIES} - debug ${OGRE_NEXT}PlanarReflections${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - optimized ${OGRE_NEXT}PlanarReflections${OGRE_STATIC} - ) -endif() - -if( NOT OGRE_BUILD_COMPONENT_ATMOSPHERE EQUAL -1 ) - message( STATUS "Detected Atmosphere Component. Linking against it." ) - set( OGRE_LIBRARIES ${OGRE_LIBRARIES} - debug ${OGRE_NEXT}Atmosphere${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - optimized ${OGRE_NEXT}Atmosphere${OGRE_STATIC} - ) - include_directories( "${OGRE_SOURCE}/Components/Atmosphere/include" ) -endif() - -if( OGRE_STATIC ) - if( OGRE_BUILD_RENDERSYSTEM_D3D11 ) - message( STATUS "Detected D3D11 RenderSystem. Linking against it." ) - set( OGRE_LIBRARIES - ${OGRE_LIBRARIES} - debug RenderSystem_Direct3D11${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - optimized RenderSystem_Direct3D11${OGRE_STATIC} ) - include_directories( "${OGRE_SOURCE}/RenderSystems/Direct3D11/include" ) - endif() - if( OGRE_BUILD_RENDERSYSTEM_GL3PLUS ) - message( STATUS "Detected GL3+ RenderSystem. Linking against it." ) - set( OGRE_LIBRARIES - ${OGRE_LIBRARIES} - debug RenderSystem_GL3Plus${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - optimized RenderSystem_GL3Plus${OGRE_STATIC} ) - include_directories( "${OGRE_SOURCE}/RenderSystems/GL3Plus/include" - "${OGRE_SOURCE}/RenderSystems/GL3Plus/include/GLSL") - - if( UNIX ) - set( OGRE_DEPENDENCY_LIBS ${OGRE_DEPENDENCY_LIBS} Xt Xrandr X11 GL ) - endif() - endif() - if( OGRE_BUILD_RENDERSYSTEM_METAL ) - message( STATUS "Detected Metal RenderSystem. Linking against it." ) - set( OGRE_LIBRARIES - ${OGRE_LIBRARIES} - debug RenderSystem_Metal${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - optimized RenderSystem_Metal${OGRE_STATIC} ) - include_directories( "${OGRE_SOURCE}/RenderSystems/Metal/include" ) - endif() - if( OGRE_BUILD_RENDERSYSTEM_VULKAN ) - message( STATUS "Detected Vulkan RenderSystem. Linking against it." ) - set( OGRE_LIBRARIES - ${OGRE_LIBRARIES} - debug RenderSystem_Vulkan${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - optimized RenderSystem_Vulkan${OGRE_STATIC} ) - include_directories( "${OGRE_SOURCE}/RenderSystems/Vulkan/include" ) - - set( OGRE_DEPENDENCY_LIBS ${OGRE_DEPENDENCY_LIBS} xcb X11-xcb xcb-randr ) -endif() -endif() - -set( OGRE_LIBRARIES - ${OGRE_LIBRARIES} - - debug ${OGRE_NEXT}Overlay${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - debug ${OGRE_NEXT}HlmsUnlit${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - debug ${OGRE_NEXT}HlmsPbs${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - debug ${OGRE_NEXT}Main${OGRE_STATIC}${OGRE_DEBUG_SUFFIX} - - optimized ${OGRE_NEXT}Overlay${OGRE_STATIC} - optimized ${OGRE_NEXT}HlmsUnlit${OGRE_STATIC} - optimized ${OGRE_NEXT}HlmsPbs${OGRE_STATIC} - optimized ${OGRE_NEXT}Main${OGRE_STATIC} - - ${OGRE_DEPENDENCY_LIBS} - ) - -set( OGRE_LIBRARIES_OUT ${OGRE_LIBRARIES} ) - -# Plugins.cfg -if( NOT APPLE ) - set( OGRE_PLUGIN_DIR "Plugins" ) -endif() - -### = changed by CryHam -### message( STATUS "Copying Hlms data files from Ogre repository" ) -### file( COPY "${OGRE_SOURCE}/Samples/Media/Hlms/Common" DESTINATION "${CMAKE_SOURCE_DIR}/bin/Data/Hlms" ) -### file( COPY "${OGRE_SOURCE}/Samples/Media/Hlms/Pbs" DESTINATION "${CMAKE_SOURCE_DIR}/bin/Data/Hlms" ) -### file( COPY "${OGRE_SOURCE}/Samples/Media/Hlms/Unlit" DESTINATION "${CMAKE_SOURCE_DIR}/bin/Data/Hlms" ) - -### message( STATUS "Copying Common data files from Ogre repository" ) -### file( COPY "${OGRE_SOURCE}/Samples/Media/2.0/scripts/materials/Common" DESTINATION "${CMAKE_SOURCE_DIR}/bin/Data/Materials" ) -### file( COPY "${OGRE_SOURCE}/Samples/Media/packs/DebugPack.zip" DESTINATION "${CMAKE_SOURCE_DIR}/bin/Data" ) - -message( STATUS "Copying DLLs and generating Plugins.cfg for Debug" ) -setupPluginFileFromTemplate( "Debug" ${OGRE_USE_SCENE_FORMAT} ${OGRE_USE_PLANAR_REFLECTIONS} ) -message( STATUS "Copying DLLs and generating Plugins.cfg for Release" ) -setupPluginFileFromTemplate( "Release" ${OGRE_USE_SCENE_FORMAT} ${OGRE_USE_PLANAR_REFLECTIONS} ) -message( STATUS "Copying DLLs and generating Plugins.cfg for RelWithDebInfo" ) -setupPluginFileFromTemplate( "RelWithDebInfo" ${OGRE_USE_SCENE_FORMAT} ${OGRE_USE_PLANAR_REFLECTIONS} ) -message( STATUS "Copying DLLs and generating Plugins.cfg for MinSizeRel" ) -setupPluginFileFromTemplate( "MinSizeRel" ${OGRE_USE_SCENE_FORMAT} ${OGRE_USE_PLANAR_REFLECTIONS} ) - -### setupResourceFileFromTemplate() -### setupOgreSamplesCommon() -include_directories( "${CMAKE_SOURCE_DIR}/include/OgreCommon/" ) - -endmacro() - -#---------------------------------------------------------------------------------------- - -macro( addStaticDependencies OGRE_SOURCE, OGRE_BINARIES, OGRE_BUILD_SETTINGS_STR, OGRE_DEPENDENCY_LIBS ) - if( WIN32 ) - # Win32 seems to be the only one actually doing Debug builds for Dependencies w/ _d - set( OGRE_DEP_DEBUG_SUFFIX "_d" ) - endif() - - if( WIN32 ) - set( OGRE_DEPENDENCIES "${OGRE_SOURCE}/Dependencies/lib/$(ConfigurationName)" CACHE STRING - "Path to OGRE-Next's dependencies folder. Only used in Static Builds" ) - elseif( IOS ) - set( OGRE_DEPENDENCIES "${OGRE_SOURCE}/iOSDependencies/lib/$(CONFIGURATION)" CACHE STRING - "Path to OGRE-Next's dependencies folder. Only used in Static Builds" ) - elseif( ANDROID ) - set( OGRE_DEPENDENCIES "${OGRE_SOURCE}/DependenciesAndroid/lib" CACHE STRING - "Path to OGRE-Next's dependencies folder. Only used in Static Builds" ) - else() - set( OGRE_DEPENDENCIES "${OGRE_SOURCE}/Dependencies/lib" CACHE STRING - "Path to OGRE-Next's dependencies folder. Only used in Static Builds" ) - endif() - link_directories( ${OGRE_DEPENDENCIES} ) - - string( FIND "${OGRE_BUILD_SETTINGS_STR}" "#define OGRE_NO_FREEIMAGE 0" OGRE_USES_FREEIMAGE ) - if( NOT OGRE_USES_FREEIMAGE EQUAL -1 ) - message( STATUS "Static lib needs FreeImage. Linking against it." ) - set( TMP_DEPENDENCY_LIBS ${TMP_DEPENDENCY_LIBS} - debug FreeImage${OGRE_DEP_DEBUG_SUFFIX} - optimized FreeImage ) - endif() - - string( FIND "${OGRE_BUILD_SETTINGS_STR}" "#define OGRE_BUILD_COMPONENT_OVERLAY" OGRE_USES_OVERLAYS ) - if( NOT OGRE_USES_OVERLAYS EQUAL -1 ) - message( STATUS "Static lib needs FreeType. Linking against it." ) - set( TMP_DEPENDENCY_LIBS ${TMP_DEPENDENCY_LIBS} - debug freetype${OGRE_DEP_DEBUG_SUFFIX} - optimized freetype ) - endif() - - string( FIND "${OGRE_BUILD_SETTINGS_STR}" "#define OGRE_NO_ZIP_ARCHIVE 0" OGRE_USES_ZIP ) - if( NOT OGRE_USES_ZIP EQUAL -1 ) - message( STATUS "Static lib needs zzip. Linking against it." ) - if( UNIX ) - set( ZZIPNAME zziplib ) - else() - set( ZZIPNAME zzip ) - endif() - set( TMP_DEPENDENCY_LIBS ${TMP_DEPENDENCY_LIBS} - debug ${ZZIPNAME}${OGRE_DEP_DEBUG_SUFFIX} - optimized ${ZZIPNAME} ) - endif() - - message( STATUS "Static lib needs freetype due to Overlays. Linking against it." ) - set( TMP_DEPENDENCY_LIBS ${TMP_DEPENDENCY_LIBS} - debug freetype${OGRE_DEP_DEBUG_SUFFIX} - optimized freetype ) - - if( UNIX ) - set( TMP_DEPENDENCY_LIBS ${TMP_DEPENDENCY_LIBS} dl Xt Xrandr X11 xcb Xaw ) - endif() - - set( OGRE_DEPENDENCY_LIBS ${TMP_DEPENDENCY_LIBS} ) -endmacro() diff --git a/CMake/DependenciesConfig.cmake b/CMake/DependenciesConfig.cmake index 9c61dcdd..3b4718d4 100644 --- a/CMake/DependenciesConfig.cmake +++ b/CMake/DependenciesConfig.cmake @@ -1,115 +1,14 @@ -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 - -#add_external_lib( -# Boost -# #boost/1.80.0 -# REQUIRED -# FIND_PACKAGE_OPTIONS COMPONENTS system thread filesystem wave -#) - -#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.21.1 -# 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( - tinyxml - tinyxml/2.6.2 - REQUIRED - PKG_CONFIG "tinyxml >= 2.6" - FIND_PACKAGE -) - -add_external_lib( - tinyxml2 - tinyxml2/9.0.0 - REQUIRED - PKG_CONFIG "tinyxml2 >= 6" - FIND_PACKAGE -) - - -set(LIBS #Boost::Boost - #Threads::Threads - #OGRE::OGRE - Bullet::Bullet - #SDL2::SDL2 - #MyGUI::MyGUI - VorbisFile::VorbisFile - OGG::OGG - #OpenAL::OpenAL - #ENet::ENet - tinyxml::tinyxml - tinyxml2::tinyxml2 -) +find_package(Threads REQUIRED) -#set(SERVER_LIBS Boost::Boost ENet::ENet) +find_package(Boost REQUIRED COMPONENTS system thread filesystem wave) +find_package(OGRE REQUIRED CONFIG COMPONENTS Bites Overlay Paging RTShaderSystem MeshLodGenerator Terrain) +find_package(BULLET REQUIRED COMPONENTS system thread filesystem wave) +find_package(SDL2 REQUIRED CONFIG) +find_package(MyGUI REQUIRED) +find_package(OGG REQUIRED) +find_package(Vorbis REQUIRED) +find_package(OpenAL REQUIRED CONFIG) +find_package(tinyxml REQUIRED) +find_package(tinyxml2 REQUIRED) diff --git a/CMake/DependenciesFunctions.cmake b/CMake/DependenciesFunctions.cmake deleted file mode 100644 index 561b4a2f..00000000 --- a/CMake/DependenciesFunctions.cmake +++ /dev/null @@ -1,310 +0,0 @@ -# Load Conan -include(conan) -include(FindPkgConfig) - -if (USE_PACKAGE_MANAGER) - conan_add_remote( - NAME rigs-of-rods-deps-V2 - URL https://artifactory.anotherfoxguy.com/artifactory/api/conan/rigs-of-rods - VERIFY_SSL True - ) -endif () - -set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) - -set(CONAN_BUILD_REQUIRES) -set(CONAN_REQUIRES) -set(CONAN_PACKAGE_OPTIONS) -set(CONAN_ONLY_DEBUG_RELEASE) -set(CONAN_CONFIG_OPTIONS) -set(CONAN_RESOLVE_LIST) - -# Add a external dependency -# Example usage: -# add_external_lib( -# OGRE -# ogre/1.12 -# OPTION_NAME ogre -# SYMBOL OGRE -# REQUIRED -# FIND_PACKAGE -# ALWAYS_ALLOW_CONAN_FALLBACK -# PKG_CONFIG "ogre >= 1.11" -# FIND_PACKAGE_OPTIONS COMPONENTS Bites Overlay Paging RTShaderSystem MeshLodGenerator Terrain -# INTERFACE_NAME ogre::ogre -# HAS_ONLY_DEBUG_RELEASE -# CONAN_OPTIONS -# ogre:shared=True -# ) - -function(add_external_lib package conan_package_name) - list(REMOVE_AT ARGV 0 1) - better_parse_args( - . REQUIRED FIND_PACKAGE ALWAYS_ALLOW_CONAN_FALLBACK HAS_ONLY_DEBUG_RELEASE - - OPTION_NAME SYMBOL INTERFACE_NAME CONAN_PKG_NAME - + CONAN_OPTIONS FIND_PACKAGE_OPTIONS PKG_CONFIG - ) - - if (ARG_OPTION_NAME) - set(option_name_base ${ARG_OPTION_NAME}) - else () - string(TOUPPER "${package}" option_name_base) - endif () - - if (ARG_ALWAYS_ALLOW_CONAN_FALLBACK) - set(system_only OFF) - else () - set(system_only ${${_PREFIX}FORCE_SYSTEM_DEPENDENCIES}) - endif () - - if (ARG_FIND_PACKAGE_OPTIONS) - set(ARG_FIND_PACKAGE ON) - endif () - - if (ARG_INTERFACE_NAME) - set(interface_name ${ARG_INTERFACE_NAME}) - else () - set(interface_name "${package}::${package}") - endif () - - if (ARG_SYMBOL) - set(symbol ${ARG_SYMBOL}) - else () - set(symbol ${option_name_base}) - endif () - - # Generate CMake option - set(option_name ${_PREFIX}USE_${option_name_base}) - set(option_desc "CONAN") - - if (NOT USE_PACKAGE_MANAGER) - set(sysopt "SYSTEM") - set(default "SYSTEM") - set(option_desc "SYSTEM (forced)") - set(system_only ON) - elseif (ARG_PKG_CONFIG OR ARG_FIND_PACKAGE) - set(sysopt "SYSTEM") - string(PREPEND option_desc "SYSTEM (if available), ") - set(default "${${_PREFIX}LIB_PREFERENCE}") - else () - set(default "CONAN") - endif () - - if (NOT ARG_REQUIRED) - set(reqopt "OFF") - string(APPEND option_desc ", OFF") - endif () - - cmd_option( - ${option_name} - "Use ${option_name_base} library [${option_desc}]" - "${default}" - STRINGS ${sysopt} "CONAN" ${reqopt} - ) - # Early bail out - if (${option_name} STREQUAL "OFF") - - message(STATUS "${package} disabled") - - set(USE_${symbol} OFF CACHE INTERNAL "" FORCE) - - return() - endif () - - set(USE_${symbol} ON CACHE INTERNAL "" FORCE) - - if (TARGET "${package}") - return() - endif () - - if (${option_name} STREQUAL "SYSTEM") - if (ARG_PKG_CONFIG AND PKG_CONFIG_FOUND) - pkg_check_modules(PKG_${package} ${ARG_PKG_CONFIG}) - - if (PKG_${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(PKG_${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}") - return() - endif () - endif () - - if (ARG_FIND_PACKAGE OR NOT PKG_CONFIG_FOUND) - - if (ARG_REQUIRED AND ${_PREFIX}FORCE_SYSTEM_DEPENDENCIES) - list(APPEND find_package_options REQUIRED) - endif () - - find_package(${package} ${find_package_options}) - - if (${package}_FOUND) - message(STATUS "Using '${package}' system library (Found by find_package)") - return() - endif () - endif () - - if (system_only) - if (ARG_REQUIRED AND ${_PREFIX}FORCE_SYSTEM_DEPENDENCIES) - message(FATAL_ERROR "Failed to find the required system package ${package}") - endif () - - message(STATUS "\tFailed to find the system package ${package}") - - set(USE_${symbol} OFF CACHE INTERNAL "" FORCE) - set(${option_name} "OFF") - set_property(CACHE ${option_name} PROPERTY VALUE "OFF") - - return() - else () - set(${option_name} "CONAN") - set_property(CACHE ${option_name} PROPERTY VALUE "CONAN") - message(STATUS "'${package}' not found on system, falling back to conan") - endif () - endif () - - if (ARG_CONAN_PKG_NAME) - set(conan_package_name_only ${ARG_CONAN_PKG_NAME}) - else () - # We only want the name of the library - string(REPLACE "/" ";" pkg_name_split ${conan_package_name}) - list(GET pkg_name_split 0 conan_package_name_only) - endif () - - list(APPEND CONAN_REQUIRES ${conan_package_name}) - list(APPEND CONAN_PACKAGE_OPTIONS ${ARG_CONAN_OPTIONS}) - list(APPEND CONAN_RESOLVE_LIST "${conan_package_name_only}|${interface_name}") - - if (ARG_HAS_ONLY_DEBUG_RELEASE) - message(STATUS "${package} only has Debug and Release versions") - list(APPEND CONAN_ONLY_DEBUG_RELEASE ${package}) - endif () - - lift_var( - CONAN_REQUIRES - CONAN_PACKAGE_OPTIONS - CONAN_RESOLVE_LIST - CONAN_ONLY_DEBUG_RELEASE - ) - - message(STATUS "Adding Conan dependency ${package}") -endfunction() - -function(_conan_install build_type) - conan_cmake_configure( - REQUIRES ${CONAN_REQUIRES} - GENERATORS cmake_multi - BUILD_REQUIRES ${CONAN_BUILD_REQUIRES} - ${CONAN_CONFIG_OPTIONS} - IMPORTS "bin, *.dll -> ${RUNTIME_OUTPUT_DIRECTORY} @ keep_path=False" - IMPORTS "lib, *.dll -> ${RUNTIME_OUTPUT_DIRECTORY} @ keep_path=False" - IMPORTS "lib, *.dylib -> ${RUNTIME_OUTPUT_DIRECTORY} @ keep_path=False" - IMPORTS "lib, *.so* -> ${RUNTIME_OUTPUT_DIRECTORY} @ keep_path=False" - IMPORTS "bin, *.dll -> redist @ keep_path=False" - IMPORTS "lib, *.dll -> redist @ keep_path=False" - IMPORTS "lib, *.dylib -> $redist @ keep_path=False" - IMPORTS "lib, *.so* -> redist @ keep_path=False" - OPTIONS ${CONAN_PACKAGE_OPTIONS} - ) - - # Hash the conanfile.txt to check if it has changed, so we can skip running conan - set(hash_name "${build_type}_CONAN_HASH") - file(MD5 "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt" conanfile_hash) - - if ("_${conanfile_hash}" STREQUAL "_${${hash_name}}" AND EXISTS "${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo_multi.cmake") - message(STATUS "Conan up to date for ${build_type}, not running Conan") - return() - endif () - - set(${hash_name} ${conanfile_hash} CACHE INTERNAL "MD5 hash of conanfile.txt for ${build_type}" FORCE) - - message(STATUS "Configuring packages for ${build_type}") - - conan_cmake_autodetect(settings BUILD_TYPE ${build_type}) - - if (build_type MATCHES "MinSizeRel|RelWithDebInfo") - message(STATUS "Release only libraries: ${CONAN_ONLY_DEBUG_RELEASE}") - - foreach (package ${CONAN_ONLY_DEBUG_RELEASE}) - list(APPEND settings "${package}:build_type=Release") - endforeach () - endif () - - message(STATUS - "Executing Conan: \ - REQUIRES ${CONAN_REQUIRES} - GENERATORS cmake_multi - BUILD_REQUIRES ${CONAN_BUILD_REQUIRES} - ${CONAN_CONFIG_OPTIONS} - OPTIONS ${CONAN_PACKAGE_OPTIONS} - SETTINGS ${settings} - ") - - conan_cmake_install( - PATH_OR_REFERENCE . - BUILD missing - SETTINGS ${settings} - ) -endfunction() - -macro(resolve_conan_dependencies) - if (USE_PACKAGE_MANAGER) - if (MSVC OR XCODE AND NOT DEFINED CMAKE_BUILD_TYPE) - foreach (TYPE ${CMAKE_CONFIGURATION_TYPES}) - _conan_install(${TYPE}) - endforeach () - else () - _conan_install(${CMAKE_BUILD_TYPE}) - endif () - - list(REMOVE_DUPLICATES CONAN_REQUIRES) - - set(CONAN_CMAKE_SILENT_OUTPUT TRUE) - include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo_multi.cmake) - conan_define_targets() - - foreach (package_raw ${CONAN_RESOLVE_LIST}) - string(REPLACE "|" ";" package_list ${package_raw}) - list(GET package_list 0 package) - list(GET package_list 1 target_name) - - # Alias the CONAN_PKG target to the propper target name - set(_curr_conan_target "CONAN_PKG::${package}") - if (TARGET ${_curr_conan_target}) - set_target_properties(${_curr_conan_target} PROPERTIES IMPORTED_GLOBAL TRUE) - add_library(${target_name} ALIAS ${_curr_conan_target}) - else () - message(WARNING "Conan target ${_curr_conan_target} not found") - endif () - endforeach () - - endif (USE_PACKAGE_MANAGER) - - file(GLOB dependency_helpers "${CMAKE_SOURCE_DIR}/CMake/dependencies-helpers/*.cmake") - foreach (f ${dependency_helpers}) - include(${f}) - endforeach () -endmacro() - -# 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() diff --git a/CMake/OgreConfigTargets.cmake b/CMake/OgreConfigTargets.cmake deleted file mode 100644 index 1916349f..00000000 --- a/CMake/OgreConfigTargets.cmake +++ /dev/null @@ -1,386 +0,0 @@ -#------------------------------------------------------------------- -# This file is part of the CMake build system for OGRE -# (Object-oriented Graphics Rendering Engine) -# For the latest info, see https://www.ogre3d.org/ -# -# The contents of this file are placed in the public domain. Feel -# free to make use of it in any way you like. -#------------------------------------------------------------------- - -# Configure settings and install targets - -# Default build output paths -if (NOT OGRE_ARCHIVE_OUTPUT) - set(OGRE_ARCHIVE_OUTPUT ${OGRE_BINARY_DIR}/lib) -endif () -if (NOT OGRE_LIBRARY_OUTPUT) - set(OGRE_LIBRARY_OUTPUT ${OGRE_BINARY_DIR}/lib) -endif () -if (NOT OGRE_RUNTIME_OUTPUT) - set(OGRE_RUNTIME_OUTPUT ${OGRE_BINARY_DIR}/bin) -endif () - -if (WIN32) - set(OGRE_RELEASE_PATH "/Release") - set(OGRE_RELWDBG_PATH "/RelWithDebInfo") - set(OGRE_MINSIZE_PATH "/MinSizeRel") - set(OGRE_DEBUG_PATH "/Debug") - set(OGRE_LIB_RELEASE_PATH "/Release") - set(OGRE_LIB_RELWDBG_PATH "/RelWithDebInfo") - set(OGRE_LIB_MINSIZE_PATH "/MinSizeRel") - set(OGRE_LIB_DEBUG_PATH "/Debug") - set(OGRE_PLUGIN_PATH "/opt") - set(OGRE_SAMPLE_PATH "/opt/samples") -elseif (UNIX) - set(OGRE_RELEASE_PATH "") - set(OGRE_RELWDBG_PATH "") - set(OGRE_MINSIZE_PATH "") - set(OGRE_DEBUG_PATH "/debug") - if (NOT APPLE) - set(OGRE_DEBUG_PATH "") - endif () - set(OGRE_LIB_RELEASE_PATH "") - set(OGRE_LIB_RELWDBG_PATH "") - set(OGRE_LIB_MINSIZE_PATH "") - set(OGRE_LIB_DEBUG_PATH "") - if (APPLE) - set(OGRE_PLUGIN_PATH "/") - else() - set(OGRE_PLUGIN_PATH "/OGRE") - endif(APPLE) - set(OGRE_SAMPLE_PATH "/OGRE/Samples") -endif () - -# create vcproj.user file for Visual Studio to set debug working directory -function(ogre_create_vcproj_userfile TARGETNAME) - if (MSVC) - configure_file( - ${OGRE_TEMPLATES_DIR}/VisualStudioUserFile.vcproj.user.in - ${CMAKE_CURRENT_BINARY_DIR}/${TARGETNAME}.vcproj.user - @ONLY - ) - endif () -endfunction(ogre_create_vcproj_userfile) - -# install targets according to current build type -function(ogre_install_target TARGETNAME SUFFIX EXPORT) - # Skip all install targets in SDK - if (OGRE_SDK_BUILD) - return() - endif() - - if(EXPORT) - install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports - BUNDLE DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None "" - RUNTIME DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None "" - LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None "" - ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None "" - FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_RELEASE_PATH}/Release" CONFIGURATIONS Release None "" - ) - install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports - BUNDLE DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo - RUNTIME DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo - LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo - ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo - FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_RELWDBG_PATH}/RelWithDebInfo" CONFIGURATIONS RelWithDebInfo - ) - install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports - BUNDLE DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel - RUNTIME DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel - LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel - ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel - FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_MINSIZE_PATH}/MinSizeRel" CONFIGURATIONS MinSizeRel - ) - install(TARGETS ${TARGETNAME} #EXPORT Ogre-exports - BUNDLE DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug - RUNTIME DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug - LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug - ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug - FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_DEBUG_PATH}/Debug" CONFIGURATIONS Debug - ) - #install(EXPORT Ogre-exports DESTINATION ${OGRE_LIB_DIRECTORY}) - else() - install(TARGETS ${TARGETNAME} - BUNDLE DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None "" - RUNTIME DESTINATION "bin${OGRE_RELEASE_PATH}" CONFIGURATIONS Release None "" - LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None "" - ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None "" - FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_RELEASE_PATH}/Release" CONFIGURATIONS Release None "" - ) - install(TARGETS ${TARGETNAME} - BUNDLE DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo - RUNTIME DESTINATION "bin${OGRE_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo - LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo - ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo - FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_RELWDBG_PATH}/RelWithDebInfo" CONFIGURATIONS RelWithDebInfo - ) - install(TARGETS ${TARGETNAME} - BUNDLE DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel - RUNTIME DESTINATION "bin${OGRE_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel - LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel - ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel - FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_MINSIZE_PATH}/MinSizeRel" CONFIGURATIONS MinSizeRel - ) - install(TARGETS ${TARGETNAME} - BUNDLE DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug - RUNTIME DESTINATION "bin${OGRE_DEBUG_PATH}" CONFIGURATIONS Debug - LIBRARY DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug - ARCHIVE DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug - FRAMEWORK DESTINATION "${OGRE_LIB_DIRECTORY}${OGRE_DEBUG_PATH}/Debug" CONFIGURATIONS Debug - ) - endif() - -endfunction(ogre_install_target) - -# setup common target settings -function(ogre_config_common TARGETNAME) - set_target_properties(${TARGETNAME} PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${OGRE_ARCHIVE_OUTPUT} - LIBRARY_OUTPUT_DIRECTORY ${OGRE_LIBRARY_OUTPUT} - RUNTIME_OUTPUT_DIRECTORY ${OGRE_RUNTIME_OUTPUT} - ) - if(OGRE_BUILD_PLATFORM_IPHONE) - set_target_properties(${TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_GCC_THUMB_SUPPORT "NO") - set_target_properties(${TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_GCC_UNROLL_LOOPS "YES") - set_target_properties(${TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer") - set_target_properties(${TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") - endif(OGRE_BUILD_PLATFORM_IPHONE) - - ogre_create_vcproj_userfile(${TARGETNAME}) -endfunction(ogre_config_common) - -# setup library build -function(ogre_config_lib LIBNAME EXPORT) - ogre_config_common(${LIBNAME}) - if (OGRE_STATIC) - # add static prefix, if compiling static version - set_target_properties(${LIBNAME} PROPERTIES OUTPUT_NAME ${LIBNAME}Static) - else (OGRE_STATIC) - if (CMAKE_COMPILER_IS_GNUCXX) - # add GCC visibility flags to shared library build - set_target_properties(${LIBNAME} PROPERTIES COMPILE_FLAGS "${OGRE_GCC_VISIBILITY_FLAGS}") - endif (CMAKE_COMPILER_IS_GNUCXX) - if (MINGW) - # remove lib prefix from DLL outputs - set_target_properties(${LIBNAME} PROPERTIES PREFIX "") - endif () - endif (OGRE_STATIC) - ogre_install_target(${LIBNAME} "" ${EXPORT}) - - if (OGRE_INSTALL_PDB) - # install debug pdb files - if (OGRE_STATIC) - install(FILES ${OGRE_BINARY_DIR}/lib${OGRE_LIB_DEBUG_PATH}/${LIBNAME}Static_d.pdb - DESTINATION ${OGRE_LIB_DIRECTORY}${OGRE_LIB_DEBUG_PATH} - CONFIGURATIONS Debug - ) - install(FILES ${OGRE_BINARY_DIR}/lib${OGRE_LIB_RELWDBG_PATH}/${LIBNAME}Static.pdb - DESTINATION ${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELWDBG_PATH} - CONFIGURATIONS RelWithDebInfo - ) - else () - install(FILES ${OGRE_BINARY_DIR}/bin${OGRE_DEBUG_PATH}/${LIBNAME}_d.pdb - DESTINATION bin${OGRE_DEBUG_PATH} - CONFIGURATIONS Debug - ) - install(FILES ${OGRE_BINARY_DIR}/bin${OGRE_RELWDBG_PATH}/${LIBNAME}.pdb - DESTINATION bin${OGRE_RELWDBG_PATH} - CONFIGURATIONS RelWithDebInfo - ) - endif () - endif () -endfunction(ogre_config_lib) - -function(ogre_config_component LIBNAME) - ogre_config_lib(${LIBNAME} FALSE) -endfunction(ogre_config_component) - - -# setup plugin build -function(ogre_config_plugin PLUGINNAME) - ogre_config_common(${PLUGINNAME}) - if (OGRE_STATIC) - # add static prefix, if compiling static version - set_target_properties(${PLUGINNAME} PROPERTIES OUTPUT_NAME ${PLUGINNAME}Static) - - if(OGRE_BUILD_PLATFORM_IPHONE) - set_target_properties(${PLUGINNAME} PROPERTIES XCODE_ATTRIBUTE_GCC_THUMB_SUPPORT "NO") - set_target_properties(${PLUGINNAME} PROPERTIES XCODE_ATTRIBUTE_GCC_UNROLL_LOOPS "YES") - set_target_properties(${PLUGINNAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") - endif(OGRE_BUILD_PLATFORM_IPHONE) - else (OGRE_STATIC) - if (CMAKE_COMPILER_IS_GNUCXX) - # add GCC visibility flags to shared library build - set_target_properties(${PLUGINNAME} PROPERTIES COMPILE_FLAGS "${OGRE_GCC_VISIBILITY_FLAGS}") - # disable "lib" prefix on Unix - set_target_properties(${PLUGINNAME} PROPERTIES PREFIX "") - endif (CMAKE_COMPILER_IS_GNUCXX) - endif (OGRE_STATIC) - # export only if static - ogre_install_target(${PLUGINNAME} ${OGRE_PLUGIN_PATH} ${OGRE_STATIC}) - - if (OGRE_INSTALL_PDB) - # install debug pdb files - if (OGRE_STATIC) - install(FILES ${OGRE_BINARY_DIR}/lib${OGRE_LIB_DEBUG_PATH}/${PLUGINNAME}Static_d.pdb - DESTINATION ${OGRE_LIB_DIRECTORY}${OGRE_LIB_DEBUG_PATH}/opt - CONFIGURATIONS Debug - ) - install(FILES ${OGRE_BINARY_DIR}/lib${OGRE_LIB_RELWDBG_PATH}/${PLUGINNAME}Static.pdb - DESTINATION ${OGRE_LIB_DIRECTORY}${OGRE_LIB_RELWDBG_PATH}/opt - CONFIGURATIONS RelWithDebInfo - ) - else () - install(FILES ${OGRE_BINARY_DIR}/bin${OGRE_DEBUG_PATH}/${PLUGINNAME}_d.pdb - DESTINATION bin${OGRE_DEBUG_PATH} - CONFIGURATIONS Debug - ) - install(FILES ${OGRE_BINARY_DIR}/bin${OGRE_RELWDBG_PATH}/${PLUGINNAME}.pdb - DESTINATION bin${OGRE_RELWDBG_PATH} - CONFIGURATIONS RelWithDebInfo - ) - endif () - endif () -endfunction(ogre_config_plugin) - -# setup Ogre sample build -function(ogre_config_sample_common SAMPLENAME) - # The PRODUCT_NAME target setting cannot contain underscores. Just remove them - # Known bug in Xcode CFBundleIdentifier processing rdar://6187020 - # Can cause an instant App Store rejection. Also, code signing will fail. - #if (OGRE_BUILD_PLATFORM_IPHONE) -# string (REPLACE "_" "" SAMPLENAME ${SAMPLENAME}) - #endif() - ogre_config_common(${SAMPLENAME}) - - # set install RPATH for Unix systems - if (UNIX AND OGRE_FULL_RPATH) - set_property(TARGET ${SAMPLENAME} APPEND PROPERTY - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${OGRE_LIB_DIRECTORY}) - set_property(TARGET ${SAMPLENAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) - endif () - - if (APPLE) - # On OS X, create .app bundle - set_property(TARGET ${SAMPLENAME} PROPERTY MACOSX_BUNDLE TRUE) - if (NOT OGRE_BUILD_PLATFORM_IPHONE) - # Add the path where the Ogre framework was found - if(${OGRE_FRAMEWORK_PATH}) - set_target_properties(${SAMPLENAME} PROPERTIES - COMPILE_FLAGS "-F${OGRE_FRAMEWORK_PATH}" - LINK_FLAGS "-F${OGRE_FRAMEWORK_PATH}" - ) - endif() - endif(NOT OGRE_BUILD_PLATFORM_IPHONE) - endif (APPLE) - if (CMAKE_COMPILER_IS_GNUCXX) - # add GCC visibility flags to shared library build - set_target_properties(${SAMPLENAME} PROPERTIES COMPILE_FLAGS "${OGRE_GCC_VISIBILITY_FLAGS}") - # disable "lib" prefix on Unix - set_target_properties(${SAMPLENAME} PROPERTIES PREFIX "") - endif (CMAKE_COMPILER_IS_GNUCXX) - if (OGRE_INSTALL_SAMPLES) - ogre_install_target(${SAMPLENAME} ${OGRE_SAMPLE_PATH} FALSE) - endif() - -endfunction(ogre_config_sample_common) - -function(ogre_config_sample_exe SAMPLENAME) - ogre_config_sample_common(${SAMPLENAME}) - if (OGRE_INSTALL_PDB AND OGRE_INSTALL_SAMPLES) - # install debug pdb files - no _d on exe - install(FILES ${OGRE_BINARY_DIR}/bin${OGRE_DEBUG_PATH}/${SAMPLENAME}.pdb - DESTINATION bin${OGRE_DEBUG_PATH} - CONFIGURATIONS Debug - ) - install(FILES ${OGRE_BINARY_DIR}/bin${OGRE_RELWDBG_PATH}/${SAMPLENAME}.pdb - DESTINATION bin${OGRE_RELWDBG_PATH} - CONFIGURATIONS RelWithDebInfo - ) - endif () - - if (APPLE AND NOT OGRE_BUILD_PLATFORM_IPHONE AND OGRE_SDK_BUILD) - # Add the path where the Ogre framework was found - if(NOT ${OGRE_FRAMEWORK_PATH} STREQUAL "") - set_target_properties(${SAMPLENAME} PROPERTIES - COMPILE_FLAGS "-F${OGRE_FRAMEWORK_PATH}" - LINK_FLAGS "-F${OGRE_FRAMEWORK_PATH}" - ) - endif() - endif(APPLE AND NOT OGRE_BUILD_PLATFORM_IPHONE AND OGRE_SDK_BUILD) -endfunction(ogre_config_sample_exe) - -function(ogre_config_sample_lib SAMPLENAME) - ogre_config_sample_common(${SAMPLENAME}) - if (OGRE_INSTALL_PDB AND OGRE_INSTALL_SAMPLES) - # install debug pdb files - with a _d on lib - install(FILES ${OGRE_BINARY_DIR}/bin${OGRE_DEBUG_PATH}/${SAMPLENAME}_d.pdb - DESTINATION bin${OGRE_DEBUG_PATH} - CONFIGURATIONS Debug - ) - install(FILES ${OGRE_BINARY_DIR}/bin${OGRE_RELWDBG_PATH}/${SAMPLENAME}.pdb - DESTINATION bin${OGRE_RELWDBG_PATH} - CONFIGURATIONS RelWithDebInfo - ) - endif () - - if (APPLE AND NOT OGRE_BUILD_PLATFORM_IPHONE AND OGRE_SDK_BUILD) - # Add the path where the Ogre framework was found - if(NOT ${OGRE_FRAMEWORK_PATH} STREQUAL "") - set_target_properties(${SAMPLENAME} PROPERTIES - COMPILE_FLAGS "-F${OGRE_FRAMEWORK_PATH}" - LINK_FLAGS "-F${OGRE_FRAMEWORK_PATH}" - ) - endif() - endif(APPLE AND NOT OGRE_BUILD_PLATFORM_IPHONE AND OGRE_SDK_BUILD) - - # Add sample to the list of link targets - # Global property so that we can build this up across entire sample tree - # since vars are local to containing scope of directories / functions - get_property(OGRE_SAMPLES_LIST GLOBAL PROPERTY "OGRE_SAMPLES_LIST") - set_property (GLOBAL PROPERTY "OGRE_SAMPLES_LIST" ${OGRE_SAMPLES_LIST} ${SAMPLENAME}) - -endfunction(ogre_config_sample_lib) - - -# setup Ogre tool build -function(ogre_config_tool TOOLNAME) - ogre_config_common(${TOOLNAME}) - - #set _d debug postfix - if (NOT APPLE) - set_property(TARGET ${TOOLNAME} APPEND PROPERTY DEBUG_POSTFIX "_d") - endif () - - # set install RPATH for Unix systems - if (UNIX AND OGRE_FULL_RPATH) - set_property(TARGET ${TOOLNAME} APPEND PROPERTY - INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${OGRE_LIB_DIRECTORY}) - set_property(TARGET ${TOOLNAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) - endif () - - if (OGRE_INSTALL_TOOLS) - ogre_install_target(${TOOLNAME} "" FALSE) - if (OGRE_INSTALL_PDB) - # install debug pdb files - install(FILES ${OGRE_BINARY_DIR}/bin${OGRE_DEBUG_PATH}/${TOOLNAME}_d.pdb - DESTINATION bin${OGRE_DEBUG_PATH} - CONFIGURATIONS Debug - ) - install(FILES ${OGRE_BINARY_DIR}/bin${OGRE_RELWDBG_PATH}/${TOOLNAME}.pdb - DESTINATION bin${OGRE_RELWDBG_PATH} - CONFIGURATIONS RelWithDebInfo - ) - endif () - endif () - -endfunction(ogre_config_tool) - -# Get component include dir (different when referencing SDK) -function(ogre_add_component_include_dir COMPONENTNAME) - if (OGRE_SDK_BUILD) - include_directories("${OGRE_INCLUDE_DIR}/${COMPONENTNAME}") - else() - include_directories("${OGRE_SOURCE_DIR}/Components/${COMPONENTNAME}/include") - endif() -endfunction(ogre_add_component_include_dir) diff --git a/CMake/OgreFindFrameworks.cmake b/CMake/OgreFindFrameworks.cmake deleted file mode 100644 index 1eabc342..00000000 --- a/CMake/OgreFindFrameworks.cmake +++ /dev/null @@ -1,35 +0,0 @@ -#------------------------------------------------------------------- -# This file is part of the CMake build system for OGRE -# (Object-oriented Graphics Rendering Engine) -# For the latest info, see https://www.ogre3d.org/ -# -# The contents of this file are placed in the public domain. Feel -# free to make use of it in any way you like. -#------------------------------------------------------------------- - -# - helper module to find OSX frameworks -# Adapted from standard CMake version, but added dependencies -# Standard finder does not look in any variable locations such as -# CMAKE_FRAMEWORK_PATH (not sure why not) - -IF(NOT OGRE_FIND_FRAMEWORKS_INCLUDED) - SET(OGRE_FIND_FRAMEWORKS_INCLUDED 1) - MACRO(OGRE_FIND_FRAMEWORKS fwk) - IF(APPLE) - SET(${fwk}_FRAMEWORKS) - SET(OGRE_FRAMEWORK_PATH - ${OGRE_DEPENDENCIES_DIR} - ~/Library/Frameworks - /Library/Frameworks - /System/Library/Frameworks - /Network/Library/Frameworks - ) - FOREACH(dir ${OGRE_FRAMEWORK_PATH}) - SET(fwkpath ${dir}/${fwk}.framework) - IF(EXISTS ${fwkpath}) - SET(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${fwkpath}) - ENDIF(EXISTS ${fwkpath}) - ENDFOREACH(dir) - ENDIF(APPLE) - ENDMACRO(OGRE_FIND_FRAMEWORKS) -ENDIF(NOT OGRE_FIND_FRAMEWORKS_INCLUDED) diff --git a/CMake/OgreGetVersion.cmake b/CMake/OgreGetVersion.cmake deleted file mode 100644 index 1fa98b6e..00000000 --- a/CMake/OgreGetVersion.cmake +++ /dev/null @@ -1,23 +0,0 @@ -#------------------------------------------------------------------- -# This file is part of the CMake build system for OGRE -# (Object-oriented Graphics Rendering Engine) -# For the latest info, see https://www.ogre3d.org/ -# -# The contents of this file are placed in the public domain. Feel -# free to make use of it in any way you like. -#------------------------------------------------------------------- - -include(PreprocessorUtils) - -macro(ogre_get_version HEADER) - file(READ ${HEADER} TEMP_VAR_CONTENTS) - get_preprocessor_entry(TEMP_VAR_CONTENTS OGRE_VERSION_MAJOR OGRE_VERSION_MAJOR) - get_preprocessor_entry(TEMP_VAR_CONTENTS OGRE_VERSION_MINOR OGRE_VERSION_MINOR) - get_preprocessor_entry(TEMP_VAR_CONTENTS OGRE_VERSION_PATCH OGRE_VERSION_PATCH) - get_preprocessor_entry(TEMP_VAR_CONTENTS OGRE_VERSION_NAME OGRE_VERSION_NAME) - get_preprocessor_entry(TEMP_VAR_CONTENTS OGRE_VERSION_SUFFIX OGRE_VERSION_SUFFIX) - set(OGRE_VERSION "${OGRE_VERSION_MAJOR}.${OGRE_VERSION_MINOR}.${OGRE_VERSION_PATCH}${OGRE_VERSION_SUFFIX}") - set(OGRE_SOVERSION "${OGRE_VERSION_MAJOR}.${OGRE_VERSION_MINOR}.${OGRE_VERSION_PATCH}") - set(OGRE_VERSION_DASH_SEPARATED "${OGRE_VERSION_MAJOR}-${OGRE_VERSION_MINOR}-${OGRE_VERSION_PATCH}${OGRE_VERSION_SUFFIX}") - -endmacro() diff --git a/CMake/conan.cmake b/CMake/conan.cmake deleted file mode 100644 index 774b2af9..00000000 --- a/CMake/conan.cmake +++ /dev/null @@ -1,923 +0,0 @@ -# The MIT License (MIT) - -# Copyright (c) 2018 JFrog - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - - -# This file comes from: https://github.com/conan-io/cmake-conan. Please refer -# to this repository for issues and documentation. - -# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called. -# It will take CMake current settings (os, compiler, compiler version, architecture) -# and translate them to conan settings for installing and retrieving dependencies. - -# It is intended to facilitate developers building projects that have conan dependencies, -# but it is only necessary on the end-user side. It is not necessary to create conan -# packages, in fact it shouldn't be use for that. Check the project documentation. - -# version: 0.18.0-dev - -include(CMakeParseArguments) - -function(_get_msvc_ide_version result) - set(${result} "" PARENT_SCOPE) - if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500) - set(${result} 8 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600) - set(${result} 9 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700) - set(${result} 10 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800) - set(${result} 11 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900) - set(${result} 12 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910) - set(${result} 14 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920) - set(${result} 15 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930) - set(${result} 16 PARENT_SCOPE) - elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1940) - set(${result} 17 PARENT_SCOPE) - else() - message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]") - endif() -endfunction() - -macro(_conan_detect_build_type) - conan_parse_arguments(${ARGV}) - - if(ARGUMENTS_BUILD_TYPE) - set(_CONAN_SETTING_BUILD_TYPE ${ARGUMENTS_BUILD_TYPE}) - elseif(CMAKE_BUILD_TYPE) - set(_CONAN_SETTING_BUILD_TYPE ${CMAKE_BUILD_TYPE}) - else() - message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") - endif() - - string(TOUPPER ${_CONAN_SETTING_BUILD_TYPE} _CONAN_SETTING_BUILD_TYPE_UPPER) - if (_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "DEBUG") - set(_CONAN_SETTING_BUILD_TYPE "Debug") - elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELEASE") - set(_CONAN_SETTING_BUILD_TYPE "Release") - elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELWITHDEBINFO") - set(_CONAN_SETTING_BUILD_TYPE "RelWithDebInfo") - elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "MINSIZEREL") - set(_CONAN_SETTING_BUILD_TYPE "MinSizeRel") - endif() -endmacro() - -macro(_conan_check_system_name) - #handle -s os setting - if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") - #use default conan os setting if CMAKE_SYSTEM_NAME is not defined - set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(CONAN_SYSTEM_NAME Macos) - endif() - if(${CMAKE_SYSTEM_NAME} STREQUAL "QNX") - set(CONAN_SYSTEM_NAME Neutrino) - endif() - set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore WindowsCE watchOS tvOS FreeBSD SunOS AIX Arduino Emscripten Neutrino) - list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index) - if (${_index} GREATER -1) - #check if the cmake system is a conan supported one - set(_CONAN_SETTING_OS ${CONAN_SYSTEM_NAME}) - else() - message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}") - endif() - endif() -endmacro() - -macro(_conan_check_language) - get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES) - if (";${_languages};" MATCHES ";CXX;") - set(LANGUAGE CXX) - set(USING_CXX 1) - elseif (";${_languages};" MATCHES ";C;") - set(LANGUAGE C) - set(USING_CXX 0) - else () - message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.") - endif() -endmacro() - -macro(_conan_detect_compiler) - - conan_parse_arguments(${ARGV}) - - if(ARGUMENTS_ARCH) - set(_CONAN_SETTING_ARCH ${ARGUMENTS_ARCH}) - endif() - - if(USING_CXX) - set(_CONAN_SETTING_COMPILER_CPPSTD ${CMAKE_CXX_STANDARD}) - endif() - - if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU) - # using GCC - # TODO: Handle other params - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(COMPILER_VERSION ${MAJOR}.${MINOR}) - if(${MAJOR} GREATER 4) - set(COMPILER_VERSION ${MAJOR}) - endif() - set(_CONAN_SETTING_COMPILER gcc) - set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Intel) - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(COMPILER_VERSION ${MAJOR}.${MINOR}) - set(_CONAN_SETTING_COMPILER intel) - set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang) - # using AppleClang - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(_CONAN_SETTING_COMPILER apple-clang) - set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang - AND NOT "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" - AND NOT "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC") - - string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) - list(GET VERSION_LIST 0 MAJOR) - list(GET VERSION_LIST 1 MINOR) - set(_CONAN_SETTING_COMPILER clang) - set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) - if(APPLE) - cmake_policy(GET CMP0025 APPLE_CLANG_POLICY) - if(NOT APPLE_CLANG_POLICY STREQUAL NEW) - message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it") - set(_CONAN_SETTING_COMPILER apple-clang) - endif() - endif() - if(${_CONAN_SETTING_COMPILER} STREQUAL clang AND ${MAJOR} GREATER 7) - set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}) - endif() - if (USING_CXX) - conan_cmake_detect_unix_libcxx(_LIBCXX) - set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) - endif () - elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC - OR (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang - AND "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" - AND "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC")) - - set(_VISUAL "Visual Studio") - _get_msvc_ide_version(_VISUAL_VERSION) - if("${_VISUAL_VERSION}" STREQUAL "") - message(FATAL_ERROR "Conan: Visual Studio not recognized") - else() - set(_CONAN_SETTING_COMPILER ${_VISUAL}) - set(_CONAN_SETTING_COMPILER_VERSION ${_VISUAL_VERSION}) - endif() - - if(NOT _CONAN_SETTING_ARCH) - if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64") - set(_CONAN_SETTING_ARCH x86_64) - elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM") - message(STATUS "Conan: Using default ARM architecture from MSVC") - set(_CONAN_SETTING_ARCH armv6) - elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86") - set(_CONAN_SETTING_ARCH x86) - else () - message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]") - endif() - endif() - - conan_cmake_detect_vs_runtime(_vs_runtime ${ARGV}) - message(STATUS "Conan: Detected VS runtime: ${_vs_runtime}") - set(_CONAN_SETTING_COMPILER_RUNTIME ${_vs_runtime}) - - if (CMAKE_GENERATOR_TOOLSET) - set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) - elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja")) - set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) - endif() - else() - message(FATAL_ERROR "Conan: compiler setup not recognized") - endif() - -endmacro() - -function(conan_cmake_settings result) - #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER}) - #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID}) - #message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION}) - #message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS}) - #message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE}) - #message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE}) - #message(STATUS "GENERATOR " ${CMAKE_GENERATOR}) - #message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64}) - - message(STATUS "Conan: Automatic detection of conan settings from cmake") - - conan_parse_arguments(${ARGV}) - - _conan_detect_build_type(${ARGV}) - - _conan_check_system_name() - - _conan_check_language() - - _conan_detect_compiler(${ARGV}) - - # If profile is defined it is used - if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_DEBUG_PROFILE}) - elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_RELEASE_PROFILE}) - elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_RELWITHDEBINFO_PROFILE}) - elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_MINSIZEREL_PROFILE}) - elseif(ARGUMENTS_PROFILE) - set(_APPLIED_PROFILES ${ARGUMENTS_PROFILE}) - endif() - - foreach(ARG ${_APPLIED_PROFILES}) - set(_SETTINGS ${_SETTINGS} -pr=${ARG}) - endforeach() - foreach(ARG ${ARGUMENTS_PROFILE_BUILD}) - conan_check(VERSION 1.24.0 REQUIRED DETECT_QUIET) - set(_SETTINGS ${_SETTINGS} -pr:b=${ARG}) - endforeach() - - if(NOT _SETTINGS OR ARGUMENTS_PROFILE_AUTO STREQUAL "ALL") - set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version - compiler.runtime compiler.libcxx compiler.toolset) - endif() - - # remove any manually specified settings from the autodetected settings - foreach(ARG ${ARGUMENTS_SETTINGS}) - string(REGEX MATCH "[^=]*" MANUAL_SETTING "${ARG}") - message(STATUS "Conan: ${MANUAL_SETTING} was added as an argument. Not using the autodetected one.") - list(REMOVE_ITEM ARGUMENTS_PROFILE_AUTO "${MANUAL_SETTING}") - endforeach() - - # Automatic from CMake - foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) - string(TOUPPER ${ARG} _arg_name) - string(REPLACE "." "_" _arg_name ${_arg_name}) - if(_CONAN_SETTING_${_arg_name}) - set(_SETTINGS ${_SETTINGS} -s ${ARG}=${_CONAN_SETTING_${_arg_name}}) - endif() - endforeach() - - foreach(ARG ${ARGUMENTS_SETTINGS}) - set(_SETTINGS ${_SETTINGS} -s ${ARG}) - endforeach() - - message(STATUS "Conan: Settings= ${_SETTINGS}") - - set(${result} ${_SETTINGS} PARENT_SCOPE) -endfunction() - - -function(conan_cmake_detect_unix_libcxx result) - # Take into account any -stdlib in compile options - get_directory_property(compile_options DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_OPTIONS) - string(GENEX_STRIP "${compile_options}" compile_options) - - # Take into account any _GLIBCXX_USE_CXX11_ABI in compile definitions - get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS) - string(GENEX_STRIP "${defines}" defines) - - foreach(define ${defines}) - if(define MATCHES "_GLIBCXX_USE_CXX11_ABI") - if(define MATCHES "^-D") - set(compile_options ${compile_options} "${define}") - else() - set(compile_options ${compile_options} "-D${define}") - endif() - endif() - endforeach() - - # add additional compiler options ala cmRulePlaceholderExpander::ExpandRuleVariable - set(EXPAND_CXX_COMPILER ${CMAKE_CXX_COMPILER}) - if(CMAKE_CXX_COMPILER_ARG1) - # CMake splits CXX="foo bar baz" into CMAKE_CXX_COMPILER="foo", CMAKE_CXX_COMPILER_ARG1="bar baz" - # without this, ccache, winegcc, or other wrappers might lose all their arguments - separate_arguments(SPLIT_CXX_COMPILER_ARG1 NATIVE_COMMAND ${CMAKE_CXX_COMPILER_ARG1}) - list(APPEND EXPAND_CXX_COMPILER ${SPLIT_CXX_COMPILER_ARG1}) - endif() - - if(CMAKE_CXX_COMPILE_OPTIONS_TARGET AND CMAKE_CXX_COMPILER_TARGET) - # without --target= we may be calling the wrong underlying GCC - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_TARGET}${CMAKE_CXX_COMPILER_TARGET}") - endif() - - if(CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN AND CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") - endif() - - if(CMAKE_CXX_COMPILE_OPTIONS_SYSROOT) - # without --sysroot= we may find the wrong #include - if(CMAKE_SYSROOT_COMPILE) - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_COMPILE}") - elseif(CMAKE_SYSROOT) - list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}") - endif() - endif() - - separate_arguments(SPLIT_CXX_FLAGS NATIVE_COMMAND ${CMAKE_CXX_FLAGS}) - - if(CMAKE_OSX_SYSROOT) - set(xcode_sysroot_option "--sysroot=${CMAKE_OSX_SYSROOT}") - endif() - - execute_process( - COMMAND ${CMAKE_COMMAND} -E echo "#include " - COMMAND ${EXPAND_CXX_COMPILER} ${SPLIT_CXX_FLAGS} -x c++ ${xcode_sysroot_option} ${compile_options} -E -dM - - OUTPUT_VARIABLE string_defines - ) - - if(string_defines MATCHES "#define __GLIBCXX__") - # Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake - if(DEFINED _GLIBCXX_USE_CXX11_ABI) - if(_GLIBCXX_USE_CXX11_ABI) - set(${result} libstdc++11 PARENT_SCOPE) - return() - else() - set(${result} libstdc++ PARENT_SCOPE) - return() - endif() - endif() - - if(string_defines MATCHES "#define _GLIBCXX_USE_CXX11_ABI 1\n") - set(${result} libstdc++11 PARENT_SCOPE) - else() - # Either the compiler is missing the define because it is old, and so - # it can't use the new abi, or the compiler was configured to use the - # old abi by the user or distro (e.g. devtoolset on RHEL/CentOS) - set(${result} libstdc++ PARENT_SCOPE) - endif() - else() - set(${result} libc++ PARENT_SCOPE) - endif() -endfunction() - -function(conan_cmake_detect_vs_runtime result) - - conan_parse_arguments(${ARGV}) - if(ARGUMENTS_BUILD_TYPE) - set(build_type "${ARGUMENTS_BUILD_TYPE}") - elseif(CMAKE_BUILD_TYPE) - set(build_type "${CMAKE_BUILD_TYPE}") - else() - message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") - endif() - - if(build_type) - string(TOUPPER "${build_type}" build_type) - endif() - set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS) - foreach(variable ${variables}) - if(NOT "${${variable}}" STREQUAL "") - string(REPLACE " " ";" flags "${${variable}}") - foreach (flag ${flags}) - if("${flag}" STREQUAL "/MD" OR "${flag}" STREQUAL "/MDd" OR "${flag}" STREQUAL "/MT" OR "${flag}" STREQUAL "/MTd") - string(SUBSTRING "${flag}" 1 -1 runtime) - set(${result} "${runtime}" PARENT_SCOPE) - return() - endif() - endforeach() - endif() - endforeach() - if("${build_type}" STREQUAL "DEBUG") - set(${result} "MDd" PARENT_SCOPE) - else() - set(${result} "MD" PARENT_SCOPE) - endif() -endfunction() - -function(_collect_settings result) - set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version - compiler.runtime compiler.libcxx compiler.toolset - compiler.cppstd) - foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) - string(TOUPPER ${ARG} _arg_name) - string(REPLACE "." "_" _arg_name ${_arg_name}) - if(_CONAN_SETTING_${_arg_name}) - set(detected_setings ${detected_setings} ${ARG}=${_CONAN_SETTING_${_arg_name}}) - endif() - endforeach() - set(${result} ${detected_setings} PARENT_SCOPE) -endfunction() - -function(conan_cmake_autodetect detected_settings) - _conan_detect_build_type(${ARGV}) - _conan_check_system_name() - _conan_check_language() - _conan_detect_compiler(${ARGV}) - _collect_settings(collected_settings) - set(${detected_settings} ${collected_settings} PARENT_SCOPE) -endfunction() - -macro(conan_parse_arguments) - set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD) - set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER OUTPUT_FOLDER CONAN_COMMAND) - set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE - PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO - INSTALL_ARGS CONFIGURATION_TYPES PROFILE_BUILD BUILD_REQUIRES) - cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) -endmacro() - -function(old_conan_cmake_install) - # Calls "conan install" - # Argument BUILD is equivalant to --build={missing, PkgName,...} or - # --build when argument is 'BUILD all' (which builds all packages from source) - # Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source - # cmake does not identify conan as command, even if it is +x and it is in the path - conan_parse_arguments(${ARGV}) - - if(CONAN_CMAKE_MULTI) - set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake_multi) - else() - set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake) - endif() - - set(CONAN_BUILD_POLICY "") - foreach(ARG ${ARGUMENTS_BUILD}) - if(${ARG} STREQUAL "all") - set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build) - break() - else() - set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG}) - endif() - endforeach() - if(ARGUMENTS_CONAN_COMMAND) - set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND}) - else() - conan_check(REQUIRED) - endif() - set(CONAN_OPTIONS "") - if(ARGUMENTS_CONANFILE) - if(IS_ABSOLUTE ${ARGUMENTS_CONANFILE}) - set(CONANFILE ${ARGUMENTS_CONANFILE}) - else() - set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE}) - endif() - else() - set(CONANFILE ".") - endif() - foreach(ARG ${ARGUMENTS_OPTIONS}) - set(CONAN_OPTIONS ${CONAN_OPTIONS} -o=${ARG}) - endforeach() - if(ARGUMENTS_UPDATE) - set(CONAN_INSTALL_UPDATE --update) - endif() - if(ARGUMENTS_NO_IMPORTS) - set(CONAN_INSTALL_NO_IMPORTS --no-imports) - endif() - set(CONAN_INSTALL_FOLDER "") - if(ARGUMENTS_INSTALL_FOLDER) - set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER}) - endif() - set(CONAN_OUTPUT_FOLDER "") - if(ARGUMENTS_OUTPUT_FOLDER) - set(CONAN_OUTPUT_FOLDER -of=${ARGUMENTS_OUTPUT_FOLDER}) - endif() - foreach(ARG ${ARGUMENTS_GENERATORS}) - set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG}) - endforeach() - foreach(ARG ${ARGUMENTS_ENV}) - set(CONAN_ENV_VARS ${CONAN_ENV_VARS} -e=${ARG}) - endforeach() - set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_INSTALL_NO_IMPORTS} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER} ${ARGUMENTS_INSTALL_ARGS}) - - string (REPLACE ";" " " _conan_args "${conan_args}") - message(STATUS "Conan executing: ${CONAN_CMD} ${_conan_args}") - - if(ARGUMENTS_OUTPUT_QUIET) - execute_process(COMMAND ${CONAN_CMD} ${conan_args} - RESULT_VARIABLE return_code - OUTPUT_VARIABLE conan_output - ERROR_VARIABLE conan_output - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - else() - execute_process(COMMAND ${CONAN_CMD} ${conan_args} - RESULT_VARIABLE return_code - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - endif() - - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan install failed='${return_code}'") - endif() - -endfunction() - -function(conan_cmake_install) - if(DEFINED CONAN_COMMAND) - set(CONAN_CMD ${CONAN_COMMAND}) - else() - conan_check(REQUIRED) - endif() - - set(installOptions UPDATE NO_IMPORTS OUTPUT_QUIET ERROR_QUIET) - set(installOneValueArgs PATH_OR_REFERENCE REFERENCE REMOTE LOCKFILE LOCKFILE_OUT LOCKFILE_NODE_ID INSTALL_FOLDER OUTPUT_FOLDER) - set(installMultiValueArgs GENERATOR BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE - PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD) - cmake_parse_arguments(ARGS "${installOptions}" "${installOneValueArgs}" "${installMultiValueArgs}" ${ARGN}) - foreach(arg ${installOptions}) - if(ARGS_${arg}) - set(${arg} ${${arg}} ${ARGS_${arg}}) - endif() - endforeach() - foreach(arg ${installOneValueArgs}) - if(DEFINED ARGS_${arg}) - if("${arg}" STREQUAL "REMOTE") - set(flag "--remote") - elseif("${arg}" STREQUAL "LOCKFILE") - set(flag "--lockfile") - elseif("${arg}" STREQUAL "LOCKFILE_OUT") - set(flag "--lockfile-out") - elseif("${arg}" STREQUAL "LOCKFILE_NODE_ID") - set(flag "--lockfile-node-id") - elseif("${arg}" STREQUAL "INSTALL_FOLDER") - set(flag "--install-folder") - elseif("${arg}" STREQUAL "OUTPUT_FOLDER") - set(flag "--output-folder") - endif() - set(${arg} ${${arg}} ${flag} ${ARGS_${arg}}) - endif() - endforeach() - foreach(arg ${installMultiValueArgs}) - if(DEFINED ARGS_${arg}) - if("${arg}" STREQUAL "GENERATOR") - set(flag "--generator") - elseif("${arg}" STREQUAL "BUILD") - set(flag "--build") - elseif("${arg}" STREQUAL "ENV") - set(flag "--env") - elseif("${arg}" STREQUAL "ENV_HOST") - set(flag "--env:host") - elseif("${arg}" STREQUAL "ENV_BUILD") - set(flag "--env:build") - elseif("${arg}" STREQUAL "OPTIONS") - set(flag "--options") - elseif("${arg}" STREQUAL "OPTIONS_HOST") - set(flag "--options:host") - elseif("${arg}" STREQUAL "OPTIONS_BUILD") - set(flag "--options:build") - elseif("${arg}" STREQUAL "PROFILE") - set(flag "--profile") - elseif("${arg}" STREQUAL "PROFILE_HOST") - set(flag "--profile:host") - elseif("${arg}" STREQUAL "PROFILE_BUILD") - set(flag "--profile:build") - elseif("${arg}" STREQUAL "SETTINGS") - set(flag "--settings") - elseif("${arg}" STREQUAL "SETTINGS_HOST") - set(flag "--settings:host") - elseif("${arg}" STREQUAL "SETTINGS_BUILD") - set(flag "--settings:build") - endif() - list(LENGTH ARGS_${arg} numargs) - foreach(item ${ARGS_${arg}}) - if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD") - set(${arg} "--build") - break() - endif() - set(${arg} ${${arg}} ${flag} ${item}) - endforeach() - endif() - endforeach() - if(DEFINED UPDATE) - set(UPDATE --update) - endif() - if(DEFINED NO_IMPORTS) - set(NO_IMPORTS --no-imports) - endif() - set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} ${OUTPUT_FOLDER} - ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} - ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}) - - string(REPLACE ";" " " _install_args "${install_args}") - message(STATUS "Conan executing: ${CONAN_CMD} ${_install_args}") - - if(ARGS_OUTPUT_QUIET) - set(OUTPUT_OPT OUTPUT_QUIET) - endif() - if(ARGS_ERROR_QUIET) - set(ERROR_OPT ERROR_QUIET) - endif() - - execute_process(COMMAND ${CONAN_CMD} ${install_args} - RESULT_VARIABLE return_code - ${OUTPUT_OPT} - ${ERROR_OPT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - - if(NOT "${return_code}" STREQUAL "0") - if (ARGS_ERROR_QUIET) - message(WARNING "Conan install failed='${return_code}'") - else() - message(FATAL_ERROR "Conan install failed='${return_code}'") - endif() - endif() - -endfunction() - -function(conan_cmake_setup_conanfile) - conan_parse_arguments(${ARGV}) - if(ARGUMENTS_CONANFILE) - get_filename_component(_CONANFILE_NAME ${ARGUMENTS_CONANFILE} NAME) - # configure_file will make sure cmake re-runs when conanfile is updated - configure_file(${ARGUMENTS_CONANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk COPYONLY) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk) - else() - conan_cmake_generate_conanfile(ON ${ARGV}) - endif() -endfunction() - -function(conan_cmake_configure) - conan_cmake_generate_conanfile(OFF ${ARGV}) -endfunction() - -# Generate, writing in disk a conanfile.txt with the requires, options, and imports -# specified as arguments -# This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR) -function(conan_cmake_generate_conanfile DEFAULT_GENERATOR) - - conan_parse_arguments(${ARGV}) - - set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt") - file(WRITE ${_FN} "") - - if(DEFINED ARGUMENTS_REQUIRES) - file(APPEND ${_FN} "[requires]\n") - foreach(REQUIRE ${ARGUMENTS_REQUIRES}) - file(APPEND ${_FN} ${REQUIRE} "\n") - endforeach() - endif() - - if (DEFAULT_GENERATOR OR DEFINED ARGUMENTS_GENERATORS) - file(APPEND ${_FN} "[generators]\n") - if (DEFAULT_GENERATOR) - file(APPEND ${_FN} "cmake\n") - endif() - if (DEFINED ARGUMENTS_GENERATORS) - foreach(GENERATOR ${ARGUMENTS_GENERATORS}) - file(APPEND ${_FN} ${GENERATOR} "\n") - endforeach() - endif() - endif() - - if(DEFINED ARGUMENTS_BUILD_REQUIRES) - file(APPEND ${_FN} "[build_requires]\n") - foreach(BUILD_REQUIRE ${ARGUMENTS_BUILD_REQUIRES}) - file(APPEND ${_FN} ${BUILD_REQUIRE} "\n") - endforeach() - endif() - - if(DEFINED ARGUMENTS_IMPORTS) - file(APPEND ${_FN} "[imports]\n") - foreach(IMPORTS ${ARGUMENTS_IMPORTS}) - file(APPEND ${_FN} ${IMPORTS} "\n") - endforeach() - endif() - - if(DEFINED ARGUMENTS_OPTIONS) - file(APPEND ${_FN} "[options]\n") - foreach(OPTION ${ARGUMENTS_OPTIONS}) - file(APPEND ${_FN} ${OPTION} "\n") - endforeach() - endif() - -endfunction() - - -macro(conan_load_buildinfo) - if(CONAN_CMAKE_MULTI) - set(_CONANBUILDINFO conanbuildinfo_multi.cmake) - else() - set(_CONANBUILDINFO conanbuildinfo.cmake) - endif() - if(ARGUMENTS_INSTALL_FOLDER) - set(_CONANBUILDINFOFOLDER ${ARGUMENTS_INSTALL_FOLDER}) - else() - set(_CONANBUILDINFOFOLDER ${CMAKE_CURRENT_BINARY_DIR}) - endif() - # Checks for the existence of conanbuildinfo.cmake, and loads it - # important that it is macro, so variables defined at parent scope - if(EXISTS "${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}") - message(STATUS "Conan: Loading ${_CONANBUILDINFO}") - include(${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}) - else() - message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}") - endif() -endmacro() - - -macro(conan_cmake_run) - conan_parse_arguments(${ARGV}) - - if(ARGUMENTS_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES) - message(WARNING "CONFIGURATION_TYPES should only be specified for multi-configuration generators") - elseif(ARGUMENTS_CONFIGURATION_TYPES AND ARGUMENTS_BUILD_TYPE) - message(WARNING "CONFIGURATION_TYPES and BUILD_TYPE arguments should not be defined at the same time.") - endif() - - if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED - AND NOT ARGUMENTS_BUILD_TYPE) - set(CONAN_CMAKE_MULTI ON) - if (NOT ARGUMENTS_CONFIGURATION_TYPES) - set(ARGUMENTS_CONFIGURATION_TYPES "Release;Debug") - endif() - message(STATUS "Conan: Using cmake-multi generator") - else() - set(CONAN_CMAKE_MULTI OFF) - endif() - - if(NOT CONAN_EXPORTED) - conan_cmake_setup_conanfile(${ARGV}) - if(CONAN_CMAKE_MULTI) - foreach(CMAKE_BUILD_TYPE ${ARGUMENTS_CONFIGURATION_TYPES}) - set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE}) - conan_cmake_settings(settings ${ARGV}) - old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) - endforeach() - set(CMAKE_BUILD_TYPE) - else() - conan_cmake_settings(settings ${ARGV}) - old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) - endif() - endif() - - if (NOT ARGUMENTS_NO_LOAD) - conan_load_buildinfo() - endif() - - if(ARGUMENTS_BASIC_SETUP) - foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS SKIP_STD) - if(ARGUMENTS_${_option}) - if(${_option} STREQUAL "CMAKE_TARGETS") - list(APPEND _setup_options "TARGETS") - else() - list(APPEND _setup_options ${_option}) - endif() - endif() - endforeach() - conan_basic_setup(${_setup_options}) - endif() -endmacro() - -macro(conan_check) - # Checks conan availability in PATH - # Arguments REQUIRED, DETECT_QUIET and VERSION are optional - # Example usage: - # conan_check(VERSION 1.0.0 REQUIRED) - set(options REQUIRED DETECT_QUIET) - set(oneValueArgs VERSION) - cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN}) - if(NOT CONAN_DETECT_QUIET) - message(STATUS "Conan: checking conan executable") - endif() - - find_program(CONAN_CMD conan) - if(NOT CONAN_CMD AND CONAN_REQUIRED) - message(FATAL_ERROR "Conan executable not found! Please install conan.") - endif() - if(NOT CONAN_DETECT_QUIET) - message(STATUS "Conan: Found program ${CONAN_CMD}") - endif() - execute_process(COMMAND ${CONAN_CMD} --version - RESULT_VARIABLE return_code - OUTPUT_VARIABLE CONAN_VERSION_OUTPUT - ERROR_VARIABLE CONAN_VERSION_OUTPUT) - - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan --version failed='${return_code}'") - endif() - - if(NOT CONAN_DETECT_QUIET) - string(STRIP "${CONAN_VERSION_OUTPUT}" _CONAN_VERSION_OUTPUT) - message(STATUS "Conan: Version found ${_CONAN_VERSION_OUTPUT}") - endif() - - if(DEFINED CONAN_VERSION) - string(REGEX MATCH ".*Conan version ([0-9]+\\.[0-9]+\\.[0-9]+)" FOO - "${CONAN_VERSION_OUTPUT}") - if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION}) - message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \ - required: ${CONAN_VERSION}. Consider updating via 'pip \ - install conan==${CONAN_VERSION}'.") - endif() - endif() -endmacro() - -function(conan_add_remote) - # Adds a remote - # Arguments URL and NAME are required, INDEX, COMMAND and VERIFY_SSL are optional - # Example usage: - # conan_add_remote(NAME bincrafters INDEX 1 - # URL https://api.bintray.com/conan/bincrafters/public-conan - # VERIFY_SSL True) - set(oneValueArgs URL NAME INDEX COMMAND VERIFY_SSL) - cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN}) - - if(DEFINED CONAN_INDEX) - set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}") - endif() - if(DEFINED CONAN_COMMAND) - set(CONAN_CMD ${CONAN_COMMAND}) - else() - conan_check(REQUIRED DETECT_QUIET) - endif() - set(CONAN_VERIFY_SSL_ARG "True") - if(DEFINED CONAN_VERIFY_SSL) - set(CONAN_VERIFY_SSL_ARG ${CONAN_VERIFY_SSL}) - endif() - message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL}) verify ssl (${CONAN_VERIFY_SSL_ARG})") - execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_INDEX_ARG} -f ${CONAN_URL} ${CONAN_VERIFY_SSL_ARG} - RESULT_VARIABLE return_code) - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan remote failed='${return_code}'") - endif() -endfunction() - -macro(conan_config_install) - # install a full configuration from a local or remote zip file - # Argument ITEM is required, arguments TYPE, SOURCE, TARGET and VERIFY_SSL are optional - # Example usage: - # conan_config_install(ITEM https://github.com/conan-io/cmake-conan.git - # TYPE git SOURCE source-folder TARGET target-folder VERIFY_SSL false) - set(oneValueArgs ITEM TYPE SOURCE TARGET VERIFY_SSL) - set(multiValueArgs ARGS) - cmake_parse_arguments(CONAN "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - if(DEFINED CONAN_COMMAND) - set(CONAN_CMD ${CONAN_COMMAND}) - else() - conan_check(REQUIRED) - endif() - - if(DEFINED CONAN_VERIFY_SSL) - set(CONAN_VERIFY_SSL_ARG "--verify-ssl=${CONAN_VERIFY_SSL}") - endif() - - if(DEFINED CONAN_TYPE) - set(CONAN_TYPE_ARG "--type=${CONAN_TYPE}") - endif() - - if(DEFINED CONAN_ARGS) - set(CONAN_ARGS_ARGS "--args=\"${CONAN_ARGS}\"") - endif() - - if(DEFINED CONAN_SOURCE) - set(CONAN_SOURCE_ARGS "--source-folder=${CONAN_SOURCE}") - endif() - - if(DEFINED CONAN_TARGET) - set(CONAN_TARGET_ARGS "--target-folder=${CONAN_TARGET}") - endif() - - set (CONAN_CONFIG_INSTALL_ARGS ${CONAN_VERIFY_SSL_ARG} - ${CONAN_TYPE_ARG} - ${CONAN_ARGS_ARGS} - ${CONAN_SOURCE_ARGS} - ${CONAN_TARGET_ARGS}) - - message(STATUS "Conan: Installing config from ${CONAN_ITEM}") - execute_process(COMMAND ${CONAN_CMD} config install ${CONAN_ITEM} ${CONAN_CONFIG_INSTALL_ARGS} - RESULT_VARIABLE return_code) - if(NOT "${return_code}" STREQUAL "0") - message(FATAL_ERROR "Conan config failed='${return_code}'") - endif() -endmacro() diff --git a/CMake/dependencies-helpers/OpenAL.cmake b/CMake/dependencies-helpers/OpenAL.cmake deleted file mode 100644 index c33f4f76..00000000 --- a/CMake/dependencies-helpers/OpenAL.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# Refind OpenAL to add the OpenAL::OpenAL target - -if (${_PREFIX}USE_OPENAL STREQUAL "SYSTEM") - find_package(OpenAL QUIET) - if (NOT TARGET OpenAL::OpenAL) - add_library(OpenAL::OpenAL INTERFACE IMPORTED) - set_target_properties(OpenAL::OpenAL PROPERTIES - INTERFACE_LINK_LIBRARIES "${OPENAL_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}" - ) - endif () -endif () \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 510ab0c6..a5d7d6f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,7 @@ # see CMake/DependenciesConfig.cmake # Conan can be is used to get SR deps. - -cmake_minimum_required( VERSION 3.16 ) +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}) @@ -17,21 +16,21 @@ set(CMAKE_CONFIGURATION_TYPES "Debug" "Release" CACHE STRING "Configuration type if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.22") cmake_policy(SET CMP0127 OLD) -endif() +endif () include(CMakeDependentOption) include(Macros) include(FeatureSummary) -project( StuntRally3 ) +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_MASTER_SERVER "Build the game list master server." OFF) -option(BUILD_TRANSL_TOOL "Build the tool for translation updating, it creates .pot" OFF) +option(BUILD_GAME "Build the game binary." ON) +option(BUILD_EDITOR "Build the track editor." ON) +option(BUILD_MASTER_SERVER "Build the game list master server." OFF) +option(BUILD_TRANSL_TOOL "Build the tool for translation updating, it creates .pot" ON) # Linux prefers lower-case exe names @@ -40,29 +39,12 @@ if (WIN32 OR APPLE) set(EDITOR_EXE SR-Editor3) set(SERVER_EXE SR-MasterServer) set(TRANSL_EXE SR-Translator) -else() +else () set(GAME_EXE stuntrally3) set(EDITOR_EXE sr-editor3) set(SERVER_EXE sr-masterserver) set(TRANSL_EXE sr-translator) -endif() - -set(_PREFIX "SR_") - -# Test if conan is installed -find_program(CONAN_CMD_TEST conan NO_CACHE) -cmake_dependent_option(USE_PACKAGE_MANAGER "Use conan" ON "NOT CONAN_CMD_TEST STREQUAL CONAN_CMD_TEST-NOTFOUND" 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") +endif () # Avoid source tree pollution @@ -70,206 +52,137 @@ 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(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}") # Set CXX compile flags -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wno-comment") +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() +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") + add_definitions(-DUNICODE -D_UNICODE) +endif () # deps ---- -include( CMake/Bootstrap.cmake ) -include( CMake/Dependencies/OGRE.cmake ) +include(Bootstrap) # Check for dependencies include(DependenciesConfig) -message( STATUS "---------- resolve_conan_dependencies" ) -resolve_conan_dependencies() - - -# 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 -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() - -# 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}) +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 - Media/gui - Media/materials - Media/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 + Media/gui + Media/materials + Media/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 ) +set(GAME_SRC_DIRS ${COMMON_SRC_DIRS}) +list(APPEND GAME_SRC_DIRS ./src/game) #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/oics) # libs # editor -set( EDITOR_SRC_DIRS ${COMMON_SRC_DIRS} ) -list( APPEND EDITOR_SRC_DIRS ./src/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() + 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 ) - - + 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() - - add_executable( ${EXE} WIN32 ${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() - - # c++ - target_compile_options( ${EXE} PRIVATE -Wswitch ) - target_compile_features( ${EXE} PRIVATE cxx_std_17 ) - - - # threads - target_link_libraries( ${EXE} ${CMAKE_THREAD_LIBS_INIT} ) - - - # OpenAL - target_link_libraries( ${EXE} "${OPENAL_LIBRARY}" ) - - - # Ogre ---- - target_link_libraries( ${EXE} ${OGRE_LIBRARIES} ) - - # SDL - target_link_libraries( ${EXE} "-lSDL2" ) - - - # MyGui ---- # todo: windows .. - target_link_libraries( ${EXE} ${DIR_ONE_ABOVE}/mygui-next/build/lib/libMyGUI.Ogre2Platform.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/lib/libMyGUIEngine.so ) - target_link_libraries( ${EXE} libMyGUIEngine ) - - - # rest - #message( STATUS "Libs " ${EXE} " " ${LIBS} ) - target_link_libraries( ${EXE} ${LIBS} ) - -endforeach() - -message( STATUS "---------- SR end" ) +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 () + + add_executable(${EXE} WIN32 ${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 () + + # threads + target_link_libraries( + ${EXE} + Boost::boost + Bullet::Bullet + MyGUI::MyGUI + Ogg::ogg + OGRE::OGRE + OpenAL::OpenAL + SDL2::SDL2 + Threads::Threads + Vorbis::vorbis + tinyxml2::tinyxml2 + tinyxml::tinyxml + ) + +endforeach () + +message(STATUS "---------- SR end") diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 00000000..38c7f439 --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,27 @@ +[requires] +boost/1.80.0 +bullet3/3.24 +ogg/1.3.5 +ogre3d-next/2023.01@anotherfoxguy/testing +mygui-next/2022.10@anotherfoxguy/testing +openal/1.21.1 +sdl/2.26.0 +tinyxml/2.6.2 +tinyxml2/9.0.0 +vorbis/1.3.7 + +[generators] +CMakeDeps +CMakeToolchain + +[imports] +bin, *.exe -> bin @ root_package=ogre3d-next, keep_path=False +bin, *.dll -> bin @ keep_path=False +lib, *.dll -> bin @ keep_path=False +lib, *.dylib -> bin @ keep_path=False +lib, *.so* -> bin @ keep_path=False + +[options] +bullet3:extras=True +bullet3:network_support=True +sdl:sdl2main=False \ No newline at end of file diff --git a/tools/CI/copy_libs.cmake b/tools/CI/copy_libs.cmake new file mode 100644 index 00000000..81f8a717 --- /dev/null +++ b/tools/CI/copy_libs.cmake @@ -0,0 +1,30 @@ +cmake_policy(SET CMP0057 NEW) +set(rgx "[A-Za-z0-9.+_-]+.so[0-9.]*") + +set(out_dir "${CMAKE_SOURCE_DIR}/redist/lib/") +file(MAKE_DIRECTORY ${out_dir}) + +set(excludelist_url "https://cdn.statically.io/gh/AppImage/pkg2appimage/master/excludelist") +execute_process(COMMAND bash -c "curl -s -L ${excludelist_url} | sed 's|#.*||g'" OUTPUT_VARIABLE excludelist) +string(REPLACE "\n" ";" excludelist ${excludelist}) + +function(copy_libs_for_target target) + execute_process(COMMAND ldd ${target} OUTPUT_VARIABLE linked_libs) + string(REGEX MATCHALL "[A-Za-z0-9/]+/x86_64-linux-gnu/${rgx}" reg_match "${linked_libs}") + + foreach (_file IN LISTS reg_match) + string(REGEX MATCH ${rgx} mtc "${_file}") + if(${mtc} IN_LIST excludelist) + message("Exclude: ${_file}") + elseif(EXISTS ${_file}) + file(COPY ${_file} DESTINATION ${out_dir} FOLLOW_SYMLINK_CHAIN) + message("Copy ${_file}") + else() + message("Not found: ${_file}") + endif() + endforeach() +endfunction() + +copy_libs_for_target("${CMAKE_SOURCE_DIR}/bin/RoR") +copy_libs_for_target("${CMAKE_SOURCE_DIR}/bin/Codec_FreeImage.so") +copy_libs_for_target("${CMAKE_SOURCE_DIR}/bin/Plugin_CgProgramManager.so") \ No newline at end of file diff --git a/tools/conan-profiles/vs-19-debug b/tools/conan-profiles/vs-19-debug new file mode 100644 index 00000000..3c74e3c5 --- /dev/null +++ b/tools/conan-profiles/vs-19-debug @@ -0,0 +1,11 @@ +[settings] +os=Windows +os_build=Windows +arch=x86_64 +arch_build=x86_64 +compiler=Visual Studio +compiler.version=16 +build_type=Debug +[options] +[build_requires] +[env] diff --git a/tools/conan-profiles/vs-19-debug-ninja b/tools/conan-profiles/vs-19-debug-ninja new file mode 100644 index 00000000..d0584463 --- /dev/null +++ b/tools/conan-profiles/vs-19-debug-ninja @@ -0,0 +1,10 @@ +[settings] +os=Windows +os_build=Windows +arch=x86_64 +arch_build=x86_64 +compiler=Visual Studio +compiler.version=16 +build_type=Debug +[conf] +tools.cmake.cmaketoolchain:generator=Ninja \ No newline at end of file diff --git a/tools/conan-profiles/vs-19-release b/tools/conan-profiles/vs-19-release new file mode 100644 index 00000000..86b9f596 --- /dev/null +++ b/tools/conan-profiles/vs-19-release @@ -0,0 +1,11 @@ +[settings] +os=Windows +os_build=Windows +arch=x86_64 +arch_build=x86_64 +compiler=Visual Studio +compiler.version=16 +build_type=Release +[options] +[build_requires] +[env] diff --git a/tools/conan-profiles/vs-19-release-ninja b/tools/conan-profiles/vs-19-release-ninja new file mode 100644 index 00000000..b41104e1 --- /dev/null +++ b/tools/conan-profiles/vs-19-release-ninja @@ -0,0 +1,10 @@ +[settings] +os=Windows +os_build=Windows +arch=x86_64 +arch_build=x86_64 +compiler=Visual Studio +compiler.version=16 +build_type=Release +[conf] +tools.cmake.cmaketoolchain:generator=Ninja \ No newline at end of file diff --git a/tools/conan-profiles/vs-19-relwithdebinfo b/tools/conan-profiles/vs-19-relwithdebinfo new file mode 100644 index 00000000..cdb847a6 --- /dev/null +++ b/tools/conan-profiles/vs-19-relwithdebinfo @@ -0,0 +1,11 @@ +[settings] +os=Windows +os_build=Windows +arch=x86_64 +arch_build=x86_64 +compiler=Visual Studio +compiler.version=16 +build_type=RelWithDebInfo +[options] +[build_requires] +[env]