Explorar el Código

cotire 1.1.5

master
Sascha Kratky hace 13 años
padre
commit
0787b381e3
Se han modificado 3 ficheros con 49 adiciones y 13 borrados
  1. +36
    -10
      CMake/cotire.cmake
  2. +7
    -1
      HISTORY.md
  3. +6
    -2
      MANUAL.md

+ 36
- 10
CMake/cotire.cmake Ver fichero

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


set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}") set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
set (COTIRE_CMAKE_MODULE_VERSION "1.1.4")
set (COTIRE_CMAKE_MODULE_VERSION "1.1.5")


include(CMakeParseArguments) include(CMakeParseArguments)


@@ -125,9 +125,15 @@ function (cotire_filter_language_source_files _language _sourceFilesVar _exclude
else() else()
set (_ignoreExtensions "") set (_ignoreExtensions "")
endif() endif()
if (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS)
set (_excludeExtensions "${COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS}")
else()
set (_excludeExtensions "")
endif()
if (COTIRE_DEBUG) if (COTIRE_DEBUG)
message (STATUS "${_language} source file extensions: ${_languageExtensions}") message (STATUS "${_language} source file extensions: ${_languageExtensions}")
message (STATUS "${_language} ignore extensions: ${_ignoreExtensions}") message (STATUS "${_language} ignore extensions: ${_ignoreExtensions}")
message (STATUS "${_language} exclude extensions: ${_excludeExtensions}")
endif() endif()
foreach (_sourceFile ${ARGN}) foreach (_sourceFile ${ARGN})
get_source_file_property(_sourceIsHeaderOnly "${_sourceFile}" HEADER_FILE_ONLY) get_source_file_property(_sourceIsHeaderOnly "${_sourceFile}" HEADER_FILE_ONLY)
@@ -138,14 +144,19 @@ function (cotire_filter_language_source_files _language _sourceFilesVar _exclude
if (NOT _sourceIsHeaderOnly AND NOT _sourceIsExternal AND NOT _sourceIsSymbolic) if (NOT _sourceIsHeaderOnly AND NOT _sourceIsExternal AND NOT _sourceIsSymbolic)
cotire_get_source_file_extension("${_sourceFile}" _sourceExt) cotire_get_source_file_extension("${_sourceFile}" _sourceExt)
if (_sourceExt) if (_sourceExt)
list (FIND _languageExtensions "${_sourceExt}" _sourceIndex)
list (FIND _ignoreExtensions "${_sourceExt}" _ignoreIndex) list (FIND _ignoreExtensions "${_sourceExt}" _ignoreIndex)
if (_ignoreIndex LESS 0) if (_ignoreIndex LESS 0)
if (_sourceIndex GREATER -1)
set (_sourceIsFiltered TRUE)
elseif ("${_sourceLanguage}" STREQUAL "${_language}")
# add to excluded sources, if file is not ignored and has correct language without having the correct extension
list (FIND _excludeExtensions "${_sourceExt}" _excludeIndex)
if (_excludeIndex GREATER -1)
list (APPEND _excludedSourceFiles "${_sourceFile}") list (APPEND _excludedSourceFiles "${_sourceFile}")
else()
list (FIND _languageExtensions "${_sourceExt}" _sourceIndex)
if (_sourceIndex GREATER -1)
set (_sourceIsFiltered TRUE)
elseif ("${_sourceLanguage}" STREQUAL "${_language}")
# add to excluded sources, if file is not ignored and has correct language without having the correct extension
list (APPEND _excludedSourceFiles "${_sourceFile}")
endif()
endif() endif()
endif() endif()
endif() endif()
@@ -1309,11 +1320,13 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
set (${_msgVar} "Unsupported ${_language} compiler ${CMAKE_${_language}_COMPILER_ID}." PARENT_SCOPE) set (${_msgVar} "Unsupported ${_language} compiler ${CMAKE_${_language}_COMPILER_ID}." PARENT_SCOPE)
endif() endif()
if (APPLE) if (APPLE)
# PCH compilation not supported by GCC / Clang when multiple build architectures (e.g., i386, x86_64) are selected
# PCH compilation not supported by GCC / Clang for multi-architecture builds (e.g., i386, x86_64)
if (CMAKE_CONFIGURATION_TYPES) if (CMAKE_CONFIGURATION_TYPES)
set (_configs ${CMAKE_CONFIGURATION_TYPES}) set (_configs ${CMAKE_CONFIGURATION_TYPES})
else()
elseif (CMAKE_BUILD_TYPE)
set (_configs ${CMAKE_BUILD_TYPE}) set (_configs ${CMAKE_BUILD_TYPE})
else()
set (_configs "None")
endif() endif()
foreach (_config ${_configs}) foreach (_config ${_configs})
cotire_get_target_compile_flags("${_config}" "${_language}" "${CMAKE_CURRENT_SOURCE_DIR}" "${_target}" _targetFlags) cotire_get_target_compile_flags("${_config}" "${_language}" "${CMAKE_CURRENT_SOURCE_DIR}" "${_target}" _targetFlags)
@@ -1322,7 +1335,7 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
if (_numberOfArchitectures GREATER 1) if (_numberOfArchitectures GREATER 1)
string (REPLACE ";" ", " _architectureStr "${_architectures}") string (REPLACE ";" ", " _architectureStr "${_architectures}")
set (${_msgVar} set (${_msgVar}
"Precompiled headers not supported on Darwin for multiple architecture builds (${_architectureStr})."
"Precompiled headers not supported on Darwin for multi-architecture builds (${_architectureStr})."
PARENT_SCOPE) PARENT_SCOPE)
break() break()
endif() endif()
@@ -2487,6 +2500,9 @@ else()
set (COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH "" CACHE STRING set (COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_PATH "" CACHE STRING
"Ignore headers from these directories when generating the prefix header.") "Ignore headers from these directories when generating the prefix header.")


set (COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS "m;mm" CACHE STRING
"Ignore sources with the listed file extensions from the generated unity source.")

set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "3" CACHE STRING set (COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES "3" CACHE STRING
"Minimum number of sources in target required to enable use of precompiled header.") "Minimum number of sources in target required to enable use of precompiled header.")


@@ -2545,7 +2561,7 @@ else()


define_property( define_property(
CACHED_VARIABLE PROPERTY "COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS" CACHED_VARIABLE PROPERTY "COTIRE_ADDITIONAL_PREFIX_HEADER_IGNORE_EXTENSIONS"
BRIEF_DOCS "Ignore includes with the listed file extensions from the prefix header when generating the prefix header."
BRIEF_DOCS "Ignore includes with the listed file extensions from the generated prefix header."
FULL_DOCS FULL_DOCS
"The variable can be set to a semicolon separated list of file extensions." "The variable can be set to a semicolon separated list of file extensions."
"If a header file extension matches one in the list, it will be excluded from the generated prefix header." "If a header file extension matches one in the list, it will be excluded from the generated prefix header."
@@ -2553,6 +2569,16 @@ else()
"If not defined, defaults to inc;inl;ipp." "If not defined, defaults to inc;inl;ipp."
) )


define_property(
CACHED_VARIABLE PROPERTY "COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS"
BRIEF_DOCS "Exclude sources with the listed file extensions from the generated unity source."
FULL_DOCS
"The variable can be set to a semicolon separated list of file extensions."
"If a source file extension matches one in the list, it will be excluded from the generated unity source file."
"Source files with an extension in CMAKE_<LANG>_IGNORE_EXTENSIONS are always excluded."
"If not defined, defaults to m;mm."
)

define_property( define_property(
CACHED_VARIABLE PROPERTY "COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES" CACHED_VARIABLE PROPERTY "COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES"
BRIEF_DOCS "Minimum number of sources in target required to enable use of precompiled header." BRIEF_DOCS "Minimum number of sources in target required to enable use of precompiled header."


+ 7
- 1
HISTORY.md Ver fichero

@@ -1,3 +1,9 @@
## 1.1.5 (2012-08-17)

* new cache variable `COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS` can be set to globally exclude
sources with the listed file extensions from the generated unity source.
* fix check for multi-architecture builds under OS X.

## 1.1.4 (2012-08-15) ## 1.1.4 (2012-08-15)


* prevent redundant re-generation of the unity source, prefix header and precompiled header files * prevent redundant re-generation of the unity source, prefix header and precompiled header files
@@ -29,7 +35,7 @@
## 1.0.9 (2012-04-09) ## 1.0.9 (2012-04-09)


* add support for compiler wrappers like ccache. * add support for compiler wrappers like ccache.
* under Mac OS X, apply `CMAKE_OSX_SYSROOT` to prefix header include and ignore paths.
* under OS X, apply `CMAKE_OSX_SYSROOT` to prefix header include and ignore paths.


## 1.0.8 (2012-04-05) ## 1.0.8 (2012-04-05)




+ 6
- 2
MANUAL.md Ver fichero

@@ -325,6 +325,9 @@ Problematic source files should be moved towards the end.
will not be included in the unity source file and will be compiled separately when the unity build will not be included in the unity source file and will be compiled separately when the unity build
is performed. is performed.


* `COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS` can be used to exclude source files by file extension
from inclusion in the generated unity source. It defaults to the CMake list `m;mm`.

* If the unity source file is too large and the compilation process runs into a compiler limit, * If the unity source file is too large and the compilation process runs into a compiler limit,
the target property `COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES` can be set. If the target the target property `COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES` can be set. If the target
contains more than that number of source files, cotire will create multiple unity source files contains more than that number of source files, cotire will create multiple unity source files
@@ -422,8 +425,9 @@ multi-architecture build (e.g., using option `-DCMAKE_OSX_ARCHITECTURES=i386;x86


### Objective-C ### Objective-C


CMake targets that contain Objective-C or Objective-C++ source files cannot be cotired.
To get a workable build system, set the `COTIRE_EXCLUDED` property on .m and .mm source files.
CMake targets that contain Objective-C or Objective-C++ source files cannot be cotired. Source
files ending with .m and .mm are excluded by default through the initial default setting of
`COTIRE_UNITY_SOURCE_EXCLUDE_EXTENSIONS`.


[1260]:http://www.cmake.org/Bug/view.php?id=1260 [1260]:http://www.cmake.org/Bug/view.php?id=1260
[ccch]:http://ccache.samba.org/ [ccch]:http://ccache.samba.org/


Cargando…
Cancelar
Guardar