-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathCMakeLists.txt
executable file
·163 lines (123 loc) · 4.72 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Set the compiler as described here: https://cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F
#
# Verify that Cmake is up to date
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
#SET(CMAKE_LEGACY_CYGWIN_WIN32 0)
#
# Project name
#
project("libra")
#
# User-defined Find modules
#
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
#
# Try using the PCH - it will only work if you have the right version of cmake
#
option(USING_PCH "Build using pre-compiled header support" ON)
#
# Python library
#
MESSAGE("Looking for Python libraries...")
MESSAGE("Advice: If this search fails, try setting cache variables: -DPYTHON_LIBRARY=\${path_to_the_python_library} -DPYTHON_INCLUDE_DIR=\${path_to_where_Python.h_is_found}")
MESSAGE("Hint to self: -DPYTHON_INCLUDE_DIR=/home/Alexey_2/Soft/Python-2.6.7/bin/include/python2.6 -DPYTHON_LIBRARY=/home/Alexey_2/Soft/Python-2.6.7/bin/bin")
# For Linux and Cygwin
# Adapt it according to your system
#FIND_PACKAGE(PythonLibs 3.6 REQUIRED)
FIND_PACKAGE(PythonLibs 3.9 REQUIRED)
#FIND_PACKAGE(PythonLibs 3.7 REQUIRED)
IF(PYTHONLIBS_FOUND)
MESSAGE("Success!")
INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_DIRS}")
ELSEIF(NOT PYTHONLIBS_FOUND)
MESSAGE("Unable to find correct Python version. If your Python include/libraries are installed in a non-standard location")
MESSAGE("Try using -DPYTHON_LIBRARY=\${path_to_the_python_library} -PYTHON_INCLUDE_DIR=\${path_to_where_Python.h_is_found}")
MESSAGE(FATAL_ERROR)
ENDIF()
MESSAGE("Found Python libraries directory: ")
MESSAGE(${PYTHON_LIBRARIES})
MESSAGE("Found Python include directory: ")
MESSAGE(${PYTHON_INCLUDE_DIRS})
#
# Boost library
#
MESSAGE("Looking for Boost libraries...")
SET(Boost_NO_BOOST_CMAKE TRUE) # to fix the problem of finding python37 libs
SET(Boost_USE_STATIC_LIBS=OFF)
SET(Boost_USE_MULTITHREADED=OFF)
SET(Boost_USE_STATIC_RUNTIME=OFF)
# Adapt it according to your system
#FIND_PACKAGE(Boost 1.73.0 REQUIRED)
FIND_PACKAGE(Boost 1.82.0 REQUIRED)
#FIND_PACKAGE(Boost REQUIRED)
IF(Boost_FOUND)
MESSAGE("Success!")
INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}")
# Adapt it based on your system
#FIND_PACKAGE(Boost COMPONENTS python36 regex) # it seems that it is important to find sub-packages too!!!
FIND_PACKAGE(Boost COMPONENTS python39 regex)
#FIND_PACKAGE(Boost COMPONENTS python37 regex)
ELSEIF(NOT Boost_FOUND)
MESSAGE(FATAL_ERROR "Unable to find correct Boost version. Did you set BOOST_ROOT?")
ENDIF()
MESSAGE("Found Boost libraries directory: ")
MESSAGE("${Boost_LIBRARIES}")
MESSAGE("Found Boost include directory: ")
MESSAGE("${Boost_INCLUDE_DIRS}")
FIND_PACKAGE(Eigen3)
IF(EIGEN3_FOUND)
INCLUDE_DIRECTORIES("${EIGEN3_INCLUDE_DIR}")
MESSAGE("Found Eigen3 include directory: ")
MESSAGE("${EIGEN3_INCLUDE_DIR}")
ELSEIF(NOT EIGEN3_FOUND)
MESSAGE(FATAL_ERROR "Unable to find Eigen3")
ENDIF()
SET(EIGEN3_INCLUDE_DIRS "${EIGEN3_INCLUDE_DIR}")
# Remove CMakeCache.txt from the previous build, if you get an error finding libint2 due to problems
# in finding Eigen3
# Libint2 2.7.0 CONFIG REQUIRED COMPONENTS shared gss e5 g5
#FIND_PACKAGE(Libint2 MODULE 2.7.0)
#find_package(Libint2)
FIND_PACKAGE(Libint2 CONFIG 2.7.1 REQUIRED COMPONENTS shared gss impure_sh onebody_d0_l6 g12_d0_l4 g12_d1_l4 eri_c4_d0_l5 eri_c4_d1_l4) #gss e5 g5)
IF(Libint2_FOUND)
#INCLUDE_DIRECTORIES("${Libint2_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES(Libint2::int2 Libint2::cxx Libint2::int2-cxx Libint2::impure_sh Libint2::gss Libint2::onebody_d0_l6 Libint::g12_d0_l4 Libint2::g12_d1_l4 Libint2::shared Libint2::cxx_ho Libint2::c Libint2::eri_c4_d0_l5 Libint2::eri_c4_d1_l4)
MESSAGE("${LIBINT2_INCLUDE_DIR}")
MESSAGE("Found Libint2 include directory: ")
MESSAGE("${Libint2_INCLUDE_DIRS}")
MESSAGE("Found Libint2_LIBRARIES: ")
MESSAGE("${Libint2_LIBRARIES}")
MESSAGE("Found Libint2_LIBRARY: ")
MESSAGE("${Libint2_LIBRARY}")
ELSEIF(NOT Libint2_FOUND)
MESSAGE(FATAL_ERROR "Unable to find correct libint2")
ENDIF()
#
# GNU compiler definitions
#
IF(CMAKE_COMPILER_IS_GNUCXX)
# For Linux
ADD_DEFINITIONS("-Wall -Wl,-z,defs")
# For Cygwin
# ADD_DEFINITIONS("-Wall -DCYGWIN")
ELSE()
MESSAGE(FATAL_ERROR "CMakeLists.txt has not been tested/written for your compiler.")
ENDIF()
#
# Cmake configuration
#
MESSAGE("Setting up the CMake configuration...")
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "RELEASE")
SET(CMAKE_CXX_FLAGS "-fPIC -O2 -fpermissive -w -I ${Boost_INCLUDE_DIRS} -fopenmp")
ENDIF()
#
# Set the libraries
#
SET( ext_libs ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
#
# Now building the project
#
MESSAGE("Going into subdirectory src...")
ADD_SUBDIRECTORY("src")