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

External project: add yaehmop #43

Closed
Closed
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
28 changes: 17 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,10 @@ endmacro()
find_package(Qt5 COMPONENTS Widgets REQUIRED)
list(APPEND OpenChemistry_DEFAULT_ARGS "-DQt5_DIR:PATH=${Qt5_DIR}")

option(BUILD_MOLEQUEUE "Build the MoleQueue application" ON)
option(BUILD_MOLEQUEUE_UIT "Built the UIT/ezHPC integration for MoleQueue" OFF)
option(BUILD_AVOGADRO "Build the Avogadro 2 application" ON)
option(BUILD_AVOGADRO_CLIENT_SERVER
"Build the client-server components for Avogadro" OFF)

# The GPL plugins just means the qtaim plugin right now, we should remove the
# GPL code, but until that happens pass down the option.
option(BUILD_GPL_PLUGINS "Build GPL plugins, i.e. QTAIM in Avogadro" OFF)

# Add the third party dependencies first
option(USE_VTK "Enable libraries that use VTK in Avogadro" OFF)
option(USE_HDF5 "Enable functionality that requires HDF5" OFF)
option(USE_PYTHON "Enable functionality that requires Python" OFF)
option(USE_YAEHMOP "Enable functionality that requires Yaehmop" OFF)

if(USE_PYTHON)
find_package(PythonInterp 3 REQUIRED)
Expand All @@ -93,13 +82,30 @@ if(USE_PYTHON)
"-DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}")
endif()

option(BUILD_MOLEQUEUE "Build the MoleQueue application" ON)
option(BUILD_MOLEQUEUE_UIT "Built the UIT/ezHPC integration for MoleQueue" OFF)
option(BUILD_AVOGADRO "Build the Avogadro 2 application" ON)
option(BUILD_AVOGADRO_CLIENT_SERVER
"Build the client-server components for Avogadro" OFF)

# The GPL plugins just means the qtaim plugin right now, we should remove the
# GPL code, but until that happens pass down the option.
option(BUILD_GPL_PLUGINS "Build GPL plugins, i.e. QTAIM in Avogadro" OFF)

option(BUILD_YAEHMOP_PLUGIN "Enable the yaehmop plugin in Avogadro. Requires VTK." OFF)

if(BUILD_YAEHMOP_PLUGIN)
set(USE_VTK ON)
endif()

add_subdirectory(thirdparty)

option(BUILD_DOCUMENTATION "Build documentation (Doxygen)" OFF)
option(ENABLE_TESTING "Enable testing for Open Chemistry projects" OFF)
list(APPEND OpenChemistry_DEFAULT_ARGS
"-DBUILD_DOCUMENTATION:BOOL=${BUILD_DOCUMENTATION}"
"-DENABLE_TESTING:BOOL=${ENABLE_TESTING}"
"-DBUILD_YAEHMOP_PLUGIN:BOOL=${BUILD_YAEHMOP_PLUGIN}"
"-DUSE_PYTHON:BOOL=${USE_PYTHON}"
"-DUSE_VTK:BOOL=${USE_VTK}")

Expand Down
4 changes: 4 additions & 0 deletions cmake/External_avogadrolibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ if(USE_HDF5)
add_optional_deps(_deps "hdf5")
endif()

if(BUILD_YAEHMOP_PLUGIN)
add_optional_deps(_deps "yaehmop")
endif()

if(ENABLE_TESTING)
add_optional_deps(_deps "gtest")
endif()
Expand Down
49 changes: 37 additions & 12 deletions cmake/External_yaehmop.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
set(_source "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind")
set(_build "${CMAKE_CURRENT_BINARY_DIR}/yaehmop")
set(_install "${OpenChemistry_INSTALL_PREFIX}")
# An external project for yaehmop

unset(_deps)
add_optional_deps(_deps "vtk")

