44cmake_minimum_required (VERSION 3.18 FATAL_ERROR )
55cmake_policy (SET CMP0048 NEW )
66cmake_policy (SET CMP0074 NEW )
7+ set (CMAKE_INSTALL_MESSAGE "LAZY" )
78
89# set up versioning.
9- set (DF_VERSION "51.04 " )
10- set (DFHACK_RELEASE "r1 " )
10+ set (DF_VERSION "53.15 " )
11+ set (DFHACK_RELEASE "r2 " )
1112set (DFHACK_PRERELEASE FALSE )
1213
1314set (DFHACK_VERSION "${DF_VERSION} -${DFHACK_RELEASE} " )
@@ -46,8 +47,8 @@ option(REMOVE_SYMBOLS_FROM_DF_STUBS "Remove debug symbols from DF stubs. (Reduce
4647macro (CHECK_GCC compiler_path )
4748 execute_process (COMMAND ${compiler_path} -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT )
4849 string (STRIP "${GCC_VERSION_OUT} " GCC_VERSION_OUT)
49- if (${GCC_VERSION_OUT} VERSION_LESS "10 " )
50- message (SEND_ERROR "${compiler_path} version ${GCC_VERSION_OUT} cannot be used - use GCC 10 or later" )
50+ if (${GCC_VERSION_OUT} VERSION_LESS "11 " )
51+ message (SEND_ERROR "${compiler_path} version ${GCC_VERSION_OUT} cannot be used - use GCC 11 or later" )
5152 endif ()
5253endmacro ()
5354
@@ -66,7 +67,7 @@ endif()
6667
6768if (WIN32 )
6869 set (MSVC_MIN_VER 1930)
69- set (MSVC_MAX_VER 1942 )
70+ set (MSVC_MAX_VER 1944 )
7071 if (NOT MSVC )
7172 message (SEND_ERROR "No MSVC found! MSVC 2022 version ${MSVC_MIN_VER} to ${MSVC_MAX_VER} is required." )
7273 elseif ((MSVC_VERSION LESS MSVC_MIN_VER) OR (MSVC_VERSION GREATER MSVC_MAX_VER))
@@ -122,6 +123,9 @@ if(MSVC)
122123 # Enable C5038 - This is equivalent to gcc's -Werror=reorder, which is enabled by default by gcc -Wall
123124 add_compile_options ("/w15038" )
124125
126+ # Enable C4062 - Warns about missing enum case in switch statement, equivalent to gcc -Wswitch
127+ add_compile_options ("/w14062" )
128+
125129 # MSVC panics if an object file contains more than 65,279 sections. this
126130 # happens quite frequently with code that uses templates, such as vectors.
127131 add_compile_options ("/bigobj" )
@@ -223,13 +227,10 @@ set(DFHACK_DATA_DESTINATION hack)
223227
224228## where to install things (after the build is done, classic 'make install' or package structure)
225229# the dfhack libraries will be installed here:
226- if (UNIX )
227- # put the lib into DF/hack
228- set (DFHACK_LIBRARY_DESTINATION ${DFHACK_DATA_DESTINATION} )
229- else ()
230- # windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile...
231- set (DFHACK_LIBRARY_DESTINATION .)
232- endif ()
230+
231+ # put the lib into DF/hack
232+ # windows will find it because dfhooks will `AddDllDirectory` the hack folder at runtime
233+ set (DFHACK_LIBRARY_DESTINATION ${DFHACK_DATA_DESTINATION} )
233234
234235# external tools will be installed here:
235236set (DFHACK_BINARY_DESTINATION .)
@@ -264,7 +265,7 @@ if(UNIX)
264265 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS } -m32 -march=i686" )
265266 endif ()
266267 string (REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO } " )
267- set (CMAKE_INSTALL_RPATH ${DFHACK_LIBRARY_DESTINATION} )
268+ set (CMAKE_INSTALL_RPATH "$ORIGIN" )
268269elseif (MSVC )
269270 # for msvc, tell it to always use 8-byte pointers to member functions to avoid confusion
270271 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } /vmg /vmm /MP" )
@@ -344,6 +345,17 @@ if(BUILD_LIBRARY)
344345 endif ()
345346endif ()
346347
348+ # this can be made conditional once we get to better platform support for std::format
349+ INCLUDE (FetchContent )
350+ FetchContent_Declare (
351+ fmt
352+ GIT_REPOSITORY https://github.com/fmtlib/fmt.git
353+ GIT_TAG 790b9389ae99c4ddebdd2736a8602eca1fec684e # 12.1.0 + bugfix for MSVC warning + build time improvements
354+ )
355+ FetchContent_MakeAvailable (fmt)
356+ set (FMTLIB fmt)
357+ add_definitions ("-DUSE_FMTLIB" )
358+
347359if (APPLE )
348360 # libstdc++ (GCC 4.8.5 for OS X 10.6)
349361 # fixes crash-on-unwind bug in DF's libstdc++
@@ -425,7 +437,7 @@ macro(dfhack_test name files)
425437if (BUILD_LIBRARY AND UNIX AND NOT APPLE ) # remove this once our MSVC build env has been updated
426438 add_executable (${name} ${files} )
427439 target_include_directories (${name} PUBLIC depends /googletest/googletest/include )
428- target_link_libraries (${name} dfhack gtest )
440+ target_link_libraries (${name} dfhack ${FMTLIB} gtest )
429441 add_test (NAME ${name} COMMAND ${name} )
430442endif ()
431443endmacro ()
@@ -523,7 +535,7 @@ if(BUILD_DOCS)
523535
524536 add_custom_command (OUTPUT ${SPHINX_OUTPUT}
525537 COMMAND "${Python3_EXECUTABLE} " "${CMAKE_CURRENT_SOURCE_DIR } /docs/build.py"
526- ${SPHINX_BUILD_TARGETS} --sphinx= "${SPHINX_EXECUTABLE} " -- -q -W
538+ ${SPHINX_BUILD_TARGETS} --sphinx= "${SPHINX_EXECUTABLE} " --quiet -- -W
527539 DEPENDS ${SPHINX_DEPS}
528540 COMMENT "Building documentation with Sphinx"
529541 )
0 commit comments