mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add cmake option to skip comptime update
In VS Code, comptime forces the game to be relinked even when no code has changed. This is a bit of a nuisance when starting with the debugger in the C++ extension, adding around 5 seconds of startup time to the game.
This commit is contained in:
parent
22e2b97171
commit
0e307208f8
2 changed files with 20 additions and 20 deletions
|
|
@ -66,6 +66,7 @@ option(SRB2_CONFIG_TESTERS "Compile a build for testers." OFF)
|
|||
option(SRB2_CONFIG_MOBJCONSISTANCY "Compile with MOBJCONSISTANCY defined." OFF)
|
||||
option(SRB2_CONFIG_PACKETDROP "Compile with PACKETDROP defined." OFF)
|
||||
option(SRB2_CONFIG_ZDEBUG "Compile with ZDEBUG defined." OFF)
|
||||
option(SRB2_CONFIG_SKIP_COMPTIME "Skip regenerating comptime. To speed up iterative debug builds in IDEs." OFF)
|
||||
# SRB2_CONFIG_PROFILEMODE is probably superceded by some CMake setting.
|
||||
option(SRB2_CONFIG_PROFILEMODE "Compile for profiling (GCC only)." OFF)
|
||||
option(SRB2_CONFIG_TRACY "Compile with Tracy profiling enabled" OFF)
|
||||
|
|
|
|||
|
|
@ -166,22 +166,24 @@ if(SRB2_CONFIG_ENABLE_WEBM_MOVIES)
|
|||
target_sources(SRB2SDL2 PRIVATE m_avrecorder.cpp)
|
||||
endif()
|
||||
|
||||
# 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
|
||||
)
|
||||
if(NOT SRB2_CONFIG_SKIP_COMPTIME)
|
||||
# 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
|
||||
)
|
||||
endif()
|
||||
|
||||
# config.h is generated by this command. It should be done at
|
||||
# build time for accurate git information and before anything
|
||||
|
|
@ -614,10 +616,7 @@ add_subdirectory(hud)
|
|||
# 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()
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo)
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue