Build: Fixed VS always triggering a full build when PCH is enabled, even if only a source file was edited
(cherry picked from commit 9b1dfe5e5e968c6ee3a2682ae2106735daeccbd7) (cherry picked from commit b64583b7c14da408b34d2c92a02e5529594ef181)
This commit is contained in:
1 parent
ec6d64b9c6
commit
ad377241f9
2 files changed
+27
-8
No files matched your search
@@ -2341,7 +2341,7 @@ function (cotire_setup_pch_file_inclusion _language _target _wholeTarget _prefix
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function (cotire_setup_prefix_file_inclusion _language _target _prefixFile)
|
function (cotire_setup_prefix_file_inclusion _language _target _prefixFile _prefixFileWasGenerated)
|
||||||
set (_sourceFiles ${ARGN})
|
set (_sourceFiles ${ARGN})
|
||||||
# force the inclusion of the prefix header for the given source files
|
# force the inclusion of the prefix header for the given source files
|
||||||
set (_flags "")
|
set (_flags "")
|
||||||
@@ -2352,8 +2352,10 @@ function (cotire_setup_prefix_file_inclusion _language _target _prefixFile)
|
|||||||
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
|
set_property (SOURCE ${_sourceFiles} APPEND_STRING PROPERTY COMPILE_FLAGS " ${_flags} ")
|
||||||
# mark sources as cotired to prevent them from being used in another cotired target
|
# mark sources as cotired to prevent them from being used in another cotired target
|
||||||
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
|
set_source_files_properties(${_sourceFiles} PROPERTIES COTIRE_TARGET "${_target}")
|
||||||
# make object files generated from source files depend on prefix header
|
if (_prefixFileWasGenerated)
|
||||||
set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}")
|
# make object files generated from source files depend on prefix header
|
||||||
|
set_property (SOURCE ${_sourceFiles} APPEND PROPERTY OBJECT_DEPENDS "${_prefixFile}")
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function (cotire_get_first_set_property_value _propertyValueVar _type _object)
|
function (cotire_get_first_set_property_value _propertyValueVar _type _object)
|
||||||
@@ -2866,9 +2868,21 @@ function (cotire_process_target_language _language _configurations _target _whol
|
|||||||
if (_prefixFile)
|
if (_prefixFile)
|
||||||
# check for user provided prefix header files
|
# check for user provided prefix header files
|
||||||
get_property(_prefixHeaderFiles TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER_INIT)
|
get_property(_prefixHeaderFiles TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER_INIT)
|
||||||
|
set (_prefixFileWasGenerated TRUE)
|
||||||
if (_prefixHeaderFiles)
|
if (_prefixHeaderFiles)
|
||||||
cotire_setup_prefix_generation_from_provided_command(
|
list (LENGTH _prefixHeaderFiles _numberOfprefixHeaderFiles)
|
||||||
${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" _cmds ${_prefixHeaderFiles})
|
# if there is only one header specified in COTIRE_${_language}_PREFIX_HEADER_INIT then use it directly
|
||||||
|
# this works around a bug/change that causes Visual Studio to always rebuild entire project
|
||||||
|
# even if only one source file changed
|
||||||
|
# custom commands in cmake are designed to be always "out of date" so generation always happens
|
||||||
|
# Visual Studio determines "out of date" status by last modification timestamp, not content
|
||||||
|
if (_numberOfprefixHeaderFiles GREATER 1 OR NOT CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
|
||||||
|
cotire_setup_prefix_generation_from_provided_command(
|
||||||
|
${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" _cmds ${_prefixHeaderFiles})
|
||||||
|
else()
|
||||||
|
list (GET _prefixHeaderFiles 0 _prefixFile)
|
||||||
|
set (_prefixFileWasGenerated FALSE)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
cotire_setup_prefix_generation_from_unity_command(
|
cotire_setup_prefix_generation_from_unity_command(
|
||||||
${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" "${_unityFile}" _cmds ${_unitySourceFiles})
|
${_language} ${_target} "${_targetConfigScript}" "${_prefixFile}" "${_unityFile}" _cmds ${_unitySourceFiles})
|
||||||
@@ -2891,7 +2905,7 @@ function (cotire_process_target_language _language _configurations _target _whol
|
|||||||
endif()
|
endif()
|
||||||
elseif (_prefixHeaderFiles)
|
elseif (_prefixHeaderFiles)
|
||||||
# user provided prefix header must be included unconditionally
|
# user provided prefix header must be included unconditionally
|
||||||
cotire_setup_prefix_file_inclusion(${_language} ${_target} "${_prefixFile}" ${_sourceFiles})
|
cotire_setup_prefix_file_inclusion(${_language} ${_target} "${_prefixFile}" ${_prefixFileWasGenerated} ${_sourceFiles})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
# mark target as cotired for language
|
# mark target as cotired for language
|
||||||
@@ -2995,7 +3009,7 @@ function (cotire_setup_unity_target_pch_usage _languages _target)
|
|||||||
get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER)
|
get_property(_prefixFile TARGET ${_target} PROPERTY COTIRE_${_language}_PREFIX_HEADER)
|
||||||
if (_userPrefixFile AND _prefixFile)
|
if (_userPrefixFile AND _prefixFile)
|
||||||
# user provided prefix header must be included unconditionally by unity sources
|
# user provided prefix header must be included unconditionally by unity sources
|
||||||
cotire_setup_prefix_file_inclusion(${_language} ${_target} "${_prefixFile}" ${_unityFiles})
|
cotire_setup_prefix_file_inclusion(${_language} ${_target} "${_prefixFile}" TRUE ${_unityFiles})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|||||||
@@ -166,6 +166,11 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
|||||||
trinity-core-interface
|
trinity-core-interface
|
||||||
PUBLIC
|
PUBLIC
|
||||||
game)
|
game)
|
||||||
|
|
||||||
|
target_include_directories(${SCRIPT_MODULE_PROJECT_NAME}
|
||||||
|
PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
set_target_properties(${SCRIPT_MODULE_PROJECT_NAME}
|
set_target_properties(${SCRIPT_MODULE_PROJECT_NAME}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
FOLDER
|
FOLDER
|
||||||
@@ -221,7 +226,7 @@ set_target_properties(scripts
|
|||||||
# Generate precompiled header
|
# Generate precompiled header
|
||||||
if (USE_SCRIPTPCH)
|
if (USE_SCRIPTPCH)
|
||||||
list(APPEND ALL_SCRIPT_PROJECTS scripts ${DYNAMIC_SCRIPT_MODULE_PROJECTS})
|
list(APPEND ALL_SCRIPT_PROJECTS scripts ${DYNAMIC_SCRIPT_MODULE_PROJECTS})
|
||||||
add_cxx_pch("${ALL_SCRIPT_PROJECTS}" ${PRIVATE_PCH_HEADER} ${PRIVATE_PCH_SOURCE})
|
add_cxx_pch("${ALL_SCRIPT_PROJECTS}" ${PRIVATE_PCH_HEADER})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Remove all shared libraries in the installl directory which
|
# Remove all shared libraries in the installl directory which
|
||||||
|
|||||||
Reference in new issue
Block a user