mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 20:11:12 +00:00
CMAKE improvements: optional asset install; exe.debug for RelWithDebInfo
This commit is contained in:
parent
a449fa4a1d
commit
ded6285249
3 changed files with 37 additions and 16 deletions
|
@ -131,4 +131,5 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR})
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
|
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
|
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
|
||||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
|
||||||
|
SET(CPACK_OUTPUT_FILE_PREFIX package)
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
|
@ -12,6 +12,9 @@ ENDFUNCTION(PREPEND)
|
||||||
set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"
|
set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"
|
||||||
CACHE STRING "Path to directory that contains all asset files for the installer.")
|
CACHE STRING "Path to directory that contains all asset files for the installer.")
|
||||||
|
|
||||||
|
set(SRB2_ASSET_INSTALL ON
|
||||||
|
CACHE BOOL "Insert asset files into the install directory or package.")
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list!
|
# POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list!
|
||||||
####################
|
####################
|
||||||
|
@ -43,20 +46,27 @@ endforeach()
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||||
get_target_property(outname SRB2SDL2 OUTPUT_NAME)
|
get_target_property(outname SRB2SDL2 OUTPUT_NAME)
|
||||||
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
|
if(${SRB2_ASSET_INSTALL})
|
||||||
DESTINATION "${outname}.app/Contents/Resources"
|
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
|
||||||
)
|
DESTINATION "${outname}.app/Contents/Resources"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
# Always install the doc files, even in non-asset packages.
|
||||||
install(FILES ${SRB2_ASSET_DOCS}
|
install(FILES ${SRB2_ASSET_DOCS}
|
||||||
DESTINATION .
|
DESTINATION .
|
||||||
OPTIONAL
|
OPTIONAL
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
|
if(${SRB2_ASSET_INSTALL})
|
||||||
DESTINATION .
|
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
|
||||||
)
|
DESTINATION .
|
||||||
# Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install again
|
)
|
||||||
#install(FILES ${SRB2_ASSET_DOCS}
|
# Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install them in their own call.
|
||||||
# DESTINATION .
|
else()
|
||||||
# OPTIONAL
|
# Always install the doc files, even in non-asset packages.
|
||||||
#)
|
install(FILES ${SRB2_ASSET_DOCS}
|
||||||
|
DESTINATION .
|
||||||
|
OPTIONAL
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -269,14 +269,18 @@ if(${SDL2_FOUND})
|
||||||
-DHAVE_SDL
|
-DHAVE_SDL
|
||||||
)
|
)
|
||||||
|
|
||||||
## strip debug symbols into separate file when using gcc
|
## strip debug symbols into separate file when using gcc.
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
## to be consistent with Makefile, don't generate for OS X.
|
||||||
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
if((CMAKE_COMPILER_IS_GNUCC) AND NOT (${CMAKE_SYSTEM} 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")
|
message(STATUS "Will make separate debug symbols in *.debug")
|
||||||
add_custom_command(TARGET SRB2SDL2 POST_BUILD
|
add_custom_command(TARGET SRB2SDL2 POST_BUILD
|
||||||
COMMAND ${OBJCOPY} --only-keep-debug $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
|
COMMAND ${OBJCOPY} ${OBJCOPY_ONLY_KEEP_DEBUG} $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
|
||||||
COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:SRB2SDL2>
|
COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:SRB2SDL2>
|
||||||
COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE_NAME:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
|
COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -290,6 +294,12 @@ if(${SDL2_FOUND})
|
||||||
install(TARGETS SRB2SDL2 SRB2SDL2
|
install(TARGETS SRB2SDL2 SRB2SDL2
|
||||||
RUNTIME DESTINATION .
|
RUNTIME DESTINATION .
|
||||||
)
|
)
|
||||||
|
if ((${CMAKE_BUILD_TYPE} MATCHES Debug) OR (${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo))
|
||||||
|
install(FILES $<TARGET_FILE:SRB2SDL2>.debug
|
||||||
|
DESTINATION .
|
||||||
|
OPTIONAL
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||||
|
|
Loading…
Reference in a new issue