mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-25 20:01:04 +00:00
Refactor CMake to allow source grouping and separation of interfaces.
Core and SDL2 are two separate targets now. Core is a static library that is linked into SRB2SDL2. The sources for both are separated. When using an IDE like Visual Studio or Xcode, the source code organized into groups that explain what that group of sources does. In the future, "Main" could be split into a few more groups based on file prefixes, but I think the way it is set up works for now. Makefile targets are not affected by source_groups and typing `make` will automatically compile both the "Core" library and SRB2SDL2 itself.
This commit is contained in:
parent
3d5d61ee87
commit
a713509493
4 changed files with 160 additions and 143 deletions
|
@ -26,7 +26,7 @@ endforeach()
|
|||
# Installation
|
||||
|
||||
if(CLANG)
|
||||
get_target_property(outname ${SRB2_SDL2_EXE_NAME} OUTPUT_NAME)
|
||||
get_target_property(outname SRB2SDL2 OUTPUT_NAME)
|
||||
install(FILES ${SRB2_ASSET_ALL}
|
||||
DESTINATION "${outname}.app/Contents/Resources"
|
||||
)
|
||||
|
|
|
@ -34,32 +34,6 @@ set(SRB2_CORE_SOURCES
|
|||
m_random.c
|
||||
md5.c
|
||||
mserv.c
|
||||
p_ceilng.c
|
||||
p_enemy.c
|
||||
p_fab.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
|
||||
r_bsp.c
|
||||
r_data.c
|
||||
r_draw.c
|
||||
r_main.c
|
||||
r_plane.c
|
||||
r_segs.c
|
||||
r_sky.c
|
||||
r_splats.c
|
||||
r_things.c
|
||||
s_sound.c
|
||||
screen.c
|
||||
sounds.c
|
||||
|
@ -124,15 +98,31 @@ set(SRB2_CORE_HEADERS
|
|||
md5.h
|
||||
mserv.h
|
||||
p5prof.h
|
||||
p_local.h
|
||||
p_maputl.h
|
||||
p_mobj.h
|
||||
p_polyobj.h
|
||||
p_pspr.h
|
||||
p_saveg.h
|
||||
p_setup.h
|
||||
p_spec.h
|
||||
p_tick.h
|
||||
s_sound.h
|
||||
screen.h
|
||||
sounds.h
|
||||
st_stuff.h
|
||||
tables.h
|
||||
v_video.h
|
||||
w_wad.h
|
||||
y_inter.h
|
||||
z_zone.h
|
||||
|
||||
config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
||||
)
|
||||
|
||||
set(SRB2_CORE_RENDER_SOURCES
|
||||
r_bsp.c
|
||||
r_data.c
|
||||
r_draw.c
|
||||
r_main.c
|
||||
r_plane.c
|
||||
r_segs.c
|
||||
r_sky.c
|
||||
r_splats.c
|
||||
r_things.c
|
||||
|
||||
r_bsp.h
|
||||
r_data.h
|
||||
r_defs.h
|
||||
|
@ -145,57 +135,45 @@ set(SRB2_CORE_HEADERS
|
|||
r_splats.h
|
||||
r_state.h
|
||||
r_things.h
|
||||
s_sound.h
|
||||
screen.h
|
||||
sounds.h
|
||||
st_stuff.h
|
||||
tables.h
|
||||
v_video.h
|
||||
w_wad.h
|
||||
y_inter.h
|
||||
z_zone.h
|
||||
)
|
||||
|
||||
prepend_sources(SRB2_CORE_SOURCES)
|
||||
prepend_sources(SRB2_CORE_HEADERS)
|
||||
set(SRB2_CORE_GAME_SOURCES
|
||||
p_ceilng.c
|
||||
p_enemy.c
|
||||
p_fab.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
|
||||
|
||||
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
set(SRB2_HWRENDER_SOURCES
|
||||
hardware/hw_bsp.c
|
||||
hardware/hw_cache.c
|
||||
hardware/hw_draw.c
|
||||
hardware/hw_light.c
|
||||
hardware/hw_main.c
|
||||
hardware/hw_md2.c
|
||||
hardware/hw_trick.c
|
||||
p_local.h
|
||||
p_maputl.h
|
||||
p_mobj.h
|
||||
p_polyobj.h
|
||||
p_pspr.h
|
||||
p_saveg.h
|
||||
p_setup.h
|
||||
p_spec.h
|
||||
p_tick.h
|
||||
)
|
||||
|
||||
set (SRB2_HWRENDER_HEADERS
|
||||
hardware/hw_data.h
|
||||
hardware/hw_defs.h
|
||||
hardware/hw_dll.h
|
||||
hardware/hw_drv.h
|
||||
hardware/hw_glide.h
|
||||
hardware/hw_glob.h
|
||||
hardware/hw_light.h
|
||||
hardware/hw_main.h
|
||||
hardware/hw_md2.h
|
||||
)
|
||||
if(NOT CLANG)
|
||||
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
|
||||
endif()
|
||||
|
||||
prepend_sources(SRB2_HWRENDER_SOURCES)
|
||||
prepend_sources(SRB2_HWRENDER_HEADERS)
|
||||
|
||||
set(SRB2_R_OPENGL_SOURCES
|
||||
hardware/r_opengl/r_opengl.c
|
||||
)
|
||||
|
||||
set(SRB2_R_OPENGL_HEADERS
|
||||
hardware/r_opengl/r_opengl.h
|
||||
)
|
||||
|
||||
prepend_sources(SRB2_R_OPENGL_SOURCES)
|
||||
prepend_sources(SRB2_R_OPENGL_HEADERS)
|
||||
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
|
||||
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
|
||||
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
|
||||
|
||||
set(SRB2_ASM_SOURCES
|
||||
vid_copy.s
|
||||
|
@ -219,8 +197,7 @@ if(MSVC)
|
|||
list(APPEND SRB2_NASM_OBJECTS tmap_vc.obj)
|
||||
endif()
|
||||
|
||||
prepend_sources(SRB2_ASM_SOURCES)
|
||||
prepend_sources(SRB2_NASM_SOURCES)
|
||||
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
|
||||
|
||||
|
||||
### Configuration
|
||||
|
@ -229,11 +206,11 @@ set(SRB2_CONFIG_HAVE_BLUA ON CACHE BOOL
|
|||
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
|
||||
"Enable PNG support. Depends on zlib, so will be disabled if you don't enable that too.")
|
||||
set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL
|
||||
"Enable zlib support")
|
||||
"Enable zlib support.")
|
||||
set(SRB2_CONFIG_HAVE_GME ON CACHE BOOL
|
||||
"Enable GME support")
|
||||
"Enable GME support.")
|
||||
set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
|
||||
"Enable hardware rendering through OpenGL")
|
||||
"Enable hardware rendering through OpenGL.")
|
||||
set(SRB2_CONFIG_USEASM OFF CACHE BOOL
|
||||
"Enable NASM tmap implementation for software mode speedup.")
|
||||
set(SRB2_CONFIG_YASM OFF CACHE BOOL
|
||||
|
@ -264,8 +241,7 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
|||
lua_script.h
|
||||
)
|
||||
|
||||
prepend_sources(SRB2_LUA_SOURCES)
|
||||
prepend_sources(SRB2_LUA_HEADERS)
|
||||
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
|
||||
|
||||
set(SRB2_BLUA_SOURCES
|
||||
blua/lapi.c
|
||||
|
@ -318,8 +294,7 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
|||
blua/lvm.h
|
||||
blua/lzio.h
|
||||
)
|
||||
prepend_sources(SRB2_BLUA_SOURCES)
|
||||
prepend_sources(SRB2_BLUA_HEADERS)
|
||||
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_GME})
|
||||
|
@ -355,6 +330,36 @@ endif()
|
|||
|
||||
if(${SRB2_CONFIG_HWRENDER})
|
||||
add_definitions(-DHWRENDER)
|
||||
set(SRB2_HWRENDER_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_trick.c
|
||||
)
|
||||
|
||||
set (SRB2_HWRENDER_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glide.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
|
||||
)
|
||||
|
||||
set(SRB2_R_OPENGL_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.c
|
||||
)
|
||||
|
||||
set(SRB2_R_OPENGL_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.h
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
|
||||
|
@ -384,10 +389,6 @@ endif()
|
|||
|
||||
# Targets
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
add_subdirectory(win32)
|
||||
endif()
|
||||
|
||||
# Compatibility flag with later versions of GCC
|
||||
# We should really fix our code to not need this
|
||||
if(NOT CLANG AND NOT MSVC)
|
||||
|
@ -396,4 +397,23 @@ endif()
|
|||
|
||||
add_definitions(-DCMAKECONFIG)
|
||||
|
||||
add_library(SRB2Core STATIC
|
||||
${SRB2_CORE_SOURCES}
|
||||
${SRB2_CORE_HEADERS}
|
||||
${SRB2_CORE_RENDER_SOURCES}
|
||||
${SRB2_CORE_GAME_SOURCES}
|
||||
${SRB2_LUA_SOURCES}
|
||||
${SRB2_LUA_HEADERS}
|
||||
${SRB2_BLUA_SOURCES}
|
||||
${SRB2_BLUA_HEADERS}
|
||||
)
|
||||
|
||||
add_subdirectory(sdl)
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
add_subdirectory(win32)
|
||||
endif()
|
||||
|
||||
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
|
||||
message(FATAL_ERROR "There are no targets available to build an SRB2 executable. :(")
|
||||
endif()
|
|
@ -3,6 +3,12 @@
|
|||
#ifndef __CONFIG_H__
|
||||
#define __CONFIG_H__
|
||||
|
||||
/* DO NOT MODIFY config.h DIRECTLY! It will be overwritten by cmake.
|
||||
* If you want to change a configuration option here, modify it in
|
||||
* your CMakeCache.txt. config.h.in is used as a template for CMake
|
||||
* variables, so you can insert them here too.
|
||||
*/
|
||||
|
||||
#ifdef CMAKECONFIG
|
||||
|
||||
#define ASSET_HASH_SRB2_SRB "${SRB2_ASSET_srb2.srb_HASH}"
|
||||
|
|
|
@ -39,16 +39,13 @@ set(SRB2_SDL2_HEADERS
|
|||
sdlmain.h
|
||||
)
|
||||
|
||||
prepend_sources(SRB2_SDL2_SOURCES)
|
||||
prepend_sources(SRB2_SDL2_HEADERS)
|
||||
source_group("Interface Code" FILES ${SRB2_SDL2_SOURCES} ${SRB2_SDL2_HEADERS})
|
||||
|
||||
# Dependency
|
||||
find_package(SDL2)
|
||||
|
||||
if(${SDL2_FOUND})
|
||||
set(SRB2_SDL2_TOTAL_SOURCES
|
||||
${SRB2_CORE_SOURCES}
|
||||
${SRB2_CORE_HEADERS}
|
||||
${SRB2_SDL2_SOURCES}
|
||||
${SRB2_SDL2_HEADERS}
|
||||
)
|
||||
|
@ -60,15 +57,9 @@ if(${SDL2_FOUND})
|
|||
${SRB2_R_OPENGL_SOURCES}
|
||||
${SRB2_R_OPENGL_HEADERS}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_BLUA})
|
||||
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
|
||||
${SRB2_LUA_SOURCES}
|
||||
${SRB2_LUA_HEADERS}
|
||||
${SRB2_BLUA_SOURCES}
|
||||
${SRB2_BLUA_HEADERS}
|
||||
)
|
||||
source_group("Hardware" FILES ${SRB2_HWRENDER_SOURCES} ${SRB2_HWRENDER_HEADERS})
|
||||
source_group("Hardware\\OpenGL Renderer" FILES ${SRB2_R_OPENGL_SOURCES} ${SRB2_R_OPENGL_HEADERS})
|
||||
endif()
|
||||
|
||||
if(${SRB2_USEASM})
|
||||
|
@ -85,7 +76,6 @@ if(${SDL2_FOUND})
|
|||
set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES LANGUAGE C)
|
||||
set_source_files_properties(${SRB2_ASM_SOURCES} PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
|
@ -94,39 +84,36 @@ if(${SDL2_FOUND})
|
|||
${CMAKE_SOURCE_DIR}/src/win32/Srb2win.rc
|
||||
)
|
||||
endif()
|
||||
if(NOT CLANG)
|
||||
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
|
||||
${CMAKE_SOURCE_DIR}/src/string.c
|
||||
)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
set(MACOSX_BUNDLE_ICON_FILE Srb2mac.icns)
|
||||
set_source_files_properties(macosx/Srb2mac.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
|
||||
set(SRB2_SDL2_MAC_SOURCES
|
||||
macosx/mac_alert.c
|
||||
macosx/mac_alert.h
|
||||
macosx/mac_resources.c
|
||||
macosx/mac_resources.h
|
||||
macosx/Srb2mac.icns
|
||||
)
|
||||
source_group("Interface Code\\OSX Compatibility" FILES ${SRB2_SDL2_MAC_SOURCES})
|
||||
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES} ${SRB2_SDL2_MAC_SOURCES})
|
||||
endif()
|
||||
|
||||
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME})
|
||||
|
||||
if(CLANG)
|
||||
add_executable(${SRB2_SDL2_EXE_NAME} MACOSX_BUNDLE ${SRB2_SDL2_TOTAL_SOURCES})
|
||||
add_framework(CoreFoundation ${SRB2_SDL2_EXE_NAME})
|
||||
add_framework(SDL2 ${SRB2_SDL2_EXE_NAME})
|
||||
add_framework(SDL2_mixer ${SRB2_SDL2_EXE_NAME})
|
||||
target_link_libraries(${SRB2_SDL2_EXE_NAME} PRIVATE
|
||||
add_framework(CoreFoundation SRB2SDL2)
|
||||
add_framework(SDL2 SRB2SDL2)
|
||||
add_framework(SDL2_mixer SRB2SDL2)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
${PNG_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
)
|
||||
set_target_properties(${SRB2_SDL2_EXE_NAME} PROPERTIES OUTPUT_NAME "Sonic Robo Blast 2")
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "Sonic Robo Blast 2")
|
||||
else()
|
||||
add_executable(${SRB2_SDL2_EXE_NAME} WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
|
||||
|
||||
target_link_libraries(${SRB2_SDL2_EXE_NAME} PRIVATE
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
${SDL2_LIBRARIES}
|
||||
${SDL2_MIXER_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
|
@ -135,14 +122,15 @@ if(${SDL2_FOUND})
|
|||
)
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Linux)
|
||||
target_link_libraries(${SRB2_SDL2_EXE_NAME} PRIVATE
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
m
|
||||
rt
|
||||
)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
target_link_libraries(SRB2SDL2 PRIVATE SRB2Core)
|
||||
|
||||
if(${SRB2_USEASM})
|
||||
if(${SRB2_CONFIG_YASM})
|
||||
set(ASM_ASSEMBLER_TEMP ${CMAKE_ASM_YASM_COMPILER})
|
||||
|
@ -159,7 +147,7 @@ if(${SDL2_FOUND})
|
|||
foreach(ASMFILE ${SRB2_NASM_SOURCES})
|
||||
get_filename_component(ASMFILE_NAME ${ASMFILE} NAME_WE)
|
||||
set(ASMFILE_NAME ${ASMFILE_NAME}.obj)
|
||||
add_custom_command(TARGET ${SRB2_SDL2_EXE_NAME} PRE_LINK
|
||||
add_custom_command(TARGET SRB2SDL2 PRE_LINK
|
||||
COMMAND ${ASM_ASSEMBLER_TEMP} ARGS -f ${ASM_ASSEMBLER_OBJFORMAT} -o ${CMAKE_CURRENT_BINARY_DIR}/${ASMFILE_NAME} ${ASMFILE}
|
||||
COMMENT "assemble ${ASMFILE_NAME}."
|
||||
)
|
||||
|
@ -167,23 +155,23 @@ if(${SDL2_FOUND})
|
|||
endif()
|
||||
endif()
|
||||
|
||||
set_target_properties(${SRB2_SDL2_EXE_NAME} PROPERTIES VERSION ${SRB2_VERSION})
|
||||
set_target_properties(SRB2SDL2 PROPERTIES VERSION ${SRB2_VERSION})
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
target_link_libraries(${SRB2_SDL2_EXE_NAME} PRIVATE
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
ws2_32
|
||||
)
|
||||
target_compile_options(${SRB2_SDL2_EXE_NAME} PRIVATE
|
||||
target_compile_options(SRB2SDL2 PRIVATE
|
||||
-U_WINDOWS
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
find_package(SDL2_MAIN REQUIRED)
|
||||
target_link_libraries(${SRB2_SDL2_EXE_NAME} PRIVATE
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
${SDL2_MAIN_LIBRARIES}
|
||||
)
|
||||
target_compile_options(${SRB2_SDL2_EXE_NAME} PRIVATE
|
||||
target_compile_options(SRB2SDL2 PRIVATE
|
||||
/Umain
|
||||
/D_CRT_SECURE_NO_WARNINGS # something about string functions.
|
||||
/D_CRT_NONSTDC_NO_DEPRECATE
|
||||
|
@ -192,7 +180,7 @@ if(${SDL2_FOUND})
|
|||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(${SRB2_SDL2_EXE_NAME} PRIVATE
|
||||
target_include_directories(SRB2SDL2 PRIVATE
|
||||
${SDL2_INCLUDE_DIRS}
|
||||
${SDL2_MIXER_INCLUDE_DIRS}
|
||||
${PNG_INCLUDE_DIRS}
|
||||
|
@ -201,10 +189,10 @@ if(${SDL2_FOUND})
|
|||
)
|
||||
|
||||
if(${SRB2_HAVE_MIXER})
|
||||
target_compile_definitions(${SRB2_SDL2_EXE_NAME} PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${SRB2_SDL2_EXE_NAME} PRIVATE
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE
|
||||
-DHAVE_SDL
|
||||
)
|
||||
|
||||
|
@ -212,21 +200,21 @@ if(${SDL2_FOUND})
|
|||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||
message(STATUS "Will make separate debug symbols in *.debug")
|
||||
add_custom_command(TARGET ${SRB2_SDL2_EXE_NAME} POST_BUILD
|
||||
COMMAND ${OBJCOPY} --only-keep-debug $<TARGET_FILE:${SRB2_SDL2_EXE_NAME}> $<TARGET_FILE:${SRB2_SDL2_EXE_NAME}>.debug
|
||||
COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:${SRB2_SDL2_EXE_NAME}>
|
||||
COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE_NAME:${SRB2_SDL2_EXE_NAME}>.debug $<TARGET_FILE:${SRB2_SDL2_EXE_NAME}>
|
||||
add_custom_command(TARGET SRB2SDL2 POST_BUILD
|
||||
COMMAND ${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_NAME:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#### Installation ####
|
||||
if (CLANG)
|
||||
install(TARGETS ${SRB2_SDL2_EXE_NAME}
|
||||
install(TARGETS SRB2SDL2
|
||||
BUNDLE DESTINATION .
|
||||
)
|
||||
else()
|
||||
install(TARGETS ${SRB2_SDL2_EXE_NAME} ${SRB2_SDL2_EXE_NAME}
|
||||
install(TARGETS SRB2SDL2 SRB2SDL2
|
||||
RUNTIME DESTINATION .
|
||||
)
|
||||
endif()
|
||||
|
@ -257,10 +245,10 @@ if(${SDL2_FOUND})
|
|||
|
||||
# We also want to copy those DLLs to build directories on MSVC.
|
||||
# So we'll add a post_build step.
|
||||
copy_files_to_build_dir(${SRB2_SDL2_EXE_NAME} win_extra_dll_list)
|
||||
copy_files_to_build_dir(SRB2SDL2 win_extra_dll_list)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
# Mac bundle fixup
|
||||
if(CLANG)
|
||||
install(CODE "
|
||||
|
@ -271,6 +259,9 @@ if(${SDL2_FOUND})
|
|||
)"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(SRB2_SDL2_AVAILABLE YES PARENT_SCOPE)
|
||||
else()
|
||||
message(WARNING "SDL2 wasn't found, so ${SRB2_SDL2_EXE_NAME} won't be available")
|
||||
endif()
|
||||
message(WARNING "SDL2 was not found, so the SDL2 target will not be available.")
|
||||
set(SRB2_SDL2_AVAILABLE NO PARENT_SCOPE)
|
||||
endif()
|
Loading…
Reference in a new issue