forked from niedoida/niedoida
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
99 lines (83 loc) · 4.14 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
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
cmake_minimum_required (VERSION 3.21)
project (NIEDOIDA VERSION 18.10 DESCRIPTION "General-purpose quantum-chemical and microelectrostatic package" HOMEPAGE_URL http://niedoida.org LANGUAGES CXX)
option (NIEDOIDA_ENABLE_USER_DOCS "generate user documentation" OFF)
option (NIEDOIDA_ENABLE_DEV_DOCS "generate developer documentation" OFF)
option (NIEDOIDA_GENERATE_XC_FUNCTIONALS "re-generate xc functionals" OFF)
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wno-unknown-pragmas -pthread -ffast-math")
add_definitions (-DNIEDOIDA_RESTRICT=__restrict__)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
add_definitions (-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED)
endif ()
elseif (${MSVC})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /fp:fast /wd4068 /wd4244 /wd4267 /EHs")
add_definitions (-DNIEDOIDA_RESTRICT=__restrict -D_USE_MATH_DEFINES -DARMA_DONT_PRINT_CXX11_WARNING -D_SCL_SECURE_NO_WARNINGS -DBOOST_ALL_NO_LIB)
endif ()
if (NOT WIN32)
set (EXTERNAL_PACKAGES_ROOT "${CMAKE_SOURCE_DIR}/external_packages")
include_directories (BEFORE SYSTEM "${EXTERNAL_PACKAGES_ROOT}/include")
find_package (OpenSSL REQUIRED)
find_package (LibXml2 REQUIRED)
include (${EXTERNAL_PACKAGES_ROOT}/share/Armadillo/CMake/ArmadilloConfig.cmake)
get_target_property(ARMADILLO_DEPENDENCIES armadillo INTERFACE_LINK_LIBRARIES)
if (NOT APPLE)
list (APPEND ARMADILLO_DEPENDENCIES gfortran)
endif ()
set (LA_LIBRARIES ${ARMADILLO_LIBRARIES} ${ARMADILLO_DEPENDENCIES})
find_library (MPI_LIBRARIES mpi PATHS "${EXTERNAL_PACKAGES_ROOT}/lib" NO_DEFAULT_PATH)
list (APPEND MPI_LIBRARIES ${LIBXML2_LIBRARIES})
if (APPLE)
find_library (PMPI_LIB pmpi PATHS "${EXTERNAL_PACKAGES_ROOT}/lib" NO_DEFAULT_PATH)
list (APPEND MPI_LIBRARIES ${PMPI_LIB})
endif ()
find_library (PETSC_LIBRARY petsc PATHS "${EXTERNAL_PACKAGES_ROOT}/lib" NO_DEFAULT_PATH)
find_library (YAML_CPP_LIBRARY yaml-cpp PATHS "${EXTERNAL_PACKAGES_ROOT}/lib" NO_DEFAULT_PATH)
set (BOOST_ROOT "${EXTERNAL_PACKAGES_ROOT}")
set (Boost_NO_SYSTEM_PATHS ON)
set (Boost_USE_STATIC_LIBS ON)
add_definitions (-DBOOST_TEST_STATIC_LINK)
else ()
set (EXTERNAL_PACKAGES_ROOT "${CMAKE_SOURCE_DIR}/external_packages")
include_directories ("${EXTERNAL_PACKAGES_ROOT}/include")
find_package(Armadillo CONFIG REQUIRED)
set (LA_LIBRARIES "${ARMADILLO_LIBRARIES}")
find_package (MPI)
include_directories (${MPI_INCLUDE_PATH})
find_library (PETSC_LIBRARY libpetsc PATHS "${EXTERNAL_PACKAGES_ROOT}/lib" NO_DEFAULT_PATH)
find_package(yaml-cpp CONFIG REQUIRED)
set (YAML_CPP_LIBRARY yaml-cpp)
endif ()
set (Boost_USE_MULTITHREADED ON)
set (Boost_NO_BOOST_CMAKE ON)
find_package(Boost REQUIRED filesystem mpi program_options thread timer system unit_test_framework regex)
find_program (YACAS yacas REQUIRED PATHS "${EXTERNAL_PACKAGES_ROOT}/bin" NO_DEFAULT_PATH)
enable_testing()
add_subdirectory (docs)
add_subdirectory (external_packages)
add_subdirectory (io_kit)
add_subdirectory (misc_kit)
add_subdirectory (compat_kit)
add_subdirectory (gto_kit)
add_subdirectory (gto_d1_kit)
#add_subdirectory (gto_d2_kit)
add_subdirectory (symmetry_kit)
add_subdirectory (core_kit)
add_subdirectory (property_kit)
add_subdirectory (semi_empirical_kit)
add_subdirectory (scf_kit)
add_subdirectory (xc_kit)
add_subdirectory (grid_kit)
add_subdirectory (td_kit)
add_subdirectory (posthf_kit)
add_subdirectory (cphf_kit)
add_subdirectory (el_stat_prop_kit)
add_subdirectory (niedoida)
install (DIRECTORY data/ DESTINATION share/niedoida)
install (DIRECTORY tests/niedoida DESTINATION share/niedoida/tests FILES_MATCHING PATTERN "*.inp" PATTERN "*.py")