Skip to content

Commit 31b4856

Browse files
committed
doc, compiler to registry, simplify policies
1 parent baff0d3 commit 31b4856

File tree

155 files changed

+76731
-1310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+76731
-1310
lines changed

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ env:
3636
LCOV_BRANCH_COVERAGE: 0
3737
CODECOV_NAME: Github Actions
3838

39+
permissions:
40+
id-token: write
41+
pages: write
42+
3943
jobs:
4044
posix:
4145
defaults:
@@ -292,6 +296,8 @@ jobs:
292296
rmdir /s /q boost-ci-cloned
293297
294298
- name: Setup Boost
299+
env:
300+
BOOST_BRANCH: master
295301
run: ci\github\install.bat
296302

297303
- name: Run tests
@@ -453,3 +459,64 @@ jobs:
453459
cmake -G "${{matrix.generator}}" -DBOOST_CI_INSTALL_TEST=ON -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DCMAKE_PREFIX_PATH=$HOME/local ..
454460
cmake --build . --config ${{matrix.build_type}} -j$B2_JOBS
455461
ctest --output-on-failure --build-config ${{matrix.build_type}}
462+
antora:
463+
name: Antora Docs
464+
runs-on: ubuntu-latest
465+
defaults:
466+
run:
467+
shell: bash
468+
steps:
469+
- name: Install packages
470+
uses: alandefreitas/cpp-actions/[email protected]
471+
with:
472+
apt-get: git cmake
473+
474+
- name: Clone Boost.OpenMethod
475+
uses: actions/checkout@v4
476+
477+
- name: Clone Boost
478+
uses: alandefreitas/cpp-actions/[email protected]
479+
id: boost-clone
480+
with:
481+
branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
482+
boost-dir: ../boost-source
483+
scan-modules-dir: .
484+
scan-modules-ignore: openmethod
485+
486+
- uses: actions/setup-node@v4
487+
with:
488+
node-version: 18
489+
490+
- name: Build Antora Docs
491+
# env:
492+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
493+
run: |
494+
git config --global --add safe.directory "$(pwd)"
495+
496+
cd ..
497+
BOOST_SRC_DIR="$(pwd)/boost-source"
498+
export BOOST_SRC_DIR
499+
cd Boost.OpenMethod
500+
501+
cd doc
502+
bash ./build_antora.sh
503+
504+
# Antora returns zero even if it fails, so we check if the site directory exists
505+
if [ ! -d "build/site" ]; then
506+
echo "Antora build failed"
507+
exit 1
508+
fi
509+
510+
- name: Create Antora Docs Artifact
511+
uses: actions/upload-artifact@v4
512+
with:
513+
name: antora-docs-${{ matrix.name }}
514+
path: doc/build/site
515+
516+
- name: Upload static files as artifact
517+
uses: actions/upload-pages-artifact@v3
518+
with:
519+
path: doc/build/site
520+
521+
- name: Deploy to GitHub Pages
522+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ build/
44
builds/
55
**/#*#
66
dependencies/*
7+
Dependencies/*
78
extern/*
89
tests/benchmarks_parameters.hpp
910
**/vcpkg_installed

CMakeLists.txt

Lines changed: 163 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,64 @@
1-
# Generated by `boostdep --cmake openmethod`
2-
# Copyright 2020, 2021 Peter Dimov
3-
# Distributed under the Boost Software License, Version 1.0.
4-
# https://www.boost.org/LICENSE_1_0.txt
1+
#
2+
# Copyright (c) 2019 Vinnie Falco ([email protected])
3+
# Copyright (c) 2021 DMitry Arkhipov ([email protected])
4+
# Copyright (c) 2022 Alan de Freitas ([email protected])
5+
#
6+
# Distributed under the Boost Software License, Version 1.0. (See accompanying
7+
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8+
#
9+
# Official repository: https://github.com/boostorg/openmethod
10+
#
511

6-
cmake_minimum_required(VERSION 3.5...3.20)
12+
#-------------------------------------------------
13+
#
14+
# Project
15+
#
16+
#-------------------------------------------------
717

