Browse Source

cotire 1.5.2

master
Sascha Kratky 10 years ago
parent
commit
862630a8b4
6 changed files with 184 additions and 9 deletions
  1. +32
    -6
      CMake/cotire.cmake
  2. +6
    -0
      HISTORY.md
  3. +46
    -0
      Patches/clang-3.4.src.patch
  4. +97
    -0
      Patches/llvm-3.4.src.patch
  5. +2
    -2
      README.md
  6. +1
    -1
      license

+ 32
- 6
CMake/cotire.cmake View File

@@ -3,7 +3,7 @@
# See the cotire manual for usage hints.
#
#=============================================================================
# Copyright 2012-2013 Sascha Kratky
# Copyright 2012-2014 Sascha Kratky
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -45,7 +45,7 @@ if (NOT CMAKE_SCRIPT_MODE_FILE)
endif()

set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
set (COTIRE_CMAKE_MODULE_VERSION "1.5.1")
set (COTIRE_CMAKE_MODULE_VERSION "1.5.2")

include(CMakeParseArguments)
include(ProcessorCount)
@@ -383,13 +383,19 @@ function (cotire_get_target_compile_flags _config _language _directory _target _
foreach (_arch ${_architectures})
list (APPEND _compileFlags "-arch" "${_arch}")
endforeach()
if (CMAKE_OSX_SYSROOT AND CMAKE_OSX_SYSROOT_DEFAULT AND CMAKE_${_language}_HAS_ISYSROOT)
if (NOT "${CMAKE_OSX_SYSROOT}" STREQUAL "${CMAKE_OSX_SYSROOT_DEFAULT}")
if (CMAKE_OSX_SYSROOT)
if (CMAKE_${_language}_SYSROOT_FLAG)
list (APPEND _compileFlags "${CMAKE_${_language}_SYSROOT_FLAG}" "${CMAKE_OSX_SYSROOT}")
else()
list (APPEND _compileFlags "-isysroot" "${CMAKE_OSX_SYSROOT}")
endif()
endif()
if (CMAKE_OSX_DEPLOYMENT_TARGET AND CMAKE_${_language}_OSX_DEPLOYMENT_TARGET_FLAG)
list (APPEND _compileFlags "${CMAKE_${_language}_OSX_DEPLOYMENT_TARGET_FLAG}${CMAKE_OSX_DEPLOYMENT_TARGET}")
if (CMAKE_OSX_DEPLOYMENT_TARGET)
if (CMAKE_${_language}_OSX_DEPLOYMENT_TARGET_FLAG)
list (APPEND _compileFlags "${CMAKE_${_language}_OSX_DEPLOYMENT_TARGET_FLAG}${CMAKE_OSX_DEPLOYMENT_TARGET}")
else()
list (APPEND _compileFlags "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
endif()
endif()
if (COTIRE_DEBUG AND _compileFlags)
@@ -683,6 +689,24 @@ macro (cotire_add_includes_to_cmd _cmdVar _language)
endforeach()
endmacro()

macro (cotire_add_frameworks_to_cmd _cmdVar _language)
if (APPLE)
set (_frameWorkDirs "")
foreach (_include ${ARGN})
if (IS_ABSOLUTE "${_include}" AND _include MATCHES "\\.framework$")
get_filename_component(_frameWorkDir "${_include}" PATH)
list (APPEND _frameWorkDirs "${_frameWorkDir}")
endif()
endforeach()
if (_frameWorkDirs)
list (REMOVE_DUPLICATES _frameWorkDirs)
foreach (_frameWorkDir ${_frameWorkDirs})
list (APPEND ${_cmdVar} "-F${_frameWorkDir}")
endforeach()
endif()
endif()
endmacro()

macro (cotire_add_compile_flags_to_cmd _cmdVar)
foreach (_flag ${ARGN})
list (APPEND ${_cmdVar} "${_flag}")
@@ -936,6 +960,7 @@ function (cotire_scan_includes _includesVar)
cotire_add_definitions_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_COMPILE_DEFINITIONS})
cotire_add_compile_flags_to_cmd(_cmd ${_option_COMPILE_FLAGS})
cotire_add_includes_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_INCLUDE_DIRECTORIES})
cotire_add_frameworks_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_INCLUDE_DIRECTORIES})
cotire_add_makedep_flags("${_option_LANGUAGE}" "${_option_COMPILER_ID}" "${_option_COMPILER_VERSION}" _cmd)
# only consider existing source files for scanning
set (_existingSourceFiles "")
@@ -1478,6 +1503,7 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile)
cotire_add_definitions_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_COMPILE_DEFINITIONS})
cotire_add_compile_flags_to_cmd(_cmd ${_option_COMPILE_FLAGS})
cotire_add_includes_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_INCLUDE_DIRECTORIES})
cotire_add_frameworks_to_cmd(_cmd "${_option_LANGUAGE}" ${_option_INCLUDE_DIRECTORIES})
cotire_add_pch_compilation_flags(
"${_option_LANGUAGE}" "${_option_COMPILER_ID}" "${_option_COMPILER_VERSION}"
"${_prefixFile}" "${_pchFile}" "${_hostFile}" _cmd)


