mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 04:51:19 +00:00
- Actually, lets not use /Gm since it's incompatible with /MP which will be much faster on multi-core machines.
- Added ZDOOM_GENERATE_MAPFILE which enables linker map file generation.
This commit is contained in:
parent
03b75ae7c1
commit
0759a4b438
2 changed files with 31 additions and 14 deletions
|
@ -39,12 +39,12 @@ endfunction( add_pk3 )
|
|||
|
||||
# Macro for building libraries without debugging information
|
||||
macro( make_release_only )
|
||||
set( CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_RELEASE} )
|
||||
set( CMAKE_C_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_RELEASE} )
|
||||
set( CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELEASE} )
|
||||
set( CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_RELEASE} )
|
||||
string( REPLACE "/MT " "/MTd " CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_RELEASE} )
|
||||
set( CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_RELEASE} )
|
||||
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELEASE} )
|
||||
string( REPLACE "/MT " "/MTd " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_RELEASE} )
|
||||
endmacro( make_release_only )
|
||||
|
||||
IF( NOT CMAKE_BUILD_TYPE )
|
||||
|
@ -87,7 +87,7 @@ if( MSVC )
|
|||
set( REL_C_FLAGS "/MT /Oy" )
|
||||
|
||||
# Debug allocations in debug builds
|
||||
set( DEB_C_FLAGS "/D _CRTDBG_MAP_ALLOC /MTd /Gm" )
|
||||
set( DEB_C_FLAGS "/D _CRTDBG_MAP_ALLOC /MTd" )
|
||||
|
||||
# Disable warnings for unsecure CRT functions from VC8+
|
||||
if( MSVC_VERSION GREATER 1399 )
|
||||
|
|
|
@ -1093,8 +1093,22 @@ include_directories( .
|
|||
|
||||
add_dependencies( zdoom revision_check )
|
||||
|
||||
# Due to some quirks, we need to do this in this order
|
||||
if( NOT ZDOOM_OUTPUT_OLDSTYLE OR NO_GENERATOR_EXPRESSIONS )
|
||||
# RUNTIME_OUTPUT_DIRECTORY does not exist in CMake 2.4.
|
||||
# Linux distributions are slow to adopt 2.6. :(
|
||||
set_target_properties( zdoom PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${ZDOOM_OUTPUT_DIR} )
|
||||
set_target_properties( zdoom PROPERTIES OUTPUT_NAME ${ZDOOM_EXE_NAME} )
|
||||
endif( NOT ZDOOM_OUTPUT_OLDSTYLE OR NO_GENERATOR_EXPRESSIONS )
|
||||
|
||||
if( MSVC )
|
||||
set_target_properties(zdoom PROPERTIES LINK_FLAGS "/MANIFEST:NO")
|
||||
option( ZDOOM_GENERATE_MAPFILE "Generate .map file for debugging." OFF )
|
||||
if( ZDOOM_GENERATE_MAPFILE )
|
||||
set_target_properties(zdoom PROPERTIES LINK_FLAGS "/MANIFEST:NO")
|
||||
else( ZDOOM_GENERATE_MAPFILE )
|
||||
set_target_properties(zdoom PROPERTIES LINK_FLAGS "/MANIFEST:NO /MAP:${ZDOOM_EXE_NAME}.map")
|
||||
endif( ZDOOM_GENERATE_MAPFILE )
|
||||
|
||||
add_custom_command(TARGET zdoom POST_BUILD
|
||||
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\win32\\zdoom.exe.manifest\" -outputresource:\"$(TargetDir)$(TargetFileName)\"\;\#2
|
||||
COMMENT "Adding manifest..."
|
||||
|
@ -1103,22 +1117,25 @@ if( MSVC )
|
|||
create_default_target_launcher( zdoom WORKING_DIRECTORY ${ZDOOM_OUTPUT_DIR} )
|
||||
endif( MSVC )
|
||||
|
||||
if( ZDOOM_OUTPUT_OLDSTYLE AND NOT NO_GENERATOR_EXPRESSION )
|
||||
if( ZDOOM_OUTPUT_OLDSTYLE AND NOT NO_GENERATOR_EXPRESSIONS )
|
||||
set_target_properties( zdoom PROPERTIES
|
||||
RUNTIME_OUTPUT_NAME ${ZDOOM_EXE_NAME}
|
||||
RUNTIME_OUTPUT_NAME_DEBUG ${ZDOOM_EXE_NAME}d
|
||||
RUNTIME_OUTPUT_NAME_MINSIZEREL ${ZDOOM_EXE_NAME}msr
|
||||
RUNTIME_OUTPUT_NAME_RELWITHDEBINFO ${ZDOOM_EXE_NAME}rd
|
||||
)
|
||||
add_custom_command(TARGET zdoom POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:zdoom> ${ZDOOM_OUTPUT_DIR}/$<TARGET_FILE_NAME:zdoom>
|
||||
COMMENT "Copying to output directory..." )
|
||||
else( ZDOOM_OUTPUT_OLDSTYLE AND NOT NO_GENERATOR_EXPRESSION )
|
||||
# RUNTIME_OUTPUT_DIRECTORY does not exist in CMake 2.4.
|
||||
# Linux distributions are slow to adopt 2.6. :(
|
||||
set_target_properties( zdoom PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${ZDOOM_OUTPUT_DIR} )
|
||||
set_target_properties( zdoom PROPERTIES OUTPUT_NAME ${ZDOOM_EXE_NAME} )
|
||||
endif( ZDOOM_OUTPUT_OLDSTYLE AND NOT NO_GENERATOR_EXPRESSION )
|
||||
|
||||
if( ZDOOM_GENERATE_MAPFILE )
|
||||
add_custom_command(TARGET zdoom POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:zdoom> ${ZDOOM_OUTPUT_DIR}/$<TARGET_FILE_NAME:zdoom>
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE_DIR:zdoom>/zdoom.map ${ZDOOM_OUTPUT_DIR}/$<TARGET_FILE_NAME:zdoom>.map
|
||||
COMMENT "Copying to output directory..." )
|
||||
else( ZDOOM_GENERATE_MAPFILE )
|
||||
add_custom_command(TARGET zdoom POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:zdoom> ${ZDOOM_OUTPUT_DIR}/$<TARGET_FILE_NAME:zdoom>
|
||||
COMMENT "Copying to output directory..." )
|
||||
endif( ZDOOM_GENERATE_MAPFILE )
|
||||
endif( ZDOOM_OUTPUT_OLDSTYLE AND NOT NO_GENERATOR_EXPRESSIONS )
|
||||
|
||||
if( NOT WIN32 )
|
||||
FILE( WRITE ${CMAKE_CURRENT_BINARY_DIR}/link-make "if [ ! -e ${ZDOOM_OUTPUT_DIR}/${ZDOOM_EXE_NAME} ]; then ln -sf ${CMAKE_CURRENT_BINARY_DIR}/${ZDOOM_EXE_NAME} ${ZDOOM_OUTPUT_DIR}/${ZDOOM_EXE_NAME}; fi" )
|
||||
|
|
Loading…
Reference in a new issue