-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
137 lines (113 loc) · 4.1 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
# 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(simde_version "${CMAKE_CURRENT_LIST_DIR}")
project(simde VERSION "${simde_version}" LANGUAGES CXX)
include(nwx_versions)
include(get_cmaize)
include(nwx_cxx_api_docs)
### Paths ###
set(SIMDE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(SIMDE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(SIMDE_TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests")
set(SIMDE_EXP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/experimental")
nwx_cxx_api_docs("${SIMDE_SOURCE_DIR}" "${SIMDE_INCLUDE_DIR}")
### Options ###
cmaize_option_list(
BUILD_TESTING OFF "Should we build the tests?"
BUILD_PYBIND11_PYBINDINGS ON "Build pybind11 python3 bindings?"
ENABLE_EXPERIMENTAL_FEATURES OFF "Build features which are not 1.0-ed yet?"
)
cmaize_find_or_build_dependency(
chemist
URL github.com/NWChemEx/chemist
BUILD_TARGET chemist
FIND_TARGET nwx::chemist
CMAKE_ARGS BUILD_TESTING=OFF
BUILD_PYBIND11_PYBINDINGS=${BUILD_PYBIND11_PYBINDINGS}
ENABLE_EXPERIMENTAL_FEATURES=${ENABLE_EXPERIMENTAL_FEATURES}
)
cmaize_find_or_build_dependency(
pluginplay
URL github.com/NWChemEx/pluginplay
BUILD_TARGET pluginplay
FIND_TARGET nwx::pluginplay
CMAKE_ARGS BUILD_TESTING=OFF
BUILD_PYBIND11_PYBINDINGS=${BUILD_PYBIND11_PYBINDINGS}
)
cmaize_add_library(
${PROJECT_NAME}
SOURCE_DIR "${SIMDE_SOURCE_DIR}/${PROJECT_NAME}"
INCLUDE_DIRS "${SIMDE_INCLUDE_DIR}/${PROJECT_NAME}"
DEPENDS chemist pluginplay
)
if("${ENABLE_EXPERIMENTAL_FEATURES}")
cmaize_add_library(
experimental_${PROJECT_NAME}
SOURCE_DIR "${SIMDE_EXP_DIR}/src/${PROJECT_NAME}"
INCLUDE_DIRS "${SIMDE_EXP_DIR}/include/${PROJECT_NAME}"
DEPENDS ${PROJECT_NAME}
)
else()
add_library(experimental_${PROJECT_NAME} INTERFACE)
endif()
# N.B. this is a no-op if BUILD_PYBIND11_PYBINDINGS is not turned on
include(nwx_pybind11)
nwx_add_pybind11_module(
${PROJECT_NAME}
SOURCE_DIR "${SIMDE_SOURCE_DIR}/python"
DEPENDS "${PROJECT_NAME}"
)
if("${BUILD_TESTING}")
set(CXX_TEST_DIR ${SIMDE_TESTS_DIR}/cxx)
set(PYTHON_TEST_DIR ${SIMDE_TESTS_DIR}/python)
cmaize_find_or_build_dependency(
Catch2
URL github.com/catchorg/Catch2
BUILD_TARGET Catch2
FIND_TARGET Catch2::Catch2
VERSION v3.6.0
)
cmaize_add_tests(
test_unit_${PROJECT_NAME}
SOURCE_DIR "${CXX_TEST_DIR}/unit_tests"
INCLUDE_DIRS "${SIMDE_SOURCE_DIR}/${PROJECT_NAME}"
DEPENDS Catch2 ${PROJECT_NAME}
)
# N.B. these are no-ops if BUILD_PYBIND11_PYBINDINGS is not turned on
nwx_pybind11_tests(
py_simde "${PYTHON_TEST_DIR}/unit_tests/test_simde.py"
SUBMODULES pluginplay chemist parallelzone
)
if("${ENABLE_EXPERIMENTAL_FEATURES}")
cmaize_add_tests(
test_unit_experimental_${PROJECT_NAME}
SOURCE_DIR "${SIMDE_EXP_DIR}/tests/cxx/unit_tests"
INCLUDE_DIRS "${SIMDE_EXP_DIR}/src/${PROJECT_NAME}"
DEPENDS Catch2::Catch2 experimental_${PROJECT_NAME}
)
nwx_pybind11_tests(
py_experimental_${PROJECT_NAME}
"${SIMDE_EXP_DIR}/tests/python/unit_tests/test_python.py"
SUBMODULES pluginplay chemist parallelzone
)
endif()
endif()
cmaize_add_package(
${PROJECT_NAME} experimental_${PROJECT_NAME} NAMESPACE nwx::
)