3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-24 13:23:37 +01:00

Cmake. Fix #97 and #89

- C++14 mode not automatic. Was based on compiler version,
  but the version of the C++ lib also matters....
  Now, there is an explicit USE_CPP14 option [default =OFF]
  to set to compile in c++1y mode.
  Solve also #89, i.e. the flags is now in TRIQS_CXX_DEFINITIONS and
  therefore pass to applications (including ipython magic).

- Python_use_mpi4py is now ON by default.
  Rational : it has been used for a while by e.g. Thomas,
  and it is necessary on OS X (boost.mpi.python raises a lot of issues).
  Hence we put it as default.

- Rename the option Build_Triqs_General_Tools_Test to a simpler
  Build_Tests
This commit is contained in:
Olivier Parcollet 2014-07-02 21:44:51 +02:00
parent 9583afc671
commit fcfcce8d61
3 changed files with 15 additions and 12 deletions

View File

@ -63,12 +63,15 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
find_package(CompilerCheck)
# Add C11 or C14 flag depending on compiler detection
if (NOT compiler_is_c14)
option(USE_CPP14 "Use C++14 mode " OFF)
if (NOT USE_CPP14)
MESSAGE(STATUS "Compiling in C++11 mode")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} " -std=c++11 ")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
MESSAGE(STATUS "Compiling in C++14 mode")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} " -std=c++1y ")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
endif()
# Include TRIQS cmake macros
@ -392,8 +395,8 @@ endif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# tests
#------------------------
option(Build_Triqs_General_Tools_Test "Build the test of the general tool ? ( array class , ... ) " ON)
if (Build_Triqs_General_Tools_Test)
option(Build_Tests "Build the tests of the library " ON)
if (Build_Tests)
message( STATUS "-------- Preparing tests -------------")
add_subdirectory(${TRIQS_SOURCE_DIR}/test )
endif()

View File

@ -21,9 +21,9 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set(compiler_name "gcc")
string(REGEX REPLACE ".*([2-5]\\.[0-9]\\.[0-9]).*" "\\1" compiler_version ${_compiler_output})
if(NOT compiler_version VERSION_LESS "4.9.0")
set (compiler_is_c14 ON)
endif()
#if(NOT compiler_version VERSION_LESS "4.9.0")
# set (compiler_is_c14 ON)
#endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
@ -46,9 +46,9 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set( compiler_version_min "3.2")
# does not always work ... To be fixed when clang 3.4 officially released and on OS X.
if(NOT compiler_version VERSION_LESS "3.4")
set (compiler_is_c14 ON)
endif()
#if(NOT compiler_version VERSION_LESS "3.4")
# set (compiler_is_c14 ON)
#endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")

View File

@ -1,4 +1,4 @@
option(Python_use_mpi4py "Use mpi4py (if OFF, use boost.mpi)" OFF)
option(Python_use_mpi4py "Use mpi4py (if OFF, use boost.mpi)" ON)
if (Python_use_mpi4py)
SET (TRIQS_PYTHON_MPI_USE_MPI4PY 1)
else()