ExternalProject_Add(yaehmop
SOURCE_DIR ${_source}
BINARY_DIR ${_build}
INSTALL_DIR ${_install}
CMAKE_CACHE_ARGS
${OpenChemistry_DEFAULT_ARGS}
DEPENDS
${_deps}
)
if(NOT USE_SYSTEM_YAEHMOP)
if(BUILD_YAEHMOP)
# Yaehmop depends on f2c or gfortran, with an optional dependency on
# blas and lapack. This may be hard to do on windows.
set(_source "${CMAKE_CURRENT_SOURCE_DIR}/yaehmop/tightbind")
set(_build "${CMAKE_CURRENT_BINARY_DIR}/yaehmop")
set(_install "${OpenChemistry_INSTALL_PREFIX}")

ExternalProject_Add(yaehmop
SOURCE_DIR ${_source}
BINARY_DIR ${_build}
INSTALL_DIR ${_install}
CMAKE_CACHE_ARGS
${OpenChemistry_DEFAULT_ARGS}
DEPENDS
${_deps}
) else()
# Need to use ExternalProject_Add
set(YAEHMOP_NAME "yaehmop")
if(WIN32)
string(APPEND YAEHMOP_NAME ".exe")
endif(WIN32)

ExternalProject_Add(yaehmop
DOWNLOAD_DIR "${download_dir}"
DOWNLOAD_NAME "${YAEHMOP_NAME}.tgz"
URL ${yaehmop_binary_url}
URL_MD5 ${yaehmop_binary_md5}
CONFIGURE_COMMAND "" # Do not configure
BUILD_COMMAND "" # Do not build
INSTALL_COMMAND "${CMAKE_COMMAND}" "-E" "copy"
"<SOURCE_DIR>/${YAEHMOP_NAME}" "${OpenChemistry_INSTALL_PREFIX}/bin"
)
endif()
endif()
20 changes: 20 additions & 0 deletions cmake/projects.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,23 @@ list(APPEND projects mmtf-cpp)
set(mmtfcpp_version "1.0.0")
set(mmtfcpp_url "https://github.com/rcsb/mmtf-cpp/archive/v${mmtfcpp_version}.tar.gz")
set(mmtfcpp_md5 "553f028a771b9d9f824903a2bf34be51")

# yaehmop binary
set(YAEHMOP_V "3.0.3")
# Linux
list(APPEND projects yaehmop)
if(UNIX AND NOT APPLE)
set(yaehmop_binary_url "https://github.com/psavery/yaehmop/releases/download/${YAEHMOP_V}/linux64-yaehmop.tgz")
set(yaehmop_binary_md5 "7f3f71c076d8604b98a7e60c351febf2")
# Apple
elseif(APPLE)
set(yaehmop_binary_url "https://github.com/psavery/yaehmop/releases/download/${YAEHMOP_V}/mac64-yaehmop.tgz")
set(yaehmop_binary_md5 "465b8217f5aed9244513dbc00f083133")
# Windows
elseif(WIN32)
set(yaehmop_binary_url "https://github.com/psavery/yaehmop/releases/download/${YAEHMOP_V}/win32-yaehmop.exe.tgz")
set(yaehmop_binary_md5 "89be7c295200f39f5c3b2c99d14ecb1e")
else()
message(FATAL_ERROR
"Yaehmop is not supported with the current OS type!")
endif()
7 changes: 7 additions & 0 deletions thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ option(USE_SYSTEM_HDF5 "Should we use the system HDF5?" OFF)
option(USE_SYSTEM_OPENBABEL "Should we use the system Open Babel?" OFF)
option(USE_SYSTEM_LIBARCHIVE "Should we use the system Libarchive?" OFF)

include(CMakeDependentOption)
cmake_dependent_option(USE_SYSTEM_YAEHMOP "Should we use the system yaehmop?"
OFF "BUILD_YAEHMOP_PLUGIN" OFF)

if(USE_SYSTEM_LIBARCHIVE)
find_package(LIBARCHIVE REQUIRED)
list(APPEND OpenChemistry_THIRDPARTYLIBS_ARGS
Expand Down Expand Up @@ -70,6 +74,9 @@ if(BUILD_AVOGADRO)
include(External_libmsym)
include(External_msgpackc)
include(External_mmtfcpp)
if(BUILD_YAEHMOP_PLUGIN)
include(External_yaehmop)
endif()
endif()

if(ENABLE_TESTING)
Expand Down