Skip to content

Commit

Permalink
Only add Open Babel if requested and found
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Feb 3, 2024
1 parent 9cc601a commit a4f06bd
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions avogadro/qtplugins/forcefield/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ set(forcefield_srcs
)

if (BUILD_GPL_PLUGINS)
find_package(OpenBabel3 REQUIRED)
list(APPEND forcefield_srcs
obenergy.cpp
)
add_definitions(-DBUILD_GPL_PLUGINS)
include_directories(${OpenBabel3_INCLUDE_DIRS} ${OpenBabel3_INCLUDE_DIR}
${AvogadroLibs_BINARY_DIR}/../prefix/include/openbabel3)
find_package(OpenBabel3)
if (OpenBabel3_LIBRARY)
list(APPEND forcefield_srcs
obenergy.cpp
)
add_definitions(-DBUILD_GPL_PLUGINS)
include_directories(${OpenBabel3_INCLUDE_DIRS} ${OpenBabel3_INCLUDE_DIR}
${AvogadroLibs_BINARY_DIR}/../prefix/include/openbabel3)
endif()
endif()

avogadro_plugin(Forcefield
Expand All @@ -26,20 +28,26 @@ avogadro_plugin(Forcefield

target_link_libraries(Forcefield PRIVATE Avogadro::Calc)

if (BUILD_GPL_PLUGINS)
if (BUILD_GPL_PLUGINS AND OpenBabel3_LIBRARY)
target_link_libraries(Forcefield PRIVATE OpenBabel3)
endif()

# Bundled forcefield scripts
set(forcefields
scripts/ani2x.py
scripts/gaff.py
scripts/gfn1.py
scripts/gfn2.py
scripts/gfnff.py
scripts/mmff94.py
scripts/uff.py
)

if (NOT BUILD_GPL_PLUGINS)
# install the OB / Pybel forcefield scripts
list(APPEND forcefields
scripts/gaff.py
scripts/mmff94.py
scripts/uff.py
)
endif()

install(PROGRAMS ${forcefields}
DESTINATION "${INSTALL_LIBRARY_DIR}/avogadro2/scripts/energy/")

0 comments on commit a4f06bd

Please sign in to comment.