Suppress Clang compiler warnings when using ccache.

This commit is contained in:
Yao Wei Tjong 姚伟忠 2015-04-18 15:56:01 +08:00
parent 403691d50c
commit c16ed4073c
2 changed files with 12 additions and 11 deletions

View File

@ -467,8 +467,8 @@ else ()
# Temporarily add the C++ standard explicitly because currently Emscripten does not consistently add the standard in its internall processing
# and this may cause compilation problem when precompiled header is involved (See https://github.com/kripken/emscripten/issues/3365 for more detail)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-warn-absolute-paths -Wno-unknown-warning-option -std=c++03")
set (CMAKE_C_FLAGS_RELEASE "-Oz")
set (CMAKE_CXX_FLAGS_RELEASE "-Oz")
set (CMAKE_C_FLAGS_RELEASE "-Oz -DNDEBUG")
set (CMAKE_CXX_FLAGS_RELEASE "-Oz -DNDEBUG")
if (DEFINED ENV{CI})
# Our CI server is slow, so do not optimize and discard all debug info when test building in Debug configuration
set (CMAKE_C_FLAGS_DEBUG "-g0")
@ -493,13 +493,14 @@ else ()
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -D_DEBUG")
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
if (CMAKE_GENERATOR STREQUAL Ninja)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
if (CMAKE_GENERATOR STREQUAL Ninja OR "$ENV{USE_CCACHE}")
# When ccache support is on, these flags keep the color diagnostics pipe through ccache output and suppress Clang warning due ccache internal preprocessing step
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics -Qunused-arguments")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics -Qunused-arguments")
endif ()
# Temporary workaround for Travis CI VM as Ubuntu 12.04 LTS still uses old glibc header files that do not have the necessary patch for Clang to work correctly
# TODO: Remove this workaround when Travis CI VM has been migrated to Ubuntu 14.04 LTS (or hopefully it will be CentOS :)
if (DEFINED ENV{CI} AND "$ENV{LINUX}" STREQUAL 1)
if (DEFINED ENV{CI} AND "$ENV{LINUX}")
add_definitions (-D__extern_always_inline=inline)
endif ()
endif ()

View File

@ -122,9 +122,11 @@ task :make do
end
}
build_tree = ENV["#{platform}_build_tree"] || ENV['build_tree'] || "../#{platform}-Build"
ccache_envvar = ENV['CCACHE_SLOPPINESS'] ? '' : 'CCACHE_SLOPPINESS=pch_defines,time_macros' # Only attempt to do the right thing when user hasn't done it
ccache_envvar = "#{ccache_envvar} CCACHE_COMPRESS=1" unless ENV['CCACHE_COMPRESS']
ccache_envvar = "#{ccache_envvar} CCACHE_CPP2=1" unless ENV['CCACHE_CPP2'] || platform != 'emscripten' # TODO: Temporary workaround for ccache support on Emscripten
unless ENV['OS']
ccache_envvar = ENV['CCACHE_SLOPPINESS'] ? '' : 'CCACHE_SLOPPINESS=pch_defines,time_macros' # Only attempt to do the right thing when user hasn't done it
ccache_envvar = "#{ccache_envvar} CCACHE_COMPRESS=1" unless ENV['CCACHE_COMPRESS']
ccache_envvar = "#{ccache_envvar} CCACHE_CPP2=1" unless ENV['CCACHE_CPP2'] || platform != 'emscripten' # TODO: Temporary workaround for ccache support on Emscripten
end
if !Dir.glob("#{build_tree}/*.xcodeproj").empty?
# xcodebuild
if !numjobs.empty?
@ -134,7 +136,6 @@ task :make do
elsif !Dir.glob("#{build_tree}/*.sln").empty?
# msbuild
numjobs = ":#{numjobs}" unless numjobs.empty?
ccache_envvar = '' # Extra env var is harmless even when ccache is not in use, well, except on Windows host system
build_options = "/maxcpucount#{numjobs}#{build_options}"
filter = unfilter ? '' : '/nologo /verbosity:minimal'
elsif !Dir.glob("#{build_tree}/*.ninja").empty?
@ -154,7 +155,6 @@ task :make do
when /win32|mingw|mswin/
require 'win32ole'
WIN32OLE.connect('winmgmts://').ExecQuery("select NumberOf#{platform == 'emscripten' ? '' : 'Logical'}Processors from Win32_ComputerSystem").each { |out| numjobs = platform == 'emscripten' ? out.NumberOfProcessors : out.NumberOfLogicalProcessors }
ccache_envvar = '' # Extra env var is harmless even when ccache is not in use, well, except on Windows host system
else
numjobs = 1
end