Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set a project-wide variable for molecule data dir AvogadroLibs_SOURCE… #1851

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ set(AvogadroLibs_VERSION
find_package(Git)
determine_version(${AvogadroLibs_SOURCE_DIR} ${GIT_EXECUTABLE} "AvogadroLibs")

# path for data / fragment files which could be overriden by package maintainers
# by default we assume we're using the openchemistry superbuild layout
# .. this is used by the fragment library, molecules, crystals, etc.
set(AvogadroLibs_SOURCEDATA_DIR "${AvogadroLibs_SOURCE_DIR}/..")

option(BUILD_SHARED_LIBS "Build with shared libraries" ON)

# Before any plugins are defined, and before any add_subdirectory calls:
Expand Down
14 changes: 7 additions & 7 deletions avogadro/qtplugins/insertfragment/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,41 @@ avogadro_plugin(InsertFragment

# Install the fragments & crystals
# TODO - make this a for loop
set(_molecules "${AvogadroLibs_SOURCE_DIR}/../molecules")
set(_crystals "${AvogadroLibs_SOURCE_DIR}/../crystals")
set(_molecules "${AvogadroLibs_SOURCEDATA_DIR}/molecules")
set(_crystals "${AvogadroLibs_SOURCEDATA_DIR}/crystals")

# Look in parallel directory for the molecule fragment repository
if(NOT EXISTS "${_molecules}")
# download molecules...
ExternalProject_Add(molecules
GIT_REPOSITORY https://github.com/openchemistry/molecules
# or https://github.com/OpenChemistry/molecules/archive/refs/heads/master.zip
SOURCE_DIR "${AvogadroLibs_SOURCE_DIR}/../molecules"
SOURCE_DIR "${AvogadroLibs_SOURCEDATA_DIR}/molecules"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endif()

install(DIRECTORY "${AvogadroLibs_SOURCE_DIR}/../molecules"
install(DIRECTORY "${AvogadroLibs_SOURCEDATA_DIR}/molecules"
DESTINATION "${INSTALL_DATA_DIR}/avogadro2"
PATTERN ".git" EXCLUDE
)

# crystals
if(NOT EXISTS "${_crystals}")
# download molecules...
# download molecules...
ExternalProject_Add(crystals
GIT_REPOSITORY https://github.com/openchemistry/crystals
# or https://github.com/OpenChemistry/crystals/archive/refs/heads/master.zip
SOURCE_DIR "${AvogadroLibs_SOURCE_DIR}/../crystals"
SOURCE_DIR "${AvogadroLibs_SOURCEDATA_DIR}/crystals"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endif()

install(DIRECTORY "${AvogadroLibs_SOURCE_DIR}/../crystals"
install(DIRECTORY "${AvogadroLibs_SOURCEDATA_DIR}/crystals"
DESTINATION "${INSTALL_DATA_DIR}/avogadro2"
PATTERN ".git" EXCLUDE
)
6 changes: 3 additions & 3 deletions avogadro/qtplugins/templatetool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ avogadro_plugin(TemplateTool
)

# Install the fragments
set(_fragments "${AvogadroLibs_SOURCE_DIR}/../fragments")
set(_fragments "${AvogadroLibs_SOURCEDATA_DIR}/fragments")

# Look in parallel directory for the molecule fragment repository
if(NOT EXISTS "${_fragments}")
Expand All @@ -33,14 +33,14 @@ ExternalProject_Add(fragments
GIT_REPOSITORY https://github.com/openchemistry/fragments
GIT_TAG main
# or https://github.com/OpenChemistry/molecules/archive/refs/heads/master.zip
SOURCE_DIR "${AvogadroLibs_SOURCE_DIR}/../fragments"
SOURCE_DIR "${AvogadroLibs_SOURCEDATA_DIR}/fragments"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endif()

install(DIRECTORY "${AvogadroLibs_SOURCE_DIR}/../fragments"
install(DIRECTORY "${AvogadroLibs_SOURCEDATA_DIR}/fragments"
DESTINATION "${INSTALL_DATA_DIR}/avogadro2"
PATTERN ".git" EXCLUDE
)
Expand Down
Loading