mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4066 System : Improve cmake macros for cotire
This commit is contained in:
parent
06feb039fc
commit
288ee59587
@ -419,6 +419,10 @@ if(RESINSIGHT_ENABLE_COTIRE)
|
||||
set_source_files_properties (${fileToExclude} PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
endforeach(fileToExclude)
|
||||
|
||||
foreach (cppFile ${CAF_COTIRE_START_NEW_UNITY_SOURCES})
|
||||
set_source_files_properties (${cppFile} PROPERTIES COTIRE_START_NEW_UNITY_SOURCE TRUE)
|
||||
endforeach(cppFile ${CAF_COTIRE_START_NEW_UNITY_SOURCES})
|
||||
|
||||
# disable precompiled headers
|
||||
set_target_properties(ResInsight PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
|
||||
|
||||
|
@ -32,3 +32,9 @@ ${CMAKE_CURRENT_LIST_DIR}/RicTextAnnotation3dEditor.h
|
||||
|
||||
|
||||
source_group( "CommandFeature\\AnnotationCommands" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
|
||||
# cotire
|
||||
caf_cotire_start_unity_at_first_item(SOURCE_GROUP_SOURCE_FILES)
|
||||
list(APPEND CAF_COTIRE_START_NEW_UNITY_SOURCES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateReachCircleAnnotationFeature.cpp
|
||||
)
|
||||
|
@ -51,3 +51,6 @@ ${QT_MOC_HEADERS}
|
||||
|
||||
|
||||
source_group( "CommandFeature\\Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
|
||||
# cotire
|
||||
caf_cotire_start_unity_at_first_item(SOURCE_GROUP_SOURCE_FILES)
|
||||
|
@ -37,3 +37,6 @@ ${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "CommandFeature\\Completion" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
|
||||
# cotire
|
||||
caf_cotire_start_unity_at_first_item(SOURCE_GROUP_SOURCE_FILES)
|
||||
|
@ -54,6 +54,7 @@ target_link_libraries( ${PROJECT_NAME}
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -93,6 +93,7 @@ target_link_libraries(${PROJECT_NAME} ${RI_ODB_LIBS} RigGeoMechDataModel LibCore
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -24,6 +24,7 @@ target_link_libraries(${PROJECT_NAME} LibCore)
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -74,9 +74,11 @@ if(RESINSIGHT_ENABLE_COTIRE)
|
||||
endif()
|
||||
|
||||
include(cotire)
|
||||
include(RiHelpers)
|
||||
endif()
|
||||
|
||||
# always include cotire tools to avoid checking if a macro is available
|
||||
include(cafCotireTools)
|
||||
|
||||
################################################################################
|
||||
# ERT
|
||||
################################################################################
|
||||
|
@ -85,7 +85,10 @@ endif()
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
set_source_files_properties (cafEffectGenerator.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
list(APPEND CAF_COTIRE_EXCLUDE_FILES
|
||||
cafEffectGenerator.cpp
|
||||
)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -84,6 +84,7 @@ endif()
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -46,6 +46,7 @@ endif()
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -76,6 +76,7 @@ endif()
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -99,6 +99,7 @@ endif()
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -68,6 +68,7 @@ endif()
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -123,6 +123,7 @@ else()
|
||||
endif(MSVC)
|
||||
endif(Qt5Core_FOUND)
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -185,6 +185,7 @@ target_link_libraries ( ${PROJECT_NAME}
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -70,7 +70,10 @@ endif()
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
set_source_files_properties (cafOpenGLWidget.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
ri_apply_cotire()
|
||||
# cotire
|
||||
if (COMMAND caf_apply_cotire)
|
||||
list(APPEND CAF_COTIRE_EXCLUDE_FILES
|
||||
cafOpenGLWidget.cpp
|
||||
)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
4
ThirdParty/Qwt/src/CMakeLists.txt
vendored
4
ThirdParty/Qwt/src/CMakeLists.txt
vendored
@ -296,6 +296,6 @@ if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Concurrent Qt5::Core Qt5::OpenGL Qt5::PrintSupport Qt5::Widgets)
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
if (COMMAND ri_apply_cotire)
|
||||
ri_apply_cotire()
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
endif()
|
||||
|
@ -1,10 +0,0 @@
|
||||
macro (ri_apply_cotire)
|
||||
if (COMMAND cotire)
|
||||
cotire(${PROJECT_NAME})
|
||||
|
||||
# make sure the unity target is included in the active builds to trigger rebuild before debug
|
||||
get_target_property(_unityTargetName ${PROJECT_NAME} COTIRE_UNITY_TARGET_NAME)
|
||||
set_target_properties(${_unityTargetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD FALSE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
endif()
|
||||
endmacro (ri_apply_cotire)
|
51
cmake/cafCotireTools.cmake
Normal file
51
cmake/cafCotireTools.cmake
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# This macro is used when a target has been created (add_library or add_executable)
|
||||
# Apply the macro like this
|
||||
#
|
||||
# add_executable(MyProject)
|
||||
# caf_apply_cotire(MyProject)
|
||||
#
|
||||
#
|
||||
macro (caf_apply_cotire target_name)
|
||||
if (COMMAND cotire)
|
||||
|
||||
#message("Applying cotire on target : ${target_name}")
|
||||
|
||||
# disable precompiled headers
|
||||
set_target_properties(${target_name} PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
|
||||
|
||||
foreach (fileToExclude ${CAF_COTIRE_EXCLUDE_FILES})
|
||||
set_source_files_properties (${fileToExclude} PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
endforeach(fileToExclude)
|
||||
|
||||
cotire(${target_name})
|
||||
|
||||
# make sure the unity target is included in the active builds to trigger rebuild before debug
|
||||
get_target_property(_unityTargetName ${target_name} COTIRE_UNITY_TARGET_NAME)
|
||||
set_target_properties(${_unityTargetName} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD FALSE)
|
||||
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
|
||||
endif()
|
||||
endmacro (caf_apply_cotire)
|
||||
|
||||
|
||||
#
|
||||
# This macro is intended to be used in *.cmake files listing a set of source files.
|
||||
# The specified file will start a new unity source file
|
||||
#
|
||||
# Example:
|
||||
# set (SOURCE_GROUP_SOURCE_FILES
|
||||
# ${CMAKE_CURRENT_LIST_DIR}/RicLaunchUnitTestsFeature.cpp
|
||||
# )
|
||||
# caf_cotire_start_unity_at_first_item(SOURCE_GROUP_SOURCE_FILES)
|
||||
#
|
||||
macro (caf_cotire_start_unity_at_first_item all_files)
|
||||
if (COMMAND cotire)
|
||||
#message("all_files : ${${all_files}}")
|
||||
list(GET ${all_files} 0 first_item_in_list)
|
||||
#message("first_item_in_list : ${first_item_in_list}")
|
||||
list(APPEND CAF_COTIRE_START_NEW_UNITY_SOURCES
|
||||
${first_item_in_list}
|
||||
)
|
||||
#message("CAF_COTIRE_START_NEW_UNITY_SOURCES : ${CAF_COTIRE_START_NEW_UNITY_SOURCES}")
|
||||
endif(COMMAND cotire)
|
||||
endmacro (caf_cotire_start_unity_at_first_item)
|
Loading…
Reference in New Issue
Block a user