-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
93 lines (80 loc) · 2.62 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
# Copyright 2023 GhostFragment
#
# 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)
set(VERSION 1.0.0) #TODO: get from git
project(ghostfragment VERSION "${VERSION}" LANGUAGES CXX)
include(FetchContent)
FetchContent_Declare(
nwx_cmake
GIT_REPOSITORY https://github.com/NWChemEx-Project/NWXCMake
)
FetchContent_MakeAvailable(nwx_cmake)
set(
CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${nwx_cmake_SOURCE_DIR}/cmake"
CACHE STRING ""
FORCE
)
include(get_cmaize)
### Options ###
option(BUILD_TESTING "Should we build the tests?" OFF)
option(BUILD_PYBIND11_PYBINDINGS "Use pybind11 to build Python3 bindings?" OFF)
# Work out the project paths
set(project_inc_dir "${CMAKE_CURRENT_LIST_DIR}/include")
set(project_src_dir "${CMAKE_CURRENT_LIST_DIR}/src")
include(nwx_cxx_api_docs)
nwx_cxx_api_docs("${project_src_dir}" "${project_inc_dir}")
cpp_find_or_build_dependency(
simde
URL github.com/NWChemEx-Project/SimDE
PRIVATE TRUE
BUILD_TARGET simde
FIND_TARGET nwx::simde
CMAKE_ARGS BUILD_TESTING=OFF
BUILD_PYBIND11_PYBINDINGS=${BUILD_PYBIND11_PYBINDINGS}
)
cpp_add_library(
${PROJECT_NAME}
SOURCE_DIR "${project_src_dir}/${PROJECT_NAME}"
INCLUDE_DIRS "${project_inc_dir}"
DEPENDS nwx::simde
)
include(nwx_pybind11)
nwx_add_pybind11_module(
${PROJECT_NAME}
SOURCE_DIR "${project_src_dir}/python"
DEPENDS ${PROJECT_NAME}
)
if("${BUILD_TESTING}")
set(cxx_tests_dir "${CMAKE_CURRENT_LIST_DIR}/tests/cxx")
set(python_tests_dir "${CMAKE_CURRENT_LIST_DIR}/tests/python")
cpp_find_or_build_dependency(
Catch2
VERSION v2.x
URL github.com/catchorg/Catch2
BUILD_TARGET Catch2
VERSION v2.13.8
FIND_TARGET Catch2::Catch2
)
cpp_add_tests(
"test_${PROJECT_NAME}"
SOURCE_DIR "${cxx_tests_dir}/unit_tests/${PROJECT_NAME}"
INCLUDE_DIR "${project_src_dir}"
DEPENDS Catch2::Catch2 ${PROJECT_NAME}
)
nwx_pybind11_tests(
py_ghostfragment
${python_tests_dir}/integration_tests/test_ghostfragment.py
SUBMODULES simde chemist pluginplay parallelzone
)
endif()