+ 6
- 0
HISTORY.md View File

@@ -1,3 +1,9 @@
## 1.5.2 (2014-01-17)

* honor framework includes under OS X correctly.
* fix handling of OS X specific variables `CMAKE_OSX_SYSROOT` and `CMAKE_OSX_DEPLOYMENT_TARGET`.
* add new examples to the `Patches` directory.

## 1.5.1 (2013-11-12)

* fixed string quoting bugs.


+ 46
- 0
Patches/clang-3.4.src.patch View File

@@ -0,0 +1,48 @@
diff -rupN clang-3.4.src/CMakeLists.txt clang-3.4.src.cotire/CMakeLists.txt
--- clang-3.4.src/CMakeLists.txt 2013-11-06 09:37:50.000000000 +0100
@@ -2,7 +2,7 @@
# standalone project, using LLVM as an external library:
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
project(Clang)
- cmake_minimum_required(VERSION 2.8)
+ cmake_minimum_required(VERSION 2.8.11)
set(CLANG_PATH_TO_LLVM_SOURCE "" CACHE PATH
"Path to LLVM source code. Not necessary if using an installed LLVM.")
@@ -40,6 +40,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
include(TableGen)
include("${CLANG_PATH_TO_LLVM_BUILD}/share/llvm/cmake/LLVMConfig.cmake")
include(HandleLLVMOptions)
+ include(cotire)
+ set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY")
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
@@ -286,6 +288,12 @@ macro(add_clang_library name)
endif()
set_target_properties(${name} PROPERTIES FOLDER "Clang libraries")
+ if (COMMAND cotire)
+ if (NOT "${name}" MATCHES "libclang")
+ set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE")
+ cotire(${name})
+ endif()
+ endif()
endmacro(add_clang_library)
macro(add_clang_executable name)
diff -rupN clang-3.4.src/tools/libclang/CMakeLists.txt clang-3.4.src.cotire/tools/libclang/CMakeLists.txt
--- clang-3.4.src/tools/libclang/CMakeLists.txt 2013-11-13 23:26:04.000000000 +0100
@@ -124,3 +124,10 @@ if( (NOT LLVM_ENABLE_PIC OR LIBCLANG_BUI
PROPERTIES
OUTPUT_NAME "clang")
endif()
+
+if (COMMAND cotire)
+ cotire(libclang)
+ if (TARGET ${LIBCLANG_STATIC_TARGET_NAME})
+ cotire(${LIBCLANG_STATIC_TARGET_NAME})
+ endif()
+endif()

+ 97
- 0
Patches/llvm-3.4.src.patch View File

@@ -0,0 +1,100 @@
diff -rupN llvm-3.4.src/CMakeLists.txt llvm-3.4.src.cotire/CMakeLists.txt
--- llvm-3.4.src/CMakeLists.txt 2013-11-25 19:34:26.000000000 +0100
@@ -1,7 +1,7 @@
# See docs/CMake.html for instructions about how to build LLVM with CMake.
project(LLVM)
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8.12)
# Add path for custom modules
set(CMAKE_MODULE_PATH
@@ -25,6 +25,8 @@ if ( LLVM_USE_FOLDERS )
endif()
include(VersionFromVCS)
+include(cotire)
+set_property(DIRECTORY PROPERTY COTIRE_UNITY_LINK_LIBRARIES_INIT "COPY_UNITY")
option(LLVM_APPEND_VC_REV
"Append the version control system revision id to LLVM version" OFF)
diff -rupN llvm-3.4.src/cmake/modules/AddLLVM.cmake llvm-3.4.src.cotire/cmake/modules/AddLLVM.cmake
--- llvm-3.4.src/cmake/modules/AddLLVM.cmake 2013-08-27 21:25:01.000000000 +0200
@@ -41,6 +41,10 @@ macro(add_llvm_library name)
# property has been set to an empty value.
get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name})
target_link_libraries(${name} ${lib_deps})
+if (COMMAND cotire)
+ set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE")
+ cotire(${name})
+endif()
endmacro(add_llvm_library name)
macro(add_llvm_loadable_module name)
@@ -78,6 +82,10 @@ ${name} ignored.")
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endif()
endif()
+if (COMMAND cotire)
+ set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE")
+ cotire(${name})
+endif()
endif()
set_target_properties(${name} PROPERTIES FOLDER "Loadable modules")
@@ -119,6 +127,10 @@ macro(add_llvm_tool name)
endif()
endif()
set_target_properties(${name} PROPERTIES FOLDER "Tools")
+if (COMMAND cotire)
+ set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE")
+ cotire(${name})
+endif()
endmacro(add_llvm_tool name)
@@ -132,12 +144,20 @@ macro(add_llvm_example name)
install(TARGETS ${name} RUNTIME DESTINATION examples)
endif()
set_target_properties(${name} PROPERTIES FOLDER "Examples")
+if (COMMAND cotire)
+ set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE")
+ cotire(${name})
+endif()
endmacro(add_llvm_example name)
macro(add_llvm_utility name)
add_llvm_executable(${name} ${ARGN})
set_target_properties(${name} PROPERTIES FOLDER "Utils")
+if (COMMAND cotire)
+ set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE")
+ cotire(${name})
+endif()
endmacro(add_llvm_utility name)
@@ -245,6 +265,10 @@ function(add_unittest test_suite test_na
set(target_compile_flags "${target_compile_flags} -Wno-variadic-macros")
endif ()
set_property(TARGET ${test_name} PROPERTY COMPILE_FLAGS "${target_compile_flags}")
+if (COMMAND cotire)
+ set_target_properties(${name} PROPERTIES COTIRE_UNITY_SOURCE_POST_UNDEFS "DEBUG_TYPE")
+ cotire(${name})
+endif()
endfunction()
# This function provides an automatic way to 'configure'-like generate a file
diff -rupN llvm-3.4.src/lib/Support/CMakeLists.txt llvm-3.4.src.cotire/lib/Support/CMakeLists.txt
--- llvm-3.4.src/lib/Support/CMakeLists.txt 2013-09-04 18:00:12.000000000 +0200
@@ -1,3 +1,7 @@
+if (COMMAND cotire)
+ set_source_files_properties (IsInf.cpp IsNAN.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
+endif()
+
add_llvm_library(LLVMSupport
APFloat.cpp
APInt.cpp

+ 2
- 2
README.md View File

@@ -9,9 +9,9 @@ features
--------

* Non-intrusive. Requires no source code modification and only minimal changes to CMake list files.
* Automatically generates a single compilation unit (aka unity source file) for a CMake target.
* Automatically generates a [single compilation unit][scu] (aka unity source file) for a CMake target.
* Automatically generates a [prefix header][pfh] by tracking includes used by a CMake target.
* Automatically precompiles prefix header and applies resulting precompiled header to a CMake target.
* Automatically precompiles prefix header and applies resulting [precompiled header][pch] to a CMake target.
* Alternatively, allows for using manually maintained unity source and prefix header files.
* Supports C/C++ compilers Clang, GCC, Intel and Visual Studio C++.
* Supports mixed language CMake targets.


+ 1
- 1
license View File

@@ -1,4 +1,4 @@
Copyright (c) 2012-2013 Sascha Kratky
Copyright (c) 2012-2014 Sascha Kratky

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation


Loading…
Cancel
Save