| 1 |
find_package(Eigen3 REQUIRED) |
| 2 |
|
| 3 |
# configure the version header |
| 4 |
configure_file("${PROJECT_SOURCE_DIR}/cmake/version.h.in" |
| 5 |
"${CMAKE_CURRENT_BINARY_DIR}/version.h") |
| 6 |
|
| 7 |
# Separate out header only components into an interface library. |
| 8 |
add_library(Headers INTERFACE) |
| 9 |
add_library(Avogadro::Headers ALIAS Headers) |
| 10 |
target_include_directories(Headers |
| 11 |
INTERFACE |
| 12 |
"$<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}>") |
| 13 |
|
| 14 |
target_sources(Headers PUBLIC |
| 15 |
FILE_SET HEADERS |
| 16 |
BASE_DIRS ${PROJECT_SOURCE_DIR} |
| 17 |
FILES |
| 18 |
angletools.h |
| 19 |
angleiterator.h |
| 20 |
array.h |
| 21 |
avogadrocore.h |
| 22 |
color3f.h |
| 23 |
constraint.h |
| 24 |
contrastcolor.h |
| 25 |
coordinateset.h |
| 26 |
matrix.h |
| 27 |
types.h |
| 28 |
utilities.h |
| 29 |
vector.h |
| 30 |
) |
| 31 |
target_link_libraries(Headers INTERFACE Eigen3::Eigen) |
| 32 |
install(TARGETS Headers |
| 33 |
EXPORT "AvogadroLibsTargets" |
| 34 |
FILE_SET HEADERS DESTINATION "${INSTALL_INCLUDE_DIR}") |
| 35 |
|
| 36 |
# Now add the main core library for Avogadro. |
| 37 |
add_library(Core) |
| 38 |
|
| 39 |
avogadro_headers(Core |
| 40 |
atom.h |
| 41 |
atomtyper.h |
| 42 |
atomtyper-inline.h |
| 43 |
atomutilities.h |
| 44 |
basisset.h |
| 45 |
bond.h |
| 46 |
coordinateblockgenerator.h |
| 47 |
crystaltools.h |
| 48 |
cube.h |
| 49 |
dihedraliterator.h |
| 50 |
elements.h |
| 51 |
gaussianset.h |
| 52 |
gaussiansettools.h |
| 53 |
graph.h |
| 54 |
internalcoordinates.h |
| 55 |
layer.h |
| 56 |
layermanager.h |
| 57 |
mesh.h |
| 58 |
molecule.h |
| 59 |
mutex.h |
| 60 |
nameatomtyper.h |
| 61 |
neighborperceiver.h |
| 62 |
residue.h |
| 63 |
ringperceiver.h |
| 64 |
secondarystructure.h |
| 65 |
slaterset.h |
| 66 |
slatersettools.h |
| 67 |
spacegroups.h |
| 68 |
symbolatomtyper.h |
| 69 |
unitcell.h |
| 70 |
variant.h |
| 71 |
variant-inline.h |
| 72 |
variantmap.h |
| 73 |
"${CMAKE_CURRENT_BINARY_DIR}/version.h" |
| 74 |
) |
| 75 |
|
| 76 |
target_sources(Core PRIVATE |
| 77 |
angleiterator.cpp |
| 78 |
atomutilities.cpp |
| 79 |
coordinateblockgenerator.cpp |
| 80 |
crystaltools.cpp |
| 81 |
cube.cpp |
| 82 |
elements.cpp |
| 83 |
dihedraliterator.cpp |
| 84 |
gaussianset.cpp |
| 85 |
gaussiansettools.cpp |
| 86 |
graph.cpp |
| 87 |
internalcoordinates.cpp |
| 88 |
layer.cpp |
| 89 |
layermanager.cpp |
| 90 |
mesh.cpp |
| 91 |
mdlvalence_p.h |
| 92 |
molecule.cpp |
| 93 |
mutex.cpp |
| 94 |
nameatomtyper.cpp |
| 95 |
neighborperceiver.cpp |
| 96 |
residue.cpp |
| 97 |
ringperceiver.cpp |
| 98 |
secondarystructure.cpp |
| 99 |
slaterset.cpp |
| 100 |
slatersettools.cpp |
| 101 |
spacegroups.cpp |
| 102 |
symbolatomtyper.cpp |
| 103 |
unitcell.cpp |
| 104 |
variantmap.cpp |
| 105 |
version.cpp |
| 106 |
) |
| 107 |
|
| 108 |
# We currently build core without shared_mutex for Python wheels. |
| 109 |
if(NOT PYTHON_WHEEL_BUILD) |
| 110 |
avogadro_headers(Core sharedmutex.h) |
| 111 |
target_sources(Core PRIVATE sharedmutex.cpp) |
| 112 |
endif() |
| 113 |
|
| 114 |
if(USE_SPGLIB) |
| 115 |
find_package(Spglib REQUIRED) |
| 116 |
avogadro_headers(Core avospglib.h) |
| 117 |
target_sources(Core PRIVATE avospglib.cpp) |
| 118 |
target_link_libraries(Core PRIVATE Spglib::symspg) |
| 119 |
endif() |
| 120 |
|
| 121 |
# The std::shared_mutex class needs pthreads on Linux. |
| 122 |
if(UNIX AND NOT APPLE AND NOT PYTHON_WHEEL_BUILD) |
| 123 |
find_package(Threads) |
| 124 |
target_link_libraries(Core PRIVATE ${CMAKE_THREAD_LIBS_INIT}) |
| 125 |
endif() |
| 126 |
|
| 127 |
avogadro_add_library(Core) |
| 128 |
target_link_libraries(Core |
| 129 |
PUBLIC Avogadro::Headers) |