Skip to content

Commit

Permalink
External project: add yaehmop
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Avery <psavery@buffalo.edu>
  • Loading branch information
psavery committed Aug 4, 2018
1 parent bc18fb9 commit 14cb961
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,21 @@ option(BUILD_AVOGADRO_CLIENT_SERVER
# 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(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}"
"-DUSE_VTK:BOOL=${USE_VTK}")
"-DUSE_VTK:BOOL=${USE_VTK}"
"-DBUILD_YAEHMOP_PLUGIN:BOOL=${BUILD_YAEHMOP_PLUGIN}")

# Now for the actual open chemistry projects!
if(BUILD_MOLEQUEUE)
Expand Down
4 changes: 4 additions & 0 deletions cmake/External_avogadrolibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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
30 changes: 30 additions & 0 deletions cmake/External_yaehmop.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# An external project for yaehmop

unset(_deps)
add_optional_deps(_deps "vtk")

if(NOT USE_SYSTEM_YAEHMOP)
if(BUILD_YAEHMOP)
# This does not work currently
# Yaehmop depends on f2c or gfortran, with an optional dependency on
# blas and lapack. This may be hard to do on windows.
message(FATAL_ERROR "Yaehmop cannot currently be built here")
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 @@ -76,3 +76,23 @@ list(APPEND projects libarchive)
set(libarchive_version "3.3.2")
set(libarchive_url "https://github.com/libarchive/libarchive/archive/v${libarchive_version}.tar.gz")
set(libarchive_md5 "a3acebe237f89d7f31c5bb1da5e843c7")

# 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 @@ -65,6 +69,9 @@ endif()
if(BUILD_AVOGADRO)
include(External_spglib)
include(External_libmsym)
if(BUILD_YAEHMOP_PLUGIN)
include(External_yaehmop)
endif()
endif()

if(ENABLE_TESTING)
Expand Down

0 comments on commit 14cb961

Please sign in to comment.