Skip to content

Commit 49316d5

Browse files
committed
cmake improvements
* reference vclibs64 as a git submodule * fix warning file names with no extension * exclude projects that don't build from vs2022 build solution default * default to NATIVE (instead of ALL) AI to avoid default java dependency * default startup project engine-legacy (tested with vs2022) * find package use correct case for names (fix cmake warning) * more cmake fixes pending in BARb, CircuitAI, tracy (separate git submodule)
1 parent 92a5b9d commit 49316d5

File tree

17 files changed

+47
-27
lines changed

17 files changed

+47
-27
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@
2121
[submodule "rts/lib/tracy"]
2222
path = rts/lib/tracy
2323
url = https://github.com/wolfpld/tracy.git
24+
[submodule "vclibs64"]
25+
path = vclibs64
26+
url = https://github.com/beyond-all-reason/vclibs64

AI/Wrappers/LegacyCpp/CMakeLists.txt

+10-10
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ if (BUILD_${myName}_AIWRAPPER)
4444

4545
# Assemble the Legacy C++ AI sources
4646
set(mySources
47-
"${mySourceDir}/AIAI"
48-
"${mySourceDir}/AIAICallback"
49-
"${mySourceDir}/AIAICheats"
50-
"${mySourceDir}/AIGlobalAICallback"
51-
"${mySourceDir}/DamageArray"
52-
"${mySourceDir}/MoveData"
53-
"${mySourceDir}/UnitDef"
54-
"${rts}/ExternalAI/AISCommands"
55-
"${rts}/Sim/Units/CommandAI/Command"
56-
"${rts}/System/float3"
47+
"${mySourceDir}/AIAI.cpp"
48+
"${mySourceDir}/AIAICallback.cpp"
49+
"${mySourceDir}/AIAICheats.cpp"
50+
"${mySourceDir}/AIGlobalAICallback.cpp"
51+
"${mySourceDir}/DamageArray.cpp"
52+
"${mySourceDir}/MoveData.cpp"
53+
"${mySourceDir}/UnitDef.cpp"
54+
"${rts}/ExternalAI/AISCommands.cpp"
55+
"${rts}/Sim/Units/CommandAI/Command.cpp"
56+
"${rts}/System/float3.cpp"
5757
${ai_common_SRC}
5858
)
5959

CMakeLists.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ option(WITH_MAPCOMPILER "Include map compiler" TRUE)
1818
# dummy so that qtcreator shows all files (even those of windows)
1919
if(CMAKE_VERSION VERSION_GREATER 3.1.2)
2020
add_library(platform_sources EXCLUDE_FROM_ALL "")
21+
set_property(TARGET platform_sources PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
2122
endif()
2223

2324
# includes rts/build/cmake/Util.cmake & rts/build/cmake/PreferStaticLibs.cmake
@@ -184,7 +185,9 @@ endif (UNIX AND NOT MINGW)
184185
# (next two are relative to CMAKE_INSTALL_PREFIX)
185186
set(AI_LIBS_DIR "${DATADIR}" CACHE STRING "Where to install Skirmish AI libraries")
186187
set(AI_DATA_DIR "${AI_LIBS_DIR}" CACHE STRING "Where to install Skirmish AI additional files (eg. configuration)")
187-
set(AI_TYPES "ALL" CACHE STRING "Which AI Interfaces (and Skirmish AIs using them) to build [ALL|NATIVE|JAVA|NONE]")
188+
189+
# NATIVE to avoid Java dependency by default (to avoid cmake config Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 AWT JVM)
190+
set(AI_TYPES "NATIVE" CACHE STRING "Which AI Interfaces (and Skirmish AIs using them) to build [ALL|NATIVE|JAVA|NONE]")
188191

189192
## DataDirs
190193
set(BUILTIN_DATADIRS "")
@@ -657,3 +660,5 @@ if (INSTALL_PORTABLE)
657660
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/springsettings_portable.cfg) # empty settings file for portable install
658661
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/springsettings_portable.cfg DESTINATION . RENAME springsettings.cfg)
659662
endif (INSTALL_PORTABLE)
663+
664+
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT engine-legacy)

