@@ -2815,6 +2815,9 @@ function (cotire_make_target_message _target _languages _disableMsg _targetMsgVa | |||
else() | |||
set (_targetMsg "${_languagesStr} target ${_target} cotired without unity build.") | |||
endif() | |||
if (_disableMsg) | |||
set (_targetMsg "${_targetMsg} ${_disableMsg}") | |||
endif() | |||
else() | |||
if (_excludedStr) | |||
set (_targetMsg "${_languagesStr} target ${_target} cotired ${_excludedStr}.") | |||
@@ -2904,6 +2907,20 @@ function (cotire_choose_target_languages _target _targetLanguagesVar _wholeTarge | |||
set (_targetUsePCH FALSE) | |||
endif() | |||
endif() | |||
if (_targetAddSCU) | |||
# disable unity builds if automatic Qt processing is used | |||
get_target_property(_targetAutoMoc ${_target} AUTOMOC) | |||
get_target_property(_targetAutoUic ${_target} AUTOUIC) | |||
get_target_property(_targetAutoRcc ${_target} AUTORCC) | |||
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc) | |||
if (_disableMsg) | |||
set (_disableMsg "${_disableMsg} Target uses automatic CMake Qt processing.") | |||
else() | |||
set (_disableMsg "Target uses automatic CMake Qt processing.") | |||
endif() | |||
set (_targetAddSCU FALSE) | |||
endif() | |||
endif() | |||
set_property(TARGET ${_target} PROPERTY COTIRE_ENABLE_PRECOMPILED_HEADER ${_targetUsePCH}) | |||
set_property(TARGET ${_target} PROPERTY COTIRE_ADD_UNITY_BUILD ${_targetAddSCU}) | |||
cotire_make_target_message(${_target} "${_targetLanguages}" "${_disableMsg}" _targetMsg ${_allExcludedSourceFiles}) | |||
@@ -3138,21 +3155,6 @@ function (cotire_setup_unity_build_target _languages _configurations _target) | |||
# determine unity target sources | |||
set (_unityTargetSources "") | |||
cotire_collect_unity_target_sources(${_target} "${_languages}" _unityTargetSources) | |||
# handle automatic Qt processing | |||
get_target_property(_targetAutoMoc ${_target} AUTOMOC) | |||
get_target_property(_targetAutoUic ${_target} AUTOUIC) | |||
get_target_property(_targetAutoRcc ${_target} AUTORCC) | |||
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc) | |||
# if the original target sources are subject to CMake's automatic Qt processing, | |||
# also include implicitly generated <targetname>_automoc.cpp file | |||
if (CMAKE_VERSION VERSION_LESS "3.8.0") | |||
list (APPEND _unityTargetSources "${_target}_automoc.cpp") | |||
set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE) | |||
else() | |||
list (APPEND _unityTargetSources "${_target}_autogen/moc_compilation.cpp") | |||
set_property (SOURCE "${_target}_autogen/moc_compilation.cpp" PROPERTY GENERATED TRUE) | |||
endif() | |||
endif() | |||
# prevent AUTOMOC, AUTOUIC and AUTORCC properties from being set when the unity target is created | |||
set (CMAKE_AUTOMOC OFF) | |||
set (CMAKE_AUTOUIC OFF) | |||
@@ -3166,21 +3168,6 @@ function (cotire_setup_unity_build_target _languages _configurations _target) | |||
else() | |||
add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources}) | |||
endif() | |||
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio") | |||
# depend on original target's automoc target, if it exists | |||
if (TARGET ${_target}_automoc) | |||
add_dependencies(${_unityTargetName} ${_target}_automoc) | |||
endif() | |||
else() | |||
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc) | |||
# depend on the original target's implicity generated <targetname>_automoc target | |||
if (CMAKE_VERSION VERSION_LESS "3.8.0") | |||
add_dependencies(${_unityTargetName} ${_target}_automoc) | |||
else() | |||
add_dependencies(${_unityTargetName} ${_target}_autogen) | |||
endif() | |||
endif() | |||
endif() | |||
# copy output location properties | |||
set (_outputDirProperties | |||
ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_DIRECTORY_<CONFIG> | |||
@@ -616,16 +616,8 @@ the property value from its enclosing directory. To make all targets in the proj | |||
### using cotire with Qt | |||
Cotire is compatible with both Qt4 and Qt5 projects that use CMake as build system. | |||
If a CMake target's `AUTOMOC` or `AUTOUIC` properties are set, the generated unity target will | |||
automatically add a dependency to the implicitly generated `<targetname>_automoc` target to ensure | |||
that `moc` and `uic` are run on the individual source files. | |||
The unity target will also include the implicitly generated `<targetname>_automoc.cpp` source file. | |||
The `Patches` directory contains examples for the [Qt4][fsedit_qt4] and [Qt5][fsedit_qt5] based | |||
variants of the *FSEditor* sample Qt application. | |||
Cotire is compatible with both Qt projects that use CMake as build system, provided Qt targets | |||
do not use CMake automatic moc, uid or rcc scanning. | |||
### installing files generated by unity targets | |||
@@ -779,8 +771,6 @@ Cotire is not compatible with [Xoreax IncrediBuild][XGE]. | |||
[ccch]:https://ccache.samba.org/ | |||
[ccch_pch]:https://ccache.samba.org/manual.html#_precompiled_headers | |||
[clang_pch]:http://clang.llvm.org/docs/UsersManual.html#precompiled-headers | |||
[fsedit_qt4]:http://www.vikingsoft.eu/fseditor.html | |||
[fsedit_qt5]:https://github.com/joonhwan/fsedit-qt5 | |||
[gcc_pch]:https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html | |||
[msvc_pch]:https://msdn.microsoft.com/en-us/library/szfdksca(v=vs.90).aspx | |||
[msvc_pch_create]:https://msdn.microsoft.com/en-us/library/7zc28563(v=vs.90).aspx | |||
@@ -1,74 +0,0 @@ | |||
diff -rupN fsedit-qt5-master/CMakeLists.txt fsedit-qt5-cotire/CMakeLists.txt | |||
+++ fsedit-qt5-cotire/CMakeLists.txt 2014-08-28 17:59:58.000000000 +0200 | |||
@@ -3,6 +3,9 @@ cmake_minimum_required(VERSION 2.8 FATAL | |||
cmake_policy(SET CMP0020 NEW) | |||
project(FSEditor) | |||
+include(cotire) | |||
+set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") | |||
+ | |||
include(InstallRequiredSystemLibraries) | |||
set(VERSION_MAJOR 1) | |||
diff -rupN fsedit-qt5-master/source/application/CMakeLists.txt fsedit-qt5-cotire/source/application/CMakeLists.txt | |||
+++ fsedit-qt5-cotire/source/application/CMakeLists.txt 2014-08-28 16:48:42.000000000 +0200 | |||
@@ -20,3 +20,7 @@ install(TARGETS fseditor DESTINATION bin | |||
include(tr_sources) | |||
add_tr_sources(${sources}) | |||
+ | |||
+if (COMMAND cotire) | |||
+ cotire(fseditor) | |||
+endif() | |||
diff -rupN fsedit-qt5-master/source/libfstest/CMakeLists.txt fsedit-qt5-cotire/source/libfstest/CMakeLists.txt | |||
+++ fsedit-qt5-cotire/source/libfstest/CMakeLists.txt 2014-08-28 16:49:11.000000000 +0200 | |||
@@ -3,8 +3,12 @@ | |||
add_library(fstest STATIC fstest.h fstest.cpp) | |||
target_link_libraries(fstest | |||
- Qt5::Widgets # ${QT_LIBRARIES} | |||
+ Qt5::Widgets Qt5::Test # ${QT_LIBRARIES} | |||
) | |||
set_target_properties(fstest | |||
PROPERTIES PROJECT_LABEL "libfstest" | |||
) | |||
+ | |||
+if (COMMAND cotire) | |||
+ cotire(fstest) | |||
+endif() | |||
diff -rupN fsedit-qt5-master/source/libmodel/CMakeLists.txt fsedit-qt5-cotire/source/libmodel/CMakeLists.txt | |||
+++ fsedit-qt5-cotire/source/libmodel/CMakeLists.txt 2014-08-28 16:49:18.000000000 +0200 | |||
@@ -37,3 +37,7 @@ fstest(test_libmodel LibModel) | |||
include(tr_sources) | |||
add_tr_sources(${sources} ${headers} ${moc_headers}) | |||
+ | |||
+if (COMMAND cotire) | |||
+ cotire(model) | |||
+endif() | |||
diff -rupN fsedit-qt5-master/source/libmodelcommands/CMakeLists.txt fsedit-qt5-cotire/source/libmodelcommands/CMakeLists.txt | |||
+++ fsedit-qt5-cotire/source/libmodelcommands/CMakeLists.txt 2014-08-28 16:49:25.000000000 +0200 | |||
@@ -21,3 +21,7 @@ target_link_libraries(modelcommands | |||
include(tr_sources) | |||
add_tr_sources(${sources} ${headers}) | |||
+ | |||
+if (COMMAND cotire) | |||
+ cotire(modelcommands) | |||
+endif() | |||
diff -rupN fsedit-qt5-master/source/libui/CMakeLists.txt fsedit-qt5-cotire/source/libui/CMakeLists.txt | |||
+++ fsedit-qt5-cotire/source/libui/CMakeLists.txt 2014-08-28 12:03:28.000000000 +0200 | |||
@@ -48,3 +48,7 @@ target_link_libraries(ui | |||
include(tr_sources) | |||
add_tr_sources(${sources} ${headers} ${moc_headers} ${forms}) | |||
+ | |||
+if (COMMAND cotire) | |||
+ cotire(ui) | |||
+endif() |
@@ -1,68 +0,0 @@ | |||
diff -rupN fseditor-1.0/CMakeLists.txt fseditor-1.0.cotire/CMakeLists.txt | |||
+++ fseditor-1.0.cotire/CMakeLists.txt 2014-08-28 18:28:39.000000000 +0200 | |||
@@ -1,6 +1,9 @@ | |||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) | |||
PROJECT(FSEditor) | |||
+include(cotire) | |||
+set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") | |||
+ | |||
INCLUDE(InstallRequiredSystemLibraries) | |||
SET(VERSION_MAJOR 1) | |||
diff -rupN fseditor-1.0/source/application/CMakeLists.txt fseditor-1.0.cotire/source/application/CMakeLists.txt | |||
+++ fseditor-1.0.cotire/source/application/CMakeLists.txt 2014-08-28 18:24:56.000000000 +0200 | |||
@@ -17,3 +17,7 @@ INSTALL(TARGETS fseditor DESTINATION bin | |||
INCLUDE(tr_sources) | |||
ADD_TR_SOURCES(${sources}) | |||
+ | |||
+if (COMMAND cotire) | |||
+ cotire(fseditor) | |||
+endif() | |||
diff -rupN fseditor-1.0/source/libfstest/CMakeLists.txt fseditor-1.0.cotire/source/libfstest/CMakeLists.txt | |||
+++ fseditor-1.0.cotire/source/libfstest/CMakeLists.txt 2014-08-28 18:25:41.000000000 +0200 | |||
@@ -3,3 +3,7 @@ INCLUDE(${QT_USE_FILE}) | |||
ADD_LIBRARY(fstest STATIC fstest.h fstest.cpp) | |||
SET_TARGET_PROPERTIES(fstest PROPERTIES PROJECT_LABEL "libfstest") | |||
+ | |||
+if (COMMAND cotire) | |||
+ cotire(fstest) | |||
+endif() | |||
diff -rupN fseditor-1.0/source/libmodel/CMakeLists.txt fseditor-1.0.cotire/source/libmodel/CMakeLists.txt | |||
+++ fseditor-1.0.cotire/source/libmodel/CMakeLists.txt 2013-10-06 20:05:06.000000000 +0200 | |||
@@ -34,3 +34,7 @@ FSTEST(test_libmodel LibModel) | |||
INCLUDE(tr_sources) | |||
ADD_TR_SOURCES(${sources} ${headers} ${moc_headers}) | |||
+ | |||
+if (COMMAND cotire) | |||
+ cotire(model) | |||
+endif() | |||
diff -rupN fseditor-1.0/source/libmodelcommands/CMakeLists.txt fseditor-1.0.cotire/source/libmodelcommands/CMakeLists.txt | |||
+++ fseditor-1.0.cotire/source/libmodelcommands/CMakeLists.txt 2013-10-06 20:05:11.000000000 +0200 | |||
@@ -18,3 +18,7 @@ TARGET_LINK_LIBRARIES(modelcommands mode | |||
INCLUDE(tr_sources) | |||
ADD_TR_SOURCES(${sources} ${headers}) | |||
+ | |||
+if (COMMAND cotire) | |||
+ cotire(modelcommands) | |||
+endif() | |||
diff -rupN fseditor-1.0/source/libui/CMakeLists.txt fseditor-1.0.cotire/source/libui/CMakeLists.txt | |||
+++ fseditor-1.0.cotire/source/libui/CMakeLists.txt 2013-10-06 20:05:18.000000000 +0200 | |||
@@ -44,3 +44,7 @@ TARGET_LINK_LIBRARIES(ui model modelcomm | |||
INCLUDE(tr_sources) | |||
ADD_TR_SOURCES(${sources} ${headers} ${moc_headers} ${forms}) | |||
+ | |||
+if (COMMAND cotire) | |||
+ cotire(ui) | |||
+endif() |
@@ -22,7 +22,6 @@ features | |||
* Leverages native precompiled header generation features of IDEs (Visual Studio and Xcode). | |||
* Compatible with CMake's [cross-compiling][ccrc] support. | |||
* Compatible with compiler wrappers like [ccache][ccch]. | |||
* Applicable to CMake based Qt projects. | |||
* Tested with Windows, Linux and OS X. | |||
* MIT licensed. | |||
@@ -117,8 +116,8 @@ known issues | |||
[ccch]:https://ccache.samba.org/ | |||
[ccrc]:https://cmake.org/Wiki/CMake_Cross_Compiling | |||
[cgwn]:http://www.cygwin.com/ | |||
[clang]:http://clang.llvm.org/ | |||
[cgwn]:https://www.cygwin.com/ | |||
[clang]:https://clang.llvm.org/ | |||
[cmk]:https://cmake.org/download/ | |||
[gcc]:https://gcc.gnu.org/ | |||
[manual]:https://github.com/sakra/cotire/blob/master/MANUAL.md | |||
@@ -131,7 +130,7 @@ known issues | |||
[xcdt]:https://developer.apple.com/xcode/ | |||
[PCHH]:https://gcc.gnu.org/wiki/PCHHaters | |||
[EoUB]:https://engineering-game-dev.com/2009/12/15/the-evils-of-unity-builds/ | |||
[jom]:http://wiki.qt.io/Jom | |||
[jom]:https://wiki.qt.io/Jom | |||
[intel]:https://software.intel.com/en-us/c-compilers | |||
[XGE]:https://www.incredibuild.com/ | |||
[shrp]:http://unriskinsight.blogspot.co.at/2014/09/sharpen-your-tools.html | |||
[shrp]:https://unriskinsight.blogspot.co.at/2014/09/sharpen-your-tools.html |