Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
455 changes: 455 additions & 0 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

113 changes: 0 additions & 113 deletions .github/workflows/main.yml

This file was deleted.

77 changes: 46 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,68 @@
# Copyright (c) 2018-2025 Jean-Louis Leroy
# Generated by `boostdep --cmake openmethod`
# Copyright 2020, 2021 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)
# https://www.boost.org/LICENSE_1_0.txt

cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.5...3.20)

if(POLICY CMP0167)
cmake_policy(SET CMP0074 NEW)
project(boost_openmethod VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)

set(BOOST_OPENMETHOD_IS_ROOT OFF)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(BOOST_OPENMETHOD_IS_ROOT ON)
endif()

if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
if(BOOST_OPENMETHOD_IS_ROOT)
include(CTest)
endif()
if(NOT BOOST_SUPERPROJECT_VERSION)
option(BOOST_OPENMETHOD_INSTALL "Install boost::openmethod files" ON)
option(BOOST_OPENMETHOD_BUILD_TESTS "Build boost::openmethod tests" ${BUILD_TESTING})
option(BOOST_OPENMETHOD_BUILD_EXAMPLES "Build boost::openmethod examples" ${BOOST_OPENMETHOD_IS_ROOT})
else()
set(BOOST_OPENMETHOD_BUILD_TESTS ${BUILD_TESTING})
endif()

project(boost_openmethod VERSION 1.87.0 LANGUAGES CXX)
if(BOOST_OPENMETHOD_IS_ROOT)
#
# Building inside Boost tree, but as a separate project e.g. on Travis or
# other CI, or when producing Visual Studio Solution and Projects.

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(BOOST_INCLUDE_LIBRARIES openmethod)
set(BOOST_EXCLUDE_LIBRARIES openmethod)
list(APPEND BOOST_INCLUDE_LIBRARIES test)
if(BOOST_OPENMETHOD_BUILD_EXAMPLES)
# list(APPEND BOOST_INCLUDE_LIBRARIES optional)
endif()

set(CMAKE_FOLDER _deps)
add_subdirectory(../.. _deps/boost EXCLUDE_FROM_ALL)
unset(CMAKE_FOLDER)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_library(boost_openmethod INTERFACE)
add_library(Boost::openmethod ALIAS boost_openmethod)

target_include_directories(boost_openmethod INTERFACE include)

find_package(Boost COMPONENTS)
target_link_libraries(boost_openmethod INTERFACE Boost::boost)
target_compile_features(boost_openmethod INTERFACE cxx_std_17)

if(MSVC)
add_compile_options(/EHsc /FAs /bigobj)
endif()
target_include_directories(boost_openmethod INTERFACE include)

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(STATUS "Enabling sanitizers")
add_compile_options(
-fPIC -Wno-deprecated-declarations -Wall -Wextra -Werror
-fsanitize=undefined -fsanitize=address -fsanitize=leak)
add_link_options(-fsanitize=undefined -fsanitize=address -fsanitize=leak)
endif()
target_link_libraries(
boost_openmethod
INTERFACE
Boost::assert
Boost::config
Boost::core
Boost::dynamic_bitset
Boost::mp11
Boost::preprocessor
)

if(BUILD_TESTING)
message(STATUS "Building tests")
include(CTest)
if(BOOST_OPENMETHOD_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()

if(BUILD_EXAMPLES)
message(STATUS "Building examples")
if(BOOST_OPENMETHOD_BUILD_EXAMPLES)
add_subdirectory(example)
endif()
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Branch | GH Actions | Azure Pipelines | Coverity Scan | codecov.io | De
[`master`](https://github.com/jll63/openmethod/tree/master) | [![CI](https://github.com/jll63/openmethod/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jll63/openmethod/actions/workflows/ci.yml) | [![Build Status](https://dev.azure.com/maintainer/template/_apis/build/status/pipeline?branchName=master)](https://dev.azure.com/maintainer/template/_build/latest?definitionId=6&branchName=master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/BADLE-NUMBER-LIKE-13982/badge.svg)](https://scan.coverity.com/projects/boostorg-template) | [![codecov](https://codecov.io/gh/jll63/openmethod/branch/master/graph/badge.svg)](https://codecov.io/gh/jll63/openmethod/branch/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/template.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/template/doc/html/template.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/template.html)
[`develop`](https://github.com/jll63/openmethod/tree/develop) | [![CI](https://github.com/jll63/openmethod/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/jll63/openmethod/actions/workflows/ci.yml) | [![Build Status](https://dev.azure.com/maintainer/template/_apis/build/status/pipeline?branchName=develop)](https://dev.azure.com/maintainer/template/_build/latest?definitionId=6&branchName=develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/BADGE-NUMBER-LIKE-13982/badge.svg)](https://scan.coverity.com/projects/boostorg-template) | [![codecov](https://codecov.io/gh/jll63/openmethod/branch/develop/graph/badge.svg)](https://codecov.io/gh/jll63/openmethod/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/template.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/template/doc/html/template.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/template.html)


### Directories

| Name | Purpose |
Expand Down
15 changes: 15 additions & 0 deletions meta/libraries.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"key": "openmethod",
"name": "OpenMethod",
"authors": [
"Jean-Louis Leroy"
],
"maintainers": [
"Jean-Louis Leroy"
],
"description": "Open methods for C++17 and above.",
"category": [
"Programming"
],
"cxxstd": "17"
}
9 changes: 8 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
# See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)

if(NOT TARGET tests)
add_custom_target(tests ${EXCLUDE_TESTS_FROM_ALL})
set_property(TARGET tests PROPERTY FOLDER _deps)
endif()

file(GLOB test_cpp_files "test_*.cpp")

foreach(test_cpp ${test_cpp_files})
cmake_path(REMOVE_EXTENSION test_cpp LAST_ONLY OUTPUT_VARIABLE test)
string(REGEX REPLACE ".*/" "" test ${test})
add_executable(${test} ${test_cpp})
target_link_libraries(${test} Boost::openmethod)
target_link_libraries(${test} Boost::openmethod Boost::unit_test_framework)
add_test(NAME ${test} COMMAND ${test})
add_dependencies(tests ${test})
endforeach()
15 changes: 12 additions & 3 deletions test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,21 @@ project
# <toolset>clang:<warnings-as-errors>on
;

# list
alias unit_test_framework
: # sources
/boost/test//boost_unit_test_framework
;

for local src in [ glob test_*.cpp ]
{
run $(src) ;
run $(src) unit_test_framework ;
}

for local src in [ glob compile_fail_*.cpp ]
{
compile-fail $(src) ;
}

# quick (for CI)
alias quick : test_blackbox ;
alias quick : test_dispatch ;
explicit quick ;
17 changes: 17 additions & 0 deletions test/cmake_install_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2018, 2019, 2021 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

cmake_minimum_required(VERSION 3.5...3.20)

project(cmake_install_test LANGUAGES CXX)

find_package(boost_openmethod REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main Boost::openmethod)

enable_testing()
add_test(main main)

add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
Loading
Loading