forked from OpenChemistry/avogadrolibs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
123 lines (102 loc) · 4.13 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
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(AvogadroLibs)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Request C++11 standard when building Python wheels due to old compiler/glibc.
# Use C++17 otherwise, and hopefully globally once the pip infra is updated.
option(PYTHON_WHEEL_BUILD "Is this a Python wheel build?" OFF)
mark_as_advanced(PYTHON_WHEEL_BUILD)
if(PYTHON_WHEEL_BUILD)
set(CMAKE_CXX_STANDARD 11)
else()
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS False)
# Set symbol visibility defaults for all targets.
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(CMAKE_VISIBILITY_INLINES_HIDDEN True)
include(BuildType)
include(BuildLocation)
include(CompilerFlags)
include(InstallLocation)
include(DetermineVersion)
# Set up our version.
set(AvogadroLibs_VERSION_MAJOR "1")
set(AvogadroLibs_VERSION_MINOR "93")
set(AvogadroLibs_VERSION_PATCH "0")
set(AvogadroLibs_VERSION
"${AvogadroLibs_VERSION_MAJOR}.${AvogadroLibs_VERSION_MINOR}.${AvogadroLibs_VERSION_PATCH}")
find_package(Git)
determine_version(${AvogadroLibs_SOURCE_DIR} ${GIT_EXECUTABLE} "AvogadroLibs")
option(BUILD_SHARED_LIBS "Build with shared libraries" ON)
# Before any plugins are defined, and before any add_subdirectory calls:
set_property(GLOBAL PROPERTY AvogadroLibs_PLUGINS)
set_property(GLOBAL PROPERTY AvogadroLibs_STATIC_PLUGINS)
if(MSVC)
add_definitions("-D_CRT_SECURE_NO_WARNINGS" "-DNOMINMAX -D_USE_MATH_DEFINES")
endif()
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR})
option(ENABLE_TESTING "Enable testing and building the tests." OFF)
option(ENABLE_TRANSLATIONS "Enable building translations with Qt5 Linguist" OFF)
option(USE_OPENGL "Enable libraries that use OpenGL" ON)
option(USE_HDF5 "Enable optional HDF5 features" OFF)
option(USE_QT "Enable libraries that use Qt 5" ON)
option(USE_VTK "Enable libraries that use VTK" OFF)
option(USE_LIBARCHIVE "Enable optional Libarchive features" ON)
option(USE_LIBMSYM "Enable optional features using libmsym" ON)
option(USE_SPGLIB "Enable optional features using spglib" ON)
option(USE_MMTF "Enable optional features using mmtf" ON)
option(USE_PROTOCALL "Enable libraries that use ProtoCall" OFF)
option(USE_MOLEQUEUE "Enable the MoleQueue dependent functionality" ON)
option(USE_PYTHON "Use Python to wrap some of our API" OFF)
add_subdirectory(utilities)
add_subdirectory(thirdparty)
add_subdirectory(avogadro)
if(ENABLE_TESTING)
include(CTest)
enable_testing()
add_subdirectory(tests)
endif()
option(BUILD_DOCUMENTATION "Build project documentation" OFF)
if(BUILD_DOCUMENTATION)
add_subdirectory(docs)
endif()
if(USE_PYTHON)
add_subdirectory(python)
endif()
if(ENABLE_TRANSLATIONS)
find_package(Qt5LinguistTools)
endif()
# SKBUILD is set for binary wheel
if (NOT SKBUILD)
install(
FILES
README.md
CONTRIBUTING.md
LICENSE
DESTINATION "${INSTALL_DOC_DIR}/avogadrolibs")
endif()
# After all add_subdirectory calls, so the list of plugins is complete:
get_property(AvogadroLibs_PLUGINS GLOBAL PROPERTY AvogadroLibs_PLUGINS)
get_property(AvogadroLibs_STATIC_PLUGINS GLOBAL
PROPERTY AvogadroLibs_STATIC_PLUGINS)
configure_file(${AvogadroLibs_SOURCE_DIR}/cmake/CTestCustom.cmake.in
${AvogadroLibs_BINARY_DIR}/CTestCustom.cmake)
configure_file("${AvogadroLibs_SOURCE_DIR}/cmake/AvogadroLibsConfig.cmake.in"
"${AvogadroLibs_BINARY_DIR}/AvogadroLibsConfig.cmake" @ONLY)
configure_file("${AvogadroLibs_SOURCE_DIR}/cmake/AvogadroLibsConfigVersion.cmake.in"
"${AvogadroLibs_BINARY_DIR}/AvogadroLibsConfigVersion.cmake" @ONLY)
# SKBUILD is set for binary wheel
if (NOT SKBUILD)
install(FILES
"${AvogadroLibs_BINARY_DIR}/AvogadroLibsConfig.cmake"
"${AvogadroLibs_BINARY_DIR}/AvogadroLibsConfigVersion.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindEigen3.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindGLEW.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindLibArchive.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findlibmsym.cmake"
DESTINATION "${INSTALL_LIBRARY_DIR}/cmake/avogadrolibs")
install(EXPORT "AvogadroLibsTargets"
DESTINATION "${INSTALL_LIBRARY_DIR}/cmake/avogadrolibs")
endif()