Compare commits

...

17 Commits

Author SHA1 Message Date
6fba35ace5 Regenerate CMakeLists.txt 2024-09-18 18:18:26 +03:00
68d6dbea89 Add test/CMakeLists.txt 2024-09-18 18:14:18 +03:00
174e8855ca Disable _ccs tests on clang-cl 32 bit 2024-09-18 18:12:30 +03:00
1d88010ae0 Update test/Jamfile 2024-09-18 18:09:07 +03:00
b8acb9aae8 Remove GCC 4.7 from ci.yml 2024-09-18 18:04:16 +03:00
9a89d9184d Update build.jam 2024-09-18 18:03:39 +03:00
e7b9acf2f3 Merge branch 'modular' of https://github.com/grafikrobot/boostorg.function_types into feature/modular-b2 2024-09-18 17:56:58 +03:00
cdef91bff7 Disable _ccs tests when _M_IX86 isn't defined (MSVC 32 bit) 2024-09-18 17:53:14 +03:00
6403460e99 Update example/fast_mem_fn_example.cpp 2024-09-18 17:39:56 +03:00
71cc514bc9 Add .github/workflows/ci.yml 2024-09-18 17:16:38 +03:00
57b36d9810 Update build deps. 2024-08-03 12:08:46 -05:00
60bfa72618 Move inter-lib dependencies to a project variable and into the build targets. 2024-07-23 22:34:23 -05:00
2d31274929 Update copyright dates. 2024-07-20 22:52:04 -05:00
a96648bffd Bump B2 require to 5.2 2024-06-14 11:33:55 -05:00
51a1f7df12 Add requires-b2 check to top-level build file. 2024-05-05 09:00:01 -05:00
d0d3b742c7 Switch to library requirements instead of source. As source puts extra source in install targets. 2024-03-29 21:15:58 -05:00
937c7bb75c Make the library modular usable. 2024-03-11 08:38:17 -05:00
15 changed files with 928 additions and 91 deletions

