2022-11-05 23:31:06 +00:00
|
|
|
include(clang-tidy-default)
|
|
|
|
|
2023-08-01 02:29:45 +00:00
|
|
|
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
|
|
|
|
comptime.c
|
|
|
|
md5.c
|
|
|
|
config.h.in
|
|
|
|
string.c
|
|
|
|
d_main.c
|
|
|
|
dehacked.c
|
|
|
|
deh_soc.c
|
|
|
|
deh_lua.c
|
|
|
|
deh_tables.c
|
|
|
|
z_zone.c
|
|
|
|
f_finale.c
|
|
|
|
f_wipe.c
|
|
|
|
g_demo.c
|
|
|
|
g_game.c
|
|
|
|
g_input.c
|
|
|
|
am_map.c
|
|
|
|
command.c
|
|
|
|
console.c
|
|
|
|
hu_stuff.c
|
|
|
|
i_time.c
|
|
|
|
y_inter.c
|
|
|
|
st_stuff.c
|
|
|
|
m_aatree.c
|
|
|
|
m_anigif.c
|
|
|
|
m_argv.c
|
|
|
|
m_bbox.c
|
|
|
|
m_cheat.c
|
|
|
|
m_cond.c
|
|
|
|
m_easing.c
|
|
|
|
m_fixed.c
|
|
|
|
m_menu.c
|
|
|
|
m_misc.c
|
|
|
|
m_perfstats.c
|
|
|
|
m_random.c
|
2023-10-30 17:54:32 +00:00
|
|
|
m_tokenizer.c
|
2023-08-01 02:29:45 +00:00
|
|
|
m_queue.c
|
2024-01-30 01:08:22 +00:00
|
|
|
m_vector.c
|
2023-08-01 02:29:45 +00:00
|
|
|
info.c
|
|
|
|
p_ceilng.c
|
|
|
|
p_enemy.c
|
|
|
|
p_floor.c
|
|
|
|
p_inter.c
|
|
|
|
p_lights.c
|
|
|
|
p_map.c
|
|
|
|
p_maputl.c
|
|
|
|
p_mobj.c
|
|
|
|
p_polyobj.c
|
|
|
|
p_saveg.c
|
|
|
|
p_setup.c
|
|
|
|
p_sight.c
|
|
|
|
p_spec.c
|
|
|
|
p_telept.c
|
|
|
|
p_tick.c
|
|
|
|
p_user.c
|
|
|
|
p_slopes.c
|
|
|
|
tables.c
|
|
|
|
r_bsp.c
|
|
|
|
r_data.c
|
|
|
|
r_draw.c
|
|
|
|
r_fps.c
|
|
|
|
r_main.c
|
|
|
|
r_plane.c
|
|
|
|
r_segs.c
|
|
|
|
r_skins.c
|
|
|
|
r_sky.c
|
|
|
|
r_splats.c
|
|
|
|
r_things.c
|
|
|
|
r_bbox.c
|
|
|
|
r_textures.c
|
2023-10-29 23:33:49 +00:00
|
|
|
r_translation.c
|
2023-08-01 02:29:45 +00:00
|
|
|
r_patch.c
|
|
|
|
r_patchrotation.c
|
|
|
|
r_picformats.c
|
|
|
|
r_portal.c
|
|
|
|
screen.c
|
|
|
|
taglist.c
|
|
|
|
v_video.c
|
|
|
|
s_sound.c
|
|
|
|
sounds.c
|
|
|
|
w_wad.c
|
|
|
|
filesrch.c
|
|
|
|
lzf.c
|
|
|
|
b_bot.c
|
|
|
|
u_list.c
|
2023-09-19 14:08:06 +00:00
|
|
|
snake.c
|
2023-08-01 02:29:45 +00:00
|
|
|
lua_script.c
|
|
|
|
lua_baselib.c
|
|
|
|
lua_mathlib.c
|
|
|
|
lua_hooklib.c
|
|
|
|
lua_consolelib.c
|
|
|
|
lua_infolib.c
|
|
|
|
lua_mobjlib.c
|
|
|
|
lua_playerlib.c
|
|
|
|
lua_skinlib.c
|
|
|
|
lua_thinkerlib.c
|
|
|
|
lua_maplib.c
|
|
|
|
lua_taglib.c
|
|
|
|
lua_polyobjlib.c
|
|
|
|
lua_blockmaplib.c
|
|
|
|
lua_hudlib.c
|
|
|
|
lua_hudlib_drawlist.c
|
2023-08-04 03:31:51 +00:00
|
|
|
lua_colorlib.c
|
2023-08-01 02:29:45 +00:00
|
|
|
lua_inputlib.c
|
|
|
|
)
|
2021-05-08 01:57:46 +00:00
|
|
|
|
2023-08-01 02:29:45 +00:00
|
|
|
# This updates the modification time for comptime.c at the
|
|
|
|
# end of building so when the build system is ran next time,
|
|
|
|
# that file gets flagged. comptime.c will always be rebuilt.
|
|
|
|
#
|
|
|
|
# This begs the question, why always rebuild comptime.c?
|
|
|
|
# Some things like the git commit must be checked each time
|
|
|
|
# the program is built. But the build system determines which
|
|
|
|
# files should be rebuilt before anything else. So
|
|
|
|
# comptime.c, which only needs to be rebuilt based on
|
|
|
|
# information known at build time, must be told to rebuild
|
|
|
|
# before that information can be ascertained.
|
|
|
|
add_custom_command(
|
|
|
|
TARGET SRB2SDL2
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/comptime.c
|
|
|
|
)
|
|
|
|
|
|
|
|
# config.h is generated by this command. It should be done at
|
|
|
|
# build time for accurate git information and before anything
|
|
|
|
# that needs it, obviously.
|
|
|
|
add_custom_target(_SRB2_reconf ALL
|
|
|
|
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/.. -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Comptime.cmake
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.."
|
|
|
|
)
|
|
|
|
add_dependencies(SRB2SDL2 _SRB2_reconf)
|
|
|
|
|
|
|
|
if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
|
|
|
|
target_link_options(SRB2SDL2 PRIVATE "-Wl,--disable-dynamicbase")
|
|
|
|
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
|
|
|
|
# On MinGW with internal libraries, link the standard library statically
|
|
|
|
target_link_options(SRB2SDL2 PRIVATE "-static")
|
|
|
|
endif()
|
2022-10-11 03:20:59 +00:00
|
|
|
endif()
|
|
|
|
|
2022-11-06 01:50:57 +00:00
|
|
|
target_compile_features(SRB2SDL2 PRIVATE c_std_11 cxx_std_17)
|
|
|
|
|
2015-01-28 05:46:39 +00:00
|
|
|
### Configuration
|
2022-10-09 05:27:57 +00:00
|
|
|
set(SRB2_CONFIG_DEV_BUILD OFF CACHE BOOL
|
|
|
|
"Compile a development build of SRB2.")
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2021-05-05 10:56:57 +00:00
|
|
|
add_subdirectory(blua)
|
2023-09-19 14:08:06 +00:00
|
|
|
add_subdirectory(netcode)
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2022-10-11 03:20:59 +00:00
|
|
|
# OS macros
|
|
|
|
if (UNIX)
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DUNIXCOMMON)
|
2015-01-28 05:46:39 +00:00
|
|
|
endif()
|
|
|
|
|
2024-02-14 07:57:22 +00:00
|
|
|
if (BSD MATCHES "FreeBSD")
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DFREEBSD)
|
|
|
|
endif()
|
|
|
|
|
2022-10-11 03:20:59 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
find_program(OBJCOPY objcopy)
|
2019-01-02 08:27:24 +00:00
|
|
|
endif()
|
|
|
|
|
2022-10-11 03:20:59 +00:00
|
|
|
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DLINUX)
|
|
|
|
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DLINUX64)
|
2020-06-07 02:05:25 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-10-11 03:20:59 +00:00
|
|
|
if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DMACOSX)
|
2015-01-28 05:46:39 +00:00
|
|
|
endif()
|
|
|
|
|
2024-02-25 00:37:38 +00:00
|
|
|
if("${SRB2_CONFIG_USE_GME}")
|
|
|
|
target_link_libraries(SRB2SDL2 PRIVATE gme)
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
|
|
|
|
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
|
|
|
# this sucks but gme doesn't use modern cmake to delineate public headers
|
|
|
|
target_include_directories(SRB2SDL2 PRIVATE "${libgme_SOURCE_DIR}")
|
|
|
|
endif()
|
2015-01-28 05:46:39 +00:00
|
|
|
endif()
|
|
|
|
|
2022-10-11 03:20:59 +00:00
|
|
|
target_link_libraries(SRB2SDL2 PRIVATE openmpt)
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
|
2020-04-07 05:48:43 +00:00
|
|
|
|
2022-10-11 03:20:59 +00:00
|
|
|
target_link_libraries(SRB2SDL2 PRIVATE ZLIB::ZLIB PNG::PNG CURL::libcurl)
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB -DHAVE_PNG -DHAVE_CURL -D_LARGEFILE64_SOURCE)
|
|
|
|
target_sources(SRB2SDL2 PRIVATE apng.c)
|
|
|
|
|
|
|
|
set(SRB2_HAVE_THREADS ON)
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
|
2020-10-20 20:58:34 +00:00
|
|
|
|
2022-10-11 03:20:59 +00:00
|
|
|
if("${SRB2_CONFIG_HWRENDER}")
|
2021-05-05 10:56:57 +00:00
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
|
|
|
|
add_subdirectory(hardware)
|
2015-01-28 07:20:43 +00:00
|
|
|
|
2022-10-11 03:20:59 +00:00
|
|
|
if("${SRB2_CONFIG_STATIC_OPENGL}")
|
|
|
|
find_package(OpenGL)
|
|
|
|
if(${OPENGL_FOUND})
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DSTATIC_OPENGL)
|
|
|
|
else()
|
|
|
|
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
|
|
|
|
endif()
|
2015-01-28 05:46:39 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Targets
|
|
|
|
|
2020-06-08 00:41:43 +00:00
|
|
|
# If using CCACHE, then force it.
|
|
|
|
# https://github.com/Cockatrice/Cockatrice/pull/3052/files
|
2022-10-11 03:20:59 +00:00
|
|
|
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
2020-06-08 00:41:43 +00:00
|
|
|
get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
|
|
|
|
if(RULE_LAUNCH_COMPILE)
|
|
|
|
MESSAGE(STATUS "Force enabling CCache usage under macOS")
|
|
|
|
# Set up wrapper scripts
|
2020-06-10 19:07:41 +00:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/launch-c.in ${CMAKE_BINARY_DIR}/launch-c)
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/launch-cxx.in ${CMAKE_BINARY_DIR}/launch-cxx)
|
2020-06-08 00:41:43 +00:00
|
|
|
execute_process(COMMAND chmod a+rx
|
|
|
|
"${CMAKE_BINARY_DIR}/launch-c"
|
|
|
|
"${CMAKE_BINARY_DIR}/launch-cxx")
|
|
|
|
|
|
|
|
# Set Xcode project attributes to route compilation through our scripts
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/launch-c")
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/launch-cxx")
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/launch-c")
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/launch-cxx")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-01-28 05:46:39 +00:00
|
|
|
# Compatibility flag with later versions of GCC
|
|
|
|
# We should really fix our code to not need this
|
2016-02-06 02:49:24 +00:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
2023-02-08 19:46:09 +00:00
|
|
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|x64|amd64|AMD64|em64t|EM64T)")
|
|
|
|
target_compile_options(SRB2SDL2 PRIVATE -mno-ms-bitfields)
|
|
|
|
endif()
|
2015-01-28 06:58:30 +00:00
|
|
|
endif()
|
2015-01-28 05:46:39 +00:00
|
|
|
|
2022-11-05 07:56:50 +00:00
|
|
|
# Compiler warnings configuration
|
|
|
|
target_compile_options(SRB2SDL2 PRIVATE
|
|
|
|
# Using generator expressions to handle per-language compile options
|
|
|
|
|
|
|
|
# C, GNU
|
|
|
|
# This is a direct translation from versions.mk
|
|
|
|
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:GNU>>:
|
|
|
|
-Wall
|
2024-03-01 19:35:04 +00:00
|
|
|
-Wextra
|
2022-11-05 07:56:50 +00:00
|
|
|
-Wno-trigraphs
|
|
|
|
-W # Was controlled by RELAXWARNINGS
|
|
|
|
-Wfloat-equal
|
|
|
|
-Wundef
|
|
|
|
-Wpointer-arith
|
|
|
|
-Wbad-function-cast
|
|
|
|
-Wcast-qual
|
|
|
|
-Wcast-align # Was controlled by NOCASTALIGNWARN
|
|
|
|
-Wwrite-strings
|
|
|
|
-Wsign-compare
|
|
|
|
-Waggregate-return
|
|
|
|
-Wmissing-prototypes
|
|
|
|
-Wmissing-declarations
|
|
|
|
-Wmissing-noreturn
|
|
|
|
-Wnested-externs
|
|
|
|
-Winline
|
|
|
|
-Wformat-y2k
|
|
|
|
-Wformat-security
|
2023-11-04 10:48:20 +00:00
|
|
|
-fwrapv
|
2022-11-12 01:31:04 +00:00
|
|
|
|
2022-11-05 07:56:50 +00:00
|
|
|
$<$<VERSION_LESS:$<C_COMPILER_VERSION>,2.9.5>:
|
|
|
|
-Wno-div-by-zero
|
|
|
|
-Wendif-labels
|
|
|
|
-Wdisabled-optimization
|
|
|
|
>
|
|
|
|
|
|
|
|
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.0.0>:
|
|
|
|
-Wold-style-definition
|
|
|
|
-Wmissing-field-initializers
|
|
|
|
>
|
|
|
|
|
|
|
|
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.1.0>:
|
|
|
|
-Wshadow
|
|
|
|
>
|
|
|
|
|
|
|
|
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.3.0>:
|
|
|
|
-funit-at-a-time
|
|
|
|
-Wlogical-op
|
|
|
|
>
|
|
|
|
|
|
|
|
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.5.0>:
|
|
|
|
-Wlogical-op
|
2023-12-26 22:49:34 +00:00
|
|
|
#-Wno-error=array-bounds
|
2022-11-05 07:56:50 +00:00
|
|
|
>
|
|
|
|
|
|
|
|
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.6.0>:
|
|
|
|
-Wno-suggest-attribute=noreturn
|
|
|
|
-Wno-error=suggest-attribute=noreturn
|
|
|
|
>
|
|
|
|
|
|
|
|
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,5.4.0>:
|
|
|
|
-Wno-logical-op
|
|
|
|
-Wno-error=logical-op
|
|
|
|
>
|
|
|
|
|
|
|
|
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,6.1.0>:
|
|
|
|
-Wno-tautological-compare
|
|
|
|
-Wno-error=tautological-compare
|
|
|
|
>
|
|
|
|
|
|
|
|
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,7.1.0>:
|
|
|
|
-Wno-error=format-overflow=2
|
|
|
|
-Wimplicit-fallthrough=4
|
|
|
|
>
|
|
|
|
|
|
|
|
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,8.1.0>:
|
|
|
|
-Wno-error=format-overflow
|
|
|
|
-Wno-format-overflow
|
|
|
|
-Wno-error=multistatement-macros
|
|
|
|
>
|
|
|
|
|
|
|
|
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,9.1.0>:
|
|
|
|
-Wno-error=address-of-packed-member
|
|
|
|
>
|
|
|
|
>
|
|
|
|
|
|
|
|
# C, Clang and Apple Clang
|
|
|
|
$<$<AND:$<COMPILE_LANGUAGE:C>,$<OR:$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>:
|
|
|
|
-Wall
|
|
|
|
-Wno-absolute-value
|
2024-03-01 19:35:04 +00:00
|
|
|
-Wextra
|
2022-11-05 07:56:50 +00:00
|
|
|
-Wno-trigraphs
|
2024-03-01 19:35:04 +00:00
|
|
|
-Wconditional-uninitialized
|
2022-11-05 07:56:50 +00:00
|
|
|
-Wno-error=non-literal-null-conversion
|
|
|
|
-Wno-error=constant-conversion
|
|
|
|
-Wno-error=unused-but-set-variable
|
2023-11-04 10:48:20 +00:00
|
|
|
-fwrapv
|
2022-11-05 07:56:50 +00:00
|
|
|
>
|
|
|
|
|
|
|
|
# C, MSVC
|
|
|
|
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:MSVC>>:
|
|
|
|
# All warnings at and before Visual Studio 2019 RTM
|
|
|
|
# https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-by-compiler-version?view=msvc-170
|
|
|
|
/Wv:19.20.27004.0
|
|
|
|
>
|
|
|
|
|
|
|
|
# C++, GNU, Clang and Apple Clang
|
|
|
|
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>:
|
|
|
|
-Wall
|
2024-03-01 19:35:04 +00:00
|
|
|
-Wextra
|
|
|
|
-Wno-trigraphs
|
|
|
|
-Wconditional-uninitialized
|
2022-11-05 07:56:50 +00:00
|
|
|
>
|
|
|
|
|
|
|
|
# C++, MSVC
|
|
|
|
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:MSVC>>:
|
|
|
|
/Wv:19.20.27004.0
|
|
|
|
>
|
|
|
|
)
|
|
|
|
if(SRB2_CONFIG_ERRORMODE)
|
|
|
|
target_compile_options(SRB2SDL2 PRIVATE
|
|
|
|
$<$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>:
|
|
|
|
-Werror
|
|
|
|
>
|
|
|
|
|
|
|
|
$<$<C_COMPILER_ID:MSVC>:
|
|
|
|
/WX
|
|
|
|
>
|
|
|
|
)
|
2016-02-06 03:38:40 +00:00
|
|
|
endif()
|
|
|
|
|
2022-11-05 07:56:50 +00:00
|
|
|
# Link warnings configuration
|
|
|
|
target_link_options(SRB2SDL2 PRIVATE
|
|
|
|
$<$<C_COMPILER_ID:GNU>:
|
|
|
|
# -Wl,--as-needed - Was controlled by NOLDWARNING
|
|
|
|
>
|
|
|
|
)
|
|
|
|
|
2022-10-09 05:27:57 +00:00
|
|
|
if(${SRB2_CONFIG_DEV_BUILD})
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DDEVELOP)
|
|
|
|
endif()
|
2021-05-05 10:56:57 +00:00
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DCMAKECONFIG)
|
2015-01-29 00:03:41 +00:00
|
|
|
|
2022-11-06 20:03:02 +00:00
|
|
|
# Misc. build options from Makefiles
|
|
|
|
if(SRB2_CONFIG_DEBUGMODE)
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DZDEBUG -DPARANOIA -DRANGECHECK -DPACKETDROP)
|
|
|
|
endif()
|
|
|
|
if(SRB2_CONFIG_MOBJCONSISTANCY)
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DMOBJCONSISTANCY)
|
|
|
|
endif()
|
|
|
|
if(SRB2_CONFIG_PACKETDROP)
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DPACKETDROP)
|
|
|
|
endif()
|
2023-12-26 00:52:32 +00:00
|
|
|
if(SRB2_CONFIG_EXECINFO)
|
|
|
|
else()
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DNOEXECINFO)
|
|
|
|
message(STATUS "You have disabled stack trace dump support")
|
|
|
|
endif()
|
2022-11-06 20:03:02 +00:00
|
|
|
if(SRB2_CONFIG_ZDEBUG)
|
|
|
|
target_compile_definitions(SRB2SDL2 PRIVATE -DZDEBUG)
|
|
|
|
endif()
|
|
|
|
if(SRB2_CONFIG_PROFILEMODE AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
target_compile_options(SRB2SDL2 PRIVATE -pg)
|
|
|
|
target_link_options(SRB2SDL2 PRIVATE -pg)
|
|
|
|
endif()
|
|
|
|
|
2015-01-28 05:46:39 +00:00
|
|
|
add_subdirectory(sdl)
|
2023-02-20 10:15:50 +00:00
|
|
|
if(SRB2_CONFIG_ENABLE_TESTS)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|
2015-03-08 08:26:54 +00:00
|
|
|
|
2022-10-11 03:20:59 +00:00
|
|
|
# strip debug symbols into separate file when using gcc.
|
|
|
|
# to be consistent with Makefile, don't generate for OS X.
|
|
|
|
if((CMAKE_COMPILER_IS_GNUCC) AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES Darwin))
|
|
|
|
if((${CMAKE_BUILD_TYPE} MATCHES Debug) OR (${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo))
|
|
|
|
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
|
|
|
set(OBJCOPY_ONLY_KEEP_DEBUG "--only-keep-debug")
|
|
|
|
endif()
|
|
|
|
message(STATUS "Will make separate debug symbols in *.debug")
|
|
|
|
add_custom_command(TARGET SRB2SDL2 POST_BUILD
|
|
|
|
COMMAND ${OBJCOPY} ${OBJCOPY_ONLY_KEEP_DEBUG} $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
|
|
|
|
COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:SRB2SDL2>
|
|
|
|
COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
|
|
|
|
)
|
|
|
|
endif()
|
2016-02-06 02:49:24 +00:00
|
|
|
endif()
|
2022-11-09 01:21:21 +00:00
|
|
|
|
|
|
|
# copy DLLs to bin/ directory if building internal shared on windows
|
|
|
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL Windows AND NOT "${SRB2_CONFIG_INTERNAL_LIBRARIES}" AND "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
|
|
|
|
set(ADDITIONAL_DLLS "")
|
|
|
|
if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU)
|
|
|
|
# also copy implicitly linked system libraries
|
|
|
|
get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
|
|
|
|
list(APPEND ADDITIONAL_DLLS
|
|
|
|
"libgcc_s_dw2-1.dll"
|
|
|
|
"libstdc++-6.dll"
|
|
|
|
"libwinpthread-1.dll"
|
|
|
|
)
|
|
|
|
list(TRANSFORM ADDITIONAL_DLLS PREPEND "${MINGW_BIN_PATH}/")
|
|
|
|
endif()
|
|
|
|
add_custom_command(TARGET SRB2SDL2 POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
$<TARGET_RUNTIME_DLLS:SRB2SDL2>
|
|
|
|
${ADDITIONAL_DLLS}
|
|
|
|
|
|
|
|
$<TARGET_FILE_DIR:SRB2SDL2>
|
|
|
|
COMMAND_EXPAND_LISTS
|
|
|
|
COMMENT "Copying runtime DLLs"
|
|
|
|
)
|
|
|
|
endif()
|
2022-11-05 23:31:06 +00:00
|
|
|
|
|
|
|
# Setup clang-tidy
|
|
|
|
if(SRB2_CONFIG_ENABLE_CLANG_TIDY_C)
|
|
|
|
target_set_default_clang_tidy(SRB2SDL2 C "-*,clang-analyzer-*,-clang-analyzer-cplusplus-*")
|
|
|
|
endif()
|
|
|
|
if(SRB2_CONFIG_ENABLE_CLANG_TIDY_CXX)
|
|
|
|
target_set_default_clang_tidy(SRB2SDL2 CXX "-*,clang-analyzer-*,modernize-*")
|
|
|
|
endif()
|