Skip to content

Commit

Permalink
Update rdkit and qt, and build zlib (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdvonbargen committed May 29, 2024
1 parent 0400248 commit 20a3873
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 89 deletions.
6 changes: 3 additions & 3 deletions .github/actions/build-external/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ inputs:
version:
description: "Version of the dependency to build"
required: true
os:
description: "Platform on which we are building"
build-output:
description: "Build output target"
required: true

outputs:
Expand All @@ -22,7 +22,7 @@ runs:
id: cache-check
with:
path: build/external/${{ inputs.library }}-${{ inputs.version }}
key: ${{ inputs.library }}-${{ inputs.version }}-${{ inputs.os }}
key: ${{ inputs.library }}-${{ inputs.version }}-${{ runner.os }}-${{ matrix.build-output }}

- name: Build
if: ${{ steps.cache-check.outputs.cache-hit != 'true' }}
Expand Down
46 changes: 29 additions & 17 deletions .github/workflows/sketcher-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,33 @@ on:
workflow_dispatch: ~
push: ~
pull_request: ~
schedule:
- cron: "0 4 * * *"

env:
BUILD_TYPE: Release

jobs:
# TODO: clang-format hook
build_test_sketcher:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
config:
- {
name: "macOS",
os: macos-latest,
app: "build/sketcher_app",
}
os: [macos-latest]
build-output: [app]

steps:
- uses: actions/checkout@v4

- name: Create and activate virtualenv
run: |
python3 -m venv .venv
source .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Install Python packages
run: python3 -m pip install ninja clang-format==14.0.6

Expand All @@ -53,43 +56,52 @@ jobs:
with:
library: fmt
version: ${{ fromJson(env.VERSIONS_JSON).fmt }}
os: ${{ matrix.config.os }}
build-output: ${{ matrix.build-output }}

- name: Fetch zlib
id: fetch-zlib
uses: ./.github/actions/build-external
with:
library: zlib
version: ${{ fromJson(env.VERSIONS_JSON).zlib }}
build-output: ${{ matrix.build-output }}

- name: Fetch zstd
id: fetch-zstd
uses: ./.github/actions/build-external
with:
library: zstd
version: ${{ fromJson(env.VERSIONS_JSON).zstd }}
os: ${{ matrix.config.os }}
build-output: ${{ matrix.build-output }}

- name: Fetch Boost
id: fetch-boost
uses: ./.github/actions/build-external
with:
library: boost
version: ${{ fromJson(env.VERSIONS_JSON).boost }}
os: ${{ matrix.config.os }}
build-output: ${{ matrix.build-output }}

- name: Fetch RDKit
id: fetch-rdkit
uses: ./.github/actions/build-external
with:
library: rdkit
version: ${{ fromJson(env.VERSIONS_JSON).rdkit }}
os: ${{ matrix.config.os }}
build-output: ${{ matrix.build-output }}

- name: Fetch Qt
id: fetch-qt
uses: ./.github/actions/build-external
with:
library: qt
version: ${{ fromJson(env.VERSIONS_JSON).qt }}
os: ${{ matrix.config.os }}
build-output: ${{ matrix.build-output }}

- name: Configure CMake
env:
CMAKE_PREFIX_PATH: "${{ steps.fetch-fmt.outputs.path }};\
${{ steps.fetch-zlib.outputs.path }};\
${{ steps.fetch-zstd.outputs.path }};\
${{ steps.fetch-boost.outputs.path }};\
${{ steps.fetch-rdkit.outputs.path }};\
Expand All @@ -109,5 +121,5 @@ jobs:
- name: Download sketcher executable
uses: actions/upload-artifact@v4
with:
name: sketcher_${{ matrix.config.name }}
path: ${{ matrix.config.app }}
name: sketcher_${{ matrix.build-output }}
path: build/sketcher_app
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ string(JSON BOOST_VERSION GET ${VERSIONS} boost)
string(JSON FMT_VERSION GET ${VERSIONS} fmt)
string(JSON QT_VERSION GET ${VERSIONS} qt)
string(JSON RDKIT_VERSION GET ${VERSIONS} rdkit)
string(JSON ZLIB_VERSION GET ${VERSIONS} zlib)
string(JSON ZSTD_VERSION GET ${VERSIONS} zstd)

set(Boost_USE_STATIC_LIBS ON) # Ensure static libs are found

find_package(Boost ${BOOST_VERSION} REQUIRED
COMPONENTS filesystem json serialization unit_test_framework)
find_package(
Boost ${BOOST_VERSION} REQUIRED COMPONENTS filesystem iostreams json
serialization unit_test_framework)
find_package(Qt6 ${QT_VERSION} REQUIRED COMPONENTS Widgets Svg)
find_package(RDKit ${RDKIT_VERSION} REQUIRED)
find_package(fmt ${FMT_VERSION} REQUIRED)
find_package(ZLIB ${ZLIB_VERSION} REQUIRED)
find_package(zstd ${ZSTD_VERSION} REQUIRED)

# Common library/executable configuration
Expand Down Expand Up @@ -66,6 +69,7 @@ target_link_libraries(
RDKit::DistGeomHelpers
RDKit::RDInchiLib
fmt::fmt
ZLIB::ZLIB
zstd::libzstd_static)

set(SKETCHER_LIB sketcher)
Expand Down
88 changes: 56 additions & 32 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ project(schrodinger_sketcher_external)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(MSVC)
# Workaround until boost 1.83 which fixes the issue with std::unary_function
add_definitions(-D_HAS_AUTO_PTR_ETC=0)
endif()

# Collect dependency versions
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/versions.json VERSIONS)
string(JSON BOOST_VERSION GET ${VERSIONS} boost)
string(JSON FMT_VERSION GET ${VERSIONS} fmt)
string(JSON QT_VERSION GET ${VERSIONS} qt)
string(JSON RDKIT_VERSION GET ${VERSIONS} rdkit)
string(JSON ZLIB_VERSION GET ${VERSIONS} zlib)
string(JSON ZSTD_VERSION GET ${VERSIONS} zstd)