rts/build/cmake/FindFontConfig.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Find_Library(FONTCONFIG_LIBRARY NAMES ${FONTCONFIG_NAMES})
2121

2222
# handle the QUIETLY and REQUIRED arguments and set FONTCONFIG_FOUND to TRUE if
2323
# all listed variables are TRUE
24-
Find_Package_Handle_Standard_Args(FONTCONFIG DEFAULT_MSG FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR)
24+
Find_Package_Handle_Standard_Args(FontConfig DEFAULT_MSG FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR)
2525

2626
If (FONTCONFIG_FOUND)
2727
Set(FONTCONFIG_LIBRARIES ${FONTCONFIG_LIBRARY})

rts/build/cmake/FindMiniZip.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Find_Library(MINIZIP_LIBRARY NAMES ${MINIZIP_NAMES})
2121

2222
# handle the QUIETLY and REQUIRED arguments and set MINIZIP_FOUND to TRUE if
2323
# all listed variables are TRUE
24-
Find_Package_Handle_Standard_Args(MiniZip DEFAULT_MSG MINIZIP_LIBRARY MINIZIP_INCLUDE_DIR)
24+
Find_Package_Handle_Standard_Args(minizip DEFAULT_MSG MINIZIP_LIBRARY MINIZIP_INCLUDE_DIR)
2525

2626
If (MINIZIP_FOUND)
2727
Set(MINIZIP_LIBRARIES ${MINIZIP_LIBRARY})

