Build private boost version if not found

This commit is contained in:
Maarten L. Hekkelman
2025-05-15 08:28:32 +02:00
parent 0a2da70235
commit 0469b0387c
4 changed files with 1318 additions and 14 deletions

View File

@@ -35,7 +35,7 @@ jobs:
- name: Install Catch2 Ubuntu
if: matrix.os == 'ubuntu-latest'
run: >
sudo apt-get update && sudo apt-get install catch2 libboost-all-dev libpython3-all-dev
sudo apt-get update && sudo apt-get install catch2 libpython3-all-dev
- name: setup python
uses: actions/setup-python@v5
@@ -45,16 +45,7 @@ jobs:
- name: Install Catch2 macOS
if: matrix.os == 'macos-latest'
run: >
brew install catch2 boost-python3
- name: Install Boost Windows
if: matrix.os == 'windows-latest'
uses: MarkusJx/install-boost@v2.4.4
id: install-boost
with:
boost_version: 1.83.0
platform_version: 2019
toolset: msvc
brew install catch2
- name: Install dependencies Window
if: matrix.os == 'windows-latest'
@@ -62,8 +53,6 @@ jobs:
shell: cmd
- name: Configure CMake
env:
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}

View File

@@ -33,6 +33,12 @@ include(CTest)
include(VersionString)
include(FetchContent)
# The default build type must be set before project()
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
elseif(MSVC)

1291
cmake/CPM.cmake Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,25 @@ if(CMAKE_VERSION GREATER_EQUAL 3.30)
endif()
find_package(Python REQUIRED COMPONENTS Interpreter Development)
find_package(Boost 1.83 REQUIRED COMPONENTS python)
find_package(Boost 1.83 QUIET COMPONENTS python)
if(NOT Boost_FOUND)
include(CPM)
# boost is a huge project and directly downloading the 'alternate release'
# from github is much faster than recursively cloning the repo.
CPMAddPackage(
NAME Boost
VERSION 1.84.0
URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
URL_HASH SHA256=2e64e5d79a738d0fa6fb546c6e5c2bd28f88d268a2a080546f74e5ff98f29d0e
OPTIONS
"BOOST_ENABLE_CMAKE ON"
"BOOST_INCLUDE_LIBRARIES python"
"BOOST_ENABLE_PYTHON ON"
"CMAKE_POSITION_INDEPENDENT_CODE ON"
)
endif()
# ---------
add_library(mkdssp_module SHARED dssp-python-plugin.cpp)