Skip to content

Commit 09770a8

Browse files
committed
[CMake] Split tools into useful and extra. (#498)
GENZH_BUILD_%GAME%_TOOLS now defaults to ON and builds only tools a developer would use/need. GENZH_BUILD_%GAME%_EXTRAS has been added and defaults to OFF. It controls building everything else. All useful tools are now added to the install target.
1 parent 693a006 commit 09770a8

File tree

6 files changed

+115
-47
lines changed

6 files changed

+115
-47
lines changed

Generals/CMakeLists.txt

+29-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ cmake_minimum_required(VERSION 3.25)
33
project(g_generals LANGUAGES C CXX)
44

55
# Do we want to build extra SDK stuff or just the game binary?
6-
option(GENZH_BUILD_GENERALS_TOOLS "Build tools for Generals" OFF)
6+
option(GENZH_BUILD_GENERALS_TOOLS "Build tools for Generals" ON)
77
add_feature_info(GeneralsTools GENZH_BUILD_GENERALS_TOOLS "Build Generals Mod Tools")
8+
option(GENZH_BUILD_GENERALS_EXTRAS "Build extra stuff for Generals" OFF)
9+
add_feature_info(GeneralsExtras GENZH_BUILD_GENERALS_EXTRAS "Build Generals Extras")
810

911
# Set where the build results will end up
1012
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
@@ -35,7 +37,32 @@ if(GENZH_GENERALS_INSTALL_PREFIX AND NOT "${GENZH_GENERALS_INSTALL_PREFIX}" STRE
3537
install(FILES $<TARGET_PDB_FILE:g_generals> DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}" OPTIONAL)
3638

3739
if(TARGET g_worldbuilder)
38-
install(TARGETS g_worldbuilder RUNTIME DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}" OPTIONAL)
40+
install(TARGETS g_worldbuilder RUNTIME DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}")
3941
install(FILES $<TARGET_PDB_FILE:g_worldbuilder> DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}" OPTIONAL)
4042
endif()
43+
44+
if(TARGET g_particleeditor)
45+
install(TARGETS g_particleeditor RUNTIME DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}")
46+
install(FILES $<TARGET_PDB_FILE:g_particleeditor> DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}" OPTIONAL)
47+
endif()
48+
49+
if(TARGET g_debugwindow)
50+
install(TARGETS g_debugwindow RUNTIME DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}")
51+
install(FILES $<TARGET_PDB_FILE:g_debugwindow> DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}" OPTIONAL)
52+
endif()
53+
54+
if(TARGET g_guiedit)
55+
install(TARGETS g_guiedit RUNTIME DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}")
56+
install(FILES $<TARGET_PDB_FILE:g_guiedit> DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}" OPTIONAL)
57+
endif()
58+
59+
if(TARGET g_imagepacker)
60+
install(TARGETS g_imagepacker RUNTIME DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}")
61+
install(FILES $<TARGET_PDB_FILE:g_imagepacker> DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}" OPTIONAL)
62+
endif()
63+
64+
if(TARGET g_mapcachebuilder)
65+
install(TARGETS g_mapcachebuilder RUNTIME DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}")
66+
install(FILES $<TARGET_PDB_FILE:g_mapcachebuilder> DESTINATION "${GENZH_GENERALS_INSTALL_PREFIX}" OPTIONAL)
67+
endif()
4168
endif()

Generals/Code/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ add_subdirectory(GameEngineDevice)
3737
# Contains the main game exe target.
3838
add_subdirectory(Main)
3939

40-
if (GENZH_BUILD_GENERALS_TOOLS)
40+
if (GENZH_BUILD_GENERALS_TOOLS OR GENZH_BUILD_GENERALS_EXTRAS)
4141
add_subdirectory(Tools)
4242
endif()

Generals/Code/Tools/CMakeLists.txt

+27-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
# Build tools
22

3-
add_subdirectory(Autorun)
4-
add_subdirectory(Babylon)
5-
add_subdirectory(buildVersionUpdate)
6-
add_subdirectory(Compress)
7-
add_subdirectory(CRCDiff)
8-
add_subdirectory(DebugWindow)
9-
add_subdirectory(GUIEdit)
10-
add_subdirectory(ImagePacker)
11-
add_subdirectory(Launcher)
12-
add_subdirectory(mangler)
13-
add_subdirectory(MapCacheBuilder)
14-
add_subdirectory(matchbot)
15-
add_subdirectory(ParticleEditor)
16-
add_subdirectory(PATCHGET)
17-
add_subdirectory(textureCompress)
18-
add_subdirectory(timingTest)
19-
add_subdirectory(versionUpdate)
20-
add_subdirectory(wolSetup)
21-
add_subdirectory(WorldBuilder)
22-
add_subdirectory(WW3D)
3+
# Build useful stuff.
4+
if(GENZH_BUILD_GENERALS_TOOLS)
5+
add_subdirectory(DebugWindow)
6+
add_subdirectory(GUIEdit)
7+
add_subdirectory(ImagePacker)
8+
add_subdirectory(MapCacheBuilder)
9+
add_subdirectory(ParticleEditor)
10+
add_subdirectory(WorldBuilder)
11+
endif()
12+
13+
# Build tat.
14+
if(GENZH_BUILD_GENERALS_EXTRAS)
15+
add_subdirectory(Autorun)
16+
add_subdirectory(Babylon)
17+
add_subdirectory(buildVersionUpdate)
18+
add_subdirectory(Compress)
19+
add_subdirectory(CRCDiff)
20+
add_subdirectory(Launcher)
21+
add_subdirectory(mangler)
22+
add_subdirectory(matchbot)
23+
add_subdirectory(PATCHGET)
24+
add_subdirectory(textureCompress)
25+
add_subdirectory(timingTest)
26+
add_subdirectory(versionUpdate)
27+
add_subdirectory(wolSetup)
28+
add_subdirectory(WW3D)
29+
endif()

GeneralsMD/CMakeLists.txt

+29-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ cmake_minimum_required(VERSION 3.25)
33
project(z_generals LANGUAGES C CXX)
44

55
# Do we want to build extra SDK stuff or just the game binary?
6-
option(GENZH_BUILD_ZEROHOUR_TOOLS "Build tools for Zero Hour" OFF)
6+
option(GENZH_BUILD_ZEROHOUR_TOOLS "Build tools for Zero Hour" ON)
77
add_feature_info(ZeroHourTools GENZH_BUILD_ZEROHOUR_TOOLS "Build Zero Hour Mod Tools")
8+
option(GENZH_BUILD_ZEROHOUR_EXTRAS "Build extra stuff for Zero Hour" OFF)
9+
add_feature_info(ZeroHourExtras GENZH_BUILD_ZEROHOUR_EXTRAS "Build Zero Hour Extras")
810

911
# Set where the build results will end up
1012
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
@@ -34,7 +36,32 @@ if(GENZH_ZEROHOUR_INSTALL_PREFIX AND NOT "${GENZH_ZEROHOUR_INSTALL_PREFIX}" STRE
3436
install(FILES $<TARGET_PDB_FILE:z_generals> DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}" OPTIONAL)
3537

3638
if(TARGET z_worldbuilder)
37-
install(TARGETS z_worldbuilder RUNTIME DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}" OPTIONAL)
39+
install(TARGETS z_worldbuilder RUNTIME DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}")
3840
install(FILES $<TARGET_PDB_FILE:z_worldbuilder> DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}" OPTIONAL)
3941
endif()
42+
43+
if(TARGET z_particleeditor)
44+
install(TARGETS z_particleeditor RUNTIME DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}")
45+
install(FILES $<TARGET_PDB_FILE:z_particleeditor> DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}" OPTIONAL)
46+
endif()
47+
48+
if(TARGET z_debugwindow)
49+
install(TARGETS z_debugwindow RUNTIME DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}")
50+
install(FILES $<TARGET_PDB_FILE:z_debugwindow> DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}" OPTIONAL)
51+
endif()
52+
53+
if(TARGET z_guiedit)
54+
install(TARGETS z_guiedit RUNTIME DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}")
55+
install(FILES $<TARGET_PDB_FILE:z_guiedit> DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}" OPTIONAL)
56+
endif()
57+
58+
if(TARGET z_imagepacker)
59+
install(TARGETS z_imagepacker RUNTIME DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}")
60+
install(FILES $<TARGET_PDB_FILE:z_imagepacker> DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}" OPTIONAL)
61+
endif()
62+
63+
if(TARGET z_mapcachebuilder)
64+
install(TARGETS z_mapcachebuilder RUNTIME DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}")
65+
install(FILES $<TARGET_PDB_FILE:z_mapcachebuilder> DESTINATION "${GENZH_ZEROHOUR_INSTALL_PREFIX}" OPTIONAL)
66+
endif()
4067
endif()

GeneralsMD/Code/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ add_subdirectory(GameEngineDevice)
3737
# Contains the main game exe target.
3838
add_subdirectory(Main)
3939

40-
if (GENZH_BUILD_ZEROHOUR_TOOLS)
40+
if (GENZH_BUILD_ZEROHOUR_TOOLS OR GENZH_BUILD_ZEROHOUR_EXTRAS)
4141
add_subdirectory(Tools)
4242
endif()

GeneralsMD/Code/Tools/CMakeLists.txt

+28-21
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
11
# Build tools
22

3-
add_subdirectory(assetcull)
4-
add_subdirectory(Autorun)
5-
add_subdirectory(Babylon)
6-
add_subdirectory(buildVersionUpdate)
7-
add_subdirectory(Compress)
8-
add_subdirectory(CRCDiff)
9-
add_subdirectory(DebugWindow)
10-
add_subdirectory(GUIEdit)
11-
add_subdirectory(ImagePacker)
12-
add_subdirectory(Launcher)
13-
add_subdirectory(mangler)
14-
add_subdirectory(MapCacheBuilder)
15-
add_subdirectory(matchbot)
16-
add_subdirectory(ParticleEditor)
17-
add_subdirectory(PATCHGET)
18-
add_subdirectory(textureCompress)
19-
add_subdirectory(timingTest)
20-
add_subdirectory(versionUpdate)
21-
add_subdirectory(wolSetup)
22-
add_subdirectory(WorldBuilder)
23-
add_subdirectory(WW3D)
3+
# Build useful stuff.
4+
if(GENZH_BUILD_ZEROHOUR_TOOLS)
5+
add_subdirectory(DebugWindow)
6+
add_subdirectory(GUIEdit)
7+
add_subdirectory(ImagePacker)
8+
add_subdirectory(MapCacheBuilder)
9+
add_subdirectory(ParticleEditor)
10+
add_subdirectory(WorldBuilder)
11+
endif()
12+
13+
# Build tat.
14+
if(GENZH_BUILD_ZEROHOUR_EXTRAS)
15+
add_subdirectory(assetcull)
16+
add_subdirectory(Autorun)
17+
add_subdirectory(Babylon)
18+
add_subdirectory(buildVersionUpdate)
19+
add_subdirectory(Compress)
20+
add_subdirectory(CRCDiff)
21+
add_subdirectory(Launcher)
22+
add_subdirectory(mangler)
23+
add_subdirectory(matchbot)
24+
add_subdirectory(PATCHGET)
25+
add_subdirectory(textureCompress)
26+
add_subdirectory(timingTest)
27+
add_subdirectory(versionUpdate)
28+
add_subdirectory(wolSetup)
29+
add_subdirectory(WW3D)
30+
endif()

0 commit comments

Comments
 (0)