-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
117 lines (92 loc) · 3.47 KB
/
CMakeLists.txt
File metadata and controls
117 lines (92 loc) · 3.47 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
# CMP0077: option() honors normal variables
# https://cmake.org/cmake/help/latest/policy/CMP0077.html
cmake_policy(SET CMP0077 NEW)
set(CMAKE_CXX_FLAGS_RELEASE "" CACHE STRING "")
if (NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
endif()
# set the project name
project(libintx)
set(CMAKE_CXX_STANDARD 20)
# set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wall>)
option(CMAKE_POSITION_INDEPENDENT_CODE "" ON)
include(CheckCXXCompilerFlag)
if (NOT CMAKE_CXX_FLAGS_RELEASE)
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -ffast-math" CACHE STRING "" FORCE)
unset(libintx_cxx_Ofast_flag)
CHECK_CXX_COMPILER_FLAG(-Ofast libintx_cxx_Ofast_flag)
if (libintx_cxx_Ofast_flag)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast" CACHE STRING "" FORCE)
endif()
unset(libintx_cxx_march_native_flag)
CHECK_CXX_COMPILER_FLAG(-march=native libintx_cxx_march_native_flag)
if (libintx_cxx_march_native_flag)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native" CACHE STRING "" FORCE)
endif()
endif()
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g" CACHE STRING "" FORCE)
option(LIBINTX_SANITIZE_ADDRESS "Compile with -fsanitize=address" OFF)
mark_as_advanced(LIBINTX_SANITIZE_ADDRESS)
if (LIBINTX_SANITIZE_ADDRESS)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fsanitize=address>)
add_link_options($<$<COMPILE_LANGUAGE:CXX>:-fsanitize=address>)
endif()
#set(BLA_VENDOR Intel10_64lp_seq)
find_package(LAPACK)
if (TARGET LAPACK::LAPACK)
message(STATUS "Found LAPACK: ${LAPACK_LIBRARIES}")
foreach (_lib in ${LAPACK_LIBRARIES})
if (_lib MATCHES "Accelerate.framework" AND APPLE AND NOT DEFINED LIBINTX_APPLE_ACCELERATE)
set(LIBINTX_APPLE_ACCELERATE TRUE CACHE BOOL "")
break()
endif()
if (_lib MATCHES "mkl_intel" AND NOT DEFINED LIBINTX_INTEL_MKL)
set(LIBINTX_INTEL_MKL TRUE CACHE BOOL "")
break()
endif()
endforeach()
unset(_lib)
endif()
set(LIBINTX_CBLAS_H "" CACHE STRING "")
set(LIBINTX_LAPACKE_H "" CACHE STRING "")
mark_as_advanced(LIBINTX_CBLAS_H LIBINTX_LAPACKE_H)
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
set(LIBINTX_OPENMP_LIBRARIES OpenMP::OpenMP_CXX)
endif()
### LIBINTX options/parameters
set(LIBINTX_MAX_L 3 CACHE STRING "")
if (NOT DEFINED LIBINTX_MAX_X)
math(EXPR LIBINTX_MAX_X "${LIBINTX_MAX_L}+1")
endif()
set(LIBINTX_MAX_X ${LIBINTX_MAX_X} CACHE STRING "LIBINTX_MAX_X")
set(LIBINTX_MAX_K 10 CACHE STRING "")
option(LIBINTX_SIMD "Compile with SIMD vectorisation" ON)
option(LIBINTX_CUDA "Compile GPU/CUDA libraries " OFF)
option(LIBINTX_HIP "Compile GPU/HIP libraries" OFF)
#find_package(Eigen3 REQUIRED)
#set(EIGEN3_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/eigen)
include_directories(src include include/eigen3)
include_directories(${PROJECT_BINARY_DIR})
configure_file(src/libintx/config.h.in ${PROJECT_BINARY_DIR}/libintx/config.h)
install(FILES ${PROJECT_BINARY_DIR}/libintx/config.h DESTINATION libintx)
add_subdirectory(src/libintx)
add_subdirectory(src/libintx/boys)
add_subdirectory(src/libintx/ao/md)
if (LIBINTX_CUDA OR LIBINTX_HIP)
if (LIBINTX_CUDA AND LIBINTX_HIP)
message(FATAL_ERROR "CUDA and HIP are mutually exclusive options")
endif()
add_subdirectory(src/libintx/gpu)
endif()
option(LIBINTX_PYTHON "Python bindings" OFF)
if (LIBINTX_PYTHON)
add_subdirectory(python)
endif()
include(CTest)
if (BUILD_TESTING)
add_subdirectory(tests)
endif()