Add support for openbabel 3
Needs ReviewPublic

Authored by arojas on May 6 2020, 1:51 PM.

Details

Reviewers
yurchor
Group Reviewers
Kalzium
Summary

We require a min version 3.1 since the cmake config files in 3.0 are totally broken. In 3.1 they are still not completely right, they miss a dependency on boost in order to define the Boost::system target so we add a find_package call here.

Test Plan

Builds with openbabel 2.4 and 3.1

Diff Detail

Repository
R326 Kalzium
Lint
Lint Skipped
Unit
Unit Tests Skipped
arojas created this revision.May 6 2020, 1:51 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptMay 6 2020, 1:51 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
arojas requested review of this revision.May 6 2020, 1:51 PM
yurchor accepted this revision.May 6 2020, 2:08 PM
yurchor added a subscriber: yurchor.

Tested to work. Thanks.

This revision is now accepted and ready to land.May 6 2020, 2:08 PM
arojas planned changes to this revision.May 6 2020, 5:02 PM

Upstream is working on fixing the remaining cmake issues and they will release a 3.1.1 that will allow to simplify the patch

arojas updated this revision to Diff 82319.May 8 2020, 9:04 PM

Removed boost dependency, no longer needed in 3.1.1. Unfortunately we can't bump the min version since they forgot to bump the version before release.

This revision is now accepted and ready to land.May 8 2020, 9:04 PM
arojas requested review of this revision.May 8 2020, 9:05 PM
joscott added a subscriber: joscott.EditedJun 9 2020, 12:27 PM

I tried using this patch to build Kalzium on Debian but got some errors:

Maybe the OpenBabel CMake files are still causing trouble?

arojas added a comment.Jun 9 2020, 1:55 PM

I tried using this patch to build Kalzium on Debian but got some errors:

What's the full path of OpenBabel3Config.cmake and its second line ("get_filename_component") on Debian?

joscott added a comment.EditedJun 9 2020, 2:13 PM

What's the full path of OpenBabel3Config.cmake and its second line ("get_filename_component") on Debian?

I was so focused on the linker errors I overlooked that. It's installed at /usr/lib/x86_64-linux-gnu/cmake/openbabel3/OpenBabel3Config.cmake. Here is its full content (on the second/third lines that's actually a hard line break, not a wrap).

# The OpenBabel3 config file. To get the targets include the exports file.
get_filename_component(OpenBabel3_INSTALL_PREFIX "${OpenBabel3_DIR}/../../.."
ABSOLUTE)
set(OpenBabel3_VERSION_MAJOR   "3")
set(OpenBabel3_VERSION_MINOR   "1")
set(OpenBabel3_VERSION_PATCH   "0")
set(OpenBabel3_VERSION         "3.1.0")
set(OpenBabel3_INCLUDE_DIRS "${OpenBabel3_INSTALL_PREFIX}/include/openbabel3")
set(OpenBabel3_LIBRARIES "$<TARGET_FILE:openbabel>")
set(OpenBabel3_EXPORTS_FILE "${OpenBabel3_INSTALL_PREFIX}/lib/cmake/openbabel3/OpenBabel3_EXPORTS.cmake")
set(OpenBabel3_ENABLE_VERSIONED_FORMATS "ON")
# Include the exports file to import the exported OpenBabel targets
include("${OpenBabel3_EXPORTS_FILE}")
arojas added a comment.EditedJun 9 2020, 2:26 PM

What's the full path of OpenBabel3Config.cmake and its second line ("get_filename_component") on Debian?

I was so focused on the linker errors I overlooked that. It's installed at /usr/lib/x86_64-linux-gnu/cmake/openbabel3/OpenBabel3Config.cmake. Here is its full content (on the second/third lines that's actually a hard line break, not a wrap).

The linker errors are caused by this (the pthread::pthread target is added in OpenBabel3_EXPORTS.cmake, which is failing to get imported for you)

This comes from the hardcoded REL_REF defined in https://github.com/openbabel/openbabel/blob/openbabel-3-1-1/CMakeLists.txt#L761 which is wrong for Debian (doesn't account for the extra /x86_64-linux-gnu/ subdir). Hardcoding this doesn't look right to me, you should ask them to fix this