rts/builds/dedicated/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,15 @@ add_executable(engine-dedicated
160160
${sources_engine_System_Log_sinkFile}
161161
${sources_engine_System_Log_sinkOutputDebugString}
162162
${ENGINE_ICON}
163-
main
163+
main.cpp
164164
)
165165
target_link_libraries(engine-dedicated ${engineDedicatedLibraries})
166166
if (MINGW)
167167
target_link_libraries(engine-dedicated ${WS2_32_LIBRARY} ${IMAGEHLP_LIBRARY} ${IPHLPAPI_LIBRARY} ${WINMM_LIBRARY})
168168
endif (MINGW)
169169
if (MSVC)
170170
target_link_libraries(engine-dedicated ${DBGHELP_LIBRARY})
171+
set_property(TARGET engine-dedicated PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
171172
endif (MSVC)
172173
add_dependencies(engine-dedicated generateVersionFiles)
173174

rts/builds/headless/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ include_directories(${ENGINE_SRC_ROOT_DIR}/lib/slimsig/include)
3636
### Build the executable
3737
add_executable(engine-headless ${engineSources} ${ENGINE_ICON})
3838
target_link_libraries(engine-headless no-sound ${engineHeadlessLibraries} no-sound)
39+
set_property(TARGET engine-headless PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
3940

4041
if (MINGW)
4142
# To enable console output/force a console window to open

rts/builds/legacy/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# which makes testing spring in the builddir easier, eg. like this:
55
# cd build-dir
66
# SPRING_DATADIR=$(pwd) ./spring
7+
cmake_minimum_required(VERSION 3.6)
78
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
89
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
910

@@ -82,8 +83,13 @@ include_directories(${engineIncludes})
8283
add_executable(engine-legacy ${EXE_FLAGS} ${engineSources} ${ENGINE_ICON} ${engineHeaders})
8384
target_link_libraries(engine-legacy ${engineLibraries})
8485

86+
if (MSVC)
87+
add_custom_command(TARGET engine-legacy PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${PROJECT_SOURCE_DIR}/vclibs64/dll/" ${PROJECT_BINARY_DIR}/$(Configuration))
88+
endif (MSVC)
8589

8690
### Install the executable
8791
install(TARGETS engine-legacy DESTINATION ${BINDIR})
8892

8993
create_engine_build_and_install_target(legacy)
94+
95+
set_property(TARGET install-spring-legacy PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)

rts/lib/assimp/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3434
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
#----------------------------------------------------------------------
36-
SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
37-
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
36+
CMAKE_MINIMUM_REQUIRED(VERSION 3.26.3)
3837
PROJECT( Assimp )
3938

4039
# All supported options ###############################################

rts/lib/assimp/code/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# 3) Add libassimp using the file lists (eliminates duplication of file names between
4444
# source groups and library command)
4545
#
46-
cmake_minimum_required( VERSION 2.6 )
46+
cmake_minimum_required(VERSION 3.26.3)
4747
SET( HEADER_PATH ../include/assimp )
4848

4949
SET( COMPILER_HEADERS

rts/lib/headlessStubs/CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
SET(headlessStubsSources
2-
"glewstub"
3-
"glstub"
4-
"glustub"
5-
"sdlstub"
2+
"glewstub.c"
3+
"glstub.c"
4+
"glustub.c"
5+
"sdlstub.c"
66
)
77

88
FIND_PACKAGE(SDL2 REQUIRED)

rts/lib/minizip/CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Spring supplied CMake build file
22

33
set(MINIZIP_FIND_QUIETLY TRUE)
4-
FIND_PACKAGE_STATIC(MiniZip)
4+
FIND_PACKAGE_STATIC(minizip)
55

66
if (MINIZIP_FOUND)
77
# Use the system supplied MiniZip library
@@ -13,9 +13,9 @@ else (MINIZIP_FOUND)
1313
# Build our own minizip library
1414

1515
set(miniZipSources
16-
"unzip"
17-
"zip"
18-
"ioapi"
16+
"unzip.c"
17+
"zip.c"
18+
"ioapi.c"
1919
)
2020

2121
add_definitions(-DNOCRYPT -DNOUNCRYPT)

test/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ macro (add_spring_test target sources libraries flags)
6868
target_link_libraries(test_${target} ${libraries} ${test_common_libraries})
6969
set_target_properties(test_${target} PROPERTIES COMPILE_FLAGS "${flags}")
7070
#install(TARGETS test_${target} DESTINATION ${BINDIR})
71+
set_property(TARGET test_${target} PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
7172
endmacro()
7273

7374
################################################################################
@@ -244,6 +245,7 @@ endif()
244245
# positive tests (should compile fine)
245246
add_spring_test(${test_name} "${test_src}" "${test_libs}" "")
246247
add_dependencies(tests test_BitwiseEnum)
248+
set_property(TARGET test_BitwiseEnum PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
247249

248250
# negative tests (must not compile)
249251
spring_test_compile_fail(testBitwiseEnum_fail1 ${test_src} "-DTEST1")

tools/DemoTool/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ set(demoToolSpringSources
3737
${ENGINE_SRC_ROOT_DIR}/System/SafeCStrings.c
3838
)
3939

40-
add_executable(demotool EXCLUDE_FROM_ALL DemoTool ${demoToolSpringSources})
40+
add_executable(demotool EXCLUDE_FROM_ALL DemoTool.cpp ${demoToolSpringSources})
4141
if (MINGW)
4242
# To enable console output/force a console window to open
4343
set_target_properties(demotool PROPERTIES LINK_FLAGS "-Wl,-subsystem,console")
@@ -48,3 +48,4 @@ target_link_libraries(demotool
4848
gflags
4949
)
5050
add_dependencies(demotool generateVersionFiles)
51+
set_property(TARGET demotool PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)

tools/dirchange/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
88
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
99

10-
add_executable(dirchange EXCLUDE_FROM_ALL dirchange)
10+
add_executable(dirchange EXCLUDE_FROM_ALL dirchange.cpp)
1111
set_target_properties(dirchange PROPERTIES OUTPUT_NAME "dch")

tools/unitsync/test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ add_executable(unitsyncTest EXCLUDE_FROM_ALL test.cpp)
1919
target_link_libraries(unitsyncTest unitsync ${CMAKE_DL_LIBS})
2020
add_dependencies(unitsyncTest unitsync)
2121
#INSTALL(TARGETS unitsyncTest DESTINATION ${BINDIR})
22+
set_property(TARGET unitsyncTest PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)

vclibs64

Submodule vclibs64 added at a00f668

0 commit comments

Comments
 (0)