Selaa lähdekoodia

cotire 1.6.1

master
Sascha Kratky 12 vuotta sitten
vanhempi
commit
03f64d36a0
5 muutettua tiedostoa jossa 49 lisäystä ja 18 poistoa
  1. +29
    -15
      CMake/cotire.cmake
  2. +5
    -0
      HISTORY.md
  3. +1
    -0
      MANUAL.md
  4. +13
    -2
      src/CMakeLists.txt
  5. +1
    -1
      src/main.cpp

+ 29
- 15
CMake/cotire.cmake Näytä tiedosto

@@ -45,7 +45,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.6.0")
set (COTIRE_CMAKE_MODULE_VERSION "1.6.1")


include(CMakeParseArguments) include(CMakeParseArguments)
include(ProcessorCount) include(ProcessorCount)
@@ -856,7 +856,7 @@ function (cotire_parse_includes _language _scanOutput _ignoredIncudeDirs _honore
# remove duplicate lines to speed up parsing # remove duplicate lines to speed up parsing
list (REMOVE_DUPLICATES _scanOutput) list (REMOVE_DUPLICATES _scanOutput)
list (LENGTH _scanOutput _uniqueLen) list (LENGTH _scanOutput _uniqueLen)
if (COTIRE_VERBOSE)
if (COTIRE_VERBOSE OR COTIRE_DEBUG)
message (STATUS "Scanning ${_uniqueLen} unique lines of ${_len} for includes") message (STATUS "Scanning ${_uniqueLen} unique lines of ${_len} for includes")
if (_ignoredExtensions) if (_ignoredExtensions)
message (STATUS "Ignored extensions: ${_ignoredExtensions}") message (STATUS "Ignored extensions: ${_ignoredExtensions}")
@@ -1408,29 +1408,36 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
# GCC options used # GCC options used
# -include process include file as the first line of the primary source file # -include process include file as the first line of the primary source file
# -Winvalid-pch warns if precompiled header is found but cannot be used # -Winvalid-pch warns if precompiled header is found but cannot be used
# -isystem treat include directory as a system directory (i.e., suppress warnings from headers)
get_filename_component(_prefixDir "${_prefixFile}" PATH)
get_filename_component(_prefixName "${_prefixFile}" NAME)
if (_flags) if (_flags)
# append to list # append to list
list (APPEND _flags "-Winvalid-pch" "-isystem" "${_prefixDir}" "-include" "${_prefixName}")
list (APPEND _flags "-Winvalid-pch" "-include" "${_prefixFile}")
else() else()
# return as a flag string # return as a flag string
set (_flags "-Winvalid-pch -isystem \"${_prefixDir}\" -include \"${_prefixName}\"")
set (_flags "-Winvalid-pch -include \"${_prefixFile}\"")
endif() endif()
elseif (_compilerID MATCHES "Clang") elseif (_compilerID MATCHES "Clang")
# Clang options used # Clang options used
# -include process include file as the first line of the primary source file # -include process include file as the first line of the primary source file
# -include-pch include precompiled header file
# -Qunused-arguments don't emit warning for unused driver arguments # -Qunused-arguments don't emit warning for unused driver arguments
# -isystem treat include directory as a system directory (i.e., suppress warnings from headers)
get_filename_component(_prefixDir "${_prefixFile}" PATH)
get_filename_component(_prefixName "${_prefixFile}" NAME)
if (_flags)
# append to list
list (APPEND _flags "-Qunused-arguments" "-isystem" "${_prefixDir}" "-include" "${_prefixName}")
if (_pchFile AND NOT CMAKE_${_language}_COMPILER MATCHES "ccache")
if (_flags)
# append to list
list (APPEND _flags "-Qunused-arguments" "-include-pch" "${_pchFile}")
else()
# return as a flag string
set (_flags "-Qunused-arguments -include-pch \"${_pchFile}\"")
endif()
else() else()
# return as a flag string
set (_flags "-Qunused-arguments -isystem \"${_prefixDir}\" -include \"${_prefixName}\"")
# no precompiled header, force inclusion of prefix header
# ccache requires the -include flag to be used in order to process precompiled header correctly
if (_flags)
# append to list
list (APPEND _flags "-Qunused-arguments" "-include" "${_prefixFile}")
else()
# return as a flag string
set (_flags "-Qunused-arguments -include \"${_prefixFile}\"")
endif()
endif() endif()
elseif (_compilerID MATCHES "Intel") elseif (_compilerID MATCHES "Intel")
if (WIN32) if (WIN32)
@@ -1570,6 +1577,13 @@ function (cotire_check_precompiled_header_support _language _targetSourceDir _ta
else() else()
set (${_msgVar} "${_unsupportedCompiler}." PARENT_SCOPE) set (${_msgVar} "${_unsupportedCompiler}." PARENT_SCOPE)
endif() endif()
if (CMAKE_${_language}_COMPILER MATCHES "ccache")
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
set (${_msgVar}
"ccache requires the environment variable CCACHE_SLOPPINESS to be set to time_macros."
PARENT_SCOPE)
endif()
endif()
if (APPLE) if (APPLE)
# PCH compilation not supported by GCC / Clang for multi-architecture builds (e.g., i386, x86_64) # PCH compilation not supported by GCC / Clang for multi-architecture builds (e.g., i386, x86_64)
if (CMAKE_CONFIGURATION_TYPES) if (CMAKE_CONFIGURATION_TYPES)


+ 5
- 0
HISTORY.md Näytä tiedosto

@@ -1,3 +1,8 @@
## 1.6.1 (2014-04-20)

* fixed bug where precompiled headers did not work with Clang (thanks to nh2 for reporting).
* when using ccache, require that environment variable `CCACHE_SLOPPINESS` is set to `time_macros`.

## 1.6.0 (2014-03-16) ## 1.6.0 (2014-03-16)


* suppress compiler warnings from precompiled headers. * suppress compiler warnings from precompiled headers.


+ 1
- 0
MANUAL.md Näytä tiedosto

@@ -539,6 +539,7 @@ enabled in the following way upon configuring the project:


$ export CC="/usr/local/bin/ccache /usr/bin/gcc" $ export CC="/usr/local/bin/ccache /usr/bin/gcc"
$ export CXX="/usr/local/bin/ccache /usr/bin/g++" $ export CXX="/usr/local/bin/ccache /usr/bin/g++"
$ export CCACHE_SLOPPINESS=time_macros
$ cmake .. $ cmake ..


Note that with ccache in order for precompiled headers to work properly, it is necessary to set Note that with ccache in order for precompiled headers to work properly, it is necessary to set


+ 13
- 2
src/CMakeLists.txt Näytä tiedosto

@@ -2,8 +2,19 @@


add_executable(example main.cpp example.cpp log.cpp log.h example.h) add_executable(example main.cpp example.cpp log.cpp log.h example.h)


if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set_target_properties(example PROPERTIES COMPILE_FLAGS "-Wall")
# enable warnings
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set_target_properties(example PROPERTIES COMPILE_FLAGS "/Wall")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_target_properties(example PROPERTIES COMPILE_FLAGS "-Weverything")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set_target_properties(example PROPERTIES COMPILE_FLAGS "-Wall -Wextra")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
if (UNIX)
set_target_properties(example PROPERTIES COMPILE_FLAGS "-w5")
elseif (WIN32)
set_target_properties(example PROPERTIES COMPILE_FLAGS "/W5")
endif()
endif() endif()


cotire(example) cotire(example)


+ 1
- 1
src/main.cpp Näytä tiedosto

@@ -5,7 +5,7 @@
#include "example.h" #include "example.h"
#include "log.h" #include "log.h"


int main(int argc, char** argv)
int main()
{ {
std::string msg = example::get_message(); std::string msg = example::get_message();
logging::info(msg); logging::info(msg);


Ladataan…
Peruuta
Tallenna