-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
60 lines (49 loc) · 1.74 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Start configuration
cmake_minimum_required(VERSION 2.8)
project(nca CXX)
# Default to Release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build" FORCE)
endif()
message(STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} -------------")
# Use shared libraries
set(BUILD_SHARED_LIBS ON)
# Load TRIQS and Cpp2Py
find_package(TRIQS 2.0 REQUIRED)
find_package(Cpp2Py 1.5 REQUIRED)
# Default Install directory to TRIQS_ROOT if not given. Checks an absolute name is given.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR (NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX}))
message(STATUS "No install prefix given (or invalid). Defaulting to TRIQS_ROOT")
set(CMAKE_INSTALL_PREFIX ${TRIQS_ROOT} CACHE PATH "default install path" FORCE)
endif()
message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} -------------")
# Use git to detect NCA version and git hash
execute_process(COMMAND bash "-c" "${TRIQS_GIT_EXECUTABLE} describe | sed \"s/-\\([0-9]*\\)-.*/.\\1/g\""
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE NCA_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT NCA_VERSION)
set(NCA_VERSION 1.0)
endif()
triqs_get_git_hash_of_source_dir(NCA_GIT_HASH)
MESSAGE(STATUS "NCA version : ${NCA_VERSION}")
message(STATUS "Git hash: ${NCA_GIT_HASH}")
# The std for all targets
add_compile_options(-std=c++17 $<$<CONFIG:Release>:-march=native>)
# Common to all targets (ctint, python, tests).
include_directories(c++)
# To be fixed!!
triqs_set_rpath_for_all_targets()
# Main c++ code
add_subdirectory(c++/nca)
# Python interface
if (${TRIQS_WITH_PYTHON_SUPPORT})
add_subdirectory(python/nca)
endif()
# Tests
option(Build_Tests "Enable Tests" ON)
if (${Build_Tests})
enable_testing()
add_subdirectory(test)
endif()