Skip to content

Commit 5ccee64

Browse files
author
Roberto Di Remigio
committed
It is now possible to disable CXX11 support.
1 parent 9ec69a1 commit 5ccee64

File tree

5 files changed

+45
-18
lines changed

5 files changed

+45
-18
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ option(DISABLE_EIGEN_OWN "Do not use Eigen3 headers shipped with the modul
1717
option(ENABLE_EIGEN_MKL "Enable Eigen3 automatic fallback to some of Intel MKL algorithms" OFF)
1818
option(ENABLE_PYTHON_EMBEDDING "Enable Python embedding" ON)
1919
option(ENABLE_64BIT_INTEGERS "Enable 64-bit integers" OFF)
20+
option(ENABLE_CXX11_SUPPORT "Enable C++11 compiler support" ON)
2021
#
2122
# CMake modules
2223
#
@@ -30,14 +31,14 @@ set(CMAKE_MODULE_PATH
3031
set(header_dir_list)
3132
set(libs_to_merge)
3233

34+
include(ConfigSafeGuards)
3335
include(ConfigVersion)
3436
include(ConfigArchitecture)
35-
include(CheckCXX11Features)
37+
include(CheckIncludeFile)
3638
include(ConfigCompilerFlags)
3739
include(PerTargetCompilerFlags)
3840
include(ConfigDocumentation)
3941
include(ConfigExternal)
40-
include(ConfigSafeGuards)
4142
include(GenericMacros)
4243
include(ConfigGitRevision) # Has to come after ConfigVersion.cmake
4344
include(MergeStaticLibs)
@@ -288,3 +289,6 @@ endif()
288289
# This is the very last thing we do, i.e. DO NOT add anything depending on this target!!!
289290
merge_static_libs(pcm "${libs_to_merge}")
290291
install(TARGETS pcm ARCHIVE DESTINATION lib)
292+
293+
# Printout useful info
294+
include(ConfigInfo)

cmake/ConfigInfo.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
message("-- System : ${CMAKE_SYSTEM_NAME}")
2+
message("-- Processor type : ${CMAKE_HOST_SYSTEM_PROCESSOR}")
3+
message("-- C++ compiler flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${cmake_build_type_toupper}} ${CXX_ARCHITECTURE_FLAGS}")
4+
message("-- C compiler flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${cmake_build_type_toupper}} ${C_ARCHITECTURE_FLAGS}")
5+
message("-- Fortran compiler flags: ${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${cmake_build_type_toupper}} ${Fortran_ARCHITECTURE_FLAGS}")
6+
message("-- Libraries : ${EXTERNAL_LIBS}")
7+
8+
get_directory_property(LIST_OF_DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
9+
message("-- Definitions : ${LIST_OF_DEFINITIONS}")
10+
unset(LIST_OF_DEFINITIONS)

cmake/ConfigSafeGuards.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11

22
# guard against in-source builds
33
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
4-
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ")
4+
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.")
55
endif()
66

77
# guard against bad build-type strings
8-
if (NOT CMAKE_BUILD_TYPE)
9-
set(CMAKE_BUILD_TYPE "Debug")
8+
if(NOT CMAKE_BUILD_TYPE)
9+
set(CMAKE_BUILD_TYPE "Debug")
1010
endif()
1111

1212
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower)
13+
string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper)
1314
if( NOT cmake_build_type_tolower STREQUAL "debug"
1415
AND NOT cmake_build_type_tolower STREQUAL "release"
16+
AND NOT cmake_build_type_tolower STREQUAL "profile"
1517
AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo")
16-
message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).")
18+
message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, Profile, RelWithDebInfo (case-insensitive).")
1719
endif()

cmake/compilers/ConfigCompilerFlags.cmake

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
include(SaveCompilerFlags)
2-
include(FindBrokenIntrinsics)
3-
include(OptimizeForArchitecture)
2+
if(ENABLE_CXX11_SUPPORT)
3+
include(CheckCXX11Features)
4+
endif()
5+
include(CheckCXXCompilerFlag)
6+
include(CheckCCompilerFlag)
7+
include(CheckFortranCompilerFlag)
48

59
if(ENABLE_VECTORIZATION)
6-
set(DEFINITIONS)
7-
set(CXX_ARCHITECTURE_FLAGS)
8-
set(C_ARCHITECTURE_FLAGS)
9-
set(Fortran_ARCHITECTURE_FLAGS)
10-
find_broken_intrinsics()
11-
OptimizeForArchitecture()
12-
message(STATUS "Vectorization flags used:")
13-
message(STATUS " CXX: ${CXX_ARCHITECTURE_FLAGS}")
14-
message(STATUS " C: ${C_ARCHITECTURE_FLAGS}")
15-
message(STATUS " Fortran: ${Fortran_ARCHITECTURE_FLAGS}")
10+
include(FindBrokenIntrinsics)
11+
include(OptimizeForArchitecture)
12+
set(DEFINITIONS)
13+
set(CXX_ARCHITECTURE_FLAGS)
14+
set(C_ARCHITECTURE_FLAGS)
15+
set(Fortran_ARCHITECTURE_FLAGS)
16+
find_broken_intrinsics()
17+
OptimizeForArchitecture()
18+
message(STATUS "Vectorization flags used:")
19+
message(STATUS " CXX: ${CXX_ARCHITECTURE_FLAGS}")
20+
message(STATUS " C: ${C_ARCHITECTURE_FLAGS}")
21+
message(STATUS " Fortran: ${Fortran_ARCHITECTURE_FLAGS}")
1622
endif()
1723

1824
if(CMAKE_C_COMPILER_WORKS)

setup

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ def parse_input():
153153
action='store_true',
154154
default=False,
155155
help='disable Python embedding (requires Python development package) [default: %(default)s]')
156+
group.add_argument('--disable_cxx11',
157+
action='store_true',
158+
default=False,
159+
help='disable C++11 support [default: %(default)s]')
156160
group.add_argument('-D',
157161
action="append",
158162
dest='define',
@@ -272,6 +276,7 @@ def gen_cmake_command(args):
272276
command += ' -DENABLE_EIGEN_MKL=%s' % translate_cmake(args.eigenmkl)
273277
command += ' -DENABLE_VECTORIZATION=%s' % translate_cmake(args.vectorization)
274278
command += ' -DENABLE_PYTHON_EMBEDDING=%s' % translate_cmake(not args.disable_python_embedding)
279+
command += ' -DENABLE_CXX11_SUPPORT=%s' % translate_cmake(not args.disable_cxx11)
275280
# command += ' -DENABLE_STATIC_LINKING=%s' % translate_cmake(args.static)
276281

277282
if args.blas == 'builtin':

0 commit comments

Comments
 (0)