├── .gitignore ├── src ├── example.h ├── log.h ├── main.cpp ├── log.cpp ├── example.cpp └── CMakeLists.txt ├── .gitattributes ├── CMakeLists.txt ├── Patches ├── cminpack-1.1.4.patch ├── zlib-1.2.6.patch ├── README.md ├── yaml-cpp.patch ├── clang-3.1.src.patch ├── clang-3.0.src.patch ├── libpng-1.5.9.patch ├── clang-3.5.src.patch ├── clang-3.3.src.patch ├── clang-3.4.src.patch ├── llvm-3.0.src.patch ├── llvm-3.1.src.patch ├── llvm-3.4.src.patch ├── llvm-3.5.src.patch ├── clapack-3.2.1-CMAKE.patch ├── llvm-3.3.src.patch ├── hdf5-1.8.8.patch ├── cmake-2.8.7.patch ├── OpenCV-2.3.1.patch └── bullet-2.80-rev2531.patch ├── license ├── README.md ├── HISTORY.md └── MANUAL.md /.gitignore: -------------------------------------------------------------------------------- 1 | # ignore CMake build directories 2 | *build*/ 3 | .DS_Store 4 | .project 5 | .idea 6 | -------------------------------------------------------------------------------- /src/example.h: -------------------------------------------------------------------------------- 1 | // cotire example project 2 | 3 | #include 4 | 5 | namespace example { 6 | 7 | std::string get_message(); 8 | 9 | } 10 | 11 | -------------------------------------------------------------------------------- /src/log.h: -------------------------------------------------------------------------------- 1 | // cotire example project 2 | 3 | #include 4 | 5 | namespace logging { 6 | 7 | void error(const std::string& msg); 8 | void info(const std::string& msg); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh eol=lf 2 | bootstrap eol=lf 3 | configure eol=lf 4 | *.[1-9] eol=lf 5 | 6 | *.bat eol=crlf 7 | *.cmd eol=crlf 8 | *.vbs eol=crlf 9 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | // cotire example project main 2 | 3 | #include 4 | 5 | #include "example.h" 6 | #include "log.h" 7 | 8 | int main() 9 | { 10 | std::string msg = example::get_message(); 11 | logging::info(msg); 12 | } 13 | -------------------------------------------------------------------------------- /src/log.cpp: -------------------------------------------------------------------------------- 1 | // cotire example project 2 | 3 | #include "log.h" 4 | 5 | #include 6 | 7 | namespace logging { 8 | 9 | void error(const std::string& msg) { 10 | std::cerr << msg << std::endl; 11 | } 12 | 13 | void info(const std::string& msg) { 14 | std::cout << msg << std::endl; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # cotire example project 2 | 3 | cmake_minimum_required(VERSION 2.8.12) 4 | 5 | if (POLICY CMP0058) 6 | # Ninja requires custom command byproducts to be explicit 7 | cmake_policy(SET CMP0058 NEW) 8 | endif() 9 | 10 | project (CotireExample) 11 | 12 | set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") 13 | 14 | if (NOT CMAKE_VERSION VERSION_LESS "3.1.0") 15 | set (CMAKE_CXX_STANDARD "98") 16 | set (CMAKE_CXX_EXTENSIONS OFF) 17 | endif() 18 | 19 | include(cotire) 20 | 21 | add_subdirectory(src) 22 | -------------------------------------------------------------------------------- /src/example.cpp: -------------------------------------------------------------------------------- 1 | // cotire example project 2 | 3 | #include "example.h" 4 | 5 | #ifndef NDEBUG 6 | #include 7 | #include 8 | #endif 9 | 10 | namespace example { 11 | 12 | std::string get_message() { 13 | char msg_chrs[] = { 'C', 'o', 't', 'i', 'r', 'e', 'd', '!' }; 14 | #ifdef NDEBUG 15 | return std::string(&msg_chrs[0], &msg_chrs[sizeof(msg_chrs)]); 16 | #else 17 | std::string msg; 18 | msg.reserve(sizeof(msg_chrs)); 19 | std::copy(msg_chrs, msg_chrs + sizeof(msg_chrs), std::back_inserter(msg)); 20 | return msg; 21 | #endif 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Patches/cminpack-1.1.4.patch: -------------------------------------------------------------------------------- 1 | diff -rupN cminpack-1.1.4/CMakeLists.txt cminpack-1.1.4.cotire/CMakeLists.txt 2 | --- cminpack-1.1.4/CMakeLists.txt 2011-04-15 08:51:13.000000000 +0200 3 | +++ cminpack-1.1.4.cotire/CMakeLists.txt 2012-03-24 20:21:19.000000000 +0100 4 | @@ -6,6 +6,7 @@ project (CMINPACK) 5 | string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) 6 | 7 | include(${PROJECT_SOURCE_DIR}/cmake/cminpack_utils.cmake) 8 | +include(${PROJECT_SOURCE_DIR}/cmake/cotire.cmake) 9 | # Set version and OS-specific settings 10 | set(CMINPACK_VERSION 1.0.90 CACHE STRING "CMinpack version") 11 | DISSECT_VERSION() 12 | @@ -70,3 +71,6 @@ endif (USE_FPIC AND NOT SHARED_LIBS) 13 | 14 | set_target_properties(cminpack PROPERTIES VERSION ${CMINPACK_VERSION}) 15 | 16 | +if (COMMAND cotire) 17 | + cotire(cminpack) 18 | +endif() 19 | -------------------------------------------------------------------------------- /Patches/zlib-1.2.6.patch: -------------------------------------------------------------------------------- 1 | diff -rupN zlib-1.2.6/CMakeLists.txt zlib-1.2.6.cotire/CMakeLists.txt 2 | --- zlib-1.2.6/CMakeLists.txt 2012-01-17 03:51:23.000000000 +0100 3 | +++ zlib-1.2.6.cotire/CMakeLists.txt 2012-03-24 21:08:41.000000000 +0100 4 | @@ -7,6 +7,8 @@ if(NOT DEFINED BUILD_SHARED_LIBS) 5 | option(BUILD_SHARED_LIBS "Build a shared library form of zlib" ON) 6 | endif() 7 | 8 | +include("${CMAKE_SOURCE_DIR}/cotire.cmake") 9 | + 10 | include(CheckTypeSize) 11 | include(CheckFunctionExists) 12 | include(CheckIncludeFile) 13 | @@ -176,6 +178,10 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_I 14 | install(FILES zlib.3 DESTINATION share/man/man3) 15 | endif() 16 | 17 | +if (COMMAND cotire) 18 | + cotire(zlib) 19 | +endif() 20 | + 21 | #============================================================================ 22 | # Example binaries 23 | #============================================================================ 24 | -------------------------------------------------------------------------------- /Patches/README.md: -------------------------------------------------------------------------------- 1 | This directory contains patch files to enable cotire for some popular open sources packages that 2 | use CMake as a build system. 3 | 4 | For example, to apply Cotire to LLVM 3.0, first copy `cotire.cmake` to a directory on the CMake 5 | module search path (e.g., `llvm-3.0.src/cmake/modules`). 6 | 7 | Then apply the corresponding patch: 8 | 9 | $ cd /path/to/llvm-3.0.src 10 | $ patch -p1 < /path/to/llvm-3.0.src.patch 11 | 12 | Then proceed with an out-of-source CMake build: 13 | 14 | $ mkdir build; cd build 15 | $ cmake .. 16 | -- The C compiler identification is GNU 4.2.1 17 | -- The CXX compiler identification is Clang 3.1.0 18 | ... 19 | $ make 20 | [ 0%] Generating C unity source lib/Support/cotire/LLVMSupport_C_unity.c 21 | [ 0%] Generating CXX unity source lib/Support/cotire/LLVMSupport_CXX_unity.cxx 22 | [ 0%] Generating CXX prefix header lib/Support/cotire/LLVMSupport_CXX_prefix.hxx 23 | [ 0%] Building CXX precompiled header lib/Support/cotire/LLVMSupport_CXX_prefix.hxx.gch 24 | ... 25 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2018 Sascha Kratky 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # cotire example project 2 | 3 | add_executable(example main.cpp example.cpp log.cpp log.h example.h) 4 | 5 | # enable warnings 6 | if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") 7 | set_target_properties(example PROPERTIES COMPILE_FLAGS "-Weverything") 8 | elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") 9 | set_target_properties(example PROPERTIES COMPILE_FLAGS "-Wall -Wextra") 10 | endif() 11 | 12 | cotire(example) 13 | 14 | # cotire sets the following properties 15 | get_target_property(_unitySource example COTIRE_CXX_UNITY_SOURCE) 16 | get_target_property(_prefixHeader example COTIRE_CXX_PREFIX_HEADER) 17 | get_target_property(_precompiledHeader example COTIRE_CXX_PRECOMPILED_HEADER) 18 | get_target_property(_unityTargetName example COTIRE_UNITY_TARGET_NAME) 19 | 20 | if (_unitySource) 21 | message(STATUS "example unity source: ${_unitySource}") 22 | endif() 23 | if (_prefixHeader) 24 | message(STATUS "example prefix header: ${_prefixHeader}") 25 | endif() 26 | if (_precompiledHeader) 27 | message(STATUS "example precompiled header: ${_precompiledHeader}") 28 | endif() 29 | if (TARGET ${_unityTargetName}) 30 | message(STATUS "example unity target: ${_unityTargetName}") 31 | endif() 32 | -------------------------------------------------------------------------------- /Patches/yaml-cpp.patch: -------------------------------------------------------------------------------- 1 | diff -rupN yaml-cpp/CMakeLists.txt yaml-cpp-cotire/CMakeLists.txt 2 | --- yaml-cpp/CMakeLists.txt 2012-01-21 09:52:48.000000000 +0100 3 | +++ yaml-cpp-cotire/CMakeLists.txt 2012-03-24 17:14:15.000000000 +0100 4 | @@ -14,6 +14,7 @@ if(POLICY CMP0015) 5 | endif() 6 | 7 | include(CheckCXXCompilerFlag) 8 | +include("${CMAKE_SOURCE_DIR}/cotire.cmake") 9 | 10 | 11 | ### 12 | @@ -235,6 +236,7 @@ add_library(yaml-cpp 13 | ${contrib_private_headers} 14 | ) 15 | 16 | +cotire(yaml-cpp) 17 | set_target_properties(yaml-cpp PROPERTIES 18 | VERSION "${YAML_CPP_VERSION}" 19 | SOVERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}" 20 | diff -rupN yaml-cpp/test/CMakeLists.txt yaml-cpp-cotire/test/CMakeLists.txt 21 | --- yaml-cpp/test/CMakeLists.txt 2012-01-21 09:52:48.000000000 +0100 22 | +++ yaml-cpp-cotire/test/CMakeLists.txt 2012-02-19 10:21:36.000000000 +0100 23 | @@ -13,3 +13,5 @@ add_executable(run-tests 24 | target_link_libraries(run-tests yaml-cpp) 25 | 26 | add_test(yaml-reader-test run-tests) 27 | + 28 | +cotire(run-tests) 29 | \ No newline at end of file 30 | diff -rupN yaml-cpp/util/CMakeLists.txt yaml-cpp-cotire/util/CMakeLists.txt 31 | --- yaml-cpp/util/CMakeLists.txt 2012-01-21 09:52:48.000000000 +0100 32 | +++ yaml-cpp-cotire/util/CMakeLists.txt 2012-02-19 10:21:54.000000000 +0100 33 | @@ -1,2 +1,3 @@ 34 | add_executable(parse parse.cpp) 35 | target_link_libraries(parse yaml-cpp) 36 | +cotire(parse) 37 | \ No newline at end of file 38 | -------------------------------------------------------------------------------- /Patches/clang-3.1.src.patch: -------------------------------------------------------------------------------- 1 | diff -rupN clang-3.1.src/CMakeLists.txt clang-3.1.src.cotire/CMakeLists.txt 2 | --- clang-3.1.src/CMakeLists.txt 2012-04-16 06:16:43.000000000 +0200 3 | +++ clang-3.1.src.cotire/CMakeLists.txt 2012-05-23 19:34:06.000000000 +0200 4 | @@ -36,6 +36,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR 5 | include(TableGen) 6 | include("${CLANG_PATH_TO_LLVM_BUILD}/share/llvm/cmake/LLVMConfig.cmake") 7 | include(HandleLLVMOptions) 8 | + include(cotire) 9 | 10 | set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") 11 | 12 | @@ -211,6 +212,11 @@ macro(add_clang_library name) 13 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} 14 | RUNTIME DESTINATION bin) 15 | set_target_properties(${name} PROPERTIES FOLDER "Clang libraries") 16 | + if (COMMAND cotire) 17 | + if (NOT "${name}" MATCHES "libclang") 18 | + cotire(${name}) 19 | + endif() 20 | + endif() 21 | endmacro(add_clang_library) 22 | 23 | macro(add_clang_executable name) 24 | diff -rupN clang-3.1.src/tools/libclang/CMakeLists.txt clang-3.1.src.cotire/tools/libclang/CMakeLists.txt 25 | --- clang-3.1.src/tools/libclang/CMakeLists.txt 2012-04-13 19:26:32.000000000 +0200 26 | +++ clang-3.1.src.cotire/tools/libclang/CMakeLists.txt 2012-05-23 19:34:06.000000000 +0200 27 | @@ -88,3 +88,8 @@ if( NOT BUILD_SHARED_LIBS AND NOT WIN32 28 | PROPERTIES 29 | OUTPUT_NAME "libclang") 30 | endif() 31 | + 32 | +if (COMMAND cotire) 33 | + cotire(libclang) 34 | + cotire(${LIBCLANG_STATIC_TARGET_NAME}) 35 | +endif() 36 | -------------------------------------------------------------------------------- /Patches/clang-3.0.src.patch: -------------------------------------------------------------------------------- 1 | diff -rupN clang-3.0.src/CMakeLists.txt clang-3.0.src.cotire/CMakeLists.txt 2 | --- clang-3.0.src/CMakeLists.txt 2011-10-06 15:03:08.000000000 +0200 3 | +++ clang-3.0.src.cotire/CMakeLists.txt 2012-03-24 14:04:10.000000000 +0100 4 | @@ -36,6 +36,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR 5 | include(TableGen) 6 | include("${CLANG_PATH_TO_LLVM_BUILD}/share/llvm/cmake/LLVMConfig.cmake") 7 | include(HandleLLVMOptions) 8 | + include(cotire) 9 | 10 | set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") 11 | 12 | @@ -206,6 +207,11 @@ macro(add_clang_library name) 13 | LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} 14 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) 15 | set_target_properties(${name} PROPERTIES FOLDER "Clang libraries") 16 | + if (COMMAND cotire) 17 | + if (NOT "${name}" MATCHES "libclang") 18 | + cotire(${name}) 19 | + endif() 20 | + endif() 21 | endmacro(add_clang_library) 22 | 23 | macro(add_clang_executable name) 24 | diff -rupN clang-3.0.src/tools/libclang/CMakeLists.txt clang-3.0.src.cotire/tools/libclang/CMakeLists.txt 25 | --- clang-3.0.src/tools/libclang/CMakeLists.txt 2011-10-06 09:00:54.000000000 +0200 26 | +++ clang-3.0.src.cotire/tools/libclang/CMakeLists.txt 2012-03-24 14:05:02.000000000 +0100 27 | @@ -70,3 +70,8 @@ if( NOT BUILD_SHARED_LIBS AND NOT WIN32 28 | PROPERTIES 29 | OUTPUT_NAME "libclang") 30 | endif() 31 | + 32 | +if (COMMAND cotire) 33 | + cotire(libclang) 34 | + cotire(${LIBCLANG_STATIC_TARGET_NAME}) 35 | +endif() 36 | -------------------------------------------------------------------------------- /Patches/libpng-1.5.9.patch: -------------------------------------------------------------------------------- 1 | diff -rupN libpng-1.5.9/CMakeLists.txt libpng-1.5.9.cotire/CMakeLists.txt 2 | --- libpng-1.5.9/CMakeLists.txt 2012-02-18 21:31:14.000000000 +0100 3 | +++ libpng-1.5.9.cotire/CMakeLists.txt 2012-03-24 18:08:54.000000000 +0100 4 | @@ -9,6 +9,8 @@ 5 | cmake_minimum_required(VERSION 2.4.4) 6 | set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) 7 | 8 | +include("${CMAKE_SOURCE_DIR}/cotire.cmake") 9 | + 10 | if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE) 11 | if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4) 12 | # workaround CMake 2.4.x bug 13 | @@ -146,6 +148,12 @@ if(PNG_SHARED) 14 | set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib") 15 | endif() 16 | target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY}) 17 | + if (COMMAND cotire) 18 | + cotire(${PNG_LIB_NAME}) 19 | + if (TARGET ${PNG_LIB_NAME}_unity) 20 | + target_link_libraries(${PNG_LIB_NAME}_unity ${ZLIB_LIBRARY} ${M_LIBRARY}) 21 | + endif() 22 | + endif() 23 | endif() 24 | 25 | if(PNG_STATIC) 26 | @@ -157,6 +165,12 @@ if(PNG_STATIC) 27 | set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib") 28 | endif() 29 | target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY}) 30 | + if (COMMAND cotire) 31 | + cotire(${PNG_LIB_NAME_STATIC}) 32 | + if (TARGET ${PNG_LIB_NAME_STATIC}_unity) 33 | + target_link_libraries(${PNG_LIB_NAME_STATIC}_unity ${ZLIB_LIBRARY} ${M_LIBRARY}) 34 | + endif() 35 | + endif() 36 | endif() 37 | 38 | if(PNG_SHARED AND WIN32) 39 | -------------------------------------------------------------------------------- /Patches/clang-3.5.src.patch: -------------------------------------------------------------------------------- 1 | diff -rupN --exclude=.DS_Store cfe-3.5.0.src/CMakeLists.txt cfe-3.5.0.src.cotire/CMakeLists.txt 2 | --- cfe-3.5.0.src/CMakeLists.txt 2014-07-16 18:48:33.000000000 +0200 3 | +++ cfe-3.5.0.src.cotire/CMakeLists.txt 2014-12-21 19:58:36.000000000 +0100 4 | @@ -94,6 +94,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR 5 | include(AddLLVM) 6 | include(TableGen) 7 | include(HandleLLVMOptions) 8 | + include(cotire) 9 | + set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") 10 | 11 | set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") 12 | 13 | @@ -343,6 +345,12 @@ macro(add_clang_library name) 14 | endif() 15 | 16 | set_target_properties(${name} PROPERTIES FOLDER "Clang libraries") 17 | + if (COMMAND cotire) 18 | + if (NOT "${name}" MATCHES "libclang") 19 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 20 | + cotire(${name}) 21 | + endif() 22 | + endif() 23 | endmacro(add_clang_library) 24 | 25 | macro(add_clang_executable name) 26 | diff -rupN --exclude=.DS_Store cfe-3.5.0.src/tools/libclang/CMakeLists.txt cfe-3.5.0.src.cotire/tools/libclang/CMakeLists.txt 27 | --- cfe-3.5.0.src/tools/libclang/CMakeLists.txt 2014-07-15 00:17:16.000000000 +0200 28 | +++ cfe-3.5.0.src.cotire/tools/libclang/CMakeLists.txt 2014-12-21 19:58:36.000000000 +0100 29 | @@ -114,3 +114,10 @@ if(ENABLE_SHARED) 30 | LINK_FLAGS ${LIBCLANG_LINK_FLAGS}) 31 | endif() 32 | endif() 33 | + 34 | +if (COMMAND cotire) 35 | + cotire(libclang) 36 | + if (TARGET ${LIBCLANG_STATIC_TARGET_NAME}) 37 | + cotire(${LIBCLANG_STATIC_TARGET_NAME}) 38 | + endif() 39 | +endif() 40 | -------------------------------------------------------------------------------- /Patches/clang-3.3.src.patch: -------------------------------------------------------------------------------- 1 | diff -rupN cfe-3.3.src/CMakeLists.txt cfe-3.3.src.cotire/CMakeLists.txt 2 | --- cfe-3.3.src/CMakeLists.txt 2013-04-22 16:51:21.000000000 +0200 3 | +++ cfe-3.3.src.cotire/CMakeLists.txt 2013-10-13 12:02:05.000000000 +0200 4 | @@ -2,7 +2,7 @@ 5 | # standalone project, using LLVM as an external library: 6 | if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) 7 | project(Clang) 8 | - cmake_minimum_required(VERSION 2.8) 9 | + cmake_minimum_required(VERSION 2.8.11) 10 | 11 | set(CLANG_PATH_TO_LLVM_SOURCE "" CACHE PATH 12 | "Path to LLVM source code. Not necessary if using an installed LLVM.") 13 | @@ -36,6 +36,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR 14 | include(TableGen) 15 | include("${CLANG_PATH_TO_LLVM_BUILD}/share/llvm/cmake/LLVMConfig.cmake") 16 | include(HandleLLVMOptions) 17 | + include(cotire) 18 | + set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") 19 | 20 | set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") 21 | 22 | @@ -234,6 +236,12 @@ macro(add_clang_library name) 23 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} 24 | RUNTIME DESTINATION bin) 25 | set_target_properties(${name} PROPERTIES FOLDER "Clang libraries") 26 | + if (COMMAND cotire) 27 | + if (NOT "${name}" MATCHES "libclang") 28 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 29 | + cotire(${name}) 30 | + endif() 31 | + endif() 32 | endmacro(add_clang_library) 33 | 34 | macro(add_clang_executable name) 35 | diff -rupN cfe-3.3.src/tools/libclang/CMakeLists.txt cfe-3.3.src.cotire/tools/libclang/CMakeLists.txt 36 | --- cfe-3.3.src/tools/libclang/CMakeLists.txt 2013-03-29 22:51:40.000000000 +0100 37 | +++ cfe-3.3.src.cotire/tools/libclang/CMakeLists.txt 2013-10-13 11:32:48.000000000 +0200 38 | @@ -114,3 +114,8 @@ if( NOT BUILD_SHARED_LIBS AND NOT WIN32 39 | PROPERTIES 40 | OUTPUT_NAME "clang") 41 | endif() 42 | + 43 | +if (COMMAND cotire) 44 | + cotire(libclang) 45 | + cotire(${LIBCLANG_STATIC_TARGET_NAME}) 46 | +endif() 47 | -------------------------------------------------------------------------------- /Patches/clang-3.4.src.patch: -------------------------------------------------------------------------------- 1 | diff -rupN clang-3.4.src/CMakeLists.txt clang-3.4.src.cotire/CMakeLists.txt 2 | --- clang-3.4.src/CMakeLists.txt 2013-11-06 09:37:50.000000000 +0100 3 | +++ clang-3.4.src.cotire/CMakeLists.txt 2014-01-17 20:33:42.000000000 +0100 4 | @@ -2,7 +2,7 @@ 5 | # standalone project, using LLVM as an external library: 6 | if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) 7 | project(Clang) 8 | - cmake_minimum_required(VERSION 2.8) 9 | + cmake_minimum_required(VERSION 2.8.11) 10 | 11 | set(CLANG_PATH_TO_LLVM_SOURCE "" CACHE PATH 12 | "Path to LLVM source code. Not necessary if using an installed LLVM.") 13 | @@ -40,6 +40,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR 14 | include(TableGen) 15 | include("${CLANG_PATH_TO_LLVM_BUILD}/share/llvm/cmake/LLVMConfig.cmake") 16 | include(HandleLLVMOptions) 17 | + include(cotire) 18 | + set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") 19 | 20 | set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") 21 | 22 | @@ -286,6 +288,12 @@ macro(add_clang_library name) 23 | endif() 24 | 25 | set_target_properties(${name} PROPERTIES FOLDER "Clang libraries") 26 | + if (COMMAND cotire) 27 | + if (NOT "${name}" MATCHES "libclang") 28 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 29 | + cotire(${name}) 30 | + endif() 31 | + endif() 32 | endmacro(add_clang_library) 33 | 34 | macro(add_clang_executable name) 35 | diff -rupN clang-3.4.src/tools/libclang/CMakeLists.txt clang-3.4.src.cotire/tools/libclang/CMakeLists.txt 36 | --- clang-3.4.src/tools/libclang/CMakeLists.txt 2013-11-13 23:26:04.000000000 +0100 37 | +++ clang-3.4.src.cotire/tools/libclang/CMakeLists.txt 2014-01-17 20:37:53.000000000 +0100 38 | @@ -124,3 +124,10 @@ if( (NOT LLVM_ENABLE_PIC OR LIBCLANG_BUI 39 | PROPERTIES 40 | OUTPUT_NAME "clang") 41 | endif() 42 | + 43 | +if (COMMAND cotire) 44 | + cotire(libclang) 45 | + if (TARGET ${LIBCLANG_STATIC_TARGET_NAME}) 46 | + cotire(${LIBCLANG_STATIC_TARGET_NAME}) 47 | + endif() 48 | +endif() 49 | -------------------------------------------------------------------------------- /Patches/llvm-3.0.src.patch: -------------------------------------------------------------------------------- 1 | diff -rupN llvm-3.0.src/CMakeLists.txt llvm-3.0.src.cotire/CMakeLists.txt 2 | --- llvm-3.0.src/CMakeLists.txt 2011-10-06 03:51:51.000000000 +0200 3 | +++ llvm-3.0.src.cotire/CMakeLists.txt 2012-03-26 20:59:22.000000000 +0200 4 | @@ -15,6 +15,7 @@ set(PACKAGE_VERSION "3.0") 5 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 6 | 7 | include(VersionFromVCS) 8 | +include(cotire) 9 | 10 | option(LLVM_APPEND_VC_REV 11 | "Append the version control system revision id to LLVM version" OFF) 12 | diff -rupN llvm-3.0.src/cmake/modules/AddLLVM.cmake llvm-3.0.src.cotire/cmake/modules/AddLLVM.cmake 13 | --- llvm-3.0.src/cmake/modules/AddLLVM.cmake 2011-07-30 10:47:05.000000000 +0200 14 | +++ llvm-3.0.src.cotire/cmake/modules/AddLLVM.cmake 2012-03-26 20:59:22.000000000 +0200 15 | @@ -25,6 +25,9 @@ macro(add_llvm_library name) 16 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) 17 | endif() 18 | set_target_properties(${name} PROPERTIES FOLDER "Libraries") 19 | + if (COMMAND cotire) 20 | + cotire(${name}) 21 | + endif() 22 | endmacro(add_llvm_library name) 23 | 24 | macro(add_llvm_library_dependencies name) 25 | @@ -69,6 +72,9 @@ ${name} ignored.") 26 | LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} 27 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) 28 | endif() 29 | + if (COMMAND cotire) 30 | + cotire(${name}) 31 | + endif() 32 | endif() 33 | 34 | set_target_properties(${name} PROPERTIES FOLDER "Loadable modules") 35 | @@ -89,6 +95,9 @@ macro(add_llvm_executable name) 36 | add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) 37 | endif( LLVM_COMMON_DEPENDS ) 38 | link_system_libs( ${name} ) 39 | + if (COMMAND cotire) 40 | + cotire(${name}) 41 | + endif() 42 | endmacro(add_llvm_executable name) 43 | 44 | 45 | diff -rupN llvm-3.0.src/lib/Analysis/CMakeLists.txt llvm-3.0.src.cotire/lib/Analysis/CMakeLists.txt 46 | --- llvm-3.0.src/lib/Analysis/CMakeLists.txt 2011-07-29 02:14:25.000000000 +0200 47 | +++ llvm-3.0.src.cotire/lib/Analysis/CMakeLists.txt 2012-03-26 20:59:36.000000000 +0200 48 | @@ -1,3 +1,7 @@ 49 | +if (COMMAND cotire) 50 | + set_source_files_properties (ConstantFolding.cpp PROPERTIES COTIRE_EXCLUDED TRUE) 51 | +endif() 52 | + 53 | add_llvm_library(LLVMAnalysis 54 | AliasAnalysis.cpp 55 | AliasAnalysisCounter.cpp 56 | diff -rupN llvm-3.0.src/lib/Support/CMakeLists.txt llvm-3.0.src.cotire/lib/Support/CMakeLists.txt 57 | --- llvm-3.0.src/lib/Support/CMakeLists.txt 2011-09-13 21:42:16.000000000 +0200 58 | +++ llvm-3.0.src.cotire/lib/Support/CMakeLists.txt 2012-03-26 20:59:22.000000000 +0200 59 | @@ -4,6 +4,10 @@ if( MINGW ) 60 | set(LLVM_REQUIRES_EH 1) 61 | endif() 62 | 63 | +if (COMMAND cotire) 64 | + set_source_files_properties (IsInf.cpp IsNAN.cpp PROPERTIES COTIRE_EXCLUDED TRUE) 65 | +endif() 66 | + 67 | add_llvm_library(LLVMSupport 68 | APFloat.cpp 69 | APInt.cpp 70 | -------------------------------------------------------------------------------- /Patches/llvm-3.1.src.patch: -------------------------------------------------------------------------------- 1 | diff -rupN llvm-3.1.src/CMakeLists.txt llvm-3.1.src.cotire/CMakeLists.txt 2 | --- llvm-3.1.src/CMakeLists.txt 2012-05-16 00:06:08.000000000 +0200 3 | +++ llvm-3.1.src.cotire/CMakeLists.txt 2012-05-23 19:49:12.000000000 +0200 4 | @@ -18,6 +18,7 @@ set(PACKAGE_VERSION "${LLVM_VERSION_MAJO 5 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 6 | 7 | include(VersionFromVCS) 8 | +include(cotire) 9 | 10 | option(LLVM_APPEND_VC_REV 11 | "Append the version control system revision id to LLVM version" OFF) 12 | diff -rupN llvm-3.1.src/cmake/modules/AddLLVM.cmake llvm-3.1.src.cotire/cmake/modules/AddLLVM.cmake 13 | --- llvm-3.1.src/cmake/modules/AddLLVM.cmake 2011-11-29 20:25:30.000000000 +0100 14 | +++ llvm-3.1.src.cotire/cmake/modules/AddLLVM.cmake 2012-05-23 19:49:59.000000000 +0200 15 | @@ -25,6 +25,9 @@ macro(add_llvm_library name) 16 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) 17 | endif() 18 | set_target_properties(${name} PROPERTIES FOLDER "Libraries") 19 | + if (COMMAND cotire) 20 | + cotire(${name}) 21 | + endif() 22 | 23 | # Add the explicit dependency information for this library. 24 | # 25 | @@ -68,6 +71,9 @@ ${name} ignored.") 26 | LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} 27 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) 28 | endif() 29 | + if (COMMAND cotire) 30 | + cotire(${name}) 31 | + endif() 32 | endif() 33 | 34 | set_target_properties(${name} PROPERTIES FOLDER "Loadable modules") 35 | @@ -88,6 +94,9 @@ macro(add_llvm_executable name) 36 | add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) 37 | endif( LLVM_COMMON_DEPENDS ) 38 | link_system_libs( ${name} ) 39 | + if (COMMAND cotire) 40 | + cotire(${name}) 41 | + endif() 42 | endmacro(add_llvm_executable name) 43 | 44 | 45 | diff -rupN llvm-3.1.src/lib/Analysis/CMakeLists.txt llvm-3.1.src.cotire/lib/Analysis/CMakeLists.txt 46 | --- llvm-3.1.src/lib/Analysis/CMakeLists.txt 2012-03-16 06:51:52.000000000 +0100 47 | +++ llvm-3.1.src.cotire/lib/Analysis/CMakeLists.txt 2012-05-23 19:49:12.000000000 +0200 48 | @@ -1,3 +1,7 @@ 49 | +if (COMMAND cotire) 50 | + set_source_files_properties (ConstantFolding.cpp PROPERTIES COTIRE_EXCLUDED TRUE) 51 | +endif() 52 | + 53 | add_llvm_library(LLVMAnalysis 54 | AliasAnalysis.cpp 55 | AliasAnalysisCounter.cpp 56 | diff -rupN llvm-3.1.src/lib/Support/CMakeLists.txt llvm-3.1.src.cotire/lib/Support/CMakeLists.txt 57 | --- llvm-3.1.src/lib/Support/CMakeLists.txt 2012-04-17 22:03:03.000000000 +0200 58 | +++ llvm-3.1.src.cotire/lib/Support/CMakeLists.txt 2012-05-23 19:49:12.000000000 +0200 59 | @@ -4,6 +4,10 @@ if( MINGW ) 60 | set(LLVM_REQUIRES_EH 1) 61 | endif() 62 | 63 | +if (COMMAND cotire) 64 | + set_source_files_properties (IsInf.cpp IsNAN.cpp PROPERTIES COTIRE_EXCLUDED TRUE) 65 | +endif() 66 | + 67 | add_llvm_library(LLVMSupport 68 | APFloat.cpp 69 | APInt.cpp 70 | -------------------------------------------------------------------------------- /Patches/llvm-3.4.src.patch: -------------------------------------------------------------------------------- 1 | diff -rupN llvm-3.4.src/CMakeLists.txt llvm-3.4.src.cotire/CMakeLists.txt 2 | --- llvm-3.4.src/CMakeLists.txt 2013-11-25 19:34:26.000000000 +0100 3 | +++ llvm-3.4.src.cotire/CMakeLists.txt 2014-01-06 20:25:12.000000000 +0100 4 | @@ -1,7 +1,7 @@ 5 | # See docs/CMake.html for instructions about how to build LLVM with CMake. 6 | 7 | project(LLVM) 8 | -cmake_minimum_required(VERSION 2.8) 9 | +cmake_minimum_required(VERSION 2.8.12) 10 | 11 | # Add path for custom modules 12 | set(CMAKE_MODULE_PATH 13 | @@ -25,6 +25,8 @@ if ( LLVM_USE_FOLDERS ) 14 | endif() 15 | 16 | include(VersionFromVCS) 17 | +include(cotire) 18 | +set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") 19 | 20 | option(LLVM_APPEND_VC_REV 21 | "Append the version control system revision id to LLVM version" OFF) 22 | diff -rupN llvm-3.4.src/cmake/modules/AddLLVM.cmake llvm-3.4.src.cotire/cmake/modules/AddLLVM.cmake 23 | --- llvm-3.4.src/cmake/modules/AddLLVM.cmake 2013-08-27 21:25:01.000000000 +0200 24 | +++ llvm-3.4.src.cotire/cmake/modules/AddLLVM.cmake 2014-01-06 20:25:50.000000000 +0100 25 | @@ -41,6 +41,10 @@ macro(add_llvm_library name) 26 | # property has been set to an empty value. 27 | get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name}) 28 | target_link_libraries(${name} ${lib_deps}) 29 | +if (COMMAND cotire) 30 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 31 | + cotire(${name}) 32 | +endif() 33 | endmacro(add_llvm_library name) 34 | 35 | macro(add_llvm_loadable_module name) 36 | @@ -78,6 +82,10 @@ ${name} ignored.") 37 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) 38 | endif() 39 | endif() 40 | +if (COMMAND cotire) 41 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 42 | + cotire(${name}) 43 | +endif() 44 | endif() 45 | 46 | set_target_properties(${name} PROPERTIES FOLDER "Loadable modules") 47 | @@ -119,6 +127,10 @@ macro(add_llvm_tool name) 48 | endif() 49 | endif() 50 | set_target_properties(${name} PROPERTIES FOLDER "Tools") 51 | +if (COMMAND cotire) 52 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 53 | + cotire(${name}) 54 | +endif() 55 | endmacro(add_llvm_tool name) 56 | 57 | 58 | @@ -132,12 +144,20 @@ macro(add_llvm_example name) 59 | install(TARGETS ${name} RUNTIME DESTINATION examples) 60 | endif() 61 | set_target_properties(${name} PROPERTIES FOLDER "Examples") 62 | +if (COMMAND cotire) 63 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 64 | + cotire(${name}) 65 | +endif() 66 | endmacro(add_llvm_example name) 67 | 68 | 69 | macro(add_llvm_utility name) 70 | add_llvm_executable(${name} ${ARGN}) 71 | set_target_properties(${name} PROPERTIES FOLDER "Utils") 72 | +if (COMMAND cotire) 73 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 74 | + cotire(${name}) 75 | +endif() 76 | endmacro(add_llvm_utility name) 77 | 78 | 79 | @@ -245,6 +265,10 @@ function(add_unittest test_suite test_na 80 | set(target_compile_flags "${target_compile_flags} -Wno-variadic-macros") 81 | endif () 82 | set_property(TARGET ${test_name} PROPERTY COMPILE_FLAGS "${target_compile_flags}") 83 | +if (COMMAND cotire) 84 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 85 | + cotire(${name}) 86 | +endif() 87 | endfunction() 88 | 89 | # This function provides an automatic way to 'configure'-like generate a file 90 | diff -rupN llvm-3.4.src/lib/Support/CMakeLists.txt llvm-3.4.src.cotire/lib/Support/CMakeLists.txt 91 | --- llvm-3.4.src/lib/Support/CMakeLists.txt 2013-09-04 18:00:12.000000000 +0200 92 | +++ llvm-3.4.src.cotire/lib/Support/CMakeLists.txt 2014-01-06 20:27:36.000000000 +0100 93 | @@ -1,3 +1,7 @@ 94 | +if (COMMAND cotire) 95 | + set_source_files_properties (IsInf.cpp IsNAN.cpp PROPERTIES COTIRE_EXCLUDED TRUE) 96 | +endif() 97 | + 98 | add_llvm_library(LLVMSupport 99 | APFloat.cpp 100 | APInt.cpp 101 | -------------------------------------------------------------------------------- /Patches/llvm-3.5.src.patch: -------------------------------------------------------------------------------- 1 | diff -rupN --exclude=.DS_Store --exclude='*.pyc' llvm-3.5.0.src/CMakeLists.txt llvm-3.5.0.src.cotire/CMakeLists.txt 2 | --- llvm-3.5.0.src/CMakeLists.txt 2014-07-04 06:23:26.000000000 +0200 3 | +++ llvm-3.5.0.src.cotire/CMakeLists.txt 2014-12-14 12:19:41.000000000 +0100 4 | @@ -1,6 +1,6 @@ 5 | # See docs/CMake.html for instructions about how to build LLVM with CMake. 6 | 7 | -cmake_minimum_required(VERSION 2.8.8) 8 | +cmake_minimum_required(VERSION 2.8.12) 9 | 10 | # FIXME: It may be removed when we use 2.8.12. 11 | if(CMAKE_VERSION VERSION_LESS 2.8.12) 12 | @@ -41,6 +41,8 @@ if ( LLVM_USE_FOLDERS ) 13 | endif() 14 | 15 | include(VersionFromVCS) 16 | +include(cotire) 17 | +set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") 18 | 19 | option(LLVM_APPEND_VC_REV 20 | "Append the version control system revision id to LLVM version" OFF) 21 | diff -rupN --exclude=.DS_Store --exclude='*.pyc' llvm-3.5.0.src/cmake/modules/AddLLVM.cmake llvm-3.5.0.src.cotire/cmake/modules/AddLLVM.cmake 22 | --- llvm-3.5.0.src/cmake/modules/AddLLVM.cmake 2014-07-23 17:19:01.000000000 +0200 23 | +++ llvm-3.5.0.src.cotire/cmake/modules/AddLLVM.cmake 2014-12-14 12:28:35.000000000 +0100 24 | @@ -106,6 +106,10 @@ function(add_llvm_symbol_exports target_ 25 | set_property(TARGET ${target_name} APPEND_STRING PROPERTY 26 | LINK_FLAGS " /DEF:${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}") 27 | endif() 28 | +if (COMMAND cotire) 29 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 30 | + cotire(${name}) 31 | +endif() 32 | endif() 33 | 34 | add_custom_target(${target_name}_exports DEPENDS ${native_export_file}) 35 | @@ -394,6 +398,10 @@ macro(add_llvm_library name) 36 | set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) 37 | endif() 38 | set_target_properties(${name} PROPERTIES FOLDER "Libraries") 39 | +if (COMMAND cotire) 40 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 41 | + cotire(${name}) 42 | +endif() 43 | endmacro(add_llvm_library name) 44 | 45 | macro(add_llvm_loadable_module name) 46 | @@ -422,6 +430,10 @@ macro(add_llvm_loadable_module name) 47 | endif() 48 | 49 | set_target_properties(${name} PROPERTIES FOLDER "Loadable modules") 50 | +if (COMMAND cotire) 51 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 52 | + cotire(${name}) 53 | +endif() 54 | endmacro(add_llvm_loadable_module name) 55 | 56 | 57 | @@ -471,6 +483,10 @@ macro(add_llvm_tool name) 58 | set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) 59 | endif() 60 | set_target_properties(${name} PROPERTIES FOLDER "Tools") 61 | +if (COMMAND cotire) 62 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 63 | + cotire(${name}) 64 | +endif() 65 | endmacro(add_llvm_tool name) 66 | 67 | 68 | @@ -483,12 +499,20 @@ macro(add_llvm_example name) 69 | install(TARGETS ${name} RUNTIME DESTINATION examples) 70 | endif() 71 | set_target_properties(${name} PROPERTIES FOLDER "Examples") 72 | +if (COMMAND cotire) 73 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 74 | + cotire(${name}) 75 | +endif() 76 | endmacro(add_llvm_example name) 77 | 78 | 79 | macro(add_llvm_utility name) 80 | add_llvm_executable(${name} ${ARGN}) 81 | set_target_properties(${name} PROPERTIES FOLDER "Utils") 82 | +if (COMMAND cotire) 83 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 84 | + cotire(${name}) 85 | +endif() 86 | endmacro(add_llvm_utility name) 87 | 88 | 89 | diff -rupN --exclude=.DS_Store --exclude='*.pyc' llvm-3.5.0.src/lib/Support/CMakeLists.txt llvm-3.5.0.src.cotire/lib/Support/CMakeLists.txt 90 | --- llvm-3.5.0.src/lib/Support/CMakeLists.txt 2014-07-17 22:05:29.000000000 +0200 91 | +++ llvm-3.5.0.src.cotire/lib/Support/CMakeLists.txt 2014-12-14 12:17:10.000000000 +0100 92 | @@ -1,3 +1,7 @@ 93 | +if (COMMAND cotire) 94 | + set_source_files_properties (IsInf.cpp IsNAN.cpp PROPERTIES COTIRE_EXCLUDED TRUE) 95 | +endif() 96 | + 97 | add_llvm_library(LLVMSupport 98 | APFloat.cpp 99 | APInt.cpp 100 | -------------------------------------------------------------------------------- /Patches/clapack-3.2.1-CMAKE.patch: -------------------------------------------------------------------------------- 1 | diff -rupN clapack-3.2.1-CMAKE/BLAS/SRC/CMakeLists.txt clapack-3.2.1-CMAKE.cotire/BLAS/SRC/CMakeLists.txt 2 | --- clapack-3.2.1-CMAKE/BLAS/SRC/CMakeLists.txt 2009-08-14 22:16:25.000000000 +0200 3 | +++ clapack-3.2.1-CMAKE.cotire/BLAS/SRC/CMakeLists.txt 2012-03-24 19:59:26.000000000 +0100 4 | @@ -141,3 +141,13 @@ if(UNIX) 5 | target_link_libraries(blas m) 6 | endif() 7 | target_link_libraries(blas f2c) 8 | + 9 | +if (COMMAND cotire) 10 | + cotire(blas) 11 | + if (TARGET blas_unity) 12 | + if(UNIX) 13 | + target_link_libraries(blas_unity m) 14 | + endif() 15 | + target_link_libraries(blas_unity f2c_unity) 16 | + endif() 17 | +endif() 18 | diff -rupN clapack-3.2.1-CMAKE/CMakeLists.txt clapack-3.2.1-CMAKE.cotire/CMakeLists.txt 19 | --- clapack-3.2.1-CMAKE/CMakeLists.txt 2009-08-10 20:46:33.000000000 +0200 20 | +++ clapack-3.2.1-CMAKE.cotire/CMakeLists.txt 2012-03-24 19:56:58.000000000 +0100 21 | @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.6) 22 | project(CLAPACK C) 23 | enable_testing() 24 | include(CTest) 25 | +include("${CMAKE_SOURCE_DIR}/cotire.cmake") 26 | 27 | if(WIN32 AND NOT CYGWIN) 28 | set(SECOND_SRC ${CLAPACK_SOURCE_DIR}/INSTALL/winsecond.c) 29 | diff -rupN clapack-3.2.1-CMAKE/F2CLIBS/libf2c/CMakeLists.txt clapack-3.2.1-CMAKE.cotire/F2CLIBS/libf2c/CMakeLists.txt 30 | --- clapack-3.2.1-CMAKE/F2CLIBS/libf2c/CMakeLists.txt 2009-08-10 20:06:06.000000000 +0200 31 | +++ clapack-3.2.1-CMAKE.cotire/F2CLIBS/libf2c/CMakeLists.txt 2012-03-24 19:58:41.000000000 +0100 32 | @@ -60,3 +60,6 @@ include_directories(${CLAPACK_SOURCE_DIR 33 | include_directories(${CLAPACK_BINARY_DIR}/F2CLIBS/libf2c) 34 | add_library(f2c ${OFILES} ${CMAKE_CURRENT_BINARY_DIR}/arith.h) 35 | set_property(TARGET f2c PROPERTY PREFIX lib) 36 | +if (COMMAND cotire) 37 | + cotire(f2c) 38 | +endif() 39 | diff -rupN clapack-3.2.1-CMAKE/SRC/CMakeLists.txt clapack-3.2.1-CMAKE.cotire/SRC/CMakeLists.txt 40 | --- clapack-3.2.1-CMAKE/SRC/CMakeLists.txt 2009-08-10 19:47:54.000000000 +0200 41 | +++ clapack-3.2.1-CMAKE.cotire/SRC/CMakeLists.txt 2012-03-24 19:59:20.000000000 +0100 42 | @@ -378,3 +378,9 @@ endif() 43 | add_library(lapack ${ALLOBJ} ${ALLXOBJ}) 44 | target_link_libraries(lapack blas) 45 | 46 | +if (COMMAND cotire) 47 | + cotire(lapack) 48 | + if (TARGET lapack_unity) 49 | + target_link_libraries(lapack_unity blas_unity) 50 | + endif() 51 | +endif() 52 | diff -rupN clapack-3.2.1-CMAKE/TESTING/EIG/CMakeLists.txt clapack-3.2.1-CMAKE.cotire/TESTING/EIG/CMakeLists.txt 53 | --- clapack-3.2.1-CMAKE/TESTING/EIG/CMakeLists.txt 2009-08-10 19:47:54.000000000 +0200 54 | +++ clapack-3.2.1-CMAKE.cotire/TESTING/EIG/CMakeLists.txt 2012-03-24 20:07:55.000000000 +0100 55 | @@ -120,6 +120,12 @@ set(ZEIGTST zchkee.c 56 | macro(add_eig_executable name ) 57 | add_executable(${name} ${ARGN}) 58 | target_link_libraries(${name} tmglib lapack ) 59 | + if (COMMAND cotire) 60 | + cotire(${name}) 61 | + if (TARGET ${name}_unity) 62 | + target_link_libraries(${name}_unity tmglib lapack ) 63 | + endif() 64 | + endif() 65 | endmacro(add_eig_executable) 66 | 67 | add_eig_executable(xeigtsts ${SEIGTST} ${SCIGTST} ${AEIGTST} 68 | diff -rupN clapack-3.2.1-CMAKE/TESTING/LIN/CMakeLists.txt clapack-3.2.1-CMAKE.cotire/TESTING/LIN/CMakeLists.txt 69 | --- clapack-3.2.1-CMAKE/TESTING/LIN/CMakeLists.txt 2009-08-10 20:06:06.000000000 +0200 70 | +++ clapack-3.2.1-CMAKE.cotire/TESTING/LIN/CMakeLists.txt 2012-03-24 20:08:13.000000000 +0100 71 | @@ -190,6 +190,12 @@ set(ZLINTSTRFP zchkrfp.c zdrvrfp.c zdrv 72 | macro(add_lin_executable name ) 73 | add_executable(${name} ${ARGN}) 74 | target_link_libraries(${name} tmglib lapack) 75 | + if (COMMAND cotire) 76 | + cotire(${name}) 77 | + if (TARGET ${name}_unity) 78 | + target_link_libraries(${name}_unity tmglib lapack ) 79 | + endif() 80 | + endif() 81 | endmacro(add_lin_executable) 82 | 83 | add_lin_executable(xlintsts ${ALINTST} ${SCLNTST} ${SLINTST} 84 | diff -rupN clapack-3.2.1-CMAKE/TESTING/MATGEN/CMakeLists.txt clapack-3.2.1-CMAKE.cotire/TESTING/MATGEN/CMakeLists.txt 85 | --- clapack-3.2.1-CMAKE/TESTING/MATGEN/CMakeLists.txt 2009-08-10 19:47:54.000000000 +0200 86 | +++ clapack-3.2.1-CMAKE.cotire/TESTING/MATGEN/CMakeLists.txt 2012-03-24 20:05:19.000000000 +0100 87 | @@ -67,3 +67,6 @@ if(BUILD_COMPLEX16) 88 | endif() 89 | add_library(tmglib ${ALLOBJ} ) 90 | 91 | +if (COMMAND cotire) 92 | + cotire(tmglib) 93 | +endif() 94 | -------------------------------------------------------------------------------- /Patches/llvm-3.3.src.patch: -------------------------------------------------------------------------------- 1 | diff -rupN llvm-3.3.src/CMakeLists.txt llvm-3.3.src.cotire/CMakeLists.txt 2 | --- llvm-3.3.src/CMakeLists.txt 2013-05-06 18:23:07.000000000 +0200 3 | +++ llvm-3.3.src.cotire/CMakeLists.txt 2013-10-13 10:05:20.000000000 +0200 4 | @@ -1,7 +1,7 @@ 5 | # See docs/CMake.html for instructions about how to build LLVM with CMake. 6 | 7 | project(LLVM) 8 | -cmake_minimum_required(VERSION 2.8) 9 | +cmake_minimum_required(VERSION 2.8.11) 10 | 11 | # Add path for custom modules 12 | set(CMAKE_MODULE_PATH 13 | @@ -21,6 +21,8 @@ if ( LLVM_USE_FOLDERS ) 14 | endif() 15 | 16 | include(VersionFromVCS) 17 | +include(cotire) 18 | +set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY") 19 | 20 | option(LLVM_APPEND_VC_REV 21 | "Append the version control system revision id to LLVM version" OFF) 22 | @@ -187,7 +189,7 @@ option(LLVM_USE_OPROFILE 23 | # If enabled, verify we are on a platform that supports oprofile. 24 | if( LLVM_USE_OPROFILE ) 25 | if( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" ) 26 | - message(FATAL_ERROR "OProfile support is available on Linux only.") 27 | + message(FATAL_ERROR "OProfile support is available on Linux only.") 28 | endif( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" ) 29 | endif( LLVM_USE_OPROFILE ) 30 | 31 | diff -rupN llvm-3.3.src/cmake/modules/AddLLVM.cmake llvm-3.3.src.cotire/cmake/modules/AddLLVM.cmake 32 | --- llvm-3.3.src/cmake/modules/AddLLVM.cmake 2013-04-21 11:04:59.000000000 +0200 33 | +++ llvm-3.3.src.cotire/cmake/modules/AddLLVM.cmake 2013-10-13 10:43:04.000000000 +0200 34 | @@ -34,6 +34,10 @@ macro(add_llvm_library name) 35 | # property has been set to an empty value. 36 | get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name}) 37 | target_link_libraries(${name} ${lib_deps}) 38 | +if (COMMAND cotire) 39 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 40 | + cotire(${name}) 41 | +endif() 42 | endmacro(add_llvm_library name) 43 | 44 | macro(add_llvm_loadable_module name) 45 | @@ -69,6 +73,10 @@ ${name} ignored.") 46 | LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} 47 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) 48 | endif() 49 | +if (COMMAND cotire) 50 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 51 | + cotire(${name}) 52 | +endif() 53 | endif() 54 | 55 | set_target_properties(${name} PROPERTIES FOLDER "Loadable modules") 56 | @@ -101,6 +109,10 @@ macro(add_llvm_tool name) 57 | install(TARGETS ${name} RUNTIME DESTINATION bin) 58 | endif() 59 | set_target_properties(${name} PROPERTIES FOLDER "Tools") 60 | +if (COMMAND cotire) 61 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 62 | + cotire(${name}) 63 | +endif() 64 | endmacro(add_llvm_tool name) 65 | 66 | 67 | @@ -114,12 +126,20 @@ macro(add_llvm_example name) 68 | install(TARGETS ${name} RUNTIME DESTINATION examples) 69 | endif() 70 | set_target_properties(${name} PROPERTIES FOLDER "Examples") 71 | +if (COMMAND cotire) 72 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 73 | + cotire(${name}) 74 | +endif() 75 | endmacro(add_llvm_example name) 76 | 77 | 78 | macro(add_llvm_utility name) 79 | add_llvm_executable(${name} ${ARGN}) 80 | set_target_properties(${name} PROPERTIES FOLDER "Utils") 81 | +if (COMMAND cotire) 82 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 83 | + cotire(${name}) 84 | +endif() 85 | endmacro(add_llvm_utility name) 86 | 87 | 88 | @@ -198,6 +218,10 @@ function(add_unittest test_suite test_na 89 | set(target_compile_flags "${target_compile_flags} -Wno-variadic-macros") 90 | endif () 91 | set_property(TARGET ${test_name} PROPERTY COMPILE_FLAGS "${target_compile_flags}") 92 | +if (COMMAND cotire) 93 | + set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 94 | + cotire(${name}) 95 | +endif() 96 | endfunction() 97 | 98 | # This function provides an automatic way to 'configure'-like generate a file 99 | diff -rupN llvm-3.3.src/include/llvm/Transforms/Utils/BlackList.h llvm-3.3.src.cotire/include/llvm/Transforms/Utils/BlackList.h 100 | --- llvm-3.3.src/include/llvm/Transforms/Utils/BlackList.h 2013-04-11 15:20:00.000000000 +0200 101 | +++ llvm-3.3.src.cotire/include/llvm/Transforms/Utils/BlackList.h 2013-10-13 11:52:41.000000000 +0200 102 | @@ -30,6 +30,9 @@ 103 | //===----------------------------------------------------------------------===// 104 | // 105 | 106 | +#ifndef LLVM_TRANSFORMS_UTILS_BLACKLIST_H 107 | +#define LLVM_TRANSFORMS_UTILS_BLACKLIST_H 108 | + 109 | #include "llvm/ADT/StringMap.h" 110 | 111 | namespace llvm { 112 | @@ -57,3 +60,5 @@ class BlackList { 113 | }; 114 | 115 | } // namespace llvm 116 | + 117 | +#endif 118 | diff -rupN llvm-3.3.src/lib/Support/CMakeLists.txt llvm-3.3.src.cotire/lib/Support/CMakeLists.txt 119 | --- llvm-3.3.src/lib/Support/CMakeLists.txt 2013-04-23 10:28:39.000000000 +0200 120 | +++ llvm-3.3.src.cotire/lib/Support/CMakeLists.txt 2013-10-13 10:25:45.000000000 +0200 121 | @@ -1,3 +1,7 @@ 122 | +if (COMMAND cotire) 123 | + set_source_files_properties (IsInf.cpp IsNAN.cpp PROPERTIES COTIRE_EXCLUDED TRUE) 124 | +endif() 125 | + 126 | add_llvm_library(LLVMSupport 127 | APFloat.cpp 128 | APInt.cpp 129 | -------------------------------------------------------------------------------- /Patches/hdf5-1.8.8.patch: -------------------------------------------------------------------------------- 1 | diff -rupN hdf5-1.8.8/CMakeLists.txt hdf5-1.8.8.cotire/CMakeLists.txt 2 | --- hdf5-1.8.8/CMakeLists.txt 2011-11-07 23:11:41.000000000 +0100 3 | +++ hdf5-1.8.8.cotire/CMakeLists.txt 2012-03-24 17:30:29.000000000 +0100 4 | @@ -200,6 +200,7 @@ SET (HDF5_PACKAGE_BUGREPORT "help@hdfgro 5 | #----------------------------------------------------------------------------- 6 | INCLUDE (${HDF5_RESOURCES_DIR}/HDFMacros.cmake) 7 | INCLUDE (${HDF5_RESOURCES_DIR}/HDF5Macros.cmake) 8 | +INCLUDE (${HDF5_RESOURCES_DIR}/cotire.cmake) 9 | 10 | #----------------------------------------------------------------------------- 11 | # Setup output Directories 12 | diff -rupN hdf5-1.8.8/c++/src/CMakeLists.txt hdf5-1.8.8.cotire/c++/src/CMakeLists.txt 13 | --- hdf5-1.8.8/c++/src/CMakeLists.txt 2011-11-07 23:11:40.000000000 +0100 14 | +++ hdf5-1.8.8.cotire/c++/src/CMakeLists.txt 2012-03-24 17:29:43.000000000 +0100 15 | @@ -85,6 +85,9 @@ ADD_LIBRARY (${HDF5_CPP_LIB_TARGET} ${LI 16 | TARGET_LINK_LIBRARIES (${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) 17 | SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}") 18 | H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} ${LIB_TYPE}) 19 | +if (COMMAND cotire) 20 | +cotire(${HDF5_CPP_LIB_TARGET}) 21 | +endif() 22 | 23 | #----------------------------------------------------------------------------- 24 | # Add file(s) to CMake Install 25 | diff -rupN hdf5-1.8.8/fortran/src/CMakeLists.txt hdf5-1.8.8.cotire/fortran/src/CMakeLists.txt 26 | --- hdf5-1.8.8/fortran/src/CMakeLists.txt 2011-11-07 23:11:41.000000000 +0100 27 | +++ hdf5-1.8.8.cotire/fortran/src/CMakeLists.txt 2012-03-24 17:30:02.000000000 +0100 28 | @@ -118,6 +118,9 @@ ADD_LIBRARY (${HDF5_F90_C_LIB_TARGET} ${ 29 | TARGET_LINK_LIBRARIES (${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET}) 30 | SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") 31 | H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} ${LIB_TYPE}) 32 | +if (COMMAND cotire) 33 | +cotire(${HDF5_F90_C_LIB_TARGET}) 34 | +endif() 35 | 36 | #----------------------------------------------------------------------------- 37 | # Fortran 2003 standard 38 | @@ -221,6 +224,7 @@ SET_TARGET_PROPERTIES (${HDF5_F90_LIB_TA 39 | TARGET_LINK_LIBRARIES (${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET}) 40 | SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") 41 | H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} ${LIB_TYPE}) 42 | +cotire(${HDF5_F90_LIB_TARGET}) 43 | 44 | #----------------------------------------------------------------------------- 45 | # Add file(s) to CMake Install 46 | diff -rupN hdf5-1.8.8/hl/c++/src/CMakeLists.txt hdf5-1.8.8.cotire/hl/c++/src/CMakeLists.txt 47 | --- hdf5-1.8.8/hl/c++/src/CMakeLists.txt 2011-11-07 23:11:39.000000000 +0100 48 | +++ hdf5-1.8.8.cotire/hl/c++/src/CMakeLists.txt 2012-03-24 17:29:52.000000000 +0100 49 | @@ -18,6 +18,9 @@ TARGET_LINK_LIBRARIES ( 50 | ) 51 | SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") 52 | H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} ${LIB_TYPE}) 53 | +if (COMMAND cotire) 54 | +cotire(${HDF5_HL_CPP_LIB_TARGET}) 55 | +endif() 56 | 57 | #----------------------------------------------------------------------------- 58 | # Add file(s) to CMake Install 59 | diff -rupN hdf5-1.8.8/hl/src/CMakeLists.txt hdf5-1.8.8.cotire/hl/src/CMakeLists.txt 60 | --- hdf5-1.8.8/hl/src/CMakeLists.txt 2011-11-07 23:11:38.000000000 +0100 61 | +++ hdf5-1.8.8.cotire/hl/src/CMakeLists.txt 2012-03-24 17:30:11.000000000 +0100 62 | @@ -37,6 +37,9 @@ ADD_LIBRARY (${HDF5_HL_LIB_TARGET} ${LIB 63 | TARGET_LINK_LIBRARIES (${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) 64 | SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") 65 | H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} ${LIB_TYPE}) 66 | +if (COMMAND cotire) 67 | +cotire(${HDF5_HL_LIB_TARGET}) 68 | +endif() 69 | 70 | #----------------------------------------------------------------------------- 71 | # Add file(s) to CMake Install 72 | diff -rupN hdf5-1.8.8/src/CMakeLists.txt hdf5-1.8.8.cotire/src/CMakeLists.txt 73 | --- hdf5-1.8.8/src/CMakeLists.txt 2011-11-07 23:11:30.000000000 +0100 74 | +++ hdf5-1.8.8.cotire/src/CMakeLists.txt 2012-03-24 17:29:26.000000000 +0100 75 | @@ -631,6 +631,16 @@ ADD_LIBRARY (${HDF5_LIB_TARGET} ${LIB_TY 76 | TARGET_LINK_LIBRARIES (${HDF5_LIB_TARGET} ${LINK_LIBS}) 77 | SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) 78 | H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} ${LIB_TYPE}) 79 | +#set_target_properties(${HDF5_LIB_TARGET} PROPERTIES COTIRE_IGNORED_INCLUDE_DIRECTORIES "/Developer/usr;/usr/llvm-gcc-4.2;${CMAKE_SOURCE_DIR};${CMAKE_BINARY_DIR}") 80 | + 81 | +if (COMMAND cotire) 82 | +SET_SOURCE_FILES_PROPERTIES ( 83 | +"${HDF5_BINARY_DIR}/H5overflow.h" 84 | +"${HDF5_BINARY_DIR}/H5version.h" 85 | +"${HDF5_BINARY_DIR}/H5Edefin.h" 86 | +PROPERTIES COTIRE_DEPENDENCY FALSE) 87 | +cotire(${HDF5_LIB_TARGET}) 88 | +endif() 89 | 90 | #----------------------------------------------------------------------------- 91 | # Add file(s) to CMake Install 92 | Binary files hdf5-1.8.8/src/H5public.h.gch and hdf5-1.8.8.cotire/src/H5public.h.gch differ 93 | diff -rupN hdf5-1.8.8/test/CMakeLists.txt hdf5-1.8.8.cotire/test/CMakeLists.txt 94 | --- hdf5-1.8.8/test/CMakeLists.txt 2011-11-07 23:11:23.000000000 +0100 95 | +++ hdf5-1.8.8.cotire/test/CMakeLists.txt 2012-03-24 17:30:22.000000000 +0100 96 | @@ -30,6 +30,9 @@ IF (MINGW) 97 | ENDIF (MINGW) 98 | TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) 99 | H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} ${LIB_TYPE}) 100 | +if (COMMAND cotire) 101 | +cotire(${HDF5_TEST_LIB_TARGET}) 102 | +endif() 103 | 104 | # -------------------------------------------------------------------- 105 | # Copy all the HDF5 files from the test directory into the source directory 106 | diff -rupN hdf5-1.8.8/tools/lib/CMakeLists.txt hdf5-1.8.8.cotire/tools/lib/CMakeLists.txt 107 | --- hdf5-1.8.8/tools/lib/CMakeLists.txt 2011-11-07 23:11:35.000000000 +0100 108 | +++ hdf5-1.8.8.cotire/tools/lib/CMakeLists.txt 2012-03-24 17:28:41.000000000 +0100 109 | @@ -40,6 +40,9 @@ H5_SET_LIB_OPTIONS ( 110 | HDF5_TOOLS_LIB_NAME_RELEASE 111 | HDF5_TOOLS_LIB_NAME_DEBUG 112 | ) 113 | +if (COMMAND cotire) 114 | +cotire(${HDF5_TOOLS_LIB_TARGET}) 115 | +endif() 116 | 117 | ############################################################################## 118 | ############################################################################## 119 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | cotire 2 | ====== 3 | 4 | Cotire (compile time reducer) is a CMake module that speeds up the build process of CMake based 5 | build systems by fully automating techniques as [precompiled header][pch] usage and 6 | [single compilation unit][scu] builds for C and C++. 7 | 8 | The functionality provided by cotire has been superseded by features added to [CMake 3.16][cmkr]. 9 | Support for [pre-compiling][cpch] and [unity builds][cscu] is now built into CMake. Thus, there 10 | will not be any further updates or support for this project. 11 | 12 | features 13 | -------- 14 | 15 | * Non-intrusive. Requires no source code modification and only minimal changes to CMake list files. 16 | * Automatically generates a [single compilation unit][scu] (aka unity source file) for a CMake target. 17 | * Automatically generates a [prefix header][pfh] by tracking includes used by a CMake target. 18 | * Automatically precompiles prefix header and applies resulting [precompiled header][pch] to a CMake target. 19 | * Alternatively, allows for using manually maintained unity source and prefix header files. 20 | * Supports C/C++ compilers Clang, GCC, Intel and Visual Studio C++. 21 | * Supports mixed language CMake targets. 22 | * Supports console (Makefile generator) and IDE (Visual Studio and Xcode) based builds. 23 | * Compatible with CMake single build type and CMake multi-configuration builds. 24 | * Compatible with most CMake generators (including [Ninja][ninja]). 25 | * Supports multi-core unity builds for some generators (make -j, [jom][jom], Visual Studio, Ninja). 26 | * Leverages native precompiled header generation features of IDEs (Visual Studio and Xcode). 27 | * Compatible with CMake's [cross-compiling][ccrc] support. 28 | * Compatible with compiler wrappers like [ccache][ccch]. 29 | * Tested with Windows, Linux and OS X. 30 | * MIT licensed. 31 | 32 | requirements 33 | ------------ 34 | 35 | * [CMake 2.8.12][cmk] or newer. The executable `cmake` should be on the system path. 36 | * [Visual Studio C++][vslstd], [MinGW][mingw] or [Cygwin][cgwn] under Windows. 37 | * [Clang][clang] under Windows, Linux or OS X. 38 | * [GCC][gcc] under Linux or OS X. 39 | * [Intel C++ compiler][intel] under Windows, Linux or OS X. 40 | * [Xcode][xcdt] application or Xcode Command Line Tools under OS X. 41 | 42 | installation 43 | ------------ 44 | 45 | Copy the file `CMake/cotire.cmake` to the module directory of your CMake project. In the 46 | top-level `CMakeList.txt` file, add the module directory to the CMake module search path: 47 | 48 | set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") 49 | 50 | usage 51 | ----- 52 | 53 | To use cotire in your CMake project, add the following include directive to the beginning of the 54 | top-level `CMakeList.txt`: 55 | 56 | include(cotire) 57 | 58 | To speed the build process of a CMake library or executable target, just apply the `cotire` 59 | function to the target: 60 | 61 | add_executable(MyExecutable ${MyExecutableSources}) 62 | target_link_libraries(MyExecutable ${MyExecutableLibraries}) 63 | cotire(MyExecutable) 64 | 65 | Cotire looks at the properties of the target provided by CMake (e.g., target type, source files, 66 | compile flags, preprocessor defines, include directories, ...) and sets up custom commands that 67 | will generate a unity source file, a prefix header and a precompiled header at build time 68 | specially tailored to the target. 69 | 70 | For the generation of the prefix header, cotire will automatically choose headers used by the 71 | target that are outside of the project directory and thus are likely to change infrequently. 72 | The precompiled prefix header is then applied to the target to speed up the compilation process. 73 | 74 | To use an existing manually maintained prefix header instead of the automatically generated one, 75 | set the `COTIRE_CXX_PREFIX_HEADER_INIT` property before invoking cotire: 76 | 77 | set_target_properties(MyExecutable PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "stdafx.h") 78 | cotire(MyExecutable) 79 | 80 | As a side effect, cotire generates a new target named `MyExecutable_unity`, which lets you perform 81 | a unity build for the original target. The unity target inherits all build settings from the 82 | original target, including linked library dependencies. 83 | 84 | For Makefile based generators you can then invoke a unity build that produces the same output as 85 | the original target, but does so much faster by entering: 86 | 87 | $ make MyExecutable_unity 88 | 89 | See the advanced usage section of the [cotire manual][manual] for information on how to 90 | configure the cotire process (e.g., how to make the unity build use all available processor 91 | cores). 92 | 93 | The directory `Patches` contains patch files to enable cotire for some popular open sources 94 | packages that use CMake as a build system. 95 | 96 | speedup 97 | ------- 98 | 99 | Depending on factors like hardware, compiler, the number of files in the target and the complexity 100 | of the C/C++ code, the build process of targets that use a cotire generated precompiled header 101 | will be sped up from 10 to 40 percent. Using precompiled headers however is not without 102 | [issues][PCHH] and may not work for some programs. 103 | 104 | A unity build may be up to 90 percent faster than the one file at a time build of the original 105 | target. Single compilation unit builds however are very unlikely to work without source code 106 | modifications, because they [break][EoUB] the use of some C and C++ language features. 107 | 108 | Generally, modern C++ code which makes heavy use of header-only libraries will profit the most from 109 | cotiring. 110 | 111 | This [blog post][shrp] discusses speedup results obtained for real-world projects. 112 | 113 | known issues 114 | ------------ 115 | 116 | * CMake configure time will increase for cotired targets. 117 | * The size of the CMake build folder will increase, because precompiled headers are large binaries. 118 | * It is not possible to share precompiled headers generated by cotire between CMake targets. 119 | Multiple targets can share a generated prefix header, though (see the [cotire manual][manual]). 120 | * Cotire is not compatible with [Xoreax IncrediBuild][XGE]. 121 | 122 | [ccch]:https://ccache.samba.org/ 123 | [ccrc]:https://cmake.org/Wiki/CMake_Cross_Compiling 124 | [cgwn]:https://www.cygwin.com/ 125 | [clang]:https://clang.llvm.org/ 126 | [cmk]:https://cmake.org/download/ 127 | [gcc]:https://gcc.gnu.org/ 128 | [manual]:https://github.com/sakra/cotire/blob/master/MANUAL.md 129 | [mingw]:http://www.mingw.org/ 130 | [ninja]:https://ninja-build.org/ 131 | [pch]:https://en.wikipedia.org/wiki/Precompiled_header 132 | [pfh]:https://en.wikipedia.org/wiki/Prefix_header 133 | [scu]:https://en.wikipedia.org/wiki/Single_Compilation_Unit 134 | [vslstd]:https://www.visualstudio.com/ 135 | [xcdt]:https://developer.apple.com/xcode/ 136 | [PCHH]:https://gcc.gnu.org/wiki/PCHHaters 137 | [EoUB]:http://altdevblog.com/2011/08/14/the-evils-of-unity-builds/ 138 | [jom]:https://wiki.qt.io/Jom 139 | [intel]:https://software.intel.com/en-us/c-compilers 140 | [XGE]:https://www.incredibuild.com/ 141 | [shrp]:https://unriskinsight.blogspot.co.at/2014/09/sharpen-your-tools.html 142 | [cmkr]:https://cmake.org/cmake/help/latest/release/3.16.html 143 | [cpch]:https://cmake.org/cmake/help/latest/command/target_precompile_headers.html 144 | [cscu]:https://cmake.org/cmake/help/v3.16/prop_tgt/UNITY_BUILD.html 145 | -------------------------------------------------------------------------------- /Patches/cmake-2.8.7.patch: -------------------------------------------------------------------------------- 1 | diff -rupN cmake-2.8.7/CMakeLists.txt cmake-2.8.7.cotire/CMakeLists.txt 2 | --- cmake-2.8.7/CMakeLists.txt 2011-12-30 17:49:56.000000000 +0100 3 | +++ cmake-2.8.7.cotire/CMakeLists.txt 2012-03-24 14:41:40.000000000 +0100 4 | @@ -13,6 +13,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FAT 5 | SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required 6 | PROJECT(CMake) 7 | 8 | +include(Modules/cotire.cmake) 9 | + 10 | IF(CMAKE_BOOTSTRAP) 11 | # Running from bootstrap script. Set local variable and remove from cache. 12 | SET(CMAKE_BOOTSTRAP 1) 13 | diff -rupN cmake-2.8.7/Source/CMakeLists.txt cmake-2.8.7.cotire/Source/CMakeLists.txt 14 | --- cmake-2.8.7/Source/CMakeLists.txt 2011-12-30 17:49:56.000000000 +0100 15 | +++ cmake-2.8.7.cotire/Source/CMakeLists.txt 2012-02-24 22:35:58.000000000 +0100 16 | @@ -364,6 +364,9 @@ TARGET_LINK_LIBRARIES(CMakeLib cmsys 17 | IF(APPLE) 18 | TARGET_LINK_LIBRARIES(CMakeLib "-framework CoreFoundation") 19 | ENDIF(APPLE) 20 | +if (COMMAND cotire) 21 | +cotire(CMakeLib) 22 | +endif() 23 | 24 | # On some platforms we need the rpcrt4 library for the VS 7 generators. 25 | IF(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) 26 | @@ -433,6 +436,9 @@ SET(CTEST_SRCS cmCTest.cxx 27 | # Build CTestLib 28 | ADD_LIBRARY(CTestLib ${CTEST_SRCS}) 29 | TARGET_LINK_LIBRARIES(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES} ${CMAKE_XMLRPC_LIBRARIES}) 30 | +if (COMMAND cotire) 31 | +cotire(CTestLib) 32 | +endif() 33 | 34 | # 35 | # Sources for CPack 36 | @@ -477,6 +483,9 @@ ENDIF(APPLE) 37 | # Build CPackLib 38 | ADD_LIBRARY(CPackLib ${CPACK_SRCS}) 39 | TARGET_LINK_LIBRARIES(CPackLib CMakeLib) 40 | +if (COMMAND cotire) 41 | +cotire(CPackLib) 42 | +endif() 43 | 44 | IF(APPLE) 45 | ADD_EXECUTABLE(cmakexbuild cmakexbuild.cxx) 46 | @@ -485,11 +494,17 @@ IF(APPLE) 47 | CPack/OSXScriptLauncher.cxx) 48 | TARGET_LINK_LIBRARIES(OSXScriptLauncher cmsys) 49 | TARGET_LINK_LIBRARIES(OSXScriptLauncher "-framework CoreFoundation") 50 | +if (COMMAND cotire) 51 | +cotire(cmakexbuild) 52 | +endif() 53 | ENDIF(APPLE) 54 | 55 | # Build CMake executable 56 | ADD_EXECUTABLE(cmake cmakemain.cxx) 57 | TARGET_LINK_LIBRARIES(cmake CMakeLib) 58 | +if (COMMAND cotire) 59 | +cotire(cmake) 60 | +endif() 61 | 62 | # Build special executable for running programs on Windows 98 63 | IF(WIN32) 64 | @@ -503,10 +518,16 @@ ENDIF(WIN32) 65 | # Build CTest executable 66 | ADD_EXECUTABLE(ctest ctest.cxx) 67 | TARGET_LINK_LIBRARIES(ctest CTestLib) 68 | +if (COMMAND cotire) 69 | +cotire(ctest) 70 | +endif() 71 | 72 | # Build CPack executable 73 | ADD_EXECUTABLE(cpack CPack/cpack.cxx) 74 | TARGET_LINK_LIBRARIES(cpack CPackLib) 75 | +if (COMMAND cotire) 76 | +cotire(cpack) 77 | +endif() 78 | 79 | # Curses GUI 80 | IF(BUILD_CursesDialog) 81 | diff -rupN cmake-2.8.7/Source/CursesDialog/CMakeLists.txt cmake-2.8.7.cotire/Source/CursesDialog/CMakeLists.txt 82 | --- cmake-2.8.7/Source/CursesDialog/CMakeLists.txt 2011-12-30 17:49:57.000000000 +0100 83 | +++ cmake-2.8.7.cotire/Source/CursesDialog/CMakeLists.txt 2012-02-22 20:41:03.000000000 +0100 84 | @@ -33,5 +33,7 @@ INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PAT 85 | ADD_EXECUTABLE(ccmake ${CURSES_SRCS} ) 86 | TARGET_LINK_LIBRARIES(ccmake CMakeLib) 87 | TARGET_LINK_LIBRARIES(ccmake cmForm) 88 | - 89 | +if (COMMAND cotire) 90 | +cotire(ccmake) 91 | +endif() 92 | INSTALL_TARGETS(/bin ccmake) 93 | diff -rupN cmake-2.8.7/Source/CursesDialog/form/CMakeLists.txt cmake-2.8.7.cotire/Source/CursesDialog/form/CMakeLists.txt 94 | --- cmake-2.8.7/Source/CursesDialog/form/CMakeLists.txt 2011-12-30 17:49:57.000000000 +0100 95 | +++ cmake-2.8.7.cotire/Source/CursesDialog/form/CMakeLists.txt 2012-02-24 21:30:47.000000000 +0100 96 | @@ -64,3 +64,6 @@ TARGET_LINK_LIBRARIES(cmForm ${CURSES_LI 97 | IF(CURSES_EXTRA_LIBRARY) 98 | TARGET_LINK_LIBRARIES(cmForm ${CURSES_EXTRA_LIBRARY}) 99 | ENDIF(CURSES_EXTRA_LIBRARY) 100 | +if (COMMAND cotire) 101 | +cotire(cmForm) 102 | +endif() 103 | diff -rupN cmake-2.8.7/Source/kwsys/CMakeLists.txt cmake-2.8.7.cotire/Source/kwsys/CMakeLists.txt 104 | --- cmake-2.8.7/Source/kwsys/CMakeLists.txt 2011-12-30 17:49:57.000000000 +0100 105 | +++ cmake-2.8.7.cotire/Source/kwsys/CMakeLists.txt 2012-03-24 15:03:17.000000000 +0100 106 | @@ -926,6 +926,9 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) 107 | ADD_LIBRARY(${KWSYS_NAMESPACE}TestDynload MODULE testDynload.c) 108 | SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestDynload PROPERTY LABELS ${KWSYS_LABELS_LIB}) 109 | ADD_DEPENDENCIES(${KWSYS_NAMESPACE}TestDynload ${KWSYS_NAMESPACE}) 110 | +if (COMMAND cotire) 111 | +cotire(${KWSYS_NAMESPACE}TestDynload) 112 | +endif() 113 | ENDIF(KWSYS_USE_DynamicLoader) 114 | CREATE_TEST_SOURCELIST( 115 | KWSYS_CXX_TEST_SRCS ${KWSYS_NAMESPACE}TestsCxx.cxx 116 | @@ -934,6 +937,9 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) 117 | ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_CXX_TEST_SRCS}) 118 | SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY LABELS ${KWSYS_LABELS_EXE}) 119 | TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_NAMESPACE}) 120 | +if (COMMAND cotire) 121 | +cotire(${KWSYS_NAMESPACE}TestsCxx) 122 | +endif() 123 | SET(TEST_SYSTEMTOOLS_BIN_FILE 124 | "${CMAKE_CURRENT_SOURCE_DIR}/testSystemTools.bin") 125 | SET(TEST_SYSTEMTOOLS_SRC_FILE 126 | diff -rupN cmake-2.8.7/Utilities/cmbzip2/CMakeLists.txt cmake-2.8.7.cotire/Utilities/cmbzip2/CMakeLists.txt 127 | --- cmake-2.8.7/Utilities/cmbzip2/CMakeLists.txt 2011-12-30 17:49:58.000000000 +0100 128 | +++ cmake-2.8.7.cotire/Utilities/cmbzip2/CMakeLists.txt 2012-02-22 20:45:26.000000000 +0100 129 | @@ -2,3 +2,6 @@ project(bzip2) 130 | add_definitions(-D_FILE_OFFSET_BITS=64) 131 | add_library(cmbzip2 132 | blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c) 133 | +if (COMMAND cotire) 134 | +cotire(cmbzip2) 135 | +endif() 136 | \ No newline at end of file 137 | diff -rupN cmake-2.8.7/Utilities/cmcompress/CMakeLists.txt cmake-2.8.7.cotire/Utilities/cmcompress/CMakeLists.txt 138 | --- cmake-2.8.7/Utilities/cmcompress/CMakeLists.txt 2011-12-30 17:49:58.000000000 +0100 139 | +++ cmake-2.8.7.cotire/Utilities/cmcompress/CMakeLists.txt 2012-02-22 20:45:29.000000000 +0100 140 | @@ -3,3 +3,6 @@ PROJECT(CMCompress) 141 | ADD_LIBRARY(cmcompress cmcompress.c) 142 | 143 | INSTALL(FILES Copyright.txt DESTINATION ${CMake_DOC_DEST}/cmcompress) 144 | +if (COMMAND cotire) 145 | +cotire(cmcompress) 146 | +endif() 147 | \ No newline at end of file 148 | diff -rupN cmake-2.8.7/Utilities/cmcurl/CMakeLists.txt cmake-2.8.7.cotire/Utilities/cmcurl/CMakeLists.txt 149 | --- cmake-2.8.7/Utilities/cmcurl/CMakeLists.txt 2011-12-30 17:49:58.000000000 +0100 150 | +++ cmake-2.8.7.cotire/Utilities/cmcurl/CMakeLists.txt 2012-02-22 20:43:57.000000000 +0100 151 | @@ -706,6 +706,9 @@ IF(CMAKE_BUILD_CURL_SHARED) 152 | RUNTIME_OUTPUT_DIRECTORY ${CMake_BIN_DIR}) 153 | INSTALL_TARGETS(/bin cmcurl) 154 | ENDIF(CMAKE_BUILD_CURL_SHARED) 155 | +if (COMMAND cotire) 156 | +cotire(cmcurl) 157 | +endif() 158 | 159 | OPTION(CURL_TESTING "Do libCurl testing" OFF) 160 | IF(CURL_TESTING) 161 | diff -rupN cmake-2.8.7/Utilities/cmexpat/CMakeLists.txt cmake-2.8.7.cotire/Utilities/cmexpat/CMakeLists.txt 162 | --- cmake-2.8.7/Utilities/cmexpat/CMakeLists.txt 2011-12-30 17:49:58.000000000 +0100 163 | +++ cmake-2.8.7.cotire/Utilities/cmexpat/CMakeLists.txt 2012-02-22 20:45:40.000000000 +0100 164 | @@ -32,3 +32,6 @@ CONFIGURE_FILE(${CMEXPAT_SOURCE_DIR}/exp 165 | 166 | ADD_LIBRARY(cmexpat ${expat_SRCS}) 167 | INSTALL(FILES COPYING DESTINATION ${CMake_DOC_DEST}/cmexpat) 168 | +if (COMMAND cotire) 169 | +cotire(cmexpat) 170 | +endif() 171 | \ No newline at end of file 172 | diff -rupN cmake-2.8.7/Utilities/cmlibarchive/libarchive/CMakeLists.txt cmake-2.8.7.cotire/Utilities/cmlibarchive/libarchive/CMakeLists.txt 173 | --- cmake-2.8.7/Utilities/cmlibarchive/libarchive/CMakeLists.txt 2011-12-30 17:49:58.000000000 +0100 174 | +++ cmake-2.8.7.cotire/Utilities/cmlibarchive/libarchive/CMakeLists.txt 2012-02-22 20:45:55.000000000 +0100 175 | @@ -116,6 +116,9 @@ IF(BUILD_ARCHIVE_WITHIN_CMAKE) 176 | # and call the library cmlibarchive 177 | ADD_LIBRARY(cmlibarchive STATIC ${libarchive_SOURCES} ${include_HEADERS}) 178 | TARGET_LINK_LIBRARIES(cmlibarchive ${ADDITIONAL_LIBS}) 179 | +if (COMMAND cotire) 180 | +cotire(cmlibarchive) 181 | +endif() 182 | ELSE() 183 | # Libarchive is a shared library 184 | ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) 185 | @@ -123,7 +126,10 @@ ELSE() 186 | SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) 187 | SET_TARGET_PROPERTIES(archive PROPERTIES 188 | RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) 189 | - 190 | +if (COMMAND cotire) 191 | +cotire(archive) 192 | +endif() 193 | + 194 | # archive_static is a static library 195 | ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) 196 | SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS 197 | @@ -134,6 +140,9 @@ ELSE() 198 | IF(NOT WIN32 OR CYGWIN) 199 | SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) 200 | ENDIF(NOT WIN32 OR CYGWIN) 201 | +if (COMMAND cotire) 202 | +cotire(archive_static) 203 | +endif() 204 | 205 | # How to install the libraries 206 | INSTALL(TARGETS archive archive_static 207 | diff -rupN cmake-2.8.7/Utilities/cmzlib/CMakeLists.txt cmake-2.8.7.cotire/Utilities/cmzlib/CMakeLists.txt 208 | --- cmake-2.8.7/Utilities/cmzlib/CMakeLists.txt 2011-12-30 17:49:58.000000000 +0100 209 | +++ cmake-2.8.7.cotire/Utilities/cmzlib/CMakeLists.txt 2012-02-22 20:42:30.000000000 +0100 210 | @@ -39,5 +39,7 @@ ENDFOREACH(name) 211 | 212 | 213 | ADD_LIBRARY(cmzlib ${ZLIB_SRCS}) 214 | - 215 | +if (COMMAND cmzlib) 216 | +cotire(cmzlib) 217 | +endif() 218 | INSTALL(FILES Copyright.txt DESTINATION ${CMake_DOC_DEST}/cmzlib) 219 | -------------------------------------------------------------------------------- /Patches/OpenCV-2.3.1.patch: -------------------------------------------------------------------------------- 1 | diff -rupN OpenCV-2.3.1/3rdparty/libjasper/CMakeLists.txt OpenCV-2.3.1.cotire/3rdparty/libjasper/CMakeLists.txt 2 | --- OpenCV-2.3.1/3rdparty/libjasper/CMakeLists.txt 2011-09-12 20:39:55.000000000 +0200 3 | +++ OpenCV-2.3.1.cotire/3rdparty/libjasper/CMakeLists.txt 2012-04-01 11:23:04.000000000 +0200 4 | @@ -56,3 +56,7 @@ if(NOT BUILD_SHARED_LIBS) 5 | install(TARGETS ${the_target} 6 | ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) 7 | endif() 8 | + 9 | +if (COMMAND cotire) 10 | +cotire(${the_target}) 11 | +endif() 12 | diff -rupN OpenCV-2.3.1/3rdparty/libjpeg/CMakeLists.txt OpenCV-2.3.1.cotire/3rdparty/libjpeg/CMakeLists.txt 13 | --- OpenCV-2.3.1/3rdparty/libjpeg/CMakeLists.txt 2011-09-12 20:40:15.000000000 +0200 14 | +++ OpenCV-2.3.1.cotire/3rdparty/libjpeg/CMakeLists.txt 2012-04-01 11:23:10.000000000 +0200 15 | @@ -48,3 +48,7 @@ if(NOT BUILD_SHARED_LIBS) 16 | install(TARGETS ${the_target} 17 | ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) 18 | endif() 19 | + 20 | +if (COMMAND cotire) 21 | +cotire(${the_target}) 22 | +endif() 23 | diff -rupN OpenCV-2.3.1/3rdparty/libpng/CMakeLists.txt OpenCV-2.3.1.cotire/3rdparty/libpng/CMakeLists.txt 24 | --- OpenCV-2.3.1/3rdparty/libpng/CMakeLists.txt 2011-09-12 20:40:02.000000000 +0200 25 | +++ OpenCV-2.3.1.cotire/3rdparty/libpng/CMakeLists.txt 2012-04-01 11:23:17.000000000 +0200 26 | @@ -49,3 +49,7 @@ if(NOT BUILD_SHARED_LIBS) 27 | install(TARGETS ${the_target} 28 | ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) 29 | endif() 30 | + 31 | +if (COMMAND cotire) 32 | +cotire(${the_target}) 33 | +endif() 34 | diff -rupN OpenCV-2.3.1/3rdparty/libtiff/CMakeLists.txt OpenCV-2.3.1.cotire/3rdparty/libtiff/CMakeLists.txt 35 | --- OpenCV-2.3.1/3rdparty/libtiff/CMakeLists.txt 2011-09-12 20:29:15.000000000 +0200 36 | +++ OpenCV-2.3.1.cotire/3rdparty/libtiff/CMakeLists.txt 2012-04-01 11:23:23.000000000 +0200 37 | @@ -103,3 +103,7 @@ if(NOT BUILD_SHARED_LIBS) 38 | install(TARGETS ${the_target} 39 | ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) 40 | endif() 41 | + 42 | +if (COMMAND cotire) 43 | +cotire(${the_target}) 44 | +endif() 45 | diff -rupN OpenCV-2.3.1/3rdparty/zlib/CMakeLists.txt OpenCV-2.3.1.cotire/3rdparty/zlib/CMakeLists.txt 46 | --- OpenCV-2.3.1/3rdparty/zlib/CMakeLists.txt 2011-09-12 20:29:21.000000000 +0200 47 | +++ OpenCV-2.3.1.cotire/3rdparty/zlib/CMakeLists.txt 2012-04-01 11:24:36.000000000 +0200 48 | @@ -40,3 +40,7 @@ if(NOT BUILD_SHARED_LIBS) 49 | install(TARGETS ${the_target} 50 | ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) 51 | endif() 52 | + 53 | +if (COMMAND cotire) 54 | +cotire(${the_target}) 55 | +endif() 56 | diff -rupN OpenCV-2.3.1/CMakeLists.txt OpenCV-2.3.1.cotire/CMakeLists.txt 57 | --- OpenCV-2.3.1/CMakeLists.txt 2011-09-12 20:45:38.000000000 +0200 58 | +++ OpenCV-2.3.1.cotire/CMakeLists.txt 2012-04-01 14:34:56.000000000 +0200 59 | @@ -39,6 +39,8 @@ endif(NOT CMAKE_TOOLCHAIN_FILE) 60 | cmake_minimum_required(VERSION 2.4) 61 | project(OpenCV) 62 | 63 | +include("${CMAKE_SOURCE_DIR}/cotire.cmake") 64 | + 65 | set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE) 66 | if(DEFINED CMAKE_BUILD_TYPE) 67 | set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} ) 68 | diff -rupN OpenCV-2.3.1/OpenCVModule.cmake OpenCV-2.3.1.cotire/OpenCVModule.cmake 69 | --- OpenCV-2.3.1/OpenCVModule.cmake 2011-09-12 20:45:38.000000000 +0200 70 | +++ OpenCV-2.3.1.cotire/OpenCVModule.cmake 2012-04-01 11:26:16.000000000 +0200 71 | @@ -86,7 +86,7 @@ macro(define_opencv_module name) 72 | INSTALL_NAME_DIR lib 73 | ) 74 | 75 | - add_opencv_precompiled_headers(${the_target}) 76 | +# add_opencv_precompiled_headers(${the_target}) 77 | 78 | # Add the required libraries for linking: 79 | target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) 80 | @@ -102,6 +102,10 @@ macro(define_opencv_module name) 81 | ) 82 | endif() 83 | 84 | + if (COMMAND cotire) 85 | + cotire(${the_target}) 86 | + endif() 87 | + 88 | # Dependencies of this target: 89 | add_dependencies(${the_target} ${ARGN}) 90 | 91 | @@ -137,7 +141,7 @@ macro(define_opencv_module name) 92 | 93 | add_executable(${the_target} ${test_srcs} ${test_hdrs}) 94 | 95 | - add_opencv_precompiled_headers(${the_target}) 96 | +# add_opencv_precompiled_headers(${the_target}) 97 | 98 | # Additional target properties 99 | set_target_properties(${the_target} PROPERTIES 100 | @@ -149,6 +153,10 @@ macro(define_opencv_module name) 101 | set_target_properties(${the_target} PROPERTIES FOLDER "tests") 102 | endif() 103 | 104 | + if (COMMAND cotire) 105 | + cotire(${the_target}) 106 | + endif() 107 | + 108 | add_dependencies(${the_target} ${test_deps}) 109 | 110 | # Add the required libraries for linking: 111 | diff -rupN OpenCV-2.3.1/modules/androidcamera/CMakeLists.txt OpenCV-2.3.1.cotire/modules/androidcamera/CMakeLists.txt 112 | --- OpenCV-2.3.1/modules/androidcamera/CMakeLists.txt 2011-09-12 20:42:03.000000000 +0200 113 | +++ OpenCV-2.3.1.cotire/modules/androidcamera/CMakeLists.txt 2012-04-01 11:28:54.000000000 +0200 114 | @@ -52,3 +52,7 @@ if (NOT BUILD_ANDROID_CAMERA_WRAPPER) 115 | COMPONENT main) 116 | endforeach() 117 | endif() 118 | + 119 | +if (COMMAND cotire) 120 | +cotire(${the_target}) 121 | +endif() 122 | diff -rupN OpenCV-2.3.1/modules/androidcamera/camera_wrapper/CMakeLists.txt OpenCV-2.3.1.cotire/modules/androidcamera/camera_wrapper/CMakeLists.txt 123 | --- OpenCV-2.3.1/modules/androidcamera/camera_wrapper/CMakeLists.txt 2011-09-12 20:42:03.000000000 +0200 124 | +++ OpenCV-2.3.1.cotire/modules/androidcamera/camera_wrapper/CMakeLists.txt 2012-04-01 11:20:26.000000000 +0200 125 | @@ -34,3 +34,7 @@ SET_TARGET_PROPERTIES(${the_target} PROP 126 | ) 127 | 128 | install(TARGETS ${the_target} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main) 129 | + 130 | +if (COMMAND cotire) 131 | +cotire(${the_target}) 132 | +endif() 133 | diff -rupN OpenCV-2.3.1/modules/gpu/CMakeLists.txt OpenCV-2.3.1.cotire/modules/gpu/CMakeLists.txt 134 | --- OpenCV-2.3.1/modules/gpu/CMakeLists.txt 2011-09-12 20:42:20.000000000 +0200 135 | +++ OpenCV-2.3.1.cotire/modules/gpu/CMakeLists.txt 2012-04-01 11:41:04.000000000 +0200 136 | @@ -106,7 +106,7 @@ if (BUILD_SHARED_LIBS) 137 | endif() 138 | endif() 139 | 140 | -add_opencv_precompiled_headers(${the_target}) 141 | +#add_opencv_precompiled_headers(${the_target}) 142 | 143 | # Additional target properties 144 | set_target_properties(${the_target} PROPERTIES 145 | @@ -156,6 +156,9 @@ install(FILES src/nvidia/NPP_staging/NPP 146 | # DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name}/device 147 | # COMPONENT main) 148 | 149 | +if (COMMAND cotire) 150 | +cotire(${the_target}) 151 | +endif() 152 | 153 | ################################################################################################################ 154 | ################################ GPU Module Tests ##################################################### 155 | @@ -192,14 +195,17 @@ if(BUILD_TESTS AND EXISTS ${CMAKE_CURREN 156 | 157 | add_executable(${the_test_target} ${test_srcs} ${test_hdrs} ${nvidia}) 158 | 159 | - add_opencv_precompiled_headers(${the_test_target}) 160 | +# add_opencv_precompiled_headers(${the_test_target}) 161 | 162 | # Additional target properties 163 | set_target_properties(${the_test_target} PROPERTIES 164 | DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" 165 | RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}" 166 | ) 167 | - 168 | + if (COMMAND cotire) 169 | + cotire(${the_test_target}) 170 | + endif() 171 | + 172 | if(ENABLE_SOLUTION_FOLDERS) 173 | set_target_properties(${the_test_target} PROPERTIES FOLDER "tests") 174 | endif() 175 | diff -rupN OpenCV-2.3.1/modules/haartraining/CMakeLists.txt OpenCV-2.3.1.cotire/modules/haartraining/CMakeLists.txt 176 | --- OpenCV-2.3.1/modules/haartraining/CMakeLists.txt 2011-09-12 20:43:56.000000000 +0200 177 | +++ OpenCV-2.3.1.cotire/modules/haartraining/CMakeLists.txt 2012-04-01 11:21:27.000000000 +0200 178 | @@ -45,6 +45,10 @@ set_target_properties(opencv_haartrainin 179 | INSTALL_NAME_DIR lib 180 | ) 181 | 182 | +if (COMMAND cotire) 183 | +cotire(opencv_haartraining_engine) 184 | +endif() 185 | + 186 | if(NOT ANDROID) 187 | # ----------------------------------------------------------- 188 | # haartraining 189 | diff -rupN OpenCV-2.3.1/modules/highgui/CMakeLists.txt OpenCV-2.3.1.cotire/modules/highgui/CMakeLists.txt 190 | --- OpenCV-2.3.1/modules/highgui/CMakeLists.txt 2011-09-12 20:41:29.000000000 +0200 191 | +++ OpenCV-2.3.1.cotire/modules/highgui/CMakeLists.txt 2012-04-01 12:17:12.000000000 +0200 192 | @@ -77,6 +77,10 @@ file(GLOB grfmt_srcs src/grfmt*.cpp) 193 | set(grfmt_hdrs src/bitstrm.hpp ${grfmt_hdrs}) 194 | set(grfmt_srcs src/bitstrm.cpp ${grfmt_srcs}) 195 | 196 | +if (COMMAND cotire) 197 | + set_source_files_properties (${grfmt_srcs} PROPERTIES COTIRE_EXCLUDED TRUE) 198 | +endif() 199 | + 200 | source_group("Src\\grfmts" FILES ${grfmt_hdrs} ${grfmt_srcs}) 201 | 202 | set(highgui_srcs 203 | @@ -209,6 +213,9 @@ if(APPLE) 204 | else() 205 | set(highgui_srcs ${highgui_srcs} src/cap_qtkit.mm) 206 | endif() 207 | + if (COMMAND cotire) 208 | + set_source_files_properties (src/window_cocoa.mm src/cap_qtkit.mm PROPERTIES COTIRE_EXCLUDED TRUE) 209 | + endif() 210 | endif(APPLE) 211 | 212 | if(WITH_ANDROID_CAMERA) 213 | @@ -276,7 +283,7 @@ if (BUILD_SHARED_LIBS) 214 | endif() 215 | endif() 216 | 217 | -add_opencv_precompiled_headers(${the_target}) 218 | +#add_opencv_precompiled_headers(${the_target}) 219 | 220 | # For dynamic link numbering convenions 221 | if(NOT ANDROID) 222 | @@ -307,6 +314,10 @@ if(MSVC) 223 | set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG") 224 | endif(MSVC) 225 | 226 | +if (COMMAND cotire) 227 | +cotire(${the_target}) 228 | +endif() 229 | + 230 | # Dependencies of this target: 231 | add_dependencies(${the_target} opencv_core opencv_imgproc) 232 | 233 | @@ -397,7 +408,7 @@ if(BUILD_TESTS) 234 | 235 | add_executable(${the_target} ${test_srcs} ${test_hdrs}) 236 | 237 | - add_opencv_precompiled_headers(${the_target}) 238 | +# add_opencv_precompiled_headers(${the_target}) 239 | 240 | # Additional target properties 241 | set_target_properties(${the_target} PROPERTIES 242 | @@ -409,6 +420,10 @@ if(BUILD_TESTS) 243 | set_target_properties(${the_target} PROPERTIES FOLDER "tests") 244 | endif() 245 | 246 | +if (COMMAND cotire) 247 | +cotire(${the_target}) 248 | +endif() 249 | + 250 | add_dependencies(${the_target} ${test_deps}) 251 | 252 | # Add the required libraries for linking: 253 | diff -rupN OpenCV-2.3.1/modules/java/CMakeLists.txt OpenCV-2.3.1.cotire/modules/java/CMakeLists.txt 254 | --- OpenCV-2.3.1/modules/java/CMakeLists.txt 2011-09-12 20:40:26.000000000 +0200 255 | +++ OpenCV-2.3.1.cotire/modules/java/CMakeLists.txt 2012-04-01 11:22:49.000000000 +0200 256 | @@ -163,6 +163,10 @@ set_target_properties(${target} PROPERTI 257 | 258 | install(TARGETS ${target} LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main) 259 | 260 | +if (COMMAND cotire) 261 | +cotire(${target}) 262 | +endif() 263 | + 264 | if(ANDROID) 265 | target_link_libraries(${target} jnigraphics) 266 | 267 | diff -rupN OpenCV-2.3.1/modules/python/CMakeLists.txt OpenCV-2.3.1.cotire/modules/python/CMakeLists.txt 268 | --- OpenCV-2.3.1/modules/python/CMakeLists.txt 2011-09-12 20:40:30.000000000 +0200 269 | +++ OpenCV-2.3.1.cotire/modules/python/CMakeLists.txt 2012-04-01 11:23:51.000000000 +0200 270 | @@ -92,3 +92,7 @@ install(TARGETS ${cvpymodules} 271 | ARCHIVE DESTINATION ${CVPY_PATH} COMPONENT main 272 | ) 273 | install(FILES src2/cv.py DESTINATION ${CVPY_PATH} COMPONENT main) 274 | + 275 | +if (COMMAND cotire) 276 | +cotire(${cv2_target}) 277 | +endif() 278 | diff -rupN OpenCV-2.3.1/modules/stitching/CMakeLists.txt OpenCV-2.3.1.cotire/modules/stitching/CMakeLists.txt 279 | --- OpenCV-2.3.1/modules/stitching/CMakeLists.txt 2011-09-12 20:42:22.000000000 +0200 280 | +++ OpenCV-2.3.1.cotire/modules/stitching/CMakeLists.txt 2012-04-01 11:24:09.000000000 +0200 281 | @@ -38,3 +38,7 @@ endif() 282 | target_link_libraries(${the_target} ${stitching_libs}) 283 | 284 | install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main) 285 | + 286 | +if (COMMAND cotire) 287 | +cotire(${the_target}) 288 | +endif() 289 | diff -rupN OpenCV-2.3.1/modules/traincascade/CMakeLists.txt OpenCV-2.3.1.cotire/modules/traincascade/CMakeLists.txt 290 | --- OpenCV-2.3.1/modules/traincascade/CMakeLists.txt 2011-09-12 20:40:17.000000000 +0200 291 | +++ OpenCV-2.3.1.cotire/modules/traincascade/CMakeLists.txt 2012-04-01 11:24:25.000000000 +0200 292 | @@ -44,3 +44,7 @@ target_link_libraries(${the_target} ${tr 293 | if(NOT ANDROID) 294 | install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main) 295 | endif() 296 | + 297 | +if (COMMAND cotire) 298 | +cotire(${the_target}) 299 | +endif() 300 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | ## 1.8.1 (2019-12-23) 2 | 3 | * harden check for embedded parent directory references. 4 | * use native paths for Clang under Windows. 5 | * work around ccache 3.7 command line interface change. 6 | 7 | ## 1.8.0 (2018-03-18) 8 | 9 | * support for clang-cl.exe under Windows. 10 | * faster prefix header generation for Clang. 11 | * enable parallel compilation of unity target for MSVC. 12 | * CMake 3.9 and 3.10 compatibility fixes. 13 | * disable inclusion of timestamp in precompiled headers for Clang. 14 | * work around ccache reporting incorrect configuration. 15 | * honor `MANUALLY_ADDED_DEPENDENCIES` property upon generation of unity targets. 16 | * use default setting of 2 for `COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES`. 17 | * drop broken support for unity building of targets with automatic CMake Qt processing turned on. 18 | * manual updates. 19 | 20 | ## 1.7.10 (2017-06-16) 21 | 22 | * CMake 3.8 compatibility. 23 | * CMake 3.8.0 Qt automoc support (thanks bilke). 24 | * fix Xcode recompiling every time builds happen (thanks gcamp). 25 | * disable PCH messages when `-Wno-pch-messages` flag exists (thanks kbinani). 26 | * work around ccache incompatibility with newer versions of GCC and Clang. 27 | * fix MinGW incompatibility with `BUILD_INTERFACE` generator expression. 28 | * fix handling of `CMAKE_INCLUDE_FLAG_SEP_` variables. 29 | 30 | ## 1.7.9 (2016-12-08) 31 | 32 | * CMake 3.6 and 3.7 compatibility. 33 | * fix ccache 3.2 compatibility issues. 34 | * fix bugs with handling language standard related properties (e.g., `CXX_STANDARD`, `CXX_EXTENSIONS`). 35 | * make prefix header generation and precompiled header compilation depend on the compiler executable. 36 | * fix Qt automoc handling for Windows (thanks jcelerier). 37 | * convert Windows paths in include directories to CMake paths (thanks wdx04). 38 | * replace object library with corresponding unity object library when using `COPY_UNITY` linking strategy. 39 | * better error reporting from prefix header generation. 40 | 41 | ## 1.7.8 (2016-03-27) 42 | 43 | * fix `COPY_UNITY` linking strategy for private link dependencies. 44 | * honor `CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE` upon handling of target usage requirements. 45 | * reworked setting up of `LINK_LIBRARIES` and `INTERFACE_LINK_LIBRARIES` properties for unity targets. 46 | 47 | ## 1.7.7 (2016-03-20) 48 | 49 | * CMake 3.5 compatibility. 50 | * fix bugs related to handling of interface libraries. 51 | * output shorter log messages when using Visual Studio IDE. 52 | * don't disable PCH if CMAKE__COMPILER_ID is not set (thanks jcelerier). 53 | * add support for compiler launchers introduced in CMake 3.4 (thanks misery). 54 | 55 | ## 1.7.6 (2015-12-06) 56 | 57 | * fix CMake 3.4 compatibility issues. 58 | * prevent redundant re-generation of prefix header when a target has generated source files. 59 | 60 | ## 1.7.5 (2015-10-27) 61 | 62 | * handle visibility target properties (`CXX_VISIBILITY_PRESET` and `VISIBILITY_INLINES_HIDDEN`). 63 | * better handling of include directories and system include directories. 64 | * parse additional system include directories from target compile flags. 65 | * activate select CMake policies. 66 | 67 | ## 1.7.4 (2015-10-10) 68 | 69 | * set up single unity source file for prefix header generation. 70 | * increase MSVC default PCH memory to 128M. 71 | * remove obsolete code. 72 | 73 | ## 1.7.3 (2015-07-25) 74 | 75 | * handle language standard target properties (e.g., `CXX_STANDARD`). 76 | * apply user provided prefix header to unity build target. 77 | * remove effect of `COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES` on generated unity target. 78 | * manual updates. 79 | 80 | ## 1.7.2 (2015-04-22) 81 | 82 | * reduce configure time overhead. 83 | * fix bug with dependency checking when using Xcode. 84 | * remove obsolete code required for CMake versions older than 2.8.12. 85 | * streamline debugging output. 86 | 87 | ## 1.7.1 (2015-04-06) 88 | 89 | * fix problem with CMake's automatic Qt processing for generated unity targets. 90 | * added a section on common pitfalls when using cotire to the manual. 91 | * remove obsolete code required for CMake versions older than 2.8.12. 92 | * streamline debugging output. 93 | * activate select CMake policies. 94 | 95 | ## 1.7.0 (2015-03-29) 96 | 97 | * fix CMake 3.2 compatibility issues. 98 | * cotire now requires CMake 2.8.12 or newer. 99 | * copy `IMPORT_PREFIX` and `IMPORT_SUFFIX` target properties for unity targets (thanks peterhuene). 100 | * new property `COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH` allows for organizing includes 101 | added to the prefix header by priority (thanks ArnaudD-FR). 102 | * for Visual Studio C++, increase static precompiled header memory allocation. 103 | * the default strategy for setting up a unity target's linked libraries is now `COPY_UNITY`. 104 | * for Qt projects, fix problem with handling of `AUTOMOC` in generated unity target. 105 | * fix problem with generating the cotire intermediate directory. 106 | * documentation updates. 107 | 108 | ## 1.6.9 (2015-01-18) 109 | 110 | * fix bug with parsing of localized MSVC `/showIncludes` output. 111 | 112 | ## 1.6.8 (2014-12-28) 113 | 114 | * fix bug with generation of unity source file segments for parallel builds. 115 | 116 | ## 1.6.7 (2014-12-21) 117 | 118 | * fix CMake 3.1 compatibility issues. 119 | * fix ccache 3.2 compatibility issues. 120 | * handle `COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES` correctly for mixed-language targets. 121 | * correctly compute absolute paths of generated source files added to the unity source file. 122 | * fix bug with checking unity source and prefix header dependencies under Xcode. 123 | * fix bug with handling of unity source file dependencies. 124 | * move code to determine build configurations to function of its own. 125 | * documentation updates. 126 | 127 | ## 1.6.6 (2014-09-21) 128 | 129 | * fix GCC issue with prefix header generation when source files are missing. 130 | * fix bug where some target properties were not properly propagated to the generated unity target. 131 | * use `target_link_libraries` to set up the unity target link libraries. 132 | * add Qt4 and Qt5 examples to the `Patches` directory. 133 | * documentation updates. 134 | 135 | ## 1.6.5 (2014-08-26) 136 | 137 | * correctly handle generator expressions used in compile definitions, compile flags and include 138 | directories (requires CMake 2.8.12 or newer). 139 | * fix `-isystem` includes being incorrectly passed to `execute_process` (thanks nickhutchinson). 140 | * make some error messages more verbose. 141 | 142 | ## 1.6.4 (2014-07-14) 143 | 144 | * fix CMake 3.0 compatibility issues. 145 | * preserve system flag for includes when generating PCH (thanks gjasny). 146 | * fix bug with setting up `EXPORTS` symbol for shared libraries. 147 | 148 | ## 1.6.3 (2014-06-11) 149 | 150 | * correctly handle usage requirements for transitive link targets. 151 | * use indirect inclusion for prefix header when using generator Xcode. 152 | 153 | ## 1.6.2 (2014-06-09) 154 | 155 | * don't use `-w` flag for pre-compiling the prefix header, because it has unwanted side effects. 156 | * correctly handle linked targets' `INTERFACE_COMPILE_OPTIONS`, `INTERFACE_INCLUDE_DIRECTORIES` 157 | and `INTERFACE_COMPILE_DEFINITIONS` properties upon pre-compiling and prefix header generation. 158 | * For Clang and GCC, pre-compile prefix header through indirect inclusion via a prefix source file, 159 | to make both compilers honor the `system_header` pragma in the prefix header correctly. 160 | * fix ccache incompatibility. 161 | 162 | ## 1.6.1 (2014-04-20) 163 | 164 | * fixed bug where precompiled headers did not work with Clang (thanks to nh2 for reporting). 165 | * when using ccache, require that environment variable `CCACHE_SLOPPINESS` is set to `time_macros`. 166 | 167 | ## 1.6.0 (2014-03-16) 168 | 169 | * suppress compiler warnings from precompiled headers. 170 | * fix Clang compatibility issue with prefix header generation. 171 | * use file extension `.pch` for precompiled headers generated with Clang. 172 | * manual updates. 173 | 174 | ## 1.5.2 (2014-01-17) 175 | 176 | * honor framework includes under OS X correctly. 177 | * fix handling of OS X specific variables `CMAKE_OSX_SYSROOT` and `CMAKE_OSX_DEPLOYMENT_TARGET`. 178 | * add new examples to the `Patches` directory. 179 | 180 | ## 1.5.1 (2013-11-12) 181 | 182 | * fixed string quoting bugs. 183 | 184 | ## 1.5.0 (2013-10-13) 185 | 186 | * CMake 2.8.12 compatibility fixes. 187 | * Upon generation of a unity target, cotire can now be configured to automatically copy all the 188 | linked libraries and targets from the original target. See the section on the new target property 189 | `COTIRE_UNITY_LINK_LIBRARIES_INIT` in the cotire manual. 190 | * fixed bug with copying target properties to generated unity target. 191 | * cotire manual updates. 192 | * add new examples to the `Patches` directory. 193 | * fix typos. 194 | 195 | ## 1.4.3 (2013-09-28) 196 | 197 | * fixed bug with generation of unity source file when `COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES` is 198 | set to 0. 199 | 200 | ## 1.4.2 (2013-08-24) 201 | 202 | * CMake 2.8.11 compatibility fixes. 203 | * always force the inclusion of a user provided prefix header, even if the target 204 | contains too few sources to enable the use of a precompiled header. 205 | 206 | ## 1.4.1 (2013-06-08) 207 | 208 | * fixed bug with determination of compiler version. 209 | * fixed bug with generation of unity source when target source files are used for multiple targets. 210 | * fixed bug with multi-core optimized prefix header generation. 211 | 212 | ## 1.4.0 (2013-03-11) 213 | 214 | * one year anniversary release. 215 | * add support for multi-core optimized unity builds for some CMake generators. 216 | * add support for multi-core optimized prefix header generation. 217 | * add more examples to cotire manual. 218 | 219 | ## 1.3.6 (2013-03-06) 220 | 221 | * fix bug with prefix header initialization for generator Xcode. 222 | * print cotire version upon inclusion. 223 | 224 | ## 1.3.5 (2013-03-01) 225 | 226 | * fix typos in function names and property descriptions. 227 | 228 | ## 1.3.4 (2013-02-07) 229 | 230 | * fixed bug with computing to output directory of the generated unity target (thanks shaunew). 231 | * fixed wrong variable reference in debugging output (thanks shaunew). 232 | 233 | ## 1.3.3 (2013-02-03) 234 | 235 | * fixed bug with handling of policy CMP0018 relating to target property `POSITION_INDEPENDENT_CODE`. 236 | * fixed warnings relating to uninitialized variables. 237 | * Intel XE 2013 Update 2 compatibility fixes. 238 | 239 | ## 1.3.2 (2013-02-02) 240 | 241 | * fixed missing curly brace (thanks shaunew). 242 | 243 | ## 1.3.1 (2013-01-29) 244 | 245 | * fix bug with filtering of compile options. 246 | 247 | ## 1.3.0 (2013-01-09) 248 | 249 | * add support for Intel C and C++ compilers. 250 | * CMake 2.8.10 compatibility fixes. 251 | * properly clean up generated cotire log files upon invoking `clean` target. 252 | * documentation updates. 253 | 254 | ## 1.2.0 (2012-11-01) 255 | 256 | * add support for manually maintained prefix header and unity source files. 257 | * the target property `COTIRE__PREFIX_HEADER_INIT` can be set to a user provided prefix 258 | header file to be used instead of the automatically generated one (e.g., `stdafx.h`). 259 | * the new target property `COTIRE__UNITY_SOURCE_INIT` can be set to a user provided unity 260 | source file to be used instead of the automatically generated one. 261 | * the target property `COTIRE_UNITY_TARGET_NAME` is no longer read-only. It can be set to the 262 | desired name of the unity target that will be added by cotire. 263 | * add parameters `SOURCE_DIR` and `BINARY_DIR` to function `cotire` to allow for explicitly 264 | specifying a target's source and binary directory, if target to be cotired has been added in a 265 | different directory. 266 | 267 | ## 1.1.8 (2012-10-27) 268 | 269 | * when using MSVC, apply option `/bigobj` to compilation of generated unity files. 270 | 271 | ## 1.1.7 (2012-10-26) 272 | 273 | * cope with double slash characters in scanned include paths. 274 | 275 | ## 1.1.6 (2012-09-22) 276 | 277 | * check result code upon scanning includes. 278 | * always add a `clean_cotire` target to easily clean up cotire generated files. 279 | * add section on `extern "C"` linkage issues to manual. 280 | 281 | ## 1.1.5 (2012-08-17) 282 | 283 | * new cache variable `COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS` can be set to globally exclude 284 | sources with the listed file extensions from the generated unity source. 285 | * fix check for multi-architecture builds under OS X. 286 | 287 | ## 1.1.4 (2012-08-15) 288 | 289 | * prevent redundant re-generation of the unity source, prefix header and precompiled header files 290 | (this makes cotire more applicable to C++ projects that use Qt). 291 | 292 | ## 1.1.3 (2012-08-12) 293 | 294 | * fix out of range index operation upon building list of target include directories. 295 | * honor target properties `POSITION_INDEPENDENT_CODE` and `NO_SONAME` introduced with CMake 2.8.9. 296 | * make selection of target source files for requested target language more careful. 297 | * prevent modification of the CMake policy stack upon CMake version check. 298 | 299 | ## 1.1.2 (2012-05-06) 300 | 301 | * make handling of include directories more robust against invalid paths. 302 | 303 | ## 1.1.1 (2012-04-20) 304 | 305 | * fixed bug with generation of unity targets for `WIN32_EXECUTABLE` targets. 306 | * fixed bug with parsing of localized MSVC `/showIncludes` output. 307 | 308 | ## 1.1.0 (2012-04-19) 309 | 310 | * tested with CMake 2.8.8. 311 | * added example to manual that shows how to apply cotire to CMake object library targets. 312 | * fixed multiple bugs with handling of CMake single build type and multiple configuration builds. 313 | * added more robust parsing of localized MSVC `/showIncludes` output. 314 | 315 | ## 1.0.9 (2012-04-09) 316 | 317 | * add support for compiler wrappers like ccache. 318 | * under OS X, apply `CMAKE_OSX_SYSROOT` to prefix header include and ignore paths. 319 | 320 | ## 1.0.8 (2012-04-05) 321 | 322 | * require CMake 2.8.6 since we are using `set_property` option `APPEND_STRING`. 323 | 324 | ## 1.0.7 (2012-04-02) 325 | 326 | * add support for Ninja generator introduced in CMake 2.8.8. 327 | * fix bug with initialization of variable `COTIRE_VERBOSE`. 328 | 329 | ## 1.0.6 (2012-04-01) 330 | 331 | * correctly handle builds where both `CMAKE_BUILD_TYPE` and `CMAKE_CONFIGURATION_TYPES` are set. 332 | 333 | ## 1.0.5 (2012-03-26) 334 | 335 | * fix Visual Studio C++ 2010 compilation of example project. 336 | * enhance heuristic for #include_next directive detection. 337 | * fix llvm-3.0.src.patch for GCC 4.6 compilation. 338 | 339 | ## 1.0.4 (2012-03-24) 340 | 341 | * honor target property INCLUDE_DIRECTORIES introduced in CMake 2.8.8. 342 | 343 | ## 1.0.3 (2012-03-23) 344 | 345 | * handle OBJECT_LIBRARY targets introduced in CMake 2.8.8. 346 | * use predefined compiler version variable, if available. 347 | 348 | ## 1.0.2 (2012-03-16) 349 | 350 | * fix Xcode 4.3 compatibility. 351 | * Cotire manual corrections. 352 | 353 | ## 1.0.1 (2012-03-15) 354 | 355 | * Cotire manual corrections. 356 | * Add prefix header to the generated unity build target. 357 | 358 | ## 1.0.0 (2012-03-11) 359 | 360 | * First release. 361 | -------------------------------------------------------------------------------- /Patches/bullet-2.80-rev2531.patch: -------------------------------------------------------------------------------- 1 | diff -rupN bullet-2.80-rev2531/CMakeLists.txt bullet-2.80-rev2531.cotire/CMakeLists.txt 2 | --- bullet-2.80-rev2531/CMakeLists.txt 2012-03-03 04:15:04.000000000 +0100 3 | +++ bullet-2.80-rev2531.cotire/CMakeLists.txt 2012-03-24 20:40:40.000000000 +0100 4 | @@ -11,6 +11,7 @@ IF(COMMAND cmake_policy) 5 | cmake_policy(SET CMP0003 NEW) 6 | ENDIF(COMMAND cmake_policy) 7 | 8 | +include("${CMAKE_SOURCE_DIR}/cotire.cmake") 9 | 10 | IF (NOT CMAKE_BUILD_TYPE) 11 | # SET(CMAKE_BUILD_TYPE "Debug") 12 | diff -rupN bullet-2.80-rev2531/Demos/OpenGL/CMakeLists.txt bullet-2.80-rev2531.cotire/Demos/OpenGL/CMakeLists.txt 13 | --- bullet-2.80-rev2531/Demos/OpenGL/CMakeLists.txt 2011-09-13 03:52:42.000000000 +0200 14 | +++ bullet-2.80-rev2531.cotire/Demos/OpenGL/CMakeLists.txt 2012-03-24 20:35:19.000000000 +0100 15 | @@ -65,3 +65,7 @@ IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR 16 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 17 | ENDIF (INSTALL_EXTRA_LIBS) 18 | ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) 19 | + 20 | +if (COMMAND cotire) 21 | + cotire(OpenGLSupport) 22 | +endif() 23 | diff -rupN bullet-2.80-rev2531/Extras/ConvexDecomposition/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/ConvexDecomposition/CMakeLists.txt 24 | --- bullet-2.80-rev2531/Extras/ConvexDecomposition/CMakeLists.txt 2010-09-18 02:24:50.000000000 +0200 25 | +++ bullet-2.80-rev2531.cotire/Extras/ConvexDecomposition/CMakeLists.txt 2012-03-24 20:35:36.000000000 +0100 26 | @@ -62,3 +62,7 @@ DESTINATION ${INCLUDE_INSTALL_DIR} FILES 27 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 28 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 29 | ENDIF (INSTALL_EXTRA_LIBS) 30 | + 31 | +if (COMMAND cotire) 32 | + cotire(ConvexDecomposition) 33 | +endif() 34 | diff -rupN bullet-2.80-rev2531/Extras/GIMPACTUtils/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/GIMPACTUtils/CMakeLists.txt 35 | --- bullet-2.80-rev2531/Extras/GIMPACTUtils/CMakeLists.txt 2010-09-18 02:24:50.000000000 +0200 36 | +++ bullet-2.80-rev2531.cotire/Extras/GIMPACTUtils/CMakeLists.txt 2012-03-24 20:35:42.000000000 +0100 37 | @@ -35,3 +35,7 @@ DESTINATION ${INCLUDE_INSTALL_DIR} FILES 38 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 39 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 40 | ENDIF (INSTALL_EXTRA_LIBS) 41 | + 42 | +if (COMMAND cotire) 43 | + cotire(GIMPACTUtils) 44 | +endif() 45 | diff -rupN bullet-2.80-rev2531/Extras/HACD/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/HACD/CMakeLists.txt 46 | --- bullet-2.80-rev2531/Extras/HACD/CMakeLists.txt 2011-07-07 02:28:15.000000000 +0200 47 | +++ bullet-2.80-rev2531.cotire/Extras/HACD/CMakeLists.txt 2012-03-24 20:36:03.000000000 +0100 48 | @@ -49,3 +49,7 @@ DESTINATION ${INCLUDE_INSTALL_DIR} FILES 49 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 50 | 51 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 52 | 53 | ENDIF (INSTALL_EXTRA_LIBS) 54 | 55 | + 56 | 57 | +if (COMMAND cotire) 58 | 59 | + cotire(HACD) 60 | 61 | +endif() 62 | 63 | diff -rupN bullet-2.80-rev2531/Extras/PhysicsEffects/src/base_level/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/PhysicsEffects/src/base_level/CMakeLists.txt 64 | --- bullet-2.80-rev2531/Extras/PhysicsEffects/src/base_level/CMakeLists.txt 2012-03-05 05:59:58.000000000 +0100 65 | +++ bullet-2.80-rev2531.cotire/Extras/PhysicsEffects/src/base_level/CMakeLists.txt 2012-03-24 20:36:29.000000000 +0100 66 | @@ -75,3 +75,7 @@ ADD_LIBRARY(PfxBaseLevel ${PfxBaseLevel_ 67 | 68 | 69 | SET_TARGET_PROPERTIES(PfxBaseLevel PROPERTIES VERSION ${BULLET_VERSION}) 70 | 71 | SET_TARGET_PROPERTIES(PfxBaseLevel PROPERTIES SOVERSION ${BULLET_VERSION}) 72 | 73 | + 74 | 75 | +if (COMMAND cotire) 76 | 77 | + cotire(PfxBaseLevel) 78 | 79 | +endif() 80 | 81 | diff -rupN bullet-2.80-rev2531/Extras/PhysicsEffects/src/low_level/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/PhysicsEffects/src/low_level/CMakeLists.txt 82 | --- bullet-2.80-rev2531/Extras/PhysicsEffects/src/low_level/CMakeLists.txt 2012-03-05 05:59:58.000000000 +0100 83 | +++ bullet-2.80-rev2531.cotire/Extras/PhysicsEffects/src/low_level/CMakeLists.txt 2012-03-24 20:36:39.000000000 +0100 84 | @@ -27,3 +27,7 @@ ADD_LIBRARY(PfxLowLevel ${PfxLowLevel_SR 85 | 86 | 87 | SET_TARGET_PROPERTIES(PfxLowLevel PROPERTIES VERSION ${BULLET_VERSION}) 88 | 89 | SET_TARGET_PROPERTIES(PfxLowLevel PROPERTIES SOVERSION ${BULLET_VERSION}) 90 | 91 | + 92 | 93 | +if (COMMAND cotire) 94 | 95 | + cotire(PfxLowLevel) 96 | 97 | +endif() 98 | 99 | diff -rupN bullet-2.80-rev2531/Extras/PhysicsEffects/src/util/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/PhysicsEffects/src/util/CMakeLists.txt 100 | --- bullet-2.80-rev2531/Extras/PhysicsEffects/src/util/CMakeLists.txt 2012-03-05 05:59:58.000000000 +0100 101 | +++ bullet-2.80-rev2531.cotire/Extras/PhysicsEffects/src/util/CMakeLists.txt 2012-03-24 20:36:47.000000000 +0100 102 | @@ -18,3 +18,7 @@ ADD_LIBRARY(PfxUtil ${PfxUtil_SRCS} ${Pf 103 | 104 | 105 | SET_TARGET_PROPERTIES(PfxUtil PROPERTIES VERSION ${BULLET_VERSION}) 106 | 107 | SET_TARGET_PROPERTIES(PfxUtil PROPERTIES SOVERSION ${BULLET_VERSION}) 108 | 109 | + 110 | 111 | +if (COMMAND cotire) 112 | 113 | + cotire(PfxUtil) 114 | 115 | +endif() 116 | 117 | diff -rupN bullet-2.80-rev2531/Extras/Serialize/BlenderSerialize/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/Serialize/BlenderSerialize/CMakeLists.txt 118 | --- bullet-2.80-rev2531/Extras/Serialize/BlenderSerialize/CMakeLists.txt 2010-03-06 16:23:36.000000000 +0100 119 | +++ bullet-2.80-rev2531.cotire/Extras/Serialize/BlenderSerialize/CMakeLists.txt 2012-03-24 20:36:55.000000000 +0100 120 | @@ -5,3 +5,7 @@ ${BULLET_PHYSICS_SOURCE_DIR}/Extras/Seri 121 | ) 122 | 123 | ADD_LIBRARY(BlenderSerialize dna249.cpp dna249-64bit.cpp bBlenderFile.cpp bBlenderFile.h bMain.cpp bMain.h ) 124 | + 125 | +if (COMMAND cotire) 126 | + cotire(BlenderSerialize) 127 | +endif() 128 | diff -rupN bullet-2.80-rev2531/Extras/Serialize/BulletFileLoader/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/Serialize/BulletFileLoader/CMakeLists.txt 129 | --- bullet-2.80-rev2531/Extras/Serialize/BulletFileLoader/CMakeLists.txt 2012-02-29 05:43:51.000000000 +0100 130 | +++ bullet-2.80-rev2531.cotire/Extras/Serialize/BulletFileLoader/CMakeLists.txt 2012-03-24 20:37:05.000000000 +0100 131 | @@ -47,3 +47,7 @@ DESTINATION ${INCLUDE_INSTALL_DIR} FILES 132 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 133 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 134 | ENDIF (INSTALL_EXTRA_LIBS) 135 | + 136 | +if (COMMAND cotire) 137 | + cotire(BulletFileLoader) 138 | +endif() 139 | diff -rupN bullet-2.80-rev2531/Extras/Serialize/BulletWorldImporter/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/Serialize/BulletWorldImporter/CMakeLists.txt 140 | --- bullet-2.80-rev2531/Extras/Serialize/BulletWorldImporter/CMakeLists.txt 2012-02-29 05:43:51.000000000 +0100 141 | +++ bullet-2.80-rev2531.cotire/Extras/Serialize/BulletWorldImporter/CMakeLists.txt 2012-03-24 20:37:15.000000000 +0100 142 | @@ -36,3 +36,7 @@ DESTINATION ${INCLUDE_INSTALL_DIR} FILES 143 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 144 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 145 | ENDIF (INSTALL_EXTRA_LIBS) 146 | + 147 | +if (COMMAND cotire) 148 | + cotire(BulletWorldImporter) 149 | +endif() 150 | diff -rupN bullet-2.80-rev2531/Extras/Serialize/makesdna/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/Serialize/makesdna/CMakeLists.txt 151 | --- bullet-2.80-rev2531/Extras/Serialize/makesdna/CMakeLists.txt 2010-03-06 16:23:36.000000000 +0100 152 | +++ bullet-2.80-rev2531.cotire/Extras/Serialize/makesdna/CMakeLists.txt 2012-03-24 20:37:26.000000000 +0100 153 | @@ -35,3 +35,7 @@ SET(SRC ${BULLET_PHYSICS_SOURCE_DIR}/sr 154 | ADD_LIBRARY(BulletDNA ${SRC} ${INC_FILES}) 155 | 156 | MESSAGE(STATUS "Configuring makesdna") 157 | + 158 | +if (COMMAND cotire) 159 | + cotire(BulletDNA) 160 | +endif() 161 | diff -rupN bullet-2.80-rev2531/Extras/glui/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/glui/CMakeLists.txt 162 | --- bullet-2.80-rev2531/Extras/glui/CMakeLists.txt 2010-03-06 16:23:36.000000000 +0100 163 | +++ bullet-2.80-rev2531.cotire/Extras/glui/CMakeLists.txt 2012-03-24 20:35:51.000000000 +0100 164 | @@ -64,3 +64,7 @@ arcball.cpp glui_button.cpp glui_fil 165 | IF (BUILD_SHARED_LIBS) 166 | TARGET_LINK_LIBRARIES(GLUI ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) 167 | ENDIF (BUILD_SHARED_LIBS) 168 | + 169 | +if (COMMAND cotire) 170 | + cotire(GLUI) 171 | +endif() 172 | diff -rupN bullet-2.80-rev2531/Extras/iff/CMakeLists.txt bullet-2.80-rev2531.cotire/Extras/iff/CMakeLists.txt 173 | --- bullet-2.80-rev2531/Extras/iff/CMakeLists.txt 2010-03-06 16:23:36.000000000 +0100 174 | +++ bullet-2.80-rev2531.cotire/Extras/iff/CMakeLists.txt 2012-03-24 20:36:12.000000000 +0100 175 | @@ -9,3 +9,7 @@ iffw.cpp 176 | ) 177 | 178 | #SUBDIRS( BulletIffConverter ) 179 | + 180 | +if (COMMAND cotire) 181 | + cotire(Iff) 182 | +endif() 183 | diff -rupN bullet-2.80-rev2531/UnitTests/cppunit/CMakeLists.txt bullet-2.80-rev2531.cotire/UnitTests/cppunit/CMakeLists.txt 184 | --- bullet-2.80-rev2531/UnitTests/cppunit/CMakeLists.txt 2010-07-24 00:09:57.000000000 +0200 185 | +++ bullet-2.80-rev2531.cotire/UnitTests/cppunit/CMakeLists.txt 2012-03-24 20:39:51.000000000 +0100 186 | @@ -71,4 +71,8 @@ ADD_LIBRARY(cppunit 187 | 188 | src/cppunit/XmlDocument.cpp 189 | 190 | src/cppunit/XmlElement.cpp 191 | 192 | 193 | 194 | -) 195 | \ No newline at end of file 196 | +) 197 | 198 | + 199 | 200 | +if (COMMAND cotire) 201 | 202 | + cotire(cppunit) 203 | 204 | +endif() 205 | 206 | diff -rupN bullet-2.80-rev2531/src/BulletCollision/CMakeLists.txt bullet-2.80-rev2531.cotire/src/BulletCollision/CMakeLists.txt 207 | --- bullet-2.80-rev2531/src/BulletCollision/CMakeLists.txt 2012-02-29 06:19:22.000000000 +0100 208 | +++ bullet-2.80-rev2531.cotire/src/BulletCollision/CMakeLists.txt 2012-03-24 20:37:38.000000000 +0100 209 | @@ -277,3 +277,7 @@ DESTINATION ${INCLUDE_INSTALL_DIR}/Bulle 210 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 211 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 212 | ENDIF (INSTALL_LIBS) 213 | + 214 | +if (COMMAND cotire) 215 | + cotire(BulletCollision) 216 | +endif() 217 | diff -rupN bullet-2.80-rev2531/src/BulletDynamics/CMakeLists.txt bullet-2.80-rev2531.cotire/src/BulletDynamics/CMakeLists.txt 218 | --- bullet-2.80-rev2531/src/BulletDynamics/CMakeLists.txt 2011-09-15 20:47:13.000000000 +0200 219 | +++ bullet-2.80-rev2531.cotire/src/BulletDynamics/CMakeLists.txt 2012-03-24 20:43:34.000000000 +0100 220 | @@ -110,3 +110,7 @@ DESTINATION ${INCLUDE_INSTALL_DIR}/Bulle 221 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 222 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 223 | ENDIF (INSTALL_LIBS) 224 | + 225 | +if (COMMAND cotire) 226 | + cotire(BulletDynamics) 227 | +endif() 228 | diff -rupN bullet-2.80-rev2531/src/BulletMultiThreaded/CMakeLists.txt bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/CMakeLists.txt 229 | --- bullet-2.80-rev2531/src/BulletMultiThreaded/CMakeLists.txt 2012-02-29 06:19:22.000000000 +0100 230 | +++ bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/CMakeLists.txt 2012-03-24 20:37:58.000000000 +0100 231 | @@ -121,3 +121,6 @@ PATTERN "*.h" PATTERN ".svn" EXCLUDE PA 232 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 233 | ENDIF (INSTALL_LIBS) 234 | 235 | +if (COMMAND cotire) 236 | + cotire(BulletMultiThreaded) 237 | +endif() 238 | diff -rupN bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/CMakeLists.txt bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/CMakeLists.txt 239 | --- bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/CMakeLists.txt 2011-11-11 20:00:26.000000000 +0100 240 | +++ bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/CMakeLists.txt 2012-03-24 20:38:09.000000000 +0100 241 | @@ -81,3 +81,7 @@ IF (INSTALL_LIBS) 242 | 243 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 244 | 245 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 246 | 247 | ENDIF (INSTALL_LIBS) 248 | 249 | + 250 | 251 | +if (COMMAND cotire) 252 | 253 | + cotire(BulletSoftBodySolvers_DX11) 254 | 255 | +endif() 256 | 257 | diff -rupN bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/AMD/CMakeLists.txt bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/AMD/CMakeLists.txt 258 | --- bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/AMD/CMakeLists.txt 2011-12-20 19:03:24.000000000 +0100 259 | +++ bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/AMD/CMakeLists.txt 2012-03-24 20:38:22.000000000 +0100 260 | @@ -60,3 +60,7 @@ IF (INSTALL_LIBS) 261 | 262 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 263 | 264 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 265 | 266 | ENDIF (INSTALL_LIBS) 267 | 268 | + 269 | 270 | +if (COMMAND cotire) 271 | 272 | + cotire(BulletSoftBodySolvers_OpenCL_AMD) 273 | 274 | +endif() 275 | 276 | diff -rupN bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Apple/CMakeLists.txt bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Apple/CMakeLists.txt 277 | --- bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Apple/CMakeLists.txt 2011-11-11 20:00:26.000000000 +0100 278 | +++ bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Apple/CMakeLists.txt 2012-03-24 20:38:38.000000000 +0100 279 | @@ -75,3 +75,7 @@ IF (INSTALL_LIBS) 280 | 281 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 282 | 283 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 284 | 285 | ENDIF (INSTALL_LIBS) 286 | 287 | + 288 | 289 | +if (COMMAND cotire) 290 | 291 | + cotire(BulletSoftBodySolvers_OpenCL_Apple) 292 | 293 | +endif() 294 | 295 | diff -rupN bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Intel/CMakeLists.txt bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Intel/CMakeLists.txt 296 | --- bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Intel/CMakeLists.txt 2011-12-20 19:03:24.000000000 +0100 297 | +++ bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Intel/CMakeLists.txt 2012-03-24 20:38:51.000000000 +0100 298 | @@ -80,3 +80,7 @@ IF (INSTALL_LIBS) 299 | 300 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 301 | 302 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 303 | 304 | ENDIF (INSTALL_LIBS) 305 | 306 | + 307 | 308 | +if (COMMAND cotire) 309 | 310 | + cotire(BulletSoftBodySolvers_OpenCL_Intel) 311 | 312 | +endif() 313 | 314 | diff -rupN bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/CMakeLists.txt bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/CMakeLists.txt 315 | --- bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/CMakeLists.txt 2011-11-11 20:00:26.000000000 +0100 316 | +++ bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/CMakeLists.txt 2012-03-24 20:39:00.000000000 +0100 317 | @@ -73,3 +73,7 @@ IF (INSTALL_LIBS) 318 | 319 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 320 | 321 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 322 | 323 | ENDIF (INSTALL_LIBS) 324 | 325 | + 326 | 327 | +if (COMMAND cotire) 328 | 329 | + cotire(BulletSoftBodySolvers_OpenCL_Mini) 330 | 331 | +endif() 332 | 333 | diff -rupN bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/NVidia/CMakeLists.txt bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/NVidia/CMakeLists.txt 334 | --- bullet-2.80-rev2531/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/NVidia/CMakeLists.txt 2011-12-20 19:03:24.000000000 +0100 335 | +++ bullet-2.80-rev2531.cotire/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/NVidia/CMakeLists.txt 2012-03-24 20:39:08.000000000 +0100 336 | @@ -79,3 +79,7 @@ IF (INSTALL_LIBS) 337 | 338 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 339 | 340 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 341 | 342 | ENDIF (INSTALL_LIBS) 343 | 344 | + 345 | 346 | +if (COMMAND cotire) 347 | 348 | + cotire(BulletSoftBodySolvers_OpenCL_NVidia) 349 | 350 | +endif() 351 | 352 | diff -rupN bullet-2.80-rev2531/src/BulletSoftBody/CMakeLists.txt bullet-2.80-rev2531.cotire/src/BulletSoftBody/CMakeLists.txt 353 | --- bullet-2.80-rev2531/src/BulletSoftBody/CMakeLists.txt 2010-12-01 06:55:08.000000000 +0100 354 | +++ bullet-2.80-rev2531.cotire/src/BulletSoftBody/CMakeLists.txt 2012-03-24 20:39:20.000000000 +0100 355 | @@ -63,3 +63,7 @@ DESTINATION ${INCLUDE_INSTALL_DIR} FILES 356 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 357 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 358 | ENDIF (INSTALL_LIBS) 359 | + 360 | +if (COMMAND cotire) 361 | + cotire(BulletSoftBody) 362 | +endif() 363 | diff -rupN bullet-2.80-rev2531/src/LinearMath/CMakeLists.txt bullet-2.80-rev2531.cotire/src/LinearMath/CMakeLists.txt 364 | --- bullet-2.80-rev2531/src/LinearMath/CMakeLists.txt 2011-11-11 21:11:03.000000000 +0100 365 | +++ bullet-2.80-rev2531.cotire/src/LinearMath/CMakeLists.txt 2012-03-24 20:39:28.000000000 +0100 366 | @@ -64,3 +64,7 @@ DESTINATION ${INCLUDE_INSTALL_DIR} FILES 367 | ENDIF (APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) 368 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 369 | ENDIF (INSTALL_LIBS) 370 | + 371 | +if (COMMAND cotire) 372 | + cotire(LinearMath) 373 | +endif() 374 | diff -rupN bullet-2.80-rev2531/src/MiniCL/CMakeLists.txt bullet-2.80-rev2531.cotire/src/MiniCL/CMakeLists.txt 375 | --- bullet-2.80-rev2531/src/MiniCL/CMakeLists.txt 2012-02-29 06:19:22.000000000 +0100 376 | +++ bullet-2.80-rev2531.cotire/src/MiniCL/CMakeLists.txt 2012-03-24 20:39:38.000000000 +0100 377 | @@ -64,3 +64,6 @@ PATTERN "*.h" PATTERN ".svn" EXCLUDE PA 378 | ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) 379 | 380 | ENDIF (INSTALL_LIBS) 381 | 382 | 383 | 384 | +if (COMMAND cotire) 385 | 386 | + cotire(MiniCL) 387 | 388 | +endif() 389 | 390 | -------------------------------------------------------------------------------- /MANUAL.md: -------------------------------------------------------------------------------- 1 | cotire manual 2 | ============= 3 | 4 | Cotire (compile time reducer) is a CMake module that speeds up the build process of CMake based 5 | build systems by fully automating techniques as [precompiled header][pch] usage and 6 | [single compilation unit][scu] builds for C and C++. 7 | 8 | motivation 9 | ---------- 10 | 11 | Cotire was born out of a dissatisfaction with the existing CMake solutions for adding 12 | [precompiled header][1260] support and unity build support to CMake based build systems. 13 | The design of cotire tries to adhere to the following principles: 14 | 15 | #### as automatic as possible 16 | 17 | [Precompiled header][pch] and [unity builds][scu] are good ideas in principle, but in reality 18 | they do not work if the burden of maintaining the required additional source files (a 19 | [prefix header][pfh] and a unity source file) is put on the developer. A modern build system 20 | like CMake provides enough context information to have the build system generate and update 21 | these files automatically. 22 | 23 | #### non-intrusive 24 | 25 | The configuration of precompiled headers usage and single computation unit builds belongs to the 26 | build system and not in the source code. Nobody wants to litter one's source files with `hdrstop` 27 | pragmas or be forced to add an include directive to every file. Source code should build properly 28 | when a precompiled header isn't used and should build faster when a precompiled header is used. 29 | 30 | #### minimal interface 31 | 32 | Maintaining a build system over time is enough work and the CMake language may often get in your 33 | way. Thus the solution should only add few public CMake functions. It should be easy to integrate 34 | it into an existing CMake based build system and it should be just as easy to remove it again. 35 | 36 | #### lazy file creation 37 | 38 | The additional source files needed for precompiled header support and unity build support should 39 | only be created when they are required for the compilation of a target. Thus the solution should 40 | not create these files upon configuring the project, but should set up custom build commands for 41 | the creation of these files that only kick in when the files are required to exist by the build 42 | process. 43 | 44 | #### cross-platform 45 | 46 | C/C++ Compilers and IDEs on different platforms vary widely in how the implement precompiled 47 | header support. The solution should hide these implementation details and present a uniform 48 | interface to the developer on all supported platforms. 49 | 50 | cotire basic usage 51 | ------------------ 52 | 53 | Cotire consists of a single CMake module file, which can be easily added to an existing CMake 54 | project. 55 | 56 | The file `CMake/cotire.cmake` needs to be copied to the module directory of a CMake project. In the 57 | top-level `CMakeList.txt` file, the module directory needs to be added to the CMake module search 58 | path: 59 | 60 | set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") 61 | 62 | To use cotire in a CMake project, one adds the following include directive to the beginning of the 63 | top-level `CMakeList.txt`: 64 | 65 | include(cotire) 66 | 67 | To speed the build process of a CMake library or executable target, the `cotire` function is 68 | applied to a CMake target. From the example project that ships with cotire: 69 | 70 | add_executable(example main.cpp example.cpp log.cpp log.h example.h) 71 | ... 72 | cotire(example) 73 | 74 | Cotire looks at the properties of the target provided by CMake (e.g., target type, source files, 75 | compile flags, preprocessor defines, include directories, ...) and modifies the target's build 76 | process in the following way: 77 | 78 | 1. cotire adds a custom build rule to produce a unity source file from the target's sources. 79 | 2. cotire adds a custom build rule to produce a prefix header file by tracking the header files 80 | included by the target's sources. 81 | 3. cotire adds a custom build rule to produce a precompiled header from the prefix header. 82 | 4. cotire modifies the target's compile flags to make use of the generated precompiled header. 83 | 5. cotire adds a couple of new targets. 84 | 85 | For makefile based build systems, running `make help` in the terminal reveals the new targets: 86 | 87 | $ make help 88 | ... 89 | ... all_pch 90 | ... all_unity 91 | ... clean_cotire 92 | ... example 93 | ... example_pch 94 | ... example_unity 95 | 96 | The `example_pch` target triggers the compilation of the precompiled header and as a side effect 97 | the generation of the unity source and the prefix header. The target `clean_cotire` cleans up all 98 | files generated by cotire. The `example_unity` target produces the same output as the original 99 | `example` target, but does so by performing a unity build. The `all_pch` and `all_unity` serve as 100 | pool targets for all cotired project targets. 101 | 102 | By default, the `example_unity` target inherits all build settings from the original target 103 | `example` including linked libraries and target dependencies. 104 | 105 | cotire generated files 106 | ---------------------- 107 | 108 | For a target that has been cotired, three files will be generated as part of the build process: 109 | 110 | ### the unity source 111 | 112 | The unity source file is generated from the target by querying the target's `SOURCES` property. 113 | It consists of preprocessor include directives for each of the target source files. The files 114 | are included in the same order that is used in the CMake `add_executable` or `add_library` call. 115 | Header files are omitted. 116 | 117 | This is a unity source generated for the example project under OS X: 118 | 119 | #ifdef __cplusplus 120 | #include "/Users/sakra/Documents/cotire/src/main.cpp" 121 | #include "/Users/sakra/Documents/cotire/src/example.cpp" 122 | #include "/Users/sakra/Documents/cotire/src/log.cpp" 123 | #endif 124 | 125 | The unity source file uses absolute paths to include the target's source file. The file is not 126 | intended to be portable across different build folders or machines. It is an intermediate file 127 | tied to the build folder that is automatically recreated by the build system if it is missing. 128 | 129 | For multi-core machines cotire can be configured to generate multiple unity file segments that 130 | can be built in parallel by the chosen CMake generator (see below). 131 | 132 | ### the prefix header 133 | 134 | The prefix header is produced from the unity source file by running the unity file through the 135 | preprocessor and keeping track of each header file used (this is done by using option `-H` with 136 | GCC / Clang and `/showIncludes` with Visual Studio C++). The path of each used header file is 137 | compared against an exclude directory list and an include directory list to decide if the header 138 | file should be added to the prefix header. 139 | 140 | By default the include directory list is empty and the exclude directory list is initialized to 141 | `"${CMAKE_SOURCE_DIR};${CMAKE_BINARY_DIR}"`. This default setting guarantees that project headers 142 | which are likely to be changed frequently are not added to the prefix header. 143 | 144 | Upon generation of the prefix header cotire makes sure that target compile options, include path 145 | settings and preprocessor defines (e.g., `NDEBUG`) that affect the outcome of the preprocessor 146 | are correctly set up. 147 | 148 | Generating the prefix header from the unity source is much faster than running each individual 149 | target source file through the preprocessor, because the coalesced unity source will make the 150 | preprocessor process most header files only once. 151 | 152 | This is a prefix header produced for the example project with Visual Studio 2013 under Windows 7: 153 | 154 | #pragma warning(push, 0) 155 | #ifdef __cplusplus 156 | #include "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\string" 157 | #include "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\algorithm" 158 | #include "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\iostream" 159 | #endif 160 | #pragma warning(pop) 161 | 162 | Generating the prefix file under Ubuntu 12.04 with GCC 4.6 yields the following result: 163 | 164 | #pragma GCC system_header 165 | #ifdef __cplusplus 166 | #include "/usr/include/c++/4.6/string" 167 | #include "/usr/include/c++/4.6/algorithm" 168 | #include "/usr/include/c++/4.6/iterator" 169 | #include "/usr/include/c++/4.6/iostream" 170 | #endif 171 | 172 | Using Xcode 5.1 under OS X 10.9, this is the resulting prefix header: 173 | 174 | #pragma clang system_header 175 | #ifdef __cplusplus 176 | #include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/string" 177 | #include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/iostream" 178 | #endif 179 | 180 | Besides include directives, cotire also adds compiler specific pragmas to the generated prefix 181 | header to suppress compiler warnings upon inclusion. 182 | 183 | Cotire attempts to produce a minimal list of header files by omitting header files indirectly 184 | included by a header that is already part of the prefix header. Header files with nonstandard 185 | file extensions like `.inl`, `.inc` of `.ipp` are omitted by default. 186 | 187 | The generated prefix file includes the selected header files by their absolute paths. This speeds 188 | up the precompiling of the prefix header because the compiler does not have to search for header 189 | files in include directories again. 190 | 191 | The prefix header is tailored to the CMake target that it is generated for. It is tied to the 192 | compiler environment of the local machine and is not portable across different compilers or 193 | machines. It is automatically recreated by the build system if it goes missing. 194 | 195 | The generated prefix header can be applied to a different target added in the same source directory 196 | (see below). 197 | 198 | Optionally, cotire will also create a prefix source file that consists of a single include directive 199 | for the prefix header. This file is needed for pre-compiling the prefix header with Clang or GCC 200 | to make both compilers handle the `system_header` pragma correctly. 201 | 202 | ### the precompiled header 203 | 204 | The precompiled header is produced from the generated prefix header by using the proprietary 205 | precompiling mechanism depending on the compiler used. For GCC and Clang cotire sets up a custom 206 | build rule and generates the precompiled header as described in the documentation for 207 | [GCC][gcc_pch] and [Clang][clang_pch]. Cotire then modifies the `COMPILE_FLAGS` property of the 208 | target to force the inclusion of the prefix header. 209 | 210 | Visual Studio C++ and Intel C++ use a [different approach][msvc_pch] to pre-compiling. Both 211 | compilers require a host source file to generate the precompiled header as a side effect of 212 | producing an object file. Cotire modifies the `COMPILE_FLAGS` of the first target source file to 213 | [generate][msvc_pch_create] the precompiled header and then modifies the `COMPILE_FLAGS` of the 214 | remaining target source files to [include][msvc_pch_use] the generated precompiled header. 215 | 216 | For Xcode projects generated with CMake, cotire completely hands off the pre-compilation of 217 | the prefix header and the inclusion of the precompiled header to the IDE. Cotire attaches a 218 | pre-build action to the target which generates the unity source file and the prefix header. 219 | Cotire then modifies Xcode attributes of the generated Xcode project to have Xcode precompile the 220 | the generated prefix header with the Xcode build steps `ProcessPCH` for C sources and 221 | `ProcessPCH++` for C++ sources. 222 | 223 | For precompiled headers creation flags must match use flags exactly. Cotire uses the same flags, 224 | include directories and preprocessor defines that are used for the compilation of source files 225 | for the generation of the precompiled header. Thus the resulting precompiled header binary is only 226 | usable for the target and cannot be re-used for a different CMake target. 227 | 228 | cotire advanced usage 229 | --------------------- 230 | 231 | ### applying cotire to multiple targets at the same time 232 | 233 | The `cotire` function can be applied to multiple targets added in the same source directory in one 234 | call: 235 | 236 | add_library(libA STATIC ...) 237 | add_library(libB SHARED ...) 238 | add_executable(example ...) 239 | ... 240 | cotire(example libA libB) 241 | 242 | ### mixed-language targets 243 | 244 | Cotire is able to speed up the build process of mixed language targets, consisting of both C and 245 | C++ sources. It generates a separate set of unity source files, prefix headers and precompiled 246 | headers for both languages and modifies the `COMPILE_FLAGS` of each target source file to include 247 | the correct precompiled header depending on the compilation language of the source file. 248 | 249 | ### obtaining the names of the generated files and targets 250 | 251 | For a cotired target the target properties `COTIRE__UNITY_SOURCE`, 252 | `COTIRE__PREFIX_HEADER`, `COTIRE__PRECOMPILED_HEADER` will be set to the paths of the 253 | generated files (`` can be set to `CXX` or `C`). The target property 254 | `COTIRE_UNITY_TARGET_NAME` will be set to the name of the generated unity target: 255 | 256 | cotire(example) 257 | ... 258 | get_target_property(_unitySource example COTIRE_CXX_UNITY_SOURCE) 259 | get_target_property(_prefixHeader example COTIRE_CXX_PREFIX_HEADER) 260 | get_target_property(_precompiledHeader example COTIRE_CXX_PRECOMPILED_HEADER) 261 | get_target_property(_unityTargetName example COTIRE_UNITY_TARGET_NAME) 262 | 263 | If a source file's `COMPILE_FLAGS` are modified by cotire, it sets the source file property 264 | `COTIRE_TARGET` to the name of the target, that the source file's build command has been 265 | altered for: 266 | 267 | cotire(example) 268 | ... 269 | get_source_file_property(_cotireTargetName "example.cpp" COTIRE_TARGET) 270 | if (_cotireTargetName) 271 | message(STATUS "example.cpp has been cotired for target ${_cotireTargetName}") 272 | endif() 273 | 274 | ### changing the name of the generated unity build target 275 | 276 | By default cotire uses the name of the the original target with the suffix `_unity` appended 277 | for the name of the generated unity build target. To create the unity build target under a 278 | different name, set the `COTIRE_UNITY_TARGET_NAME` property: 279 | 280 | add_executable(example_template main.cpp example.cpp log.cpp log.h example.h) 281 | set_target_properties(example_template PROPERTIES COTIRE_UNITY_TARGET_NAME "example") 282 | ... 283 | cotire(example_template) 284 | 285 | Invoking the `example` target will then run the unity build. 286 | 287 | ### restricting cotire to certain build configurations 288 | 289 | To restrict the cotire related modifications to the build process to certain build configurations, 290 | the `CONFIGURATIONS` parameter can be added to the `cotire` call. 291 | 292 | cotire(example CONFIGURATIONS Release MinSizeRel) 293 | 294 | For single build type builds the selected configuration will be checked at configure time, for 295 | multi-configuration builds the check will be done at build time. 296 | 297 | It is recommended to have at least one build configuration that does not make use of cotire to 298 | ensure that the project builds properly without cotire. 299 | 300 | ### disabling precompiled headers and unity builds 301 | 302 | If the target's build process should not be modified to make use of the generated precompiled 303 | header, the target property `COTIRE_ENABLE_PRECOMPILED_HEADER` can be set to `FALSE`: 304 | 305 | set_target_properties(example PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE) 306 | cotire(example) 307 | 308 | If a unity build target should not be added by cotire, the target property 309 | `COTIRE_ADD_UNITY_BUILD` can be set to `FALSE`: 310 | 311 | set_target_properties(example PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE) 312 | cotire(example) 313 | 314 | The property `COTIRE_ADD_UNITY_BUILD` only affects the addition of the unity build target. Custom 315 | build rules for the generation of the unity source file will always be set up, because the 316 | unity source file is needed for the generation of the prefix header. 317 | 318 | Both properties default to `TRUE`. If both are set to `FALSE`, cotire will only set up custom build 319 | rules for the generation of the unity source and the prefix header. 320 | 321 | The properties `COTIRE_ENABLE_PRECOMPILED_HEADER` and `COTIRE_ADD_UNITY_BUILD` can also be set on 322 | directories. A target inherits the property value from its enclosing directory. 323 | 324 | ### disabling precompiled headers for small targets 325 | 326 | The cache variable `COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES` can be set to the minimum number of 327 | source files required to enable the use of a precompiled header. It defaults to 2. To override the 328 | default, run `cmake` with the following options: 329 | 330 | $ cmake -D COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES=5 331 | 332 | ### using a manually maintained prefix header instead of the automatically generated one 333 | 334 | cotire can be configured to use an existing manually maintained prefix header (e.g., Visual Studio 335 | projects often use a prefix header named `stdafx.h`) instead of the automatically generated one. 336 | Set the target property `COTIRE_CXX_PREFIX_HEADER_INIT` to the path of the existing prefix header 337 | file. The path is interpreted relative to the target source directory: 338 | 339 | set_target_properties(example PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "stdafx.h") 340 | cotire(example) 341 | 342 | If the prefix header `stdafx.h` needs an accompanying source file (e.g., `stdafx.cpp`) in order 343 | to be precompiled properly, that source file needs to be the first one on the list of source 344 | files in the target's `add_executable` or `add_library` call. 345 | 346 | The property `COTIRE_CXX_PREFIX_HEADER_INIT` can also be set to a list of header files which will 347 | then make up the contents of the generated prefix header. 348 | 349 | A manually maintained prefix header will always be applied to the corresponding target, 350 | even if the target contains too few sources to enable the use of a precompiled header. 351 | 352 | ### using a generated prefix header for multiple targets 353 | 354 | A prefix header that is generated for a cotired target can be applied to a different target 355 | added in the same source directory: 356 | 357 | cotire(example) 358 | get_target_property(_prefixHeader example COTIRE_CXX_PREFIX_HEADER) 359 | ... 360 | set_target_properties(other_target PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${_prefixHeader}") 361 | cotire(other_target) 362 | 363 | The compilation of either target will trigger the generation of the prefix header. 364 | 365 | ### configuring the generation of the prefix header 366 | 367 | There are multiple target properties which affect the generation of the prefix header: 368 | 369 | * `COTIRE_PREFIX_HEADER_IGNORE_PATH` can be set to a semicolon separated list of directories. If a 370 | header file is found in one of these directories or sub-directories, it will be excluded from the 371 | generated prefix header. 372 | 373 | * `COTIRE_PREFIX_HEADER_INCLUDE_PATH` can be set to a semicolon separated list of directories. If 374 | a header file is included from one of these directories or sub-directories, it will be included 375 | in the generated prefix header. 376 | 377 | If a header file is matched by both `COTIRE_PREFIX_HEADER_IGNORE_PATH` and 378 | `COTIRE_PREFIX_HEADER_INCLUDE_PATH`, the option which yields the closer relative path match wins. 379 | For example, if third-party libraries are part of the source tree in a directory called `Libs`, 380 | the following setting will make cotire select header files from the third-party directory, but 381 | ignore other project related headers in `CMAKE_SOURCE_DIR`: 382 | 383 | set_target_properties(example PROPERTIES 384 | COTIRE_PREFIX_HEADER_IGNORE_PATH "${CMAKE_SOURCE_DIR}" 385 | COTIRE_PREFIX_HEADER_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/Libs") 386 | 387 | The properties `COTIRE_PREFIX_HEADER_IGNORE_PATH` and `COTIRE_PREFIX_HEADER_INCLUDE_PATH` can 388 | also be set on directories. 389 | 390 | The following cache variables also affect the selection of prefix headers: 391 | 392 | * Directory paths in `COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH` will be added to the list of 393 | ignored directories when the prefix header file is created. 394 | 395 | * `COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS` can be used to ignore header files by file 396 | extension. It defaults to the CMake list `inc;inl;ipp`. 397 | 398 | During development, changes to the project source files may affect the list of header files that 399 | should be selected for inclusion in the prefix header (e.g., a standard include may be added or 400 | removed from a target source file). Cotire does not automatically recreate the prefix header, 401 | when a target source file is changed, because this would always trigger a re-compilation of the 402 | precompiled header and would result in a rebuild of the whole target. To make the prefix header 403 | creation dependent on changes to certain target source files, the source file property 404 | `COTIRE_DEPENDENCY` can be set to `TRUE` for those files: 405 | 406 | set_property (SOURCE "example.cpp" PROPERTY COTIRE_DEPENDENCY "TRUE") 407 | 408 | ### fixing linkage issues 409 | 410 | When a C++ program uses `extern "C"` on a system header file, cotire will not be able to detect 411 | that the include file needs C linkage and will include the file with C++ linkage in the generated 412 | prefix header instead. For example, the C interface to BLAS `cblas.h` usually has to be included 413 | as `extern "C"` in a C++ program: 414 | 415 | extern "C" { 416 | #include 417 | } 418 | 419 | The presence of `extern "C"` includes will prevent cotired targets from being linked successfully 420 | because of unresolved function references using the wrong linkage. To work around the problem, 421 | the property `COTIRE_PREFIX_HEADER_IGNORE_PATH` can also include the full path of header files 422 | besides directories. Here is an example: 423 | 424 | set_property(DIRECTORY 425 | PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH 426 | "${ATLAS_INCLUDE_DIR}/cblas.h" 427 | "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}") 428 | 429 | That way `cblas.h` will not be included in the generated prefix header and will not cause problems 430 | upon linking. 431 | 432 | ### using a manually maintained unity source instead of the automatically generated one 433 | 434 | Cotire can be configured to use an existing manually maintained unity source file instead of the 435 | automatically generated one. Set the target property `COTIRE_CXX_UNITY_SOURCE_INIT` to the path 436 | of the existing unity source file. Its path is interpreted relative to the target source directory: 437 | 438 | set_target_properties(example PROPERTIES COTIRE_CXX_UNITY_SOURCE_INIT "example-all.cpp") 439 | cotire(example) 440 | 441 | The property can also be set to a list of source files which will then make up the contents of 442 | the generated unity source file. 443 | 444 | ### configuring the generation of the unity source 445 | 446 | By default cotire adds all target source files to the generated unity source. In most cases a 447 | unity build will not work out of the box, because unity builds [break][EoUB] the use of some C 448 | and C++ language features. Unity build problems can be tackled in the following way: 449 | 450 | * Change the order of the source files in the `add_executable` or `add_library` calls. 451 | Problematic source files should be moved towards the end. 452 | 453 | * Set the source file property `COTIRE_EXCLUDED` on problematic source files. The source file 454 | will not be included in the unity source file and will be compiled separately when the unity build 455 | is performed. 456 | 457 | * `COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS` can be used to exclude source files by file extension 458 | from inclusion in the generated unity source. It defaults to the CMake list `m;mm`. 459 | 460 | * If the unity source file is too large and the compilation process runs into a compiler limit, 461 | the target property `COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES` can be set. If the target 462 | contains more than that number of source files, cotire will create multiple unity source files 463 | for it. Each unity source file is compiled separately when the unity build is performed. 464 | The property is initialized by value of the cache variable 465 | `COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES`. 466 | 467 | * Another way to break up a large unity source file is to set the source file property 468 | `COTIRE_START_NEW_UNITY_SOURCE` to `TRUE` on selected target source files. If cotire encounters 469 | this property, it will complete the current unity file and start a new one. The new unity source 470 | file will include the source file as the first one. This property essentially works as a separator 471 | for unity source files. 472 | 473 | ### optimizing the build process for multiple processor cores 474 | 475 | To make use of all the machine's CPU cores for the unity compilation of a target, the target 476 | property `COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES` can be set to the string `-j`. Cotire 477 | will then create as many unity file segments as there are CPU cores on the machine. Because 478 | the unity file segments do not depend on each other, a multi-core aware build process can compile 479 | the file segments in parallel. 480 | 481 | To explicitly specify the number of cores, append the number after `-j`, e.g. `-j 4` or `-j4`. 482 | 483 | For CMake generators that are multi-core aware by default (i.e., Visual Studio, JOM, Ninja), cotire 484 | will automatically initialize the property to `-j`. For makefile based generators, this has to be 485 | done explicitly by setting the cache variable `COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES`, i.e.: 486 | 487 | $ cmake -D COTIRE_MAXIMUM_NUMBER_OF_UNITY_INCLUDES=-j4 488 | $ make -j 4 489 | 490 | ### fixing macro definition clashes 491 | 492 | Many unity build problems stem from macro definitions leaking into other target source files, 493 | where they may conflict with other definitions of the same name. Cotire adds the properties 494 | `COTIRE_UNITY_SOURCE_PRE_UNDEFS` and `COTIRE_UNITY_SOURCE_POST_UNDEFS` to fix macro definition 495 | clashes. 496 | 497 | As an example, if these properties are set on a source file of the example project: 498 | 499 | set_source_files_properties (example.cpp PROPERTIES 500 | COTIRE_UNITY_SOURCE_PRE_UNDEFS "max;min" 501 | COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE") 502 | 503 | This will make cotire add undefs to the generated unity source file. 504 | 505 | #ifdef __cplusplus 506 | #include "/Users/sakra/Documents/cotire/src/main.cpp" 507 | #undef min 508 | #undef max 509 | #include "/Users/sakra/Documents/cotire/src/example.cpp" 510 | #undef DEBUG_TYPE 511 | #include "/Users/sakra/Documents/cotire/src/log.cpp" 512 | #endif 513 | 514 | The properties `COTIRE_UNITY_SOURCE_PRE_UNDEFS` and `COTIRE_UNITY_SOURCE_POST_UNDEFS` can also be 515 | set on targets. Cotire will add `#undef` directives for each source file in the unity source then. 516 | 517 | ### enabling verbose builds 518 | 519 | The cache variable `COTIRE_VERBOSE` can be set to `TRUE` to see all compile commands used when 520 | generating the cotire related files. Cotire will also print the contents of the generated unity 521 | source and the prefix header for verbose builds. `COTIRE_VERBOSE` defaults to `FALSE`. 522 | When using a Makefile generator `COTIRE_VERBOSE` defaults to the value of the makefile variable 523 | `VERBOSE` (i.e., `make VERBOSE=1`). 524 | 525 | ### conditionally loading cotire 526 | 527 | To make a `CMakeLists.txt` robust against a missing `cotire.cmake` module, the following strategy 528 | can be applied to using cotire: 529 | 530 | include(cotire OPTIONAL) 531 | ... 532 | add_executable(example main.cpp example.cpp log.cpp log.h example.h) 533 | ... 534 | if (COMMAND cotire) 535 | cotire(example) 536 | endif() 537 | 538 | The `include(cotire OPTIONAL)` will prevent CMake from raising an error if cotire cannot be 539 | found. The actual calls to cotire need to be guarded by `if (COMMAND cotire)` blocks. 540 | 541 | ### using cotire with compiler wrappers 542 | 543 | Cotire is compatible with CMake compiler wrappers. For example, the use of [ccache][ccch] may be 544 | enabled in the following way upon configuring the project: 545 | 546 | $ export CC="/usr/local/bin/ccache /usr/bin/gcc" 547 | $ export CXX="/usr/local/bin/ccache /usr/bin/g++" 548 | $ export CCACHE_SLOPPINESS=pch_defines,time_macros 549 | $ cmake .. 550 | 551 | Alternatively, for CMake 3.4 or later compiler wrappers can be enabled by pointing the CMake 552 | variable `CMAKE_CXX_COMPILER_LAUNCHER` to the compiler wrapper executable upon configuring: 553 | 554 | $ cmake -D CMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/ccache 555 | 556 | Note that with ccache in order for precompiled headers to work properly, it is necessary to set 557 | the environment variable `CCACHE_SLOPPINESS` to `pch_defines,time_macros`. Otherwise the build 558 | process may abort with the following error message: 559 | 560 | fatal error: file 'example_CXX_prefix.hxx' has been modified since the precompiled header 561 | 'example_CXX_prefix.hxx.gch' was built 562 | 563 | Also see the [ccache manual][ccch_pch]. 564 | 565 | ### applying cotire to object library targets 566 | 567 | CMake 2.8.8 introduced a new type of library target called [object library][objlib]. An object 568 | library is a convenience target that compiles multiple source files but does not create a linked 569 | target library for them, e.g.: 570 | 571 | add_library(myLib OBJECT lib1.cpp lib2.cpp lib3.cpp) 572 | add_executable(exeA $ mainA.cpp) 573 | add_executable(exeB $ mainB.cpp) 574 | 575 | The `cotire` function can be applied to an object library target in a familiar fashion: 576 | 577 | add_library(myLib OBJECT lib1.cpp lib2.cpp lib3.cpp) 578 | cotire(myLib) 579 | # use unity object library for executables 580 | add_executable(exeA $ mainA.cpp) 581 | add_executable(exeB $ mainB.cpp) 582 | 583 | Because object library targets do not support `PRE_BUILD` actions, precompiled header usage cannot 584 | be enabled for them for Xcode projects generated with CMake. Unity builds work as expected, though. 585 | 586 | ### automatically setting up linked libraries in the unity target 587 | 588 | The setting of the target property `COTIRE_UNITY_LINK_LIBRARIES_INIT` controls the linking 589 | strategy for the generated unit target. 590 | 591 | If this property is empty or set to `NONE`, the generated unity target's link libraries have to be 592 | set up manually with subsequent `target_link_libraries` calls: 593 | 594 | set_target_properties(example PROPERTIES COTIRE_UNITY_LINK_LIBRARIES_INIT "NONE") 595 | ... 596 | cotire(example) 597 | target_link_libraries(MyExecutable_unity ${MyExecutableLibraries}) 598 | 599 | If this property is set to `COPY`, the unity target's link libraries will be copied from the 600 | original target. 601 | 602 | If this property is set to `COPY_UNITY`, the unity target's link libraries will be copied from the 603 | original target but instead of copying a linked target verbatim, the target's corresponding unity 604 | target will be preferred, provided one exists. This also applies to object libraries, which have 605 | been added to the original target with a `TARGET_OBJECTS` generator expression. 606 | 607 | As of cotire 1.7.0, the default linking strategy for unit targets is `COPY_UNITY`. 608 | 609 | The property `COTIRE_UNITY_LINK_LIBRARIES_INIT` can also be set on directories. A target inherits 610 | the property value from its enclosing directory. To make all targets in the project use the 611 | `COPY` strategy, the directory property can be set in the outermost `CMakeList.txt` file: 612 | 613 | include(cotire) 614 | ... 615 | set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY") 616 | 617 | ### using cotire with Qt 618 | 619 | Cotire is compatible with both Qt projects that use CMake as build system, provided Qt targets 620 | do not use CMake automatic moc, uid or rcc scanning. 621 | 622 | ### installing files generated by unity targets 623 | 624 | Cotire cannot set up a `install_unity` target that mimics the `install` target automatically, 625 | because CMake does not provide the necessary information about the existing install rules 626 | programmatically. 627 | 628 | When using a Makefile generator, you can use the following workaround (thanks to peterhuene): 629 | 630 | $ make all_unity 631 | $ make install/fast 632 | 633 | The `install/fast` does not trigger a build, but will use the binaries built by the `all_unity` 634 | target. 635 | 636 | For other generators, set up an `install_unity` target manually. First set up install rules for 637 | all unity targets, that mimic the install rules for the original targets: 638 | 639 | install(TARGETS example_unity RUNTIME DESTINATION "bin" OPTIONAL COMPONENT "unity") 640 | 641 | This installs the `example` executable built by the unity target to the `bin` folder. The install 642 | rules for unity targets must use a custom install component. Then add a global `install_unity` 643 | target that performs the installation of all unity targets: 644 | 645 | add_custom_target(install_unity 646 | COMMAND ${CMAKE_COMMAND} -DCOMPONENT=unity -P cmake_install.cmake 647 | COMMENT "Install the unity-built project..." 648 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) 649 | add_dependencies(unity_install example_unity) 650 | 651 | The global `install_unity` target must depend on all unity targets that should be installed. 652 | 653 | ### customized inclusion of system headers 654 | 655 | If a system header ends up in a precompiled header, it is not possible to customize the inclusion 656 | of that header in a source file through preprocessor defines. 657 | 658 | For example, under Windows one may want to include `Windows.h` with `NOMINMAX` defined to prevent 659 | the definition of the `min` and `max` macros: 660 | 661 | #define NOMINMAX 662 | #include 663 | 664 | The dependency of `Windows.h` on the preprocessor define `NOMINMAX` will not be picked up by cotire 665 | automatically upon adding `Windows.h` to the prefix header. To work around the problem, make the 666 | dependency explicit by using `add_definitions` in the corresponding `CMakeLists.txt`: 667 | 668 | if (WIN32) 669 | # prevent definition of min and max macros through inclusion of Windows.h 670 | add_definitions("-DNOMINMAX") 671 | endif() 672 | 673 | That way, the preprocessor define `NOMINMAX` will be picked up by cotire and applied to the 674 | pre-compilation of the prefix header. 675 | 676 | ### organize includes added to the prefix header 677 | 678 | Sometimes the order of the includes in the automatically generated prefix header may result in 679 | compilation errors due to subtile header dependencies. 680 | 681 | To work around the problem, the target property `COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH` 682 | can be set to a list of directories. Header files whose path matches one of these directories will 683 | be inserted at the beginning of generated prefix header. Header files are sorted according to 684 | the order of the directories in the property. Headers not matching one of these directories are 685 | left untouched. 686 | 687 | The property `COTIRE_PREFIX_HEADER_INCLUDE_PRIORITY_PATH` can also be set on directories. A target 688 | inherits the property value from its enclosing directory. 689 | 690 | common pitfalls 691 | --------------- 692 | 693 | ### include the `cotire.cmake` module correctly 694 | 695 | If CMake issues the message `Unknown CMake command "cotire"`, double check that the cotire module 696 | has been included correctly in your project. See the manual section "cotire basic usage". 697 | 698 | ### do not modify a target's build related properties after applying cotire 699 | 700 | Cotire only considers build related settings of a target at the time of the `cotire` function call. 701 | If target properties that control the build are changed after the call to the `cotire` function, 702 | the build rules set up by cotire for the precompiled header and unity build may not work correctly. 703 | 704 | Don't do this: 705 | 706 | add_executable(example main.cpp example.cpp log.cpp log.h example.h) 707 | cotire(example) 708 | ... 709 | set_target_properties(example PROPERTIES POSITION_INDEPENDENT_CODE ON) # affects build 710 | 711 | 712 | ### always apply cotire in the same source directory where a target has been added 713 | 714 | CMake targets are globally visible. Nevertheless, it is important that the `cotire` function is 715 | called for a target in the exact same directory that creates the target with `add_library` or 716 | `add_executable`. 717 | 718 | Don't do this: 719 | 720 | add_subdirectory(src) 721 | ... 722 | cotire(mytarget) # mytarget added in src directory 723 | 724 | Cotire may fail to inspect the target's source files correctly, if the target has been added in a 725 | different directory and you may get odd messages about missing source files. 726 | 727 | known issues 728 | ------------ 729 | 730 | ### generator expressions 731 | 732 | cotire uses the CMake command `file(GENERATE ...` to expand generator expressions used in various 733 | compilation settings. This command does not handle certain CMake generator expressions like 734 | `$` correctly. 735 | 736 | ### Ninja compatibility 737 | 738 | Under Ninja indirect prefix header dependencies are ignored by the generated build system. Cotire 739 | uses the `IMPLICIT_DEPENDS` option of `add_custom_command` to make the precompiled header depend 740 | on header files indirectly included by the prefix header. The `IMPLICIT_DEPENDS` option is not 741 | supported by CMake's Ninja generator. See [CMake issue][ninja_issue]. 742 | 743 | ### using source files for multiple targets 744 | 745 | When the same set of source files is used for different targets (e.g., for producing a static 746 | and a shared library variant from the same sources), using a precompiled header may not work. 747 | Under certain circumstances, cotire cannot enable the precompiled header usage by changing the 748 | `COMPILE_FLAGS` property of the whole target, but must set the `COMPILE_FLAGS` properties of 749 | individual target source files instead. This will break the usage of the source file for multiple 750 | targets. 751 | 752 | ### multi-architecture builds under Mac OS X 753 | 754 | Neither GCC nor Clang support the use of precompiled headers when performing a Mac OS X 755 | multi-architecture build (e.g., using option `-DCMAKE_OSX_ARCHITECTURES=i386;x86_64`). 756 | 757 | ### Objective-C 758 | 759 | CMake targets that contain Objective-C or Objective-C++ source files cannot be cotired. Source 760 | files ending with .m and .mm are excluded by default through the initial default setting of 761 | `COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS`. 762 | 763 | ### Intel C++ 764 | 765 | Intel C++ support has only been tested with [Intel C++ Composer XE 2013 for Linux][icc_linux] and 766 | may not work with other platforms or versions. 767 | 768 | The Intel compiler may issue incorrect warnings #672 (the command line options do not match those 769 | used when precompiled header was created) or #673 (the initial sequence of preprocessing directives 770 | is not compatible with those of precompiled header file) upon compilation of cotired targets. 771 | 772 | ### IncrediBuild 773 | 774 | Cotire is not compatible with [Xoreax IncrediBuild][XGE]. 775 | 776 | [1260]:https://cmake.org/Bug/view.php?id=1260 777 | [ccch]:https://ccache.samba.org/ 778 | [ccch_pch]:https://ccache.samba.org/manual.html#_precompiled_headers 779 | [clang_pch]:https://clang.llvm.org/docs/UsersManual.html#precompiled-headers 780 | [gcc_pch]:https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html 781 | [msvc_pch]:https://msdn.microsoft.com/en-us/library/szfdksca(v=vs.90).aspx 782 | [msvc_pch_create]:https://msdn.microsoft.com/en-us/library/7zc28563(v=vs.90).aspx 783 | [msvc_pch_use]:https://msdn.microsoft.com/en-us/library/z0atkd6c(v=vs.90).aspx 784 | [ninja_issue]:https://cmake.org/Bug/view.php?id=13234 785 | [EoUB]:http://altdevblog.com/2011/08/14/the-evils-of-unity-builds/ 786 | [pch]:https://en.wikipedia.org/wiki/Precompiled_header 787 | [scu]:https://en.wikipedia.org/wiki/Single_Compilation_Unit 788 | [objlib]:https://cmake.org/cmake/help/latest/command/add_library.html#object-libraries 789 | [pfh]:https://en.wikipedia.org/wiki/Prefix_header 790 | [icc_linux]:https://software.intel.com/en-us/c-compilers/ipsxe-support 791 | [XGE]:https://www.incredibuild.com/ 792 | --------------------------------------------------------------------------------