Skip to content

Commit

Permalink
Cmake compiler option tweaks for Intel 2016
Browse files Browse the repository at this point in the history
  • Loading branch information
DeadParrot committed Sep 15, 2015
1 parent 4b2cc73 commit f5552ed
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions cmake/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,36 @@ IF ( MSVC AND NOT ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" ) ) # Visual C++
ELSEIF ( CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) # g++/Clang
option(ENABLE_THREAD_SANITIZER "Enable thread sanitizer testing in gcc/clang" FALSE)
set(LINKER_FLAGS "")
if(ENABLE_THREAD_SANITIZER)
ADD_CXX_DEFINITIONS(-fsanitize=thread )
add_definitions(-ggdb -fno-omit-frame-pointer)
if (ENABLE_THREAD_SANITIZER)
ADD_CXX_DEFINITIONS("-fsanitize=thread")
ADD_DEFINITIONS("-ggdb -fno-omit-frame-pointer")
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=thread -ggdb")
endif()

option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer testing in gcc/clang" FALSE)
if(ENABLE_ADDRESS_SANITIZER)
ADD_CXX_DEFINITIONS(-fsanitize=address)
add_definitions(-ggdb -fno-omit-frame-pointer)
if (ENABLE_ADDRESS_SANITIZER)
ADD_CXX_DEFINITIONS("-fsanitize=address")
ADD_DEFINITIONS("-ggdb -fno-omit-frame-pointer")
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=address -ggdb")
endif()

option(ENABLE_MEMORY_SANITIZER "Enable reads of unintialized memory sanitizer testing in gcc/clang" FALSE)
if (ENABLE_MEMORY_SANITIZER)
ADD_CXX_DEFINITIONS("-fsanitize=memory")
ADD_DEFINITIONS("-ggdb -fno-omit-frame-pointer")
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=memory -ggdb")
endif()

option(ENABLE_UNDEFINED_SANITIZER "Enable undefined behavior sanitizer testing in gcc/clang" FALSE)
if(ENABLE_UNDEFINED_SANITIZER)
ADD_CXX_DEFINITIONS(-fsanitize=undefined )
add_definitions(-ggdb -fno-omit-frame-pointer)
if (ENABLE_UNDEFINED_SANITIZER)
ADD_CXX_DEFINITIONS("-fsanitize=undefined")
ADD_DEFINITIONS("-ggdb -fno-omit-frame-pointer")
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=undefined -ggdb")
endif()

option(ENABLE_COVERAGE "Enable Coverage Reporting in GCC" FALSE)
if(ENABLE_COVERAGE)
add_definitions(--coverage -O0)
if (ENABLE_COVERAGE)
ADD_DEFINITIONS("--coverage -O0")
set(LINKER_FLAGS "${LINKER_FLAGS} --coverage")
endif()

Expand All @@ -71,7 +78,7 @@ ELSEIF ( CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
if(CMAKE_HOST_UNIX)
if(NOT APPLE)
set(LINKER_FLAGS "${LINKER_FLAGS} -pthread")
add_definitions(-pthread)
ADD_DEFINITIONS("-pthread")
endif()
endif()

Expand All @@ -86,7 +93,7 @@ ELSEIF ( CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
ADD_CXX_DEFINITIONS("-ffor-scope")
ADD_CXX_DEFINITIONS("-Wall -Wextra") # Turn on warnings
ADD_CXX_DEFINITIONS("-Wno-unknown-pragmas")
if( CMAKE_COMPILER_IS_GNUCXX ) # g++
if ( CMAKE_COMPILER_IS_GNUCXX ) # g++
ADD_CXX_DEFINITIONS("-Wno-unused-but-set-parameter -Wno-unused-but-set-variable") # Suppress unused-but-set warnings until more serious ones are addressed
ADD_CXX_DEFINITIONS("-Wno-maybe-uninitialized")
elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
Expand All @@ -98,7 +105,7 @@ ELSEIF ( CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
ADD_CXX_DEBUG_DEFINITIONS("-ffloat-store") # Improve debug run solution stability
ADD_CXX_DEBUG_DEFINITIONS("-fsignaling-nans") # Disable optimizations that may have concealed NaN behavior
ADD_CXX_DEBUG_DEFINITIONS("-D_GLIBCXX_DEBUG") # Standard container debug mode (bounds checking, ...)
endif ()
endif()

ADD_CXX_DEBUG_DEFINITIONS("-ggdb") # Produces debugging information specifically for gdb

Expand All @@ -107,6 +114,7 @@ ELSEIF ( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
# Disabled Warnings: Enable some of these as more serious warnings are addressed
# 177 Variable declared but never referenced
# 488 Template parameter not used ...
# 809 Exception specification consistency warnings that fire in gtest code
# 869 Parameter never referenced
# 1786 Use of deprecated items
# 2259 Non-pointer conversions may lose significant bits
Expand All @@ -119,7 +127,7 @@ ELSEIF ( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
ADD_CXX_DEFINITIONS("/Qcxx-features") # Enables standard C++ features without disabling Microsoft extensions
ADD_CXX_DEFINITIONS("/Wall") # Enable "all" warnings
ADD_CXX_DEFINITIONS("/Wp64") # 64-bit warnings
ADD_CXX_DEFINITIONS("/Qdiag-disable:177,488,869,1786,2259,3280,11074,11075") # Disable warnings listed above
ADD_CXX_DEFINITIONS("/Qdiag-disable:177,488,809,869,1786,2259,3280,11074,11075") # Disable warnings listed above
ADD_CXX_DEFINITIONS("/DNOMINMAX") # Avoid build errors due to STL/Windows min-max conflicts
ADD_CXX_DEFINITIONS("/DWIN32_LEAN_AND_MEAN") # Excludes rarely used services and headers from compilation

Expand Down Expand Up @@ -151,6 +159,7 @@ ELSEIF ( UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
# Disabled Warnings: Enable some of these as more serious warnings are addressed
# 177 Variable declared but never referenced
# 488 Template parameter not used ...
# 809 Exception specification consistency warnings that fire in gtest code
# 869 Parameter never referenced
# 1786 Use of deprecated items
# 2259 Non-pointer conversions may lose significant bits
Expand All @@ -162,7 +171,7 @@ ELSEIF ( UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
ADD_CXX_DEFINITIONS("-std=c++11") # Specify C++11 language
ADD_CXX_DEFINITIONS("-Wall") # Enable "all" warnings
ADD_CXX_DEFINITIONS("-Wp64") # 64-bit warnings
ADD_CXX_DEFINITIONS("-diag-disable:177,488,869,1786,2259,3280,11074,11075") # Disable warnings listed above
ADD_CXX_DEFINITIONS("-diag-disable:177,488,809,869,1786,2259,3280,11074,11075") # Disable warnings listed above

IF(NOT APPLE)
ADD_CXX_DEFINITIONS(-pthread)
Expand Down

7 comments on commit f5552ed

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjexxFCL_Update (DeadParrot) - x86_64-MacOS-10.9-clang: OK (1865 of 1865 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjexxFCL_Update (DeadParrot) - i386-Windows-7-VisualStudio-12: OK (1871 of 1871 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjexxFCL_Update (DeadParrot) - Win64-Windows-7-VisualStudio-12: OK (1871 of 1871 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjexxFCL_Update (DeadParrot) - x86_64-Linux-Ubuntu-14.04-gcc-4.8: OK (1871 of 1871 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjexxFCL_Update (DeadParrot) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed)

Build Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjexxFCL_Update (DeadParrot) - x86_64-Linux-Ubuntu-14.04-gcc-4.8-UnitTestsCoverage-Debug: OK (801 of 801 tests passed)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjexxFCL_Update (DeadParrot) - x86_64-Linux-Ubuntu-14.04-gcc-4.8-IntegrationCoverage-Debug: OK (1337 of 1337 tests passed)

Build Badge Test Badge Coverage Badge

Please sign in to comment.