mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-13 22:22:05 +00:00
Indented USE_PRECOMPILED_HEADERS blocks
This commit is contained in:
parent
e54fc22180
commit
747878eee1
2 changed files with 103 additions and 103 deletions
|
@ -101,50 +101,49 @@ if(MSVC)
|
|||
|
||||
add_library(idlib ${ID_SOURCES_ALL} ${ID_INCLUDES_ALL})
|
||||
else()
|
||||
if (USE_PRECOMPILED_HEADERS)
|
||||
foreach( src_file ${ID_PRECOMPILED_SOURCES} )
|
||||
#message(STATUS "-include precompiled.h for ${src_file}")
|
||||
set_source_files_properties(
|
||||
${src_file}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "-include ${CMAKE_CURRENT_SOURCE_DIR}/precompiled.h"
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
include_directories(.)
|
||||
|
||||
if (USE_PRECOMPILED_HEADERS)
|
||||
# precompiled magic for GCC/clang, adapted from https://gist.github.com/573926
|
||||
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
|
||||
SET(_compiler_FLAGS "${${_flags_var_name}} -std=c++${CMAKE_CXX_STANDARD}")
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${_directory_flags})
|
||||
LIST(APPEND _compiler_FLAGS " -I${item}")
|
||||
ENDFOREACH(item)
|
||||
endif()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
LIST(APPEND _compiler_FLAGS ${_directory_flags})
|
||||
|
||||
SEPARATE_ARGUMENTS(_compiler_FLAGS)
|
||||
|
||||
if (USE_PRECOMPILED_HEADERS)
|
||||
if(OPTICK)
|
||||
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=1)
|
||||
else()
|
||||
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=0)
|
||||
endif()
|
||||
add_custom_target(precomp_header_idlib ALL
|
||||
COMMAND ${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header precompiled.h -o precompiled.h.gch
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Creating idlib/precompiled.h.gch for idlib"
|
||||
)
|
||||
foreach( src_file ${ID_PRECOMPILED_SOURCES} )
|
||||
#message(STATUS "-include precompiled.h for ${src_file}")
|
||||
set_source_files_properties(
|
||||
${src_file}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "-include ${CMAKE_CURRENT_SOURCE_DIR}/precompiled.h"
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# precompiled magic for GCC/clang, adapted from https://gist.github.com/573926
|
||||
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
|
||||
SET(_compiler_FLAGS "${${_flags_var_name}} -std=c++${CMAKE_CXX_STANDARD}")
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${_directory_flags})
|
||||
LIST(APPEND _compiler_FLAGS " -I${item}")
|
||||
ENDFOREACH(item)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
LIST(APPEND _compiler_FLAGS ${_directory_flags})
|
||||
|
||||
SEPARATE_ARGUMENTS(_compiler_FLAGS)
|
||||
|
||||
if(OPTICK)
|
||||
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=1)
|
||||
else()
|
||||
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=0)
|
||||
endif()
|
||||
|
||||
add_custom_target(precomp_header_idlib ALL
|
||||
COMMAND ${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header precompiled.h -o precompiled.h.gch
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Creating idlib/precompiled.h.gch for idlib"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(idlib ${ID_SOURCES_ALL} ${ID_INCLUDES_ALL})
|
||||
|
||||
if (USE_PRECOMPILED_HEADERS)
|
||||
add_dependencies(idlib precomp_header_idlib)
|
||||
add_dependencies(idlib precomp_header_idlib)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
|
|
@ -269,15 +269,18 @@ if(MSVC)
|
|||
)
|
||||
|
||||
# SRS - disable certain MSVC warnings for select third-party source libraries, consider updating versions in the future?
|
||||
# C4005: macro redefinition, C4244: type conversion with possible loss of data, C4305: trucation from double to float
|
||||
set_source_files_properties(
|
||||
${MC_IMTUI_SOURCES} ${MC_IMGUI_SOURCES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "/wd4005 /wd4244 /wd4305" # C4005: macro redefinition, C4244: type conversion with possible loss of data, C4305: trucation from double to float
|
||||
COMPILE_FLAGS "/wd4005 /wd4244 /wd4305"
|
||||
)
|
||||
|
||||
# C4244, C4267: type conversion with possible loss of data, C4996: declared deprecated
|
||||
set_source_files_properties(
|
||||
${PDCURSES_SOURCES} ${WINCON_SOURCES}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "/wd4244 /wd4267 /wd4996" # C4244, C4267: type conversion with possible loss of data, C4996: declared deprecated
|
||||
COMPILE_FLAGS "/wd4244 /wd4267 /wd4996"
|
||||
)
|
||||
|
||||
add_executable(rbdmap ${MC_SOURCES_ALL} ${MC_INCLUDES_ALL})
|
||||
|
@ -290,16 +293,7 @@ if(MSVC)
|
|||
endif()
|
||||
|
||||
else()
|
||||
if (USE_PRECOMPILED_HEADERS)
|
||||
foreach( src_file ${MC_PRECOMPILED_SOURCES} )
|
||||
#message(STATUS "-include precompiled.h for ${src_file}")
|
||||
set_source_files_properties(
|
||||
${src_file}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "-include ${CMAKE_CURRENT_SOURCE_DIR}/precompiled.h"
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
include_directories(.)
|
||||
|
||||
# SRS - disable certain gcc/clang warnings for select third-party source libraries, consider updating versions in the future?
|
||||
set_source_files_properties(
|
||||
|
@ -309,72 +303,79 @@ else()
|
|||
COMPILE_FLAGS "-Wno-stringop-overread -Wno-deprecated-non-prototype"
|
||||
)
|
||||
|
||||
include_directories(.)
|
||||
|
||||
if (USE_PRECOMPILED_HEADERS)
|
||||
# precompiled magic for GCC/clang, adapted from https://gist.github.com/573926
|
||||
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
|
||||
SET(_compiler_FLAGS "${${_flags_var_name}} -std=c++${CMAKE_CXX_STANDARD}")
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${_directory_flags})
|
||||
LIST(APPEND _compiler_FLAGS " -I${item}")
|
||||
ENDFOREACH(item)
|
||||
endif()
|
||||
foreach( src_file ${MC_PRECOMPILED_SOURCES} )
|
||||
#message(STATUS "-include precompiled.h for ${src_file}")
|
||||
set_source_files_properties(
|
||||
${src_file}
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "-include ${CMAKE_CURRENT_SOURCE_DIR}/precompiled.h"
|
||||
)
|
||||
endforeach()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
LIST(APPEND _compiler_FLAGS ${_directory_flags})
|
||||
|
||||
SEPARATE_ARGUMENTS(_compiler_FLAGS)
|
||||
|
||||
if (USE_PRECOMPILED_HEADERS)
|
||||
# SRS - USE_OPTICK not useful for rbdmap, but definition required to avoid mismatch with idlib precompiled header
|
||||
if(OPTICK)
|
||||
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=1)
|
||||
else()
|
||||
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=0)
|
||||
endif()
|
||||
add_custom_target(precomp_header_rbdmap ALL
|
||||
COMMAND ${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header precompiled.h -o precompiled.h.gch
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Creating tools/compilers/precompiled.h.gch for rbdmap"
|
||||
)
|
||||
# precompiled magic for GCC/clang, adapted from https://gist.github.com/573926
|
||||
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
|
||||
SET(_compiler_FLAGS "${${_flags_var_name}} -std=c++${CMAKE_CXX_STANDARD}")
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${_directory_flags})
|
||||
LIST(APPEND _compiler_FLAGS " -I${item}")
|
||||
ENDFOREACH(item)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
LIST(APPEND _compiler_FLAGS ${_directory_flags})
|
||||
|
||||
SEPARATE_ARGUMENTS(_compiler_FLAGS)
|
||||
|
||||
# SRS - USE_OPTICK not useful for rbdmap, but definition required to avoid mismatch with idlib precompiled header
|
||||
if(OPTICK)
|
||||
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=1)
|
||||
else()
|
||||
LIST(APPEND _compiler_FLAGS -DUSE_OPTICK=0)
|
||||
endif()
|
||||
|
||||
add_custom_target(precomp_header_rbdmap ALL
|
||||
COMMAND ${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header precompiled.h -o precompiled.h.gch
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "Creating tools/compilers/precompiled.h.gch for rbdmap"
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable(rbdmap ${MC_SOURCES_ALL} ${MC_INCLUDES_ALL})
|
||||
add_dependencies(rbdmap idlib)
|
||||
|
||||
if (USE_PRECOMPILED_HEADERS)
|
||||
add_dependencies(rbdmap precomp_header_rbdmap)
|
||||
add_dependencies(rbdmap precomp_header_rbdmap)
|
||||
|
||||
if(WIN32)
|
||||
set(remove_command "del")
|
||||
set(idlib_dir_slash "${CMAKE_SOURCE_DIR}\\idlib\\")
|
||||
else()
|
||||
set(remove_command "rm")
|
||||
set(idlib_dir_slash "${CMAKE_SOURCE_DIR}/idlib/")
|
||||
if(WIN32)
|
||||
set(remove_command "del")
|
||||
set(idlib_dir_slash "${CMAKE_SOURCE_DIR}\\idlib\\")
|
||||
else()
|
||||
set(remove_command "rm")
|
||||
set(idlib_dir_slash "${CMAKE_SOURCE_DIR}/idlib/")
|
||||
endif()
|
||||
|
||||
# SRS - delete precompiled header file after executable is compiled: command line build case
|
||||
if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja")
|
||||
add_custom_target(rm_precomp_header_rbdmap ALL
|
||||
COMMAND ${remove_command} "precompiled.h.gch"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "remove tools/compilers/precompiled.h.gch"
|
||||
)
|
||||
add_dependencies(rm_precomp_header_rbdmap rbdmap)
|
||||
|
||||
# SRS - delete precompiled header files after executable is compiled: IDE build case (e.g. Xcode)
|
||||
else()
|
||||
add_custom_command(TARGET rbdmap POST_BUILD
|
||||
# SRS - added wildcards to remove tmp files from cmake ZERO_CHECK regeneration
|
||||
COMMAND ${remove_command} "${idlib_dir_slash}precompiled.h*.gch*"
|
||||
COMMAND ${remove_command} "precompiled.h*.gch*"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "remove idlib/precompiled.h.gch and tools/compilers/precompiled.h.gch"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# SRS - delete precompiled header file after executable is compiled: command line build case
|
||||
if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja")
|
||||
add_custom_target(rm_precomp_header_rbdmap ALL
|
||||
COMMAND ${remove_command} "precompiled.h.gch"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "remove tools/compilers/precompiled.h.gch"
|
||||
)
|
||||
add_dependencies(rm_precomp_header_rbdmap rbdmap)
|
||||
|
||||
# SRS - delete precompiled header files after executable is compiled: IDE build case (e.g. Xcode)
|
||||
else()
|
||||
add_custom_command(TARGET rbdmap POST_BUILD
|
||||
# SRS - added wildcards to remove tmp files from cmake ZERO_CHECK regeneration
|
||||
COMMAND ${remove_command} "${idlib_dir_slash}precompiled.h*.gch*"
|
||||
COMMAND ${remove_command} "precompiled.h*.gch*"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "remove idlib/precompiled.h.gch and tools/compilers/precompiled.h.gch"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(rbdmap idlib ${CURSES_NCURSES_LIBRARY} ${ZLIB_LIBRARY})
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue