Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/upgrade to boost v1.79-0 #111

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
61c290d
Ignoring .idea folder from git
ITesserakt Oct 31, 2021
3e2b5b7
Bumped Boost version to 1.77.0
ITesserakt Oct 31, 2021
818ee68
Fixed various errors after bump
ITesserakt Oct 31, 2021
06a0916
Add compile definitions only on test builds
ITesserakt Oct 31, 2021
bada208
Updated download URL/hash for 1.78
KevinThierauf Dec 25, 2021
c0b1432
Fixed Boost.filesystem compilation error for C++17 or earlier
KevinThierauf Jan 2, 2022
8cb2ca9
ResourceCompiler work + other
KevinThierauf Jan 3, 2022
6635022
Revert "ResourceCompiler work + other"
KevinThierauf Jan 3, 2022
e332360
Upgrade to boost v1.79.0
ClausKlein May 27, 2022
0fbb328
use ubuntu-latest on CI
ClausKlein May 27, 2022
908b954
use gcc-11 and clang-12 on linux CI
ClausKlein May 27, 2022
0b66712
use default gcc and clang on linux CI
ClausKlein May 27, 2022
8c659ab
enable tests again
ClausKlein May 28, 2022
bac9690
Boost_container contains c files
ClausKlein May 28, 2022
d035ea4
build only 64bit on CI
ClausKlein May 29, 2022
2a59565
fix NKD download link
ClausKlein May 29, 2022
cd45571
prevent bcopy macro conflict on android builds
ClausKlein May 29, 2022
bb1921c
rm old patch files
ClausKlein May 30, 2022
bf86819
add boost_json lib
ClausKlein Jun 1, 2022
b7c741f
define BOOST_JSON_STATIC_LINK=1 to Boost::json
ClausKlein Jun 1, 2022
c8fcc96
install CMakeLists.txt add BOOST_SOURCE
ClausKlein Jun 2, 2022
8c25594
modernice some cmake files
ClausKlein Jun 4, 2022
17b02b2
Merge pull request #1 from ClausKlein/feature/upgrade-to-boost-V1-79-0
ClausKlein Jun 4, 2022
127ef69
Add alias for Boost::asio lib
ClausKlein Jun 7, 2022
87c5ddb
fix typo
ClausKlein Jun 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
parse:
additional_commands:
_add_boost_lib:
# flags:
kwargs:
NAME: '1'
CXXFLAGS_PRIVATE: '*'
DEFINE: '*'
DEFINE_PRIVATE: '*'
INCLUDE_PRIVATE: '*'
LINK: '*'
SOURCES: '*'
_add_boost_test:
# flags:
kwargs:
NAME: '1'
RUN: '1'
DEFINE: '*'
INCLUDE: '*'
LINK: '*'
TESTS: '*'

format:
dangle_parens: true
line_ending: unix
line_width: 123
max_lines_hwrap: 3
max_pargs_hwrap: 4
max_rows_cmdline: 8
max_subgroups_hwrap: 4
min_prefix_chars: 8
separate_ctrl_name_with_space: false
separate_fn_name_with_space: false
tab_size: 2

markup:
bullet_char: "*"
enum_char: .
enable_markup: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
build*/
boost/
boost_*.tar.xz
.idea/
113 changes: 65 additions & 48 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
cmake_minimum_required(VERSION 3.12)
project(Boost-CMake)
cmake_minimum_required(VERSION 3.16...3.23)

project(Boost-CMake LANGUAGES C CXX VERSION 1.79.0)

option(BOOST_DISABLE_TESTS "Do not build test targets, even if building standalone" OFF)

set(BOOST_URL "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2" CACHE STRING "Boost download URL")
set(BOOST_URL_SHA256 "d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee" CACHE STRING "Boost download URL SHA256 checksum")
if(EXISTS "$ENV{CPM_SOURCE_CACHE}/boost_1_79_0")
set(FETCHCONTENT_SOURCE_DIR_BOOST "$ENV{CPM_SOURCE_CACHE}/boost_1_79_0" CACHE PATH "Boost source DIR")
set(CPM_Boost_SOURCE ${FETCHCONTENT_SOURCE_DIR_BOOST} CACHE PATH "Manual override")
endif()

include(FetchContent)
FetchContent_Declare(
Boost
URL ${BOOST_URL}
URL_HASH SHA256=${BOOST_URL_SHA256}
set(BOOST_URL "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2"
CACHE STRING "Boost download URL"
)
set(BOOST_URL_SHA256 "475d589d51a7f8b3ba2ba4eda022b170e562ca3b760ee922c146b6c65856ef39"
CACHE STRING "Boost download URL SHA256 checksum"
)
FetchContent_GetProperties(Boost)

include(FetchContent)
FetchContent_Declare(Boost URL ${BOOST_URL} URL_HASH SHA256=${BOOST_URL_SHA256})

FetchContent_GetProperties(Boost)
if(NOT Boost_POPULATED)
message(STATUS "Fetching Boost")
FetchContent_Populate(Boost)
Expand All @@ -31,6 +37,11 @@ include(PlatformDetect)
include(AddBoostLib)
include(AddBoostTest)

# NOTE: Install the missing CMakeList.txt file, but it will not yet used! CK
# If the tar achive contains one, it will not overridden.
configure_file(cmake/CMakeLists.txt.in ${BOOST_SOURCE}/CMakeLists.txt @ONLY)
configure_file(cmake/Modules/ccache.cmake ${BOOST_SOURCE}/tools/cmake/include/ccache.cmake COPYONLY)

set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)

