瀏覽代碼

cotire 1.6.6

master
Sascha Kratky 11 年之前
父節點
當前提交
3d6d933f65
共有 6 個文件被更改,包括 180 次插入28 次删除
  1. +33
    -27
      CMake/cotire.cmake
  2. +8
    -0
      HISTORY.md
  3. +8
    -0
      MANUAL.md
  4. +68
    -0
      Patches/fsedit-qt5.patch
  5. +62
    -0
      Patches/fseditor-1.0.patch
  6. +1
    -1
      README.md

+ 33
- 27
CMake/cotire.cmake 查看文件

@@ -45,7 +45,7 @@ if (NOT CMAKE_SCRIPT_MODE_FILE)
endif()

set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
set (COTIRE_CMAKE_MODULE_VERSION "1.6.5")
set (COTIRE_CMAKE_MODULE_VERSION "1.6.6")

include(CMakeParseArguments)
include(ProcessorCount)
@@ -1890,8 +1890,8 @@ function (cotire_get_prefix_header_dependencies _language _target _dependencySou
# depend on target source files marked with custom COTIRE_DEPENDENCY property
set (_dependencySources "")
cotire_get_objects_with_property_on(_dependencySources COTIRE_DEPENDENCY SOURCE ${ARGN})
if (CMAKE_${_language}_COMPILER_ID MATCHES "Clang")
# Clang raises a fatal error if a file is not found during preprocessing
if (CMAKE_${_language}_COMPILER_ID MATCHES "GNU|Clang")
# GCC and clang raise a fatal error if a file is not found during preprocessing
# thus we depend on target's generated source files for prefix header generation
cotire_get_objects_with_property_on(_generatedSources GENERATED SOURCE ${ARGN})
if (_generatedSources)
@@ -2712,9 +2712,10 @@ function (cotire_setup_unity_build_target _languages _configurations _targetSour
C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN)
# copy interface stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_STRING
COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_STRING
INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
INTERFACE_AUTOUIC_OPTIONS)
# copy link stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUILD_WITH_INSTALL_RPATH INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
@@ -2727,7 +2728,8 @@ function (cotire_setup_unity_build_target _languages _configurations _targetSour
NO_SONAME SOVERSION VERSION)
# copy Qt stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
AUTOMOC AUTOMOC_MOC_OPTIONS)
AUTOMOC AUTOMOC_MOC_OPTIONS AUTOUIC AUTOUIC_OPTIONS AUTORCC AUTORCC_OPTIONS
AUTOGEN_TARGET_DEPENDS)
# copy cmake stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
IMPLICIT_DEPENDS_INCLUDE_TRANSFORM RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK)
@@ -2847,6 +2849,24 @@ function (cotire_target _target)
endif()
endfunction(cotire_target)

function (cotire_map_libraries _strategy _mappedLibrariesVar)
set (_mappedLibraries "")
foreach (_library ${ARGN})
if (TARGET "${_library}" AND "${_strategy}" MATCHES "COPY_UNITY")
get_target_property(_libraryUnityTargetName ${_library} COTIRE_UNITY_TARGET_NAME)
if (TARGET "${_libraryUnityTargetName}")
list (APPEND _mappedLibraries "${_libraryUnityTargetName}")
else()
list (APPEND _mappedLibraries "${_library}")
endif()
else()
list (APPEND _mappedLibraries "${_library}")
endif()
endforeach()
list (REMOVE_DUPLICATES _mappedLibraries)
set (${_mappedLibrariesVar} ${_mappedLibraries} PARENT_SCOPE)
endfunction()

function (cotire_target_link_libraries _target)
get_target_property(_unityTargetName ${_target} COTIRE_UNITY_TARGET_NAME)
if (TARGET "${_unityTargetName}")
@@ -2857,29 +2877,15 @@ function (cotire_target_link_libraries _target)
if ("${_linkLibrariesStrategy}" MATCHES "^(COPY|COPY_UNITY)$")
if (CMAKE_VERSION VERSION_LESS "2.8.11")
message (WARNING "cotire: unity target link strategy ${_linkLibrariesStrategy} requires CMake 2.8.11 or later. Defaulting to NONE for ${_target}.")
return()
endif()
get_target_property(_linkLibraries ${_target} LINK_LIBRARIES)
if (_linkLibraries)
else()
get_target_property(_linkLibraries ${_target} LINK_LIBRARIES)
get_target_property(_interfaceLinkLibraries ${_target} INTERFACE_LINK_LIBRARIES)
cotire_map_libraries("${_linkLibrariesStrategy}" _unityLinkLibraries ${_linkLibraries} ${_interfaceLinkLibraries})
if (COTIRE_DEBUG)
message (STATUS "target ${_target} link libraries: ${_linkLibraries}")
message (STATUS "unity target ${_unityTargetName} libraries: ${_unityLinkLibraries}")
endif()
set (_unityTargetLibraries "")
foreach (_library ${_linkLibraries})
if (TARGET "${_library}" AND "${_linkLibrariesStrategy}" MATCHES "COPY_UNITY")
get_target_property(_libraryUnityTargetName ${_library} COTIRE_UNITY_TARGET_NAME)
if (TARGET "${_libraryUnityTargetName}")
list (APPEND _unityTargetLibraries "${_libraryUnityTargetName}")
else()
list (APPEND _unityTargetLibraries "${_library}")
endif()
else()
list (APPEND _unityTargetLibraries "${_library}")
endif()
endforeach()
set_property(TARGET ${_unityTargetName} APPEND PROPERTY LINK_LIBRARIES ${_unityTargetLibraries})
if (COTIRE_DEBUG)
message (STATUS "set unity target ${_unityTargetName} link libraries: ${_unityTargetLibraries}")
if (_unityLinkLibraries)
target_link_libraries(${_unityTargetName} ${_unityLinkLibraries})
endif()
endif()
endif()


