|
| 1 | +cmake_minimum_required(VERSION 3.25) |
| 2 | + |
| 3 | +# Use packagename_ROOT for FindPackage. |
| 4 | +if(POLICY CMP0074) |
| 5 | + cmake_policy(SET CMP0074 NEW) |
| 6 | +endif() |
| 7 | + |
| 8 | +# Disable default MSVC setting CRT type so we can set it ourselves. |
| 9 | +if(POLICY CMP0091) |
| 10 | + cmake_policy(SET CMP0091 NEW) |
| 11 | +endif() |
| 12 | + |
| 13 | +# Disable default MSVC warning level so we can set it ourselves. |
| 14 | +if(POLICY CMP0092) |
| 15 | + cmake_policy(SET CMP0092 NEW) |
| 16 | +endif() |
| 17 | + |
| 18 | +# Allow specifying MSVC debug configurations. |
| 19 | +#if(POLICY CMP0141) |
| 20 | +# cmake_policy(SET CMP0141 NEW) |
| 21 | +#endif() |
| 22 | + |
| 23 | +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") |
| 24 | + |
| 25 | +include(FeatureSummary) |
| 26 | +include(CMakeDependentOption) |
| 27 | + |
| 28 | +# We don't support in tree builds, so help people make the right choice. |
| 29 | +if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR) |
| 30 | + message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt") |
| 31 | +endif() |
| 32 | + |
| 33 | +# Top level project, doesn't really affect anything. |
| 34 | +project(genzh LANGUAGES C CXX) |
| 35 | + |
| 36 | +include(FetchContent) |
| 37 | + |
| 38 | +# Find/Add build dependencies and stubs shared by all projects |
| 39 | +if((WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") AND ${CMAKE_SIZEOF_VOID_P} EQUAL 4) |
| 40 | + include(cmake/miles.cmake) |
| 41 | + include(cmake/bink.cmake) |
| 42 | + include(cmake/stlport.cmake) |
| 43 | + include(cmake/dx8.cmake) |
| 44 | + include(cmake/dbghelp.cmake) |
| 45 | +endif() |
| 46 | + |
| 47 | +include(cmake/gamespy.cmake) |
| 48 | +include(cmake/lzhl.cmake) |
| 49 | +include(cmake/zlib.cmake) |
| 50 | +add_subdirectory(Dependencies/Benchmark) |
| 51 | +add_subdirectory(Dependencies/SafeDisc) |
| 52 | +add_subdirectory(Dependencies/MaxSDK) |
| 53 | + |
| 54 | +# EA Compression library, shared between games (diff is comments only) |
| 55 | +#add_subdirectory(GeneralsMD/Code/Libraries/Source/Compression) |
| 56 | + |
| 57 | +# BrowserDispatch COM object interface (No difference) |
| 58 | +#add_subdirectory(GeneralsMD/Code/Libraries/Source/EABrowserDispatch) |
| 59 | + |
| 60 | +# Do we want to build extra SDK stuff or just the game binary? |
| 61 | +option(GENZH_BUILD_ZEROHOUR "Build Zero Hour code." ON) |
| 62 | +option(GENZH_BUILD_GENERALS "Build Generals code." ON) |
| 63 | + |
| 64 | +if(NOT GENZH_BUILD_ZEROHOUR AND NOT GENZH_BUILD_GENERALS) |
| 65 | + set(GENZH_BUILD_ZEROHOUR TRUE) |
| 66 | + message("You must select one project to build, building Zero Hour by default.") |
| 67 | +endif() |
| 68 | + |
| 69 | +add_feature_info(ZeroHourStuff GENZH_BUILD_ZEROHOUR "Build Zero Hour code") |
| 70 | +add_feature_info(GeneralsStuff GENZH_BUILD_GENERALS "Build Generals code") |
| 71 | + |
| 72 | +# Add main build targets |
| 73 | +if(GENZH_BUILD_ZEROHOUR) |
| 74 | + add_subdirectory(GeneralsMD) |
| 75 | +endif() |
| 76 | + |
| 77 | +if(GENZH_BUILD_GENERALS) |
| 78 | + add_subdirectory(Generals) |
| 79 | +endif() |
| 80 | + |
| 81 | +feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:") |
| 82 | +feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:") |
0 commit comments