-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
114 lines (105 loc) · 3.26 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
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
cmake_minimum_required(VERSION 3.14)
project(
libgtoint
VERSION 1.0.0.0
DESCRIPTION "An analytical GTO integral library for C and Fortran"
HOMEPAGE_URL https://github.com/arithy/libgtoint
LANGUAGES C
)
set(Fortran ON CACHE BOOL "Support Fortran interface")
if(Fortran)
include(CheckLanguage)
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)
enable_language(Fortran)
set(Fortran_SOURCE src/gtoint-fortran.f90)
set(Fortran_MODULE ${PROJECT_BINARY_DIR}/gtoint.mod)
else()
message(FATAL_ERROR "Fortran compiler not found")
endif()
endif()
if(MSVC)
string(REGEX REPLACE "/W[0-3]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") # To avoid the warning D9025.
endif()
function(add_common_compile_options target)
target_compile_features(${target} PRIVATE c_std_99)
target_compile_options(
${target} PRIVATE
$<$<COMPILE_LANGUAGE:C>:
$<$<C_COMPILER_ID:GNU>:
-Wall -Wextra -Wno-unused-parameter -Wno-misleading-indentation -pedantic -Werror
$<$<CONFIG:Release>:-ffast-math>
>
$<$<C_COMPILER_ID:Clang>:
-Wall -Wextra -Wno-unused-parameter -Wno-gnu-folding-constant -Wno-gnu-zero-variadic-macro-arguments -pedantic -Werror
$<$<CONFIG:Release>:-ffast-math>
>
$<$<AND:$<C_COMPILER_ID:Intel>,$<NOT:$<PLATFORM_ID:Windows>>>:
-Wall -Wextra -Wno-unused-parameter -pedantic -Werror
$<$<CONFIG:Release>:-fp-model fast>
>
$<$<C_COMPILER_ID:MSVC>:
/W4 /WX /wd4100 /wd4706
$<$<CONFIG:Release>:/fp:fast>
>
$<$<AND:$<C_COMPILER_ID:Intel>,$<PLATFORM_ID:Windows>>:
/W4 /WX
$<$<CONFIG:Release>:/fp:fast>
>
>
$<$<COMPILE_LANGUAGE:Fortran>:
$<$<Fortran_COMPILER_ID:GNU>:
-Wall -Wextra -Wno-unused-dummy-argument -Wno-compare-reals -pedantic -Werror
>
$<$<Fortran_COMPILER_ID:Flang>:
-Wall -Wextra -pedantic -Werror
>
$<$<AND:$<Fortran_COMPILER_ID:Intel>,$<NOT:$<PLATFORM_ID:Windows>>>:
-warn all,errors
>
$<$<AND:$<Fortran_COMPILER_ID:Intel>,$<PLATFORM_ID:Windows>>:
/warn:all,errors
>
>
)
endfunction()
add_library(
gtoint
src/array.c
src/stack.c
src/cache.c
src/cache-oi.c
src/cache-kei.c
src/cache-nai.c
src/cache-mmi.c
src/cache-eri.c
src/cache-ecp0.c
src/cache-ecp1.c
src/cache-ecp2.c
src/function.c
src/function-boys.c
src/function-bessel.c
src/spherical.c
src/integral-oi.c
src/integral-kei.c
src/integral-nai.c
src/integral-mmi.c
src/integral-eri.c
src/integral-ecp.c
src/integral-ecp-1-0.c
src/integral-ecp-1-1.c
src/integral-ecp-1-2.c
src/integral-ecp-2.c
src/integral-ecp-2-spherical.c
src/integral-ecp-2-angular.c
src/integral-ecp-2-radial.c
src/integrator.c
src/basis.c
src/ecp.c
${Fortran_SOURCE}
)
add_common_compile_options(gtoint)
install(TARGETS gtoint)
install(FILES src/gtoint.h ${Fortran_MODULE} TYPE INCLUDE)
enable_testing()
add_subdirectory(tests)