if(USE_ANDROID)
Expand All @@ -39,40 +50,40 @@ if(USE_ANDROID)
set(CMAKE_ASM_COMPILER_TARGET "${CMAKE_CXX_COMPILER_TARGET}")
endif()

set(BOOST_LIBS_REQUIRED
# Header only libs
header
set(BOOST_LIBS_REQUIRED # Header only libs
header
)
set(BOOST_LIBS_OPTIONAL
# Compiled libs
atomic
chrono
container
context
coroutine
date_time
exception
fiber
filesystem
graph
iostreams
locale
log
math
mpi
graph_parallel # depends on mpi, so needs to be put after it
program_options
#python # complex module
random
regex
serialization
system
test
thread
timer
type_erasure
wave
CACHE STRING "Boost libs to be compiled"
# Compiled libs
atomic
chrono
container
context
coroutine
date_time
exception
fiber
filesystem
graph
graph_parallel
iostreams
json
locale
log
math
mpi
program_options
#python # complex module
random
regex
serialization
system
test
thread
timer
type_erasure
wave
CACHE STRING "Boost libs to be compiled"
)

foreach(lib ${BOOST_LIBS_REQUIRED})
Expand All @@ -88,14 +99,20 @@ endforeach()

# TODO: Move those to option() calls in the right file
if(NOT BOOST_STANDALONE)
find_package(Threads)

# Compilation options required by all platforms
target_compile_definitions(Boost::boost INTERFACE
$<$<CONFIG:Release>:BOOST_DISABLE_ASSERT>
BOOST_SYSTEM_NO_DEPRECATED
BOOST_THREAD_VERSION=4
BOOST_THREAD_USES_CHRONO
BOOST_THREAD_PROVIDES_EXECUTORS
target_compile_definitions(
Boost::boost
INTERFACE $<$<CONFIG:Release>:BOOST_DISABLE_ASSERT>
BOOST_ASIO_NO_DEPRECATED
BOOST_SYSTEM_NO_DEPRECATED
BOOST_THREAD_VERSION=5
BOOST_THREAD_USES_CHRONO
BOOST_THREAD_PROVIDES_EXECUTORS
)
add_library(Boost::asio ALIAS Boost::boost)
target_link_libraries(Boost::boost INTERFACE Threads::Threads)
endif()

if(USE_ANDROID)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target_link_libraries(lib_using_header_only PUBLIC Boost::boost)

## Configuration

Boost will automatically be downloaded from GitHub as a minified archive created with the `repack.sh` script.
Boost will automatically be downloaded from https://boostorg.jfrog.io/artifactory !

If that is not acceptable to you, you can use an alternate Boost version, apply custom patches or just mirror the current archive in your internal network like so:
```
Expand Down
26 changes: 9 additions & 17 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,19 @@
strategy:
matrix:
Linux-GCC:
imageName: 'ubuntu-16.04'
imageName: 'ubuntu-latest'
BUILD_TARGET: 'Linux'
BUILD_COMPILER: 'GCC'
Linux-Clang:
imageName: 'ubuntu-16.04'
imageName: 'ubuntu-latest'
BUILD_TARGET: 'Linux'
BUILD_COMPILER: 'Clang'
Android-arm64:
imageName: 'ubuntu-16.04'
imageName: 'ubuntu-latest'
BUILD_TARGET: 'Android'
BUILD_ARCH: 'arm64-v8a'
Android-arm:
imageName: 'ubuntu-16.04'
BUILD_TARGET: 'Android'
BUILD_ARCH: 'armeabi-v7a'
Android-x86:
imageName: 'ubuntu-16.04'
BUILD_TARGET: 'Android'
BUILD_ARCH: 'x86'
Android-x86_64:
imageName: 'ubuntu-16.04'
imageName: 'ubuntu-latest'
BUILD_TARGET: 'Android'
BUILD_ARCH: 'x86_64'
macOS:
Expand All @@ -35,14 +27,14 @@ strategy:
iOS:
imageName: 'macos-latest'
BUILD_TARGET: 'iOS'
Windows-v141-amd64:
imageName: 'vs2017-win2016'
Windows-2019-amd64:
imageName: 'windows-2019'
BUILD_TARGET: 'Windows'
BUILD_TOOLCHAIN: 'amd64'
Windows-v141-x86:
imageName: 'vs2017-win2016'
Windows-latest-amd64:
imageName: 'windows-latest'
BUILD_TARGET: 'Windows'
BUILD_TOOLCHAIN: 'amd64_x86'
BUILD_TOOLCHAIN: 'amd64'

trigger:
- master
Expand Down
22 changes: 11 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#/usr/bin/env bash

NDK_VER=android-ndk-r18b
# Latest LTS Version (r23c)
NDK_VER=android-ndk-r23c

download_extract() {
aria2c -x 16 $1 -o $2
Expand All @@ -27,18 +28,17 @@ build_before_install() {
}

build_install() {
# Ubuntu Linux + GCC 4.8
# Ubuntu Linux + GCC
if [[ "$AGENT_OS" == "Linux" ]]; then
sudo apt-get install \
build-essential \
g++-5 \
clang-6.0 \
g++ \
clang-12 \
aria2 \
ninja-build \
ccache

download_extract "https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2-Linux-x86_64.tar.gz" cmake-3.13.2-Linux-x86_64.tar.gz
export PATH=$(pwd)/cmake-3.13.2-Linux-x86_64/bin:$PATH
pip install cmake ninja
elif [[ "$AGENT_OS" == "Darwin" ]]; then
brew_install ccache
brew_install cmake
Expand All @@ -50,7 +50,7 @@ build_install() {

# Android NDK
if [[ "$BUILD_TARGET" == "Android" ]]; then
download_extract_zip http://dl.google.com/android/repository/${NDK_VER}-linux-x86_64.zip ${NDK_VER}-linux-x86_64.zip
download_extract_zip http://dl.google.com/android/repository/${NDK_VER}-linux.zip ${NDK_VER}-linux.zip
export ANDROID_NDK=$(pwd)/${NDK_VER}
fi
}
Expand All @@ -61,11 +61,11 @@ build_script() {

if [[ "$BUILD_TARGET" == "Linux" ]]; then
if [[ "$BUILD_COMPILER" == "GCC" ]]; then
CC=gcc-5
CXX=g++-5
CC=gcc
CXX=g++
else
CC=clang-6.0
CXX=clang++-6.0
CC=clang-12
CXX=clang++-12
fi
cmake .. -GNinja \
-DCMAKE_C_COMPILER=$CC \
Expand Down
76 changes: 76 additions & 0 deletions cmake/CMakeLists.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Copyright 2019, 2021, 2022 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
#
# Use this cmake project to build and run the unit tests
# $ pip install cmake ninja
# $ cmake -B cmake-build -S . -G Ninja -Wdev --log-level=DEBUG
# $ cmake --build cmake-build
# $ cmake --build cmake-build --target test

cmake_minimum_required(VERSION 3.21...3.23)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

find_program(CACHE_BINARY NAMES ccache sccache)
if(CACHE_BINARY)
message(STATUS "${CACHE_BINARY} found and enabled")
set(CMAKE_CXX_COMPILER_LAUNCHER ${CACHE_BINARY} CACHE FILEPATH "CXX compiler cache used")
set(CMAKE_C_COMPILER_LAUNCHER ${CACHE_BINARY} CACHE FILEPATH "C compiler cache used")
endif()

# 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()

project(Boost VERSION @Boost-CMake_VERSION@ LANGUAGES CXX C)

set(BOOST_SUPERPROJECT_VERSION ${PROJECT_VERSION})
set(BOOST_SUPERPROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR})

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/include)

option(CMAKE_CXX_EXTENSIONS "Default value for CXX_EXTENSIONS property of targets." NO)
option(CMAKE_CXX_STANDARD_REQUIRED "The c++ standard is requrired" YES)
option(BUILD_SHARED_LIBS "Build shared libraries" ${PROJECT_IS_TOP_LEVEL})

### see tools/cmake/include/BoostRoot.cmake
#XXX option(CMAKE_SKIP_INSTALL_RULES "do NOT create install targes!" ${PROJECT_IS_TOP_LEVEL})
# option(BOOST_ENABLE_MPI "Enable MPI" ${PROJECT_IS_TOP_LEVEL})
# option(BUILD_TESTING "Enable testing" ${PROJECT_IS_TOP_LEVEL})

set(CMAKE_CXX_STANDARD @CMAKE_CXX_STANDARD@ CACHE STRING "The used c++ standard")

### Workaround to compile some boost libs. CK
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

# NOTE: prepared, but not used! CK
### Define the header-only Boost targets
# add_library(Boost::boost SYSTEM INTERFACE IMPORTED GLOBAL)
# add_library(Boost::headers ALIAS Boost::boost)
# target_include_directories(Boost::boost INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
# target_compile_features(Boost::boost INTERFACE cxx_std_${CMAKE_CXX_STANDARD})
# target_compile_definitions(
# Boost::boost
# INTERFACE $<$<CONFIG:Release>:BOOST_DISABLE_ASSERT>
# BOOST_ASIO_NO_DEPRECATED
# BOOST_SYSTEM_NO_DEPRECATED
# BOOST_THREAD_VERSION=5
# BOOST_THREAD_USES_CHRONO
# BOOST_THREAD_PROVIDES_EXECUTORS
# )

if(PROJECT_IS_TOP_LEVEL)
enable_testing()
endif()

include(BoostRoot)
Loading