-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1072 from KineticTheory/always_use_dash_g
Enable -g for all builds, including Release.
- Loading branch information
Showing
13 changed files
with
249 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,106 @@ | ||
#--------------------------------------------*-cmake-*---------------------------------------------# | ||
# -------------------------------------------*-cmake-*-------------------------------------------- # | ||
# file config/unix-clang.cmake | ||
# brief Establish flags for Unix clang | ||
# note Copyright (C) 2010-2020 Triad National Security, LLC., All rights reserved. | ||
#--------------------------------------------------------------------------------------------------# | ||
# note Copyright (C) 2010-2021 Triad National Security, LLC., All rights reserved. | ||
# ------------------------------------------------------------------------------------------------ # | ||
|
||
include_guard(GLOBAL) | ||
|
||
# Note: In config/compilerEnv.cmake, the build system sets flags for | ||
# 1) the language standard (C++14, C99, etc) | ||
# 2) interprocedural optimization. | ||
# | ||
# 1. the language standard (C++14, C99, etc) | ||
# 2. interprocedural optimization. | ||
|
||
# Suggested flags: | ||
# --------------- | ||
# - http://clang.llvm.org/docs/UsersManual.html#options-to-control-error-and-warning-messages | ||
# -fdiagnostics-show-hotness | ||
# - https://lefticus.gitbooks.io/cpp-best-practices/content/02-Use_the_Tools_Available.html | ||
# | ||
# valgrind like options - https://clang.llvm.org/docs/AddressSanitizer.html | ||
# '-g -fsanitize=address -fno-omit-frame-pointer' | ||
# must use clang++ for linking | ||
# suppressions: LSAN_OPTIONS=suppressions=MyLSan.supp | ||
# human readable: ASAN_SYMBOLIZER_PATH=/usr/local/bin/llvm-symbolizer ./a.out | ||
# * http://clang.llvm.org/docs/UsersManual.html#options-to-control-error-and-warning-messages | ||
# -fdiagnostics-show-hotness | ||
# * https://lefticus.gitbooks.io/cpp-best-practices/content/02-Use_the_Tools_Available.html | ||
# | ||
# valgrind like options, https://clang.llvm.org/docs/AddressSanitizer.html | ||
# | ||
# * '-g -fsanitize=address -fno-omit-frame-pointer' | ||
# * must use clang++ for linking | ||
# * suppressions: LSAN_OPTIONS=suppressions=MyLSan.supp | ||
# * human readable: ASAN_SYMBOLIZER_PATH=/usr/local/bin/llvm-symbolizer ./a.out | ||
|
||
if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0 AND NOT MSVC ) | ||
message( FATAL_ERROR "Draco requires LLVM clang version >= 6.0." ) | ||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0 AND NOT MSVC) | ||
message(FATAL_ERROR "Draco requires LLVM clang version >= 6.0.") | ||
endif() | ||
|
||
# | ||
# Compiler Flags | ||
# | ||
if( NOT CXX_FLAGS_INITIALIZED ) | ||
set( CXX_FLAGS_INITIALIZED "yes" CACHE INTERNAL "using draco settings." ) | ||
if(NOT CXX_FLAGS_INITIALIZED) | ||
set(CXX_FLAGS_INITIALIZED | ||
"yes" | ||
CACHE INTERNAL "using draco settings.") | ||
|
||
string( APPEND CMAKE_C_FLAGS " -Weverything") | ||
string(APPEND CMAKE_C_FLAGS " -g -Weverything") | ||
# now turn off some flags that produce too many warnings (we should work on these eventually!) | ||
string( APPEND CMAKE_C_FLAGS " -Wno-c++98-compat -Wno-c++98-compat-pedantic" | ||
" -Wno-documentation-unknown-command -Wno-exit-time-destructors -Wno-global-constructors" | ||
" -Wno-weak-vtables -Wno-old-style-cast -Wno-sign-conversion -Wno-padded -Wno-extra-semi-stmt" | ||
" -Wno-unreachable-code-break -Wno-unreachable-code-return" | ||
" -Wno-missing-prototypes -Wno-disabled-macro-expansion -Wno-switch-enum" | ||
" -Wno-deprecated-declarations -Wno-missing-noreturn -Wno-unreachable-code" | ||
string( | ||
APPEND | ||
CMAKE_C_FLAGS | ||
" -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-documentation-unknown-command" | ||
" -Wno-exit-time-destructors -Wno-global-constructors -Wno-weak-vtables -Wno-old-style-cast" | ||
" -Wno-sign-conversion -Wno-padded -Wno-extra-semi-stmt -Wno-unreachable-code-break" | ||
" -Wno-unreachable-code-return -Wno-missing-prototypes -Wno-disabled-macro-expansion" | ||
" -Wno-switch-enum -Wno-deprecated-declarations -Wno-missing-noreturn -Wno-unreachable-code" | ||
" -Wno-documentation-deprecated-sync -Wno-documentation -Wno-undefined-func-template" | ||
" -Wno-weak-template-vtables -Wno-comma") | ||
|
||
if( (NOT CMAKE_CXX_COMPILER_WRAPPER STREQUAL CrayPrgEnv) AND | ||
(NOT ${CMAKE_GENERATOR} MATCHES Xcode) AND HAS_MARCH_NATIVE) | ||
string( APPEND CMAKE_C_FLAGS " -march=native" ) | ||
if((NOT CMAKE_CXX_COMPILER_WRAPPER STREQUAL CrayPrgEnv) | ||
AND (NOT ${CMAKE_GENERATOR} MATCHES Xcode) | ||
AND HAS_MARCH_NATIVE) | ||
string(APPEND CMAKE_C_FLAGS " -march=native") | ||
endif() | ||
|
||
set( CMAKE_C_FLAGS_DEBUG "-g -fno-inline -O0 -DDEBUG") | ||
set( CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops -DNDEBUG" ) | ||
set( CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE}" ) | ||
set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -funroll-loops" ) | ||
set(CMAKE_C_FLAGS_DEBUG "-fno-inline -O0 -DDEBUG") | ||
set(CMAKE_C_FLAGS_RELEASE "-O3 -funroll-loops -DNDEBUG") | ||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE}") | ||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -funroll-loops") | ||
|
||
# Suppress warnings about typeid() called with function as an argument. In this case, the function | ||
# might not be called if the type can be deduced. | ||
string( APPEND CMAKE_CXX_FLAGS " ${CMAKE_C_FLAGS} -Wno-undefined-var-template" | ||
" -Wno-potentially-evaluated-expression" ) | ||
string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_C_FLAGS} -Wno-undefined-var-template" | ||
" -Wno-potentially-evaluated-expression") | ||
|
||
if( DEFINED CMAKE_CXX_COMPILER_WRAPPER AND "${CMAKE_CXX_COMPILER_WRAPPER}" STREQUAL "CrayPrgEnv" ) | ||
if(DEFINED CMAKE_CXX_COMPILER_WRAPPER AND "${CMAKE_CXX_COMPILER_WRAPPER}" STREQUAL "CrayPrgEnv") | ||
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libstdc++") | ||
# Work around for broken ftn + CC linking (Redmine #1323) that results in | ||
# > ld.lld: error: corrupt input file: version definition index 0 for symbol mpiprivc_ is out | ||
# > of bounds | ||
# | ||
# ld.lld: error: corrupt input file: version definition index 0 for symbol mpiprivc_ is out of | ||
# bounds | ||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -fuse-ld=bfd") | ||
else() | ||
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++") | ||
endif() | ||
|
||
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Woverloaded-virtual") | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Woverloaded-virtual") | ||
# Tried to use -fsanitize=safe-stack but this caused build issues. | ||
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") | ||
set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE}") | ||
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" ) | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") | ||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE}") | ||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") | ||
|
||
endif() | ||
|
||
#--------------------------------------------------------------------------------------------------# | ||
# ------------------------------------------------------------------------------------------------ # | ||
# Toggle for OpenMP support | ||
if( OpenMP_C_FLAGS ) | ||
toggle_compiler_flag( OPENMP_FOUND "${OpenMP_C_FLAGS}" "C" "" ) | ||
if(OpenMP_C_FLAGS) | ||
toggle_compiler_flag(OPENMP_FOUND "${OpenMP_C_FLAGS}" "C" "") | ||
endif() | ||
if( OpenMP_CXX_FLAGS ) | ||
toggle_compiler_flag( OPENMP_FOUND "${OpenMP_CXX_FLAGS}" "CXX" "" ) | ||
if(OpenMP_CXX_FLAGS) | ||
toggle_compiler_flag(OPENMP_FOUND "${OpenMP_CXX_FLAGS}" "CXX" "") | ||
endif() | ||
# Note: adding openmp option to EXE_LINKER will break MPI detection for gfortran when running with | ||
# clang++/clang/gfortran. | ||
# clang++/clang/gfortran. | ||
|
||
#--------------------------------------------------------------------------------------------------# | ||
# ------------------------------------------------------------------------------------------------ # | ||
# Ensure cache values always match current selection | ||
deduplicate_flags(CMAKE_C_FLAGS) | ||
deduplicate_flags(CMAKE_CXX_FLAGS) | ||
force_compiler_flags_to_cache("C;CXX;EXE_LINKER") | ||
|
||
#--------------------------------------------------------------------------------------------------# | ||
# ------------------------------------------------------------------------------------------------ # | ||
# End config/unix-clang.cmake | ||
#--------------------------------------------------------------------------------------------------# | ||
# ------------------------------------------------------------------------------------------------ # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
#--------------------------------------------*-cmake-*---------------------------------------------# | ||
# -------------------------------------------*-cmake-*-------------------------------------------- # | ||
# file config/unix-crayCC.cmake | ||
# author Kelly Thompson | ||
# date 2010 Nov 1 | ||
# brief Establish flags for Linux64 - Cray C/C++ | ||
# note Copyright (C) 2016-2020 Triad National Security, LLC., All rights reserved. | ||
#--------------------------------------------------------------------------------------------------# | ||
# note Copyright (C) 2016-2021 Triad National Security, LLC., All rights reserved. | ||
# ------------------------------------------------------------------------------------------------ # | ||
|
||
include_guard(GLOBAL) | ||
|
||
# | ||
# Compiler flag checks | ||
# | ||
if( CMAKE_CXX_COMPILER_VERSION LESS "8.4" ) | ||
message( FATAL_ERROR "Cray C++ prior to 8.4 does not support C++11.") | ||
if(CMAKE_CXX_COMPILER_VERSION LESS "8.4") | ||
message(FATAL_ERROR "Cray C++ prior to 8.4 does not support C++11.") | ||
endif() | ||
|
||
# | ||
# Compiler Flags | ||
# | ||
|
||
# As of cmake-3.12.1, the cray flags for C++14 were not available in cmake. | ||
if( NOT DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION ) | ||
set( CMAKE_CXX14_STANDARD_COMPILE_OPTION "-hstd=c++14" CACHE STRING "internal" FORCE) | ||
if(NOT DEFINED CMAKE_CXX14_STANDARD_COMPILE_OPTION) | ||
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION | ||
"-hstd=c++14" | ||
CACHE STRING "internal" FORCE) | ||
endif() | ||
|
||
if( NOT CXX_FLAGS_INITIALIZED ) | ||
set( CXX_FLAGS_INITIALIZED "yes" CACHE INTERNAL "using draco settings." ) | ||
|
||
string( APPEND CMAKE_C_FLAGS " -DR123_USE_GNU_UINT128=0" ) | ||
set( CMAKE_C_FLAGS_DEBUG "-g -O0 -DDEBUG") | ||
#if( HAVE_MIC ) | ||
# # For floating point consistency with Xeon when using Intel 15.0.090 + Intel MPI 5.0.2 | ||
# set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fp-model precise -fp-speculation safe") | ||
#endif() | ||
set( CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" ) | ||
set( CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE}" ) | ||
set( CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3 -DNDEBUG" ) | ||
|
||
string( APPEND CMAKE_CXX_FLAGS " ${CMAKE_C_FLAGS}") | ||
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") | ||
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") | ||
set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE}") | ||
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" ) | ||
if(NOT CXX_FLAGS_INITIALIZED) | ||
set(CXX_FLAGS_INITIALIZED | ||
"yes" | ||
CACHE INTERNAL "using draco settings.") | ||
|
||
string(APPEND CMAKE_C_FLAGS " -g -DR123_USE_GNU_UINT128=0") | ||
set(CMAKE_C_FLAGS_DEBUG "-O0 -DDEBUG") | ||
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") | ||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE}") | ||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -DNDEBUG") | ||
|
||
string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_C_FLAGS}") | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") | ||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") | ||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE}") | ||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") | ||
|
||
endif() | ||
|
||
#--------------------------------------------------------------------------------------------------# | ||
# ------------------------------------------------------------------------------------------------ # | ||
# Ensure cache values always match current selection | ||
deduplicate_flags(CMAKE_C_FLAGS) | ||
deduplicate_flags(CMAKE_CXX_FLAGS) | ||
force_compiler_flags_to_cache("C;CXX") | ||
|
||
toggle_compiler_flag( OPENMP_FOUND ${OpenMP_C_FLAGS} "C;CXX" "" ) | ||
toggle_compiler_flag(OPENMP_FOUND ${OpenMP_C_FLAGS} "C;CXX" "") | ||
|
||
#--------------------------------------------------------------------------------------------------# | ||
# ------------------------------------------------------------------------------------------------ # | ||
# End config/unix-crayCC.cmake | ||
#--------------------------------------------------------------------------------------------------# | ||
# ------------------------------------------------------------------------------------------------ # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,48 @@ | ||
#--------------------------------------------*-cmake-*---------------------------------------------# | ||
# -------------------------------------------*-cmake-*-------------------------------------------- # | ||
# file config/unix-crayftn.cmake | ||
# author Kelly Thompson | ||
# date 2008 May 30 | ||
# brief Establish flags for Unix - Cray Fortran | ||
# note Copyright (C) 2016-2020 Triad National Security, LLC., All rights reserved. | ||
#--------------------------------------------------------------------------------------------------# | ||
# note Copyright (C) 2016-2021 Triad National Security, LLC., All rights reserved. | ||
# ------------------------------------------------------------------------------------------------ # | ||
|
||
include_guard(GLOBAL) | ||
|
||
# | ||
# Compiler flags: | ||
# | ||
if( NOT Fortran_FLAGS_INITIALIZED ) | ||
set( Fortran_FLAGS_INITIALIZED "yes" CACHE INTERNAL "using draco settings." ) | ||
if(NOT Fortran_FLAGS_INITIALIZED) | ||
set(Fortran_FLAGS_INITIALIZED | ||
"yes" | ||
CACHE INTERNAL "using draco settings.") | ||
|
||
# Find and cache the compiler version (2015-09-28 CMake-3.3.1 misses this). | ||
execute_process( COMMAND ${CMAKE_Fortran_COMPILER} -V | ||
execute_process( | ||
COMMAND ${CMAKE_Fortran_COMPILER} -V | ||
ERROR_VARIABLE ftn_version_output | ||
OUTPUT_STRIP_TRAILING_WHITESPACE ) | ||
string( REGEX REPLACE ".*Version ([0-9]+)[.]([0-9]+)[.]([0-9]+).*" "\\1.\\2" | ||
CMAKE_Fortran_COMPILER_VERSION "${ftn_version_output}" ) | ||
set( CMAKE_Fortran_COMPILER_VERSION ${CMAKE_Fortran_COMPILER_VERSION} CACHE STRING | ||
"Fortran compiler version string" FORCE ) | ||
mark_as_advanced( CMAKE_Fortran_COMPILER_VERSION ) | ||
|
||
# string( APPEND CMAKE_Fortran_FLAGS "" ) | ||
set( CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -DDEBUG" ) | ||
set( CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG" ) | ||
set( CMAKE_Fortran_FLAGS_MINSIZEREL "${CMAKE_Fortran_FLAGS_RELEASE}" ) | ||
set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g -O3 -DDEBUG" ) | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
string(REGEX REPLACE ".*Version ([0-9]+)[.]([0-9]+)[.]([0-9]+).*" "\\1.\\2" | ||
CMAKE_Fortran_COMPILER_VERSION "${ftn_version_output}") | ||
set(CMAKE_Fortran_COMPILER_VERSION | ||
${CMAKE_Fortran_COMPILER_VERSION} | ||
CACHE STRING "Fortran compiler version string" FORCE) | ||
mark_as_advanced(CMAKE_Fortran_COMPILER_VERSION) | ||
|
||
string(APPEND CMAKE_Fortran_FLAGS " -g") | ||
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -DDEBUG") | ||
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG") | ||
set(CMAKE_Fortran_FLAGS_MINSIZEREL "${CMAKE_Fortran_FLAGS_RELEASE}") | ||
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-O3 -DDEBUG") | ||
|
||
endif() | ||
|
||
#--------------------------------------------------------------------------------------------------# | ||
# ------------------------------------------------------------------------------------------------ # | ||
# Ensure cache values always match current selection | ||
deduplicate_flags(CMAKE_Fortran_FLAGS) | ||
force_compiler_flags_to_cache("Fortran") | ||
|
||
toggle_compiler_flag( OPENMP_FOUND ${OpenMP_Fortran_FLAGS} "Fortran" "" ) | ||
toggle_compiler_flag(OPENMP_FOUND ${OpenMP_Fortran_FLAGS} "Fortran" "") | ||
|
||
#--------------------------------------------------------------------------------------------------# | ||
# ------------------------------------------------------------------------------------------------ # | ||
# End config/unix-crayftn.cmake | ||
#--------------------------------------------------------------------------------------------------# | ||
# ------------------------------------------------------------------------------------------------ # |
Oops, something went wrong.