Skip to content

Commit

Permalink
Merge pull request #17 from RMeli/update/openbabel3
Browse files Browse the repository at this point in the history
Support OpenBabel 3
  • Loading branch information
dkoes authored Oct 8, 2019
2 parents e9ebd92 + f4f6cde commit fad0bd7
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 3 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
#dependencies
find_package(CUDA REQUIRED)
find_package(Boost REQUIRED COMPONENTS regex unit_test_framework program_options system filesystem iostreams)
find_package(OpenBabel2 REQUIRED)
find_package(OpenBabel2)
if(${OPENBABEL2_FOUND})
include_directories(SYSTEM ${OPENBABEL2_INCLUDE_DIR})
else()
find_package(OpenBabel3 REQUIRED)
include_directories(SYSTEM ${OPENBABEL3_INCLUDE_DIR})
endif()

# configure a header file to pass some of the CMake settings
# to the source code
Expand Down Expand Up @@ -67,7 +73,6 @@ include_directories("${PROJECT_BINARY_DIR}")
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${PROJECT_BINARY_DIR}/include)
include_directories(SYSTEM ${CUDA_INCLUDE_DIRS})
include_directories(SYSTEM ${OPENBABEL2_INCLUDE_DIR})
include_directories(SYSTEM ${Boost_INCLUDE_DIR})

add_subdirectory(src)
Expand Down
1 change: 0 additions & 1 deletion cmake/Modules/FindOpenBabel2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,3 @@ message("Setting openbabel found ${OPENBABEL2_FOUND}")

mark_as_advanced(OPENBABEL2_INCLUDE_DIR OPENBABEL2_LIBRARIES)
endif()

75 changes: 75 additions & 0 deletions cmake/Modules/FindOpenBabel3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# FindOpenBabel.cmake
# Try to find Open Babel headers and libraries
# Defines:
#
# OPENBABEL3_FOUND - system has Open Babel
# OPENBABEL3_INCLUDE_DIR - the Open Babel include directory
# OPENBABEL3_LIBRARIES - Link these to use Open Babel
# IF OPENBABEL_DIR is defined, will look there first

if(OPENBABEL3_INCLUDE_DIR AND OPENBABEL3_LIBRARIES)
# in cache already or user-specified
set(OPENBABEL3_FOUND TRUE)

else()

if(NOT OPENBABEL3_INCLUDE_DIR)
find_path(OPENBABEL3_INCLUDE_DIR openbabel/obconversion.h
PATHS
${OPENBABEL_DIR}/include/openbabel3
${OPENBABEL_DIR}/include
$ENV{OPENBABEL_INCLUDE_DIR}/openbabel3
$ENV{OPENBABEL_INCLUDE_DIR}
$ENV{OPENBABEL_INCLUDE_PATH}/openbabel3
$ENV{OPENBABEL_INCLUDE_PATH}
$ENV{OPENBABEL_DIR}/include/openbabel3
$ENV{OPENBABEL_DIR}/include
$ENV{OPENBABEL_PATH}/include/openbabel3
$ENV{OPENBABEL_PATH}/include
$ENV{OPENBABEL_BASE}/include/openbabel3
$ENV{OPENBABEL_BASE}/include
/usr/include/openbabel3
/usr/include
/usr/local/include/openbabel3
/usr/local/include
/usr/local/openbabel/include/openbabel3
/usr/local/openbabel/include
/usr/local/openbabel3/include/openbabel3
/usr/local/openbabel3/include
~/include/openbabel3
~/include
)
if(OPENBABEL3_INCLUDE_DIR)
message(STATUS "Found Open Babel include files at ${OPENBABEL3_INCLUDE_DIR}")
endif()
endif()

if(NOT OPENBABEL3_LIBRARIES)
find_library(OPENBABEL3_LIBRARIES NAMES openbabel openbabel3
HINTS
${OPENBABEL_DIR}/lib
${OPENBABEL_DIR}/windows-vc2008/build/src/Release
${OPENBABEL_DIR}/build/src/Release
PATHS
$ENV{OPENBABEL_DIR}/lib
$ENV{OPENBABEL_DIR}/windows-vc2008/build/src/Release
$ENV{OPENBABEL_PATH}/lib
$ENV{OPENBABEL_BASE}/lib
/usr/lib
/usr/local/lib
~/lib
$ENV{LD_LIBRARY_PATH}
)
if(OPENBABEL3_LIBRARIES)
message(STATUS "Found Open Babel library at ${OPENBABEL3_LIBRARIES}")
endif()
endif()

if(OPENBABEL3_INCLUDE_DIR AND OPENBABEL3_LIBRARIES)
set(OPENBABEL3_FOUND TRUE)
message("Setting openbabel found ${OPENBABEL3_FOUND}")
endif()

mark_as_advanced(OPENBABEL3_INCLUDE_DIR OPENBABEL3_LIBRARIES)
endif()

0 comments on commit fad0bd7

Please sign in to comment.