# Ensure args passed to ExternalProject_Add's CMAKE_ARGS support semicolons
function(set_cmake_arg VAR_NAME)
set(CMAKE_ARG ${ARGN})
string(REPLACE ";" "$<SEMICOLON>" CMAKE_ARG "${CMAKE_ARG}")
set(${VAR_NAME}
"${CMAKE_ARG}"
PARENT_SCOPE)
endfunction()

ExternalProject_Add(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
Expand All @@ -28,6 +33,17 @@ ExternalProject_Add(
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/fmt-${FMT_VERSION}
-DCMAKE_BUILD_TYPE=Release -DFMT_DOC=OFF -DFMT_TEST=OFF -DFMT_INSTALL=ON)

ExternalProject_Add(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG v${ZLIB_VERSION}
GIT_SHALLOW TRUE
PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/zlib.patch
UPDATE_DISCONNECTED 1 # required to not apply patch again once populated
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/zlib-${ZLIB_VERSION}
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF)

ExternalProject_Add(
zstd
GIT_REPOSITORY https://github.com/facebook/zstd.git
Expand All @@ -39,37 +55,46 @@ ExternalProject_Add(
-DCMAKE_BUILD_TYPE=Release -DZSTD_BUILD_SHARED=OFF
-DZSTD_BUILD_PROGRAMS=OFF)

set(BOOST_INCLUDE_LIBS
# RDKit required libraries
assign
crc
format
flyweight
graph
iostreams
json
multi_array
multiprecision
program_options
serialization
# rdkit_extensions required libraries
beast
bimap
filesystem
test)
# Use generator expression to sidestep CMAKE_ARGS removing semicolons
string(REPLACE ";" "$<SEMICOLON>" BOOST_INCLUDE_LIBS "${BOOST_INCLUDE_LIBS}")
set_cmake_arg(
BOOST_INCLUDE_LIBS
# RDKit required libraries
assign
crc
format
flyweight
graph
iostreams
json
multi_array
multiprecision
program_options
serialization
# rdkit_extensions required libraries
beast
bimap
filesystem
test)
set_cmake_arg(
BOOST_CMAKE_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/zlib-${ZLIB_VERSION}
${CMAKE_CURRENT_BINARY_DIR}/zstd-${ZSTD_VERSION})
ExternalProject_Add(
boost
GIT_REPOSITORY https://github.com/boostorg/boost.git
GIT_TAG boost-${BOOST_VERSION}
GIT_SHALLOW TRUE
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/boost-${BOOST_VERSION}
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
-DBOOST_INCLUDE_LIBRARIES=${BOOST_INCLUDE_LIBS})
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_PREFIX_PATH=${BOOST_CMAKE_PREFIX}
-DBUILD_SHARED_LIBS=OFF
-DBOOST_INCLUDE_LIBRARIES=${BOOST_INCLUDE_LIBS}
-DBOOST_RUNTIME_LINK=static
-DBOOST_IOSTREAMS_ENABLE_BZIP2=OFF)

string(REPLACE "." "_" RDKIT_GIT_TAG ${RDKIT_VERSION})
set_cmake_arg(
RDKIT_CMAKE_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/boost-${BOOST_VERSION}
${CMAKE_CURRENT_BINARY_DIR}/zlib-${ZLIB_VERSION})
ExternalProject_Add(
rdkit
GIT_REPOSITORY https://github.com/rdkit/rdkit.git
Expand All @@ -80,7 +105,7 @@ ExternalProject_Add(
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/rdkit-${RDKIT_VERSION}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_PREFIX_PATH=${CMAKE_CURRENT_BINARY_DIR}/boost-${BOOST_VERSION}
-DCMAKE_PREFIX_PATH=${RDKIT_CMAKE_PREFIX}
-DBUILD_SHARED_LIBS=OFF
-DBoost_USE_STATIC_LIBS=ON
-DRDK_BUILD_CPP_TESTS=OFF
Expand All @@ -97,19 +122,18 @@ ExternalProject_Add(
-DRDK_OPTIMIZE_POPCNT=OFF
-DRDK_USE_BOOST_STACKTRACE=OFF)

set_cmake_arg(QT_SUBMODULES qtbase qtsvg)
ExternalProject_Add(
qt
GIT_REPOSITORY https://github.com/qt/qt5.git
GIT_TAG v${QT_VERSION}-lts-lgpl
GIT_TAG v${QT_VERSION}
GIT_SUBMODULES qtbase qtsvg
GIT_SHALLOW TRUE
PATCH_COMMAND cd qtsvg && git apply ${CMAKE_CURRENT_SOURCE_DIR}/qtsvg.patch
UPDATE_DISCONNECTED 1 # required to not apply patch again once populated
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/qt-${QT_VERSION}
-DCMAKE_BUILD_TYPE=Release
-DBUILD_SHARED_LIBS=OFF
-DQT_BUILD_EXAMPLES=OFF
-DQT_BUILD_SUBMODULES=qtbase$<SEMICOLON>qtsvg
-DQT_BUILD_SUBMODULES=${QT_SUBMODULES}
-DQT_BUILD_TESTS=OFF
-DQT_FEATURE_brotli=OFF
-DQT_FEATURE_sql=OFF
Expand Down
10 changes: 0 additions & 10 deletions external/qtsvg.patch

This file was deleted.

22 changes: 0 additions & 22 deletions external/rdkit.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 37d618000..37c82d6fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -448,7 +448,7 @@ else()
endif()

if(RDK_USE_BOOST_SERIALIZATION)
- find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS system serialization iostreams REQUIRED)
+ find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS serialization iostreams REQUIRED)
target_link_libraries(rdkit_base INTERFACE ${Boost_LIBRARIES})
target_compile_definitions(rdkit_base INTERFACE -DRDK_USE_BOOST_SERIALIZATION)
if(NOT Boost_USE_STATIC_LIBS)
@@ -458,7 +458,7 @@ endif()

if(RDK_USE_BOOST_IOSTREAMS)
target_compile_definitions(rdkit_base INTERFACE -DRDK_USE_BOOST_IOSTREAMS)
- find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS system iostreams REQUIRED)
+ find_package(Boost ${RDK_BOOST_VERSION} COMPONENTS iostreams REQUIRED)
target_link_libraries(rdkit_base INTERFACE ${Boost_LIBRARIES})

if (NOT Boost_USE_STATIC_LIBS)
diff --git a/Code/cmake/Modules/RDKitUtils.cmake b/Code/cmake/Modules/RDKitUtils.cmake
index 7c4f5add5..1e79aa1c0 100644
--- a/Code/cmake/Modules/RDKitUtils.cmake
Expand Down
8 changes: 5 additions & 3 deletions external/versions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"boost": "1.81.0",
"boost": "1.83.0",
"fmt": "10.1.0",
"qt": "6.2.7",
"rdkit": "2023.09.4",
"qt": "6.5.3",
"rdkit": "2024.03.2",
"sqlite": "3.42.0",
"zlib": "1.2.11",
"zstd": "1.5.5"
}
13 changes: 13 additions & 0 deletions external/zlib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3d9b58d..f0e8e2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -184,7 +184,7 @@ elseif(BUILD_SHARED_LIBS AND WIN32)
endif()

if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
- install(TARGETS zlib zlibstatic
+ install(TARGETS zlibstatic
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )

0 comments on commit 20a3873

Please sign in to comment.