-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
101 lines (86 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
# Copyright 2022 NWChemEx-Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.14)
#Downloads common CMake modules used throughout NWChemEx
include(cmake/get_nwx_cmake.cmake)
#Sets the version to whatever git thinks it is
include(get_version_from_git)
get_version_from_git(friendzone_version "${CMAKE_CURRENT_LIST_DIR}")
project(friendzone VERSION "${friendzone_version}" LANGUAGES CXX)
include(nwx_versions)
include(get_cmaize)
include(nwx_cxx_api_docs)
### Files and Paths ###
set(friends_template "${CMAKE_CURRENT_LIST_DIR}/cmake/friends.py.in")
set(python_src_directory "${CMAKE_CURRENT_LIST_DIR}/src/python")
# # Doxygen docs
if("${ONLY_BUILD_DOCS}")
# If we are only building the docs, we need to produce friends.py here
configure_file(
"${friends_template}"
"${python_src_directory}/friendzone/friends.py"
@ONLY
)
endif()
nwx_cxx_api_docs("${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}/include")
### Options ###
cmaize_option_list(
BUILD_TESTING OFF "Should we build the tests?"
BUILD_PYBIND11_PYBINDINGS ON "Use Pybind11 to build Python bindings?"
ENABLE_EXPERIMENTAL_FEATURES OFF "Build features which are not 1.0-ed yet?"
ENABLE_NWCHEM ON "Should we build support for friend: NWChem ?"
ENABLE_ASE ON "Build support for the Atomic Simulation Environment?"
)
## Build FriendZone's dependencies ##
cmaize_find_or_build_dependency(
simde
URL github.com/NWChemEx/SimDE
VERSION ${NWX_SIMDE_VERSION}
BUILD_TARGET simde
FIND_TARGET nwx::simde
CMAKE_ARGS BUILD_TESTING=OFF
BUILD_PYBIND11_PYBINDINGS=${BUILD_PYBIND11_PYBINDINGS}
ENABLE_EXPERIMENTAL_FEATURES=${ENABLE_EXPERIMENTAL_FEATURES}
)
## Get the CMake utilities for this project ##
set(
CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake"
CACHE STRING "" FORCE
)
## Find friends ##
include(ase)
include(nwchem)
## Configure file with enabled friends ##
configure_file(
"${friends_template}" # Input file
"${python_src_directory}/friendzone/friends.py" # Output file
@ONLY # Only replace @ variables
)
#TOOD: Replace cmaize_add_library when it supports Python
add_library(${PROJECT_NAME} INTERFACE)
target_link_libraries(${PROJECT_NAME} INTERFACE simde ase nwchem)
if("${BUILD_TESTING}")
include(CTest)
include(nwx_pybind11)
set(PYTHON_TEST_DIR "${CMAKE_CURRENT_LIST_DIR}/tests/python")
nwx_pybind11_tests(
py_${PROJECT_NAME}
"${PYTHON_TEST_DIR}/unit_tests/test_friendzone.py"
SUBMODULES simde chemist pluginplay parallelzone tensorwrapper
)
endif()
install(
DIRECTORY "${python_src_directory}/friendzone"
DESTINATION "${NWX_MODULE_DIRECTORY}"
)