8-
project(boost_openmethod VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
18+
cmake_minimum_required(VERSION 3.8...3.20)
919

10-
set(BOOST_OPENMETHOD_IS_ROOT OFF)
11-
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
12-
set(BOOST_OPENMETHOD_IS_ROOT ON)
13-
endif()
20+
set(BOOST_OPENMETHOD_VERSION 1)
1421

15-
if(BOOST_OPENMETHOD_IS_ROOT)
16-
include(CTest)
17-
endif()
18-
if(NOT BOOST_SUPERPROJECT_VERSION)
19-
option(BOOST_OPENMETHOD_INSTALL "Install boost::openmethod files" ON)
20-
option(BOOST_OPENMETHOD_BUILD_TESTS "Build boost::openmethod tests" ${BUILD_TESTING})
21-
option(BOOST_OPENMETHOD_BUILD_EXAMPLES "Build boost::openmethod examples" ${BOOST_OPENMETHOD_IS_ROOT})
22-
else()
23-
set(BOOST_OPENMETHOD_BUILD_TESTS ${BUILD_TESTING})
24-
endif()
22+
if (BOOST_SUPERPROJECT_VERSION)
23+
set(BOOST_OPENMETHOD_VERSION ${BOOST_SUPERPROJECT_VERSION})
24+
endif ()
2525

26-
if(BOOST_OPENMETHOD_IS_ROOT)
27-
#
28-
# Building inside Boost tree, but as a separate project e.g. on Travis or
29-
# other CI, or when producing Visual Studio Solution and Projects.
26+
project(boost_openmethod VERSION "${BOOST_OPENMETHOD_VERSION}" LANGUAGES CXX)
3027

31-
set(BOOST_INCLUDE_LIBRARIES openmethod)
32-
set(BOOST_EXCLUDE_LIBRARIES openmethod)
33-
list(APPEND BOOST_INCLUDE_LIBRARIES test)
34-
if(BOOST_OPENMETHOD_BUILD_EXAMPLES)
35-
# list(APPEND BOOST_INCLUDE_LIBRARIES optional)
36-
endif()
28+
set(BOOST_OPENMETHOD_IS_ROOT OFF)
3729

38-
set(CMAKE_FOLDER _deps)
39-
add_subdirectory(../.. _deps/boost EXCLUDE_FROM_ALL)
40-
unset(CMAKE_FOLDER)
41-
endif()
30+
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
31+
set(BOOST_OPENMETHOD_IS_ROOT ON)
32+
endif ()
33+
set(__ignore__ ${CMAKE_C_COMPILER})
4234

43-
add_library(boost_openmethod INTERFACE)
44-
add_library(Boost::openmethod ALIAS boost_openmethod)
35+
#-------------------------------------------------
36+
#
37+
# Options
38+
#
39+
#-------------------------------------------------
40+
option(BOOST_OPENMETHOD_BUILD_TESTS "Build boost::openmethod tests even if BUILD_TESTING is OFF" OFF)
41+
option(BOOST_OPENMETHOD_BUILD_EXAMPLES "Build boost::openmethod examples" ${BOOST_OPENMETHOD_IS_ROOT})
42+
option(BOOST_OPENMETHOD_MRDOCS_BUILD "Build the target for MrDocs: see mrdocs.yml" OFF)
43+
option(BOOST_OPENMETHOD_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
4544

46-
target_compile_features(boost_openmethod INTERFACE cxx_std_17)
45+
# Check if environment variable BOOST_SRC_DIR is set
46+
if (NOT DEFINED BOOST_SRC_DIR AND DEFINED ENV{BOOST_SRC_DIR})
47+
set(DEFAULT_BOOST_SRC_DIR "$ENV{BOOST_SRC_DIR}")
48+
else ()
49+
set(DEFAULT_BOOST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..")
50+
endif ()
51+
set(BOOST_SRC_DIR ${DEFAULT_BOOST_SRC_DIR} CACHE STRING "Boost source dir to use when running CMake from this directory")
4752

48-
target_include_directories(boost_openmethod INTERFACE include)
53+
#-------------------------------------------------
54+
#
55+
# Boost modules
56+
#
57+
#-------------------------------------------------
58+
# The boost super-project requires one explicit dependency per-line.
4959

50-
target_link_libraries(
51-
boost_openmethod
52-
INTERFACE
60+
set(
61+
BOOST_OPENMETHOD_DEPENDENCIES
5362
Boost::assert
5463
Boost::config
5564
Boost::core
@@ -58,11 +67,119 @@ target_link_libraries(
5867
Boost::preprocessor
5968
)
6069

61-
if(BOOST_OPENMETHOD_BUILD_TESTS)
62-
enable_testing()
63-
add_subdirectory(test)
70+
71+
foreach (BOOST_OPENMETHOD_DEPENDENCY ${BOOST_OPENMETHOD_DEPENDENCIES})
72+
if (BOOST_OPENMETHOD_DEPENDENCY MATCHES "^[ ]*Boost::([A-Za-z0-9_]+)[ ]*$")
73+
list(APPEND BOOST_OPENMETHOD_INCLUDE_LIBRARIES ${CMAKE_MATCH_1})
74+
endif ()
75+
endforeach ()
76+
# Conditional dependencies
77+
if (NOT BOOST_OPENMETHOD_MRDOCS_BUILD)
78+
if (BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS)
79+
set(BOOST_OPENMETHOD_UNIT_TEST_LIBRARIES test)
80+
endif()
81+
if (BOOST_OPENMETHOD_BUILD_EXAMPLES)
82+
#set(BOOST_OPENMETHOD_EXAMPLE_LIBRARIES json regex beast)
83+
endif()
6484
endif()
85+
# Complete dependency list
86+
set(BOOST_INCLUDE_LIBRARIES ${BOOST_OPENMETHOD_INCLUDE_LIBRARIES} ${BOOST_OPENMETHOD_UNIT_TEST_LIBRARIES} ${BOOST_OPENMETHOD_EXAMPLE_LIBRARIES})
87+
set(BOOST_EXCLUDE_LIBRARIES openmethod)
88+
89+
#-------------------------------------------------
90+
#
91+
# Add Boost Subdirectory
92+
#
93+
#-------------------------------------------------
94+
if (BOOST_OPENMETHOD_IS_ROOT)
95+
set(CMAKE_FOLDER Dependencies)
96+
# Find absolute BOOST_SRC_DIR
97+
if (NOT IS_ABSOLUTE ${BOOST_SRC_DIR})
98+
set(BOOST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${BOOST_SRC_DIR}")
99+
endif ()
100+
101+
# Validate BOOST_SRC_DIR
102+
set(BOOST_SRC_DIR_IS_VALID ON)
103+
foreach (F "CMakeLists.txt" "Jamroot" "boost-build.jam" "bootstrap.sh" "libs")
104+
if (NOT EXISTS "${BOOST_SRC_DIR}/${F}")
105+
message(STATUS "${BOOST_SRC_DIR}/${F} does not exist. Fallback to find_package.")
106+
set(BOOST_SRC_DIR_IS_VALID OFF)
107+
break()
108+
endif ()
109+
endforeach ()
110+
111+
# Create Boost interface targets
112+
if (BOOST_SRC_DIR_IS_VALID)
113+
# From BOOST_SRC_DIR
114+
if (BUILD_SHARED_LIBS)
115+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
116+
endif()
117+
set(BOOST_EXCLUDE_LIBRARIES ${PROJECT_NAME})
118+
set(PREV_BUILD_TESTING ${BUILD_TESTING})
119+
set(BUILD_TESTING OFF CACHE BOOL "Build the tests." FORCE)
120+
add_subdirectory(${BOOST_SRC_DIR} Dependencies/boost EXCLUDE_FROM_ALL)
121+
set(BUILD_TESTING ${PREV_BUILD_TESTING} CACHE BOOL "Build the tests." FORCE)
122+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${BOOST_SRC_DIR}/tools/cmake/include")
123+
else ()
124+
# From Boost Package
125+
find_package(Boost REQUIRED COMPONENTS container)
126+
foreach (BOOST_INCLUDE_LIBRARY ${BOOST_INCLUDE_LIBRARIES})
127+
if (NOT TARGET Boost::${BOOST_INCLUDE_LIBRARY})
128+
add_library(Boost::${BOOST_INCLUDE_LIBRARY} ALIAS Boost::headers)
129+
endif ()
130+
endforeach ()
131+
endif ()
132+
unset(CMAKE_FOLDER)
133+
endif ()
65134

66-
if(BOOST_OPENMETHOD_BUILD_EXAMPLES)
67-
add_subdirectory(example)
135+
#-------------------------------------------------
136+
#
137+
# Library
138+
#
139+
#-------------------------------------------------
140+
file(GLOB_RECURSE BOOST_OPENMETHOD_HEADERS CONFIGURE_DEPENDS include/boost/*.hpp)
141+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
142+
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost PREFIX "" FILES ${BOOST_OPENMETHOD_HEADERS})
143+
function(boost_openmethod_setup_properties target)
144+
target_link_libraries(${target} INTERFACE ${BOOST_OPENMETHOD_DEPENDENCIES})
145+
endfunction()
146+
147+
add_library(boost_openmethod INTERFACE ${BOOST_OPENMETHOD_HEADERS})
148+
add_library(Boost::openmethod ALIAS boost_openmethod)
149+
target_include_directories(boost_openmethod INTERFACE "${PROJECT_SOURCE_DIR}/include")
150+
boost_openmethod_setup_properties(boost_openmethod)
151+
target_compile_features(boost_openmethod INTERFACE cxx_std_17)
152+
153+
if (BOOST_OPENMETHOD_MRDOCS_BUILD)
154+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/mrdocs.cpp" "#include <boost/openmethod.hpp>\n")
155+
foreach (HEADER ${BOOST_OPENMETHOD_HEADERS})
156+
string(REPLACE "${PROJECT_SOURCE_DIR}/include/" "" HEADER "${HEADER}")
157+
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/mrdocs.cpp" "#include <${HEADER}>\n")
158+
endforeach()
159+
add_library(boost_openmethod_mrdocs "${CMAKE_CURRENT_BINARY_DIR}/mrdocs.cpp")
160+
target_include_directories(boost_openmethod_mrdocs PUBLIC "${PROJECT_SOURCE_DIR}/include")
161+
boost_openmethod_setup_properties(boost_openmethod_mrdocs)
162+
target_link_libraries(boost_openmethod_mrdocs PUBLIC Boost::openmethod)
163+
target_compile_definitions(boost_openmethod_mrdocs PUBLIC BOOST_OPENMETHOD_MRDOCS)
164+
return()
68165
endif()
166+
167+
#-------------------------------------------------
168+
#
169+
# Tests
170+
#
171+
#-------------------------------------------------
172+
if (BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS)
173+
enable_testing()
174+
add_subdirectory(test)
175+
endif ()
176+
177+
#-------------------------------------------------
178+
#
179+
# Examples
180+
#
181+
#-------------------------------------------------
182+
if (BOOST_OPENMETHOD_BUILD_EXAMPLES)
183+
enable_testing()
184+
add_subdirectory(doc/modules/ROOT/examples)
185+
endif ()

ce/2-method-vptr-final.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <iostream>
22
#include <vector>
33
#include <boost/openmethod.hpp>
4-
#include <boost/openmethod/compiler.hpp>
4+
#include <boost/openmethod/initialize.hpp>
55

66
struct Animal {
77
const char* name;

ce/2-method-vptr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <iostream>
22
#include <vector>
33
#include <boost/openmethod.hpp>
4-
#include <boost/openmethod/compiler.hpp>
4+
#include <boost/openmethod/initialize.hpp>
55

66
struct Animal {
77
const char* name;

ce/2-method.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <iostream>
22
#include <vector>
33
#include <boost/openmethod.hpp>
4-
#include <boost/openmethod/compiler.hpp>
4+
#include <boost/openmethod/initialize.hpp>
55

66
struct Animal {
77
const char* name;

ce/uni-method-vptr-final.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <vector>
33

44
#include <boost/openmethod.hpp>
5-
#include <boost/openmethod/compiler.hpp>
5+
#include <boost/openmethod/initialize.hpp>
66

77
struct Animal {
88
const char* name;

ce/uni-method-vptr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <iostream>
22
#include <vector>
33
#include <boost/openmethod.hpp>
4-
#include <boost/openmethod/compiler.hpp>
4+
#include <boost/openmethod/initialize.hpp>
55

66
struct Animal {
77
const char* name;

ce/uni-method.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <iostream>
22
#include <vector>
33
#include <boost/openmethod.hpp>
4-
#include <boost/openmethod/compiler.hpp>
4+
#include <boost/openmethod/initialize.hpp>
55

66
struct Animal {
77
const char* name;

dev/local-flat.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ python3 dev/flatten.py \
44
include/boost/openmethod.hpp \
55
include/boost/openmethod/unique_ptr.hpp \
66
include/boost/openmethod/shared_ptr.hpp \
7-
include/boost/openmethod/compiler.hpp
7+
include/boost/openmethod/initialize.hpp
88
python3 dev/flatten.py \
99
flat/boost/openmethod/registry.hpp \
1010
include/boost/openmethod/registry.hpp \

0 commit comments

Comments
 (0)