BVB Source Codes

CRYENGINE Show CMakeLists.txt Source code

Return Download CRYENGINE: download CMakeLists.txt Source code - Download CRYENGINE Source code - Type:.txt
  1. cmake_minimum_required(VERSION 3.5)
  2. set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS Debug Profile)
  3.  
  4. if (NOT DEFINED CRYENGINE_DIR)
  5.         set (CRYENGINE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
  6. endif()
  7. list(APPEND CMAKE_MODULE_PATH "${CRYENGINE_DIR}/Tools/CMake/modules")
  8.  
  9. # C/C++ languages required.
  10. enable_language(C)
  11. enable_language(CXX)
  12. # Force C++11 support requirement
  13. set (CMAKE_CXX_STANDARD 11)
  14.  
  15. if (DURANGO OR ORBIS OR ANDROID OR LINUX)
  16.         unset(WIN32)
  17.         unset(WIN64)
  18. endif ()
  19.  
  20. if (WIN32)  # Either Win32 or Win64
  21.         set(WINDOWS TRUE)
  22.         include(${CRYENGINE_DIR}/Tools/CMake/toolchain/windows/WindowsPC-MSVC.cmake)
  23. endif(WIN32)
  24.  
  25. if(NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio")
  26.         set(valid_configs Debug Profile Release)
  27.         list(FIND valid_configs "${CMAKE_BUILD_TYPE}" config_index)
  28.         if(${config_index} EQUAL -1)
  29.                 message(SEND_ERROR "Build type \"${CMAKE_BUILD_TYPE}\" is not supported, set CMAKE_BUILD_TYPE to one of ${valid_configs}")
  30.         endif()
  31. endif()
  32.  
  33. if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
  34.         set(OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}_release)
  35. endif()
  36.  
  37. set(METADATA_PROJECT_NAME "CryEngine" CACHE STRING "Name of the solution project")
  38. project(${METADATA_PROJECT_NAME}_CMake_${BUILD_PLATFORM} CXX C)
  39.  
  40. set(MODULES CACHE INTERNAL "Modules for monolithic builds" FORCE)
  41. set(GAME_MODULES CACHE INTERNAL "Game Modules for monolithic builds" FORCE)
  42.  
  43. if (DURANGO OR ORBIS OR ANDROID OR LINUX)
  44.         # WIN32 Should be unset  again after project( line to work correctly
  45.         unset(WIN32)
  46.         unset(WIN64)
  47. endif ()
  48.  
  49. if (ANDROID AND ${CMAKE_GENERATOR} MATCHES "Visual Studio")
  50.         # Write out a profile for Incredibuild so it won't try to link remotely
  51.         file(WRITE ${CMAKE_BINARY_DIR}/${METADATA_PROJECT_NAME}_CMake_${BUILD_PLATFORM}
  52.                 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>"
  53.                 "<Profile FormatVersion=\"1\">"
  54.                 "  <Tools>"
  55.                 "    <Tool Filename=\"clang\" AllowRemoteIf=\"-c,/c\" AllowIntercept=\"false\" DeriveCaptionFrom=\"lastparam\" AllowRestartOnLocal=\"false\"/>"
  56.                 "       <Tool Filename=\"clang++\" AllowRemoteIf=\"-c,/c\" AllowIntercept=\"false\" DeriveCaptionFrom=\"lastparam\" AllowRestartOnLocal=\"false\"/>"
  57.                 "  </Tools>"
  58.                 "</Profile>"
  59.         )
  60. endif()
  61.  
  62. set(game_folder CACHE INTERNAL "Game folder used for resource files on Windows" FORCE)
  63.  
  64. if(LINUX32 OR LINUX64)
  65.         set(LINUX TRUE)
  66. endif()
  67.  
  68. # Define Options
  69. option(OPTION_ENGINE "Enable CRYENGINE" ON)
  70.  
  71. option(OPTION_PROFILE "Enable Profiling" ON)
  72. option(OPTION_UNITY_BUILD "Enable Unity Build" ON)
  73. if(WIN32 OR WIN64)
  74.         option(OPTION_ENABLE_BROFILER "Enable Brofiler profiler support" ON)
  75. endif()
  76.  
  77. if(WIN64 AND EXISTS "${CRYENGINE_DIR}/Code/Sandbox/EditorQt")
  78.         option(OPTION_SANDBOX "Enable Sandbox" ON)
  79.         if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
  80.                 set(OPTION_SANDBOX OFF)
  81.         endif()
  82.         if(OPTION_SANDBOX)
  83.                 # Sandbox cannot be built in release mode
  84.                 set(CMAKE_CONFIGURATION_TYPES Debug Profile CACHE STRING "Reset the configurations to what we need" FORCE)
  85.         endif()
  86. endif()
  87.  
  88. option(OPTION_RC "Include RC in the build" OFF)
  89. option(OPTION_PCH "Enable Precompiled Headers" ON)
  90.  
  91. #Plugins
  92. option(PLUGIN_FPSPLUGIN "Frames per second sample plugin" OFF)
  93. option(PLUGIN_SCHEMATYC "Enable Schematyc" ON)
  94.  
  95. if(WIN32 OR WIN64)
  96.         option(PLUGIN_USERANALYTICS "Enable User Analytics" ON)
  97.         option(PLUGIN_VR_OCULUS "Oculus support" ON)
  98.         option(PLUGIN_VR_OSVR "OSVR support" ON)
  99.         option(PLUGIN_VR_OPENVR "OpenVR support" ON)
  100.         option(OPTION_CRYMONO "C# support" OFF)
  101. endif()
  102.  
  103. if (WIN32 OR WIN64)
  104.         option(OPTION_ENABLE_CRASHRPT "Enable CrashRpt crash reporting library" ON)
  105. endif()
  106.  
  107. # Print current project settings
  108. MESSAGE(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
  109. MESSAGE(STATUS "CMAKE_GENERATOR = ${CMAKE_GENERATOR}")
  110. MESSAGE(STATUS "CMAKE_CONFIGURATION_TYPES = ${CMAKE_CONFIGURATION_TYPES}")
  111. MESSAGE(STATUS "BUILD_PLATFORM = ${BUILD_PLATFORM}")
  112. MESSAGE(STATUS "OPTION_PROFILE = ${OPTION_PROFILE}")
  113. MESSAGE(STATUS "OPTION_PCH = ${OPTION_PCH}")
  114.  
  115. if (OPTION_PROFILE)
  116.         set_property( DIRECTORY PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Release>:_PROFILE> )
  117. else()
  118.         set_property( DIRECTORY PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Release>:_RELEASE> )
  119. endif()
  120.  
  121. if(OPTION_UNITY_BUILD)
  122.         message(STATUS "UNITY BUILD Enabled")
  123. endif()
  124.  
  125. if(ORBIS OR ANDROID)
  126.         set(OPTION_STATIC_LINKING TRUE)
  127. else()
  128.         option(OPTION_STATIC_LINKING "Link all CryEngine modules as static libs to single exe" OFF)
  129. endif()
  130.  
  131. # SDK Directory
  132. set(SDK_DIR ${CRYENGINE_DIR}/Code/SDKs)
  133. set(CRY_LIBS_DIR ${CRYENGINE_DIR}/Code/Libs)
  134. set(CRY_EXTENSIONS_DIR ${CRYENGINE_DIR}/Code/CryExtensions)
  135.  
  136. set(WINSDK_SDK_DIR "${SDK_DIR}/Microsoft Windows SDK")
  137. set(WINSDK_SDK_LIB_DIR "${WINSDK_SDK_DIR}/V8.0/Lib/Win8/um")
  138. set(WINSDK_SDK_INCLUDE_DIR "${WINSDK_SDK_DIR}/V8.0/Include/um")
  139.  
  140. # Must be included after SDK_DIR definition
  141. include(${CRYENGINE_DIR}/Tools/CMake/CopyFilesToBin.cmake)
  142.  
  143. # custom defines
  144. set(global_defines "CRYENGINE_DEFINE")
  145.  
  146. if(NOT ANDROID AND NOT ORBIS)
  147.         option(OPTION_SCALEFORMHELPER "Use Scaleform Helper" ON)
  148. else()
  149.         set(OPTION_SCALEFORMHELPER TRUE)
  150. endif()
  151.  
  152. if(OPTION_STATIC_LINKING)
  153.         # Enable static libraries
  154.         MESSAGE(STATUS "Use Static Linking (.lib/.a)" )
  155.         set(BUILD_SHARED_LIBS FALSE)
  156. else()
  157.         # Enable dynamic libraries
  158.         MESSAGE(STATUS "Use Dynamic Linking (.dll/.so)" )
  159.         set(BUILD_SHARED_LIBS TRUE)
  160. endif()
  161.  
  162. if (OUTPUT_DIRECTORY)
  163.         set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIRECTORY}")
  164.         set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_DIRECTORY}")
  165.         set(EXECUTABLE_OUTPUT_PATH "${OUTPUT_DIRECTORY}")
  166.  
  167.         # Make sure the output directory exists
  168.         file(MAKE_DIRECTORY ${OUTPUT_DIRECTORY})
  169. endif (OUTPUT_DIRECTORY)
  170.  
  171. # Bootstrap support
  172. if(EXISTS ${CRYENGINE_DIR}/Tools/CMake/Bootstrap.cmake)
  173.         include(${CRYENGINE_DIR}/Tools/CMake/Bootstrap.cmake)
  174.         if(OPTION_AUTO_BOOTSTRAP)
  175.                 set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "bootstrap.dat")
  176.         endif()
  177. endif()
  178.  
  179. include(${CRYENGINE_DIR}/Tools/CMake/ConfigureChecks.cmake)
  180. include(${CRYENGINE_DIR}/Tools/CMake/CommonMacros.cmake)
  181.  
  182. if(WIN32)
  183.         # Common Libriries linked to all targets
  184.         set(COMMON_LIBS Ntdll User32 Advapi32 Ntdll Ws2_32)
  185.  
  186.         if (EXISTS ${SDK_DIR}/GPA)
  187.                 include_directories( ${SDK_DIR}/GPA/include )
  188.                 if (WIN64)
  189.                         link_directories( ${SDK_DIR}/GPA/lib64 )
  190.                 else()
  191.                         link_directories( ${SDK_DIR}/GPA/lib32 )
  192.                 endif()
  193.                 set(COMMON_LIBS ${COMMON_LIBS} jitprofiling libittnotify)
  194.         endif()
  195. else()
  196.         # Common Libriries linked to all targets
  197.         set(COMMON_LIBS )
  198. endif()
  199.  
  200. # add global defines
  201. foreach( current_define ${platform_defines} )
  202.         add_definitions(-D${current_define})
  203. endforeach()
  204.  
  205. if ((WIN32 OR WIN64) AND OPTION_ENABLE_BROFILER)
  206.         add_definitions(-DUSE_BROFILER)
  207.         include_directories( ${SDK_DIR}/Brofiler )
  208.         link_directories( ${SDK_DIR}/Brofiler )
  209.         if (WIN64)
  210.                 set(COMMON_LIBS ${COMMON_LIBS} ProfilerCore64)
  211.         elseif(WIN32)
  212.                 set(COMMON_LIBS ${COMMON_LIBS} ProfilerCore32)
  213.         endif()
  214. endif()
  215.  
  216. set_property(GLOBAL PROPERTY USE_FOLDERS ON)
  217. if (OPTION_GAME_PROJECT STREQUAL "BenchmarkVR")
  218.         add_subdirectory(Code/Game_Skyharbor/BenchmarkFramework)
  219.         add_subdirectory(Code/Game_Skyharbor/GameDll)
  220.         set_solution_folder("Projects" BenchmarkFramework)
  221.         set_solution_folder("Projects" CryGameSkyharbor)
  222. endif()
  223.  
  224. include(${CRYENGINE_DIR}/Tools/CMake/modules/SDL2.cmake)
  225. include(${CRYENGINE_DIR}/Tools/CMake/modules/Boost.cmake)
  226. include(${CRYENGINE_DIR}/Tools/CMake/modules/ncurses.cmake)
  227.  
  228. if (OPTION_SANDBOX AND WIN64)
  229.         # Find Qt before including any plugin subdirectories
  230.         if (MSVC_VERSION EQUAL 1900) # Visual Studio 2015
  231.                 set(QT_DIR ${SDK_DIR}/Qt/5.6/msvc2015_64/Qt)
  232.         elseif (MSVC_VERSION EQUAL 1800) # Visual Studio 2013
  233.                 set(QT_DIR ${SDK_DIR}/Qt/5.6/msvc2013_64)
  234.         elseif (MSVC_VERSION EQUAL 1700) # Visual Studio 2012
  235.                 set(QT_DIR ${SDK_DIR}/Qt/5.6/msvc2012_64)
  236.         endif()
  237.         set(Qt5_DIR ${QT_DIR})
  238.  
  239.         find_package(Qt5 COMPONENTS Core Gui OpenGL Widgets REQUIRED PATHS "${QT_DIR}")
  240.         set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER  "Sandbox/AUTOGEN")
  241.         set_property(GLOBAL PROPERTY AUTOMOC_TARGETS_FOLDER  "Sandbox/AUTOMOC")
  242. endif()
  243.  
  244. # Order currently matters for Engine, Games and Launchers
  245. # 1. CryEngine
  246. include ("${CRYENGINE_DIR}/Tools/CMake/BuildEngine.cmake")
  247.  
  248. # 2. Games
  249. add_subdirectories_glob("Code/Game*")
  250.  
  251. # 3. Launchers
  252. include ("${CRYENGINE_DIR}/Tools/CMake/BuildLaunchers.cmake")
  253.  
  254. # Shaders custom project
  255. add_subdirectory(Engine/Shaders)
  256.  
  257. # CryExtensions
  258. add_subdirectory(Code/CryExtensions)
  259.  
  260. if (PLUGIN_SCHEMATYC)
  261.         add_subdirectory(Code/CryPlugins/CrySensorSystem/Module)
  262. endif()
  263.  
  264. # Example plugin
  265. if (PLUGIN_FPSPLUGIN)
  266.         add_subdirectory(Code/CryPlugins/CryFramesPerSecond/Module)
  267. endif()
  268. if (PLUGIN_USERANALYTICS)
  269.         add_subdirectory(Code/CryPlugins/CryUserAnalytics/Module)
  270. endif()
  271. # VR plugins
  272. if (PLUGIN_VR_OCULUS)
  273.         add_subdirectory(Code/Libs/oculus)
  274.         add_subdirectory(Code/CryPlugins/VR/CryOculusVR/Module)
  275. endif()
  276. if (PLUGIN_VR_OPENVR)  
  277.         add_subdirectory(Code/CryPlugins/VR/CryOpenVR/Module)
  278. endif()
  279. if (PLUGIN_VR_OSVR)    
  280.         add_subdirectory(Code/CryPlugins/VR/CryOSVR/Module)
  281. endif()
  282.  
  283.  
  284. set(MY_TARGET_LIST "CrySystem CryAction CryRenderD3D11 CryFont CryNetwork CryMovie CryInput CryAISystem CryAnimation Cry3DEngine CryScriptSystem CryEntitySystem CryAudioSystem CryAudioImplSDLMixer CryDynamicResponseSystem")
  285. if (PHYSICS_CRYPHYSICS)
  286.         list(APPEND MY_TARGET_LIST "CryPhysics")
  287. endif()
  288. if (PHYSICS_PHYSX)
  289.         list(APPEND MY_TARGET_LIST "CryPhysX")
  290. endif()
  291. add_custom_target(CE DEPENDS MY_TARGET_LIST)
  292.  
  293.  
  294. if (OPTION_CRYMONO)
  295.         add_subdirectory(Code/CryManaged/CryMonoBridge)
  296.         add_subdirectory(Code/CryManaged/CESharp)
  297. endif()
  298.  
  299. # Sandbox Editor
  300. if (OPTION_SANDBOX AND WIN64)
  301.         MESSAGE(STATUS "Include Sandbox Editor")
  302.         include ("${CRYENGINE_DIR}/Tools/CMake/BuildSandbox.cmake")
  303. endif()
  304.  
  305. # UQS: Optional plugin; option PLUGIN_CRYUQS to enable/disable it resides in its own sub directory
  306. add_subdirectory(Code/CryPlugins/CryUQS)
  307.  
  308. if(WIN64 AND EXISTS "${CRYENGINE_DIR}/Code/Tools/ShaderCacheGen/ShaderCacheGen")
  309.         option(OPTION_SHADERCACHEGEN "Build the shader cache generator." OFF)
  310. endif()
  311.  
  312. if (OPTION_SHADERCACHEGEN)
  313.         add_subdirectory(Code/Tools/ShaderCacheGen/ShaderCacheGen)
  314. endif()
  315.  
  316. if (OPTION_RC AND EXISTS "${CRYENGINE_DIR}/Code/Tools/rc")
  317.         include(ExternalProject)
  318.         ExternalProject_Add(RC
  319.                 SOURCE_DIR "${CRYENGINE_DIR}/Code/Tools/rc"
  320.                 INSTALL_COMMAND echo "Skipping install"
  321.         )
  322. endif()
  323.  
  324. set(CMAKE_INSTALL_MESSAGE LAZY)
  325. install(FILES Tools/CMake/modules/CryCommonConfig.cmake DESTINATION share/cmake)
  326. install(FILES Tools/CMake/modules/CryActionConfig.cmake DESTINATION share/cmake)
  327.  
  328. copy_binary_files_to_target()
  329.  
downloadCMakeLists.txt Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top