640
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,640 @@
name: CI
on:
pull_request:
push:
branches:
- master
- develop
- feature/**
env:
UBSAN_OPTIONS: print_stacktrace=1
jobs:
posix:
strategy:
fail-fast: false
matrix:
include:
- toolset: gcc-4.8
cxxstd: "11"
container: ubuntu:16.04
os: ubuntu-latest
install: g++-4.8-multilib
address-model: 32,64
- toolset: gcc-4.9
cxxstd: "11"
container: ubuntu:16.04
os: ubuntu-latest
install: g++-4.9-multilib
address-model: 32,64
- toolset: gcc-5
cxxstd: "11,14,1z"
container: ubuntu:18.04
os: ubuntu-latest
install: g++-5-multilib
address-model: 32,64
- toolset: gcc-6
cxxstd: "11,14,1z"
container: ubuntu:18.04
os: ubuntu-latest
install: g++-6-multilib
address-model: 32,64
- toolset: gcc-7
cxxstd: "11,14,17"
os: ubuntu-20.04
install: g++-7-multilib
address-model: 32,64
- toolset: gcc-8
cxxstd: "11,14,17,2a"
os: ubuntu-20.04
install: g++-8-multilib
address-model: 32,64
- toolset: gcc-9
cxxstd: "11,14,17,2a"
os: ubuntu-20.04
install: g++-9-multilib
address-model: 32,64
- toolset: gcc-10
cxxstd: "11,14,17,2a"
os: ubuntu-20.04
install: g++-10-multilib
address-model: 32,64
- toolset: gcc-11
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install: g++-11-multilib
address-model: 32,64
- toolset: gcc-12
cxxstd: "11,14,17,20,2b"
os: ubuntu-22.04
install: g++-12-multilib
address-model: 32,64
- toolset: gcc-13
cxxstd: "11,14,17,20,2b"
container: ubuntu:23.04
os: ubuntu-latest
install: g++-13-multilib
address-model: 32,64
- toolset: gcc-14
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: g++-14-multilib
address-model: 32,64
- toolset: clang
compiler: clang++-3.9
cxxstd: "11,14"
container: ubuntu:18.04
os: ubuntu-latest
install: clang-3.9
- toolset: clang
compiler: clang++-4.0
cxxstd: "11,14"
container: ubuntu:18.04
os: ubuntu-latest
install: clang-4.0
- toolset: clang
compiler: clang++-5.0
cxxstd: "11,14,1z"
container: ubuntu:18.04
os: ubuntu-latest
install: clang-5.0
- toolset: clang
compiler: clang++-6.0
cxxstd: "11,14,17"
os: ubuntu-20.04
install: clang-6.0
- toolset: clang
compiler: clang++-7
cxxstd: "11,14,17"
os: ubuntu-20.04
install: clang-7
- toolset: clang
compiler: clang++-8
cxxstd: "11,14,17"
os: ubuntu-20.04
install: clang-8
- toolset: clang
compiler: clang++-9
cxxstd: "11,14,17"
os: ubuntu-20.04
install: clang-9
- toolset: clang
compiler: clang++-10
cxxstd: "11,14,17,2a"
os: ubuntu-20.04
- toolset: clang
compiler: clang++-11
cxxstd: "11,14,17,2a"
os: ubuntu-20.04
- toolset: clang
compiler: clang++-12
cxxstd: "11,14,17,20"
os: ubuntu-20.04
- toolset: clang
compiler: clang++-13
cxxstd: "11,14,17,20"
container: ubuntu:22.04
os: ubuntu-latest
install: clang-13
- toolset: clang
compiler: clang++-14
cxxstd: "11,14,17,20,2b"
container: ubuntu:22.04
os: ubuntu-latest
install: clang-14
- toolset: clang
compiler: clang++-15
cxxstd: "11,14,17,20,2b"
container: ubuntu:22.04
os: ubuntu-latest
install: clang-15
- toolset: clang
compiler: clang++-16
cxxstd: "11,14,17,20,2b"
container: ubuntu:23.04
os: ubuntu-latest
install: clang-16
- toolset: clang
compiler: clang++-17
cxxstd: "11,14,17,20,2b"
container: ubuntu:23.10
os: ubuntu-latest
install: clang-17
- toolset: clang
compiler: clang++-18
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: clang-18
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-12
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-13
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-14
runs-on: ${{matrix.os}}
container: ${{matrix.container}}
defaults:
run:
shell: bash
steps:
- name: Enable Node 16
run: |
echo "ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Setup container environment
if: matrix.container
run: |
apt-get update
apt-get -y install sudo python3 git g++
- name: Install packages
if: matrix.install
run: |
sudo apt-get update
sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python3 tools/boostdep/depinst/depinst.py -I example $LIBRARY
./bootstrap.sh
./b2 -d0 headers
- name: Create user-config.jam
if: matrix.compiler
run: |
echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam
- name: Run tests
run: |
cd ../boost-root
export ADDRMD=${{matrix.address-model}}
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} ${ADDRMD:+address-model=$ADDRMD} variant=debug,release
windows:
strategy:
fail-fast: false
matrix:
include:
- toolset: msvc-14.0
cxxstd: 14,latest
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.2
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.3
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2022
- toolset: clang-win
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2022
- toolset: gcc
cxxstd: "11,14,17,2a"
addrmd: 64
os: windows-2019
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" -I example %LIBRARY%
cmd /c bootstrap
b2 -d0 headers
- name: Run tests
shell: cmd
run: |
cd ../boost-root
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release embed-manifest-via=linker
posix-cmake-subdir:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: macos-12
- os: macos-13
- os: macos-14
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Use library with add_subdirectory
run: |
cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
mkdir __build__ && cd __build__
cmake ..
cmake --build .
ctest --output-on-failure --no-tests=error
posix-cmake-install:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: macos-12
- os: macos-13
- os: macos-14
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Configure
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
- name: Install
run: |
cd ../boost-root/__build__
cmake --build . --target install
- name: Use the installed library
run: |
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
cmake --build .
ctest --output-on-failure --no-tests=error
posix-cmake-test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: macos-12
- os: macos-13
- os: macos-14
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Configure
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON ..
- name: Build tests
run: |
cd ../boost-root/__build__
cmake --build . --target tests
- name: Run tests
run: |
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error
windows-cmake-subdir:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
- name: Use library with add_subdirectory (Debug)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test
mkdir __build__ && cd __build__
cmake ..
cmake --build . --config Debug
ctest --output-on-failure --no-tests=error -C Debug
- name: Use library with add_subdirectory (Release)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
cmake --build . --config Release
ctest --output-on-failure --no-tests=error -C Release
windows-cmake-install:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
- name: Configure
shell: cmd
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
- name: Install (Debug)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target install --config Debug
- name: Install (Release)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target install --config Release
- name: Use the installed library (Debug)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
cmake --build . --config Debug
ctest --output-on-failure --no-tests=error -C Debug
- name: Use the installed library (Release)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
cmake --build . --config Release
ctest --output-on-failure --no-tests=error -C Release
windows-cmake-test:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
- name: Configure
shell: cmd
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DBUILD_TESTING=ON ..
- name: Build tests (Debug)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target tests --config Debug
- name: Run tests (Debug)
shell: cmd
run: |
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error -C Debug
- name: Build tests (Release)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target tests --config Release
- name: Run tests (Release)
shell: cmd
run: |
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error -C Release

View File

@ -1,21 +1,29 @@
# Copyright 2019 Mike Dev
# Generated by `boostdep --cmake function_types`
# Copyright 2020, 2021 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required( VERSION 3.5...3.20 )
project( boost_function_types VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX )
cmake_minimum_required(VERSION 3.5...3.20)
add_library( boost_function_types INTERFACE )
add_library( Boost::function_types ALIAS boost_function_types )
project(boost_function_types VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
target_include_directories( boost_function_types INTERFACE include )
add_library(boost_function_types INTERFACE)
add_library(Boost::function_types ALIAS boost_function_types)
target_link_libraries( boost_function_types
INTERFACE
Boost::config
Boost::core
Boost::detail
Boost::mpl
Boost::preprocessor
Boost::type_traits
target_include_directories(boost_function_types INTERFACE include)
target_link_libraries(boost_function_types
INTERFACE
Boost::config
Boost::core
Boost::detail
Boost::mpl
Boost::preprocessor
Boost::type_traits
)
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()

25
build.jam Normal file
View File

@ -0,0 +1,25 @@
# Copyright 2023-2024 René Ferdinand Rivera Morell
# Copyright 2024 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
require-b2 5.2 ;
constant boost_dependencies :
/boost/config//boost_config
/boost/core//boost_core
/boost/detail//boost_detail
/boost/mpl//boost_mpl
/boost/preprocessor//boost_preprocessor
/boost/type_traits//boost_type_traits
;
project /boost/function_types ;
explicit
[ alias boost_function_types : : : : <include>include <library>$(boost_dependencies) ]
[ alias all : boost_function_types example test ]
;
call-if : boost-library function_types
;

View File

@ -1,19 +1,27 @@
# (C) Copyright Tobias Schwinger
# (C) Copyright Tobias Schwinger
#
# Use, modification and distribution are subject to the Boost Software License,
# Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
#-------------------------------------------------------------------------------
exe interpreter_example : interpreter_example.cpp ;
project : requirements <library>/boost/function_types//boost_function_types ;
exe interpreter_example : interpreter_example.cpp
: <library>/boost/tokenizer//boost_tokenizer
<library>/boost/lexical_cast//boost_lexical_cast
;
exe result_of_example : result_of_example.cpp ;
exe interface_example : interface_example.cpp ;
exe fast_mem_fn_example : fast_mem_fn_example.cpp
: <include>. ; # needed for Boost.PP file iteration with some compilers
exe fast_mem_fn_example : fast_mem_fn_example.cpp
: <include>. # needed for Boost.PP file iteration with some compilers
<library>/boost/timer//boost_timer
<library>/boost/bind//boost_bind
;
exe macro_type_args_example : macro_type_args_example.cpp ;

View File

@ -13,7 +13,7 @@
#include <algorithm>
#include <functional>
#include <boost/timer.hpp>
#include <boost/timer/timer.hpp>
#include <boost/mem_fn.hpp>
#include "fast_mem_fn.hpp"
@ -91,28 +91,28 @@ template<typename F> void do_test(test_vector & v, F criterion)
int main()
{
test_vector v;
boost::timer t;
boost::timer::cpu_timer t;
double time1, time2;
std::cout <<
"Test case: sorting " << N << " objects.\n\n"
"Criterion accessor called with | elasped seconds\n"
"Criterion accessor called with | elapsed seconds\n"
"-------------------------------|----------------" << std::endl;
setup_test(v);
t.restart();
t.start();
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1400)
do_test(v, BOOST_EXAMPLE_FAST_MEM_FN(& test::id));
#else // MSVC<8 does not like the implementation of the deduction macro:
do_test(v, ::example::fast_mem_fn< int (test::*)() const, & test::id >());
#endif
time1 = t.elapsed();
time1 = t.elapsed().wall * 1e-9;
std::cout << "fast_mem_fn | " << time1 << std::endl;
setup_test(v);
t.restart();
t.start();
do_test(v, boost::mem_fn(& test::id));
time2 = t.elapsed();
time2 = t.elapsed().wall * 1e-9;
std::cout << "mem_fn | " << time2 << std::endl;
std::cout << '\n' << (time2/time1-1)*100 << "% speedup" << std::endl;

11
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
# Copyright 2018, 2019 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
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST)
boost_test_jamfile(FILE Jamfile LINK_LIBRARIES Boost::function_types Boost::core)
endif()

View File

@ -1,5 +1,5 @@
# (C) Copyright Tobias Schwinger
# (C) Copyright Tobias Schwinger
#
# Use, modification and distribution are subject to the Boost Software License,
# Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
@ -8,82 +8,78 @@
import testing ;
{
test-suite function_types :
project : requirements <library>/boost/function_types//boost_function_types ;
# Classification
# Classification
[ compile classification/is_function.cpp ]
[ compile classification/is_function_pointer.cpp ]
[ compile classification/is_function_reference.cpp ]
[ compile classification/is_member_function_pointer.cpp ]
[ compile classification/is_member_object_pointer.cpp ]
[ compile classification/is_callable_builtin.cpp ]
[ compile classification/is_nonmember_callable_builtin.cpp ]
[ compile classification/is_member_pointer.cpp ]
compile classification/is_function.cpp ;
compile classification/is_function_pointer.cpp ;
compile classification/is_function_reference.cpp ;
compile classification/is_member_function_pointer.cpp ;
compile classification/is_member_object_pointer.cpp ;
compile classification/is_callable_builtin.cpp ;
compile classification/is_nonmember_callable_builtin.cpp ;
compile classification/is_member_pointer.cpp ;
[ compile classification/is_cv_mem_func_ptr.cpp ]
[ compile classification/is_variadic.cpp ]
[ compile classification/is_cv_pointer.cpp ]
# [ compile classification/is_cv_function.cpp ]
compile classification/is_cv_mem_func_ptr.cpp ;
compile classification/is_variadic.cpp ;
compile classification/is_cv_pointer.cpp ;
# compile classification/is_cv_function.cpp ;
# Decomposition
[ compile decomposition/components.cpp ]
[ compile decomposition/result_type.cpp ]
[ compile decomposition/function_arity.cpp ]
[ compile decomposition/parameter_types.cpp ]
# Decomposition
[ compile decomposition/components_seq.cpp ]
[ compile decomposition/class_type_transform.cpp ]
compile decomposition/components.cpp ;
compile decomposition/result_type.cpp ;
compile decomposition/function_arity.cpp ;
compile decomposition/parameter_types.cpp ;
[ compile-fail decomposition/result_type_fail.cpp ]
[ compile-fail decomposition/parameter_types_fail.cpp ]
[ compile-fail decomposition/function_arity_fail.cpp ]
compile decomposition/components_seq.cpp ;
compile decomposition/class_type_transform.cpp ;
# Synthesis
compile-fail decomposition/result_type_fail.cpp ;
compile-fail decomposition/parameter_types_fail.cpp ;
compile-fail decomposition/function_arity_fail.cpp ;
[ compile synthesis/function_type.cpp ]
[ compile synthesis/function_pointer.cpp ]
[ compile synthesis/function_reference.cpp ]
[ compile synthesis/member_function_pointer.cpp ]
[ compile synthesis/member_object_pointer.cpp ]
# Synthesis
[ compile synthesis/transformation.cpp ]
[ compile synthesis/mem_func_ptr_cv1.cpp ]
[ compile synthesis/mem_func_ptr_cv2.cpp ]
[ compile synthesis/mem_func_ptr_cv_ptr_to_this.cpp ]
[ compile synthesis/variadic_function_synthesis.cpp ]
# [ compile synthesis/cv_function_synthesis.cpp ]
compile synthesis/function_type.cpp ;
compile synthesis/function_pointer.cpp ;
compile synthesis/function_reference.cpp ;
compile synthesis/member_function_pointer.cpp ;
compile synthesis/member_object_pointer.cpp ;
# Reconfiguration
compile synthesis/transformation.cpp ;
compile synthesis/mem_func_ptr_cv1.cpp ;
compile synthesis/mem_func_ptr_cv2.cpp ;
compile synthesis/mem_func_ptr_cv_ptr_to_this.cpp ;
compile synthesis/variadic_function_synthesis.cpp ;
# compile synthesis/cv_function_synthesis.cpp ;
[ compile reconfiguration/preprocessing_mode.cpp ]
[ compile reconfiguration/partial_arity_preprocessing.cpp ]
[ compile reconfiguration/cc_preprocessing.cpp ]
# Reconfiguration
# Custom calling conventions
compile reconfiguration/preprocessing_mode.cpp ;
compile reconfiguration/partial_arity_preprocessing.cpp ;
compile reconfiguration/cc_preprocessing.cpp ;
[ compile custom_ccs/nonmember_ccs.cpp : <address-model>64:<build>no ]
[ compile custom_ccs/nonmember_ccs_exact.cpp : <address-model>64:<build>no ]
[ compile custom_ccs/member_ccs.cpp : <address-model>64:<build>no ]
[ compile custom_ccs/member_ccs_exact.cpp : <address-model>64:<build>no ]
# Custom calling conventions
# Property tag
[ compile custom_ccs/property_tag.cpp ]
# Code from the examples
compile custom_ccs/nonmember_ccs.cpp ;
compile custom_ccs/nonmember_ccs_exact.cpp ;
compile custom_ccs/member_ccs.cpp ;
compile custom_ccs/member_ccs_exact.cpp ;
[ compile ../example/interpreter_example.cpp ]
[ compile ../example/result_of_example.cpp ]
[ compile ../example/interface_example.cpp ]
[ compile ../example/fast_mem_fn_example.cpp
# needed for Boost.PP file iteration with some compilers
: <include>../example
]
[ compile ../example/macro_type_args_example.cpp ]
;
}
# Property tag
compile custom_ccs/property_tag.cpp ;
# Code from the examples
compile ../example/interpreter_example.cpp : <library>/boost/tokenizer//boost_tokenizer <library>/boost/lexical_cast//boost_lexical_cast ;
compile ../example/result_of_example.cpp ;
compile ../example/interface_example.cpp ;
compile ../example/fast_mem_fn_example.cpp : <library>/boost/timer//boost_timer <library>/boost/bind//boost_bind
# needed for Boost.PP file iteration with some compilers
<include>../example ;
compile ../example/macro_type_args_example.cpp ;

View File

@ -0,0 +1,17 @@
# Copyright 2018, 2019 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.16)
project(cmake_install_test LANGUAGES CXX)
find_package(boost_function_types REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main Boost::function_types)
enable_testing()
add_test(main main)
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@ -0,0 +1,14 @@
// Copyright 2017, 2021 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/function_types/function_arity.hpp>
#include <cassert>
#define BOOST_TEST(expr) assert(expr)
#define BOOST_TEST_EQ(x1, x2) assert((x1)==(x2))
int main()
{
BOOST_TEST_EQ( boost::function_types::function_arity<void(int, int)>::value, 2 );
}

View File

@ -0,0 +1,46 @@
# Copyright 2018, 2019 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_subdir_test LANGUAGES CXX)
add_subdirectory(../.. boostorg/function_types)
set(deps
# Primary dependencies
config
core
detail
mpl
preprocessor
type_traits
# Secondary dependencies
assert
static_assert
throw_exception
predef
utility
io
)
foreach(dep IN LISTS deps)
add_subdirectory(../../../${dep} boostorg/${dep})
endforeach()
# --target check
add_executable(main main.cpp)
target_link_libraries(main Boost::function_types)
enable_testing()
add_test(main main)
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@ -0,0 +1,14 @@
// Copyright 2017, 2021 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/function_types/function_arity.hpp>
#include <cassert>
#define BOOST_TEST(expr) assert(expr)
#define BOOST_TEST_EQ(x1, x2) assert((x1)==(x2))
int main()
{
BOOST_TEST_EQ( boost::function_types::function_arity<void(int, int)>::value, 2 );
}

View File

@ -6,6 +6,20 @@
//------------------------------------------------------------------------------
#if !defined(_M_IX86)
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("Test skipped because _M_IX86 is not defined")
#elif defined(__clang__)
// Clang-cl 32 bit supports __stdcall, but BOOST_FT_CC_STDCALL isn't defined so the test errors out
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("Test skipped because _M_IX86 is defined, but __clang__ is also defined")
#else
#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
#include <boost/mpl/assert.hpp>
@ -48,3 +62,4 @@ BOOST_MPL_ASSERT((
>
));
#endif

View File

@ -6,6 +6,20 @@
//------------------------------------------------------------------------------
#if !defined(_M_IX86)
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("Test skipped because _M_IX86 is not defined")
#elif defined(__clang__)
// Clang-cl 32 bit supports __stdcall, but BOOST_FT_CC_STDCALL isn't defined so the test errors out
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("Test skipped because _M_IX86 is defined, but __clang__ is also defined")
#else
#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
#include <boost/mpl/assert.hpp>
@ -69,3 +83,4 @@ BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::member_function_pointer<mpl::vector<int, C &>, cc>::type, dc >
));
#endif

View File

@ -6,6 +6,20 @@
//------------------------------------------------------------------------------
#if !defined(_M_IX86)
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("Test skipped because _M_IX86 is not defined")
#elif defined(__clang__)
// Clang-cl 32 bit supports __stdcall, but BOOST_FT_CC_STDCALL isn't defined so the test errors out
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("Test skipped because _M_IX86 is defined, but __clang__ is also defined")
#else
#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
#include <boost/mpl/assert.hpp>
@ -43,3 +57,4 @@ BOOST_MPL_ASSERT((
>
));
#endif

View File

@ -6,6 +6,20 @@
//------------------------------------------------------------------------------
#if !defined(_M_IX86)
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("Test skipped because _M_IX86 is not defined")
#elif defined(__clang__)
// Clang-cl 32 bit supports __stdcall, but BOOST_FT_CC_STDCALL isn't defined so the test errors out
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("Test skipped because _M_IX86 is defined, but __clang__ is also defined")
#else
#define BOOST_FT_AUTODETECT_CALLING_CONVENTIONS
#include <boost/mpl/assert.hpp>
@ -58,5 +72,4 @@ BOOST_MPL_ASSERT_NOT((
ft::is_callable_builtin< ft::function_pointer<mpl::vector<void> >::type, cc >
));
#endif