+ 8
- 0
HISTORY.md 查看文件

@@ -1,3 +1,11 @@
## 1.6.6 (2014-09-21)

* fix GCC issue with prefix header generation when source files are missing.
* fix bug where some target properties were not properly propagated to the generated unity target.
* use `target_link_libraries` to set up the unity target link libraries.
* add Qt4 and Qt5 examples to the `Patches` directory.
* documentation updates.

## 1.6.5 (2014-08-26)

* correctly handle generator expressions used in compile definitions, compile flags and include


+ 8
- 0
MANUAL.md 查看文件

@@ -607,6 +607,12 @@ the property value from its enclosing directory. To make all targets in the proj
...
set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY")

### using cotire with Qt

Cotire is compatible with both Qt4 and Qt5 projects that use CMake as build system. The `Patches`
directory contains examples for the [Qt4][fsedit_qt4] and [Qt5][fsedit_qt5] based variants of the
*FSEditor* sample Qt application.

cotire usage restrictions
-------------------------

@@ -647,6 +653,8 @@ Cotire is not compatible with [Xoreax IncrediBuild][XGE].
[ccch]:http://ccache.samba.org/
[ccch_pch]:http://ccache.samba.org/manual.html#_precompiled_headers
[clang_pch]:http://clang.llvm.org/docs/UsersManual.html#precompiledheaders
[fsedit_qt4]:http://www.vikingsoft.eu/fseditor.html
[fsedit_qt5]:https://github.com/joonhwan/fsedit-qt5
[gcc_pch]:http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html
[kde4macros]:http://kbfxmenu.googlecode.com/svn/trunk/kbfx3/cmakemodules/KDE4Macros.cmake
[msvc_pch]:http://msdn.microsoft.com/en-us/library/szfdksca(v=vs.90).aspx


+ 68
- 0
Patches/fsedit-qt5.patch 查看文件

@@ -0,0 +1,74 @@
diff -rupN fsedit-qt5-master/CMakeLists.txt fsedit-qt5-cotire/CMakeLists.txt
--- fsedit-qt5-master/CMakeLists.txt 2013-09-25 17:02:56.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-master/source/application/CMakeLists.txt 2013-09-25 17:02:56.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-master/source/libfstest/CMakeLists.txt 2013-09-25 17:02:56.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-master/source/libmodel/CMakeLists.txt 2013-09-25 17:02:56.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-master/source/libmodelcommands/CMakeLists.txt 2013-09-25 17:02:56.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-master/source/libui/CMakeLists.txt 2013-09-25 17:02:56.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()

+ 62
- 0
Patches/fseditor-1.0.patch 查看文件

@@ -0,0 +1,68 @@
diff -rupN fseditor-1.0/CMakeLists.txt fseditor-1.0.cotire/CMakeLists.txt
--- fseditor-1.0/CMakeLists.txt 2010-10-01 07:43:16.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/source/application/CMakeLists.txt 2010-10-01 07:43:16.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/source/libfstest/CMakeLists.txt 2010-10-01 07:43:16.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/source/libmodel/CMakeLists.txt 2010-10-01 07:43:16.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/source/libmodelcommands/CMakeLists.txt 2010-10-01 07:43:16.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/source/libui/CMakeLists.txt 2010-10-01 07:43:16.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()

+ 1
- 1
README.md 查看文件

@@ -140,7 +140,7 @@ known issues
[vslstd]:http://msdn.microsoft.com/vstudio/
[xcdt]:http://developer.apple.com/tools/xcode/
[PCHH]:http://gcc.gnu.org/wiki/PCHHaters
[EoUB]:http://leewinder.co.uk/blog/?p=394
[EoUB]:http://engineering-game-dev.com/2009/12/15/the-evils-of-unity-builds/
[jom]:http://qt-project.org/wiki/jom
[intel]:http://software.intel.com/en-us/c-compilers
[XGE]:http://www.incredibuild.com

Loading…
取消
儲存