diff --git a/.drone.star b/.drone.star new file mode 100644 index 0000000000..a17aca5d60 --- /dev/null +++ b/.drone.star @@ -0,0 +1,28 @@ +# Use, modification, and distribution are +# subject to the Boost Software License, Version 1.0. (See accompanying +# file LICENSE.txt) +# +# Copyright Rene Rivera 2020. + +# For Drone CI we use the Starlark scripting language to reduce duplication. +# As the yaml syntax for Drone CI is rather limited. +# +# +globalenv={} +linuxglobalimage="cppalliance/droneubuntu1604:1" +windowsglobalimage="cppalliance/dronevs2019" + +def main(ctx): + return [ + linux_cxx("TOOLSET=gcc LINK=static,shared Job 0", "g++", packages="", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'LINK': 'static,shared', 'TRAVIS_COMPILER': 'g++', 'DRONE_JOB_UUID': 'b6589fc6ab'}, globalenv=globalenv), + linux_cxx("TOOLSET=gcc LINK=static,shared Job 1", "g++", packages="g++-5", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'LINK': 'static,shared', 'TRAVIS_COMPILER': 'g++-5', 'DRONE_JOB_UUID': '356a192b79'}, globalenv=globalenv), + linux_cxx("TOOLSET=gcc LINK=static,shared Job 2", "g++", packages="g++-6", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'LINK': 'static,shared', 'TRAVIS_COMPILER': 'g++-6', 'DRONE_JOB_UUID': 'da4b9237ba'}, globalenv=globalenv), + linux_cxx("TOOLSET=gcc LINK=static,shared Job 3", "g++", packages="g++-7", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'LINK': 'static,shared', 'TRAVIS_COMPILER': 'g++-7', 'DRONE_JOB_UUID': '77de68daec'}, globalenv=globalenv), + linux_cxx("TOOLSET=clang LINK=static,shared Job 4", "clang++", packages="", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'LINK': 'static,shared', 'TRAVIS_COMPILER': 'clang++', 'DRONE_JOB_UUID': '1b64538924'}, globalenv=globalenv), + linux_cxx("TOOLSET=clang LINK=static,shared Job 5", "clang++", packages="libc++-dev", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'LINK': 'static,shared', 'TRAVIS_COMPILER': 'clang++-libc++', 'DRONE_JOB_UUID': 'ac3478d69a'}, globalenv=globalenv), + osx_cxx("TOOLSET=clang LINK=static,shared Job 6", "clang++", packages="", buildtype="boost", buildscript="drone", environment={'TOOLSET': 'clang', 'LINK': 'static,shared', 'TRAVIS_COMPILER': 'clang++', 'DRONE_JOB_UUID': 'c1dfd96eea'}, globalenv=globalenv), + osx_cxx("TOOLSET=clang LINK=static,shared Job 7", "clang++", packages="", buildtype="boost", buildscript="drone", xcode_version="10", environment={'TOOLSET': 'clang', 'LINK': 'static,shared', 'TRAVIS_COMPILER': 'clang++', 'DRONE_JOB_UUID': '902ba3cda1'}, globalenv=globalenv), + ] + +# from https://github.com/boostorg/boost-ci +load("@boost_ci//ci/drone/:functions.star", "linux_cxx","windows_cxx","osx_cxx","freebsd_cxx") diff --git a/.drone/drone.sh b/.drone/drone.sh new file mode 100755 index 0000000000..026bd377c7 --- /dev/null +++ b/.drone/drone.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Copyright 2020 Rene Rivera, Sam Darwin +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt) + +set -e +export TRAVIS_BUILD_DIR=$(pwd) +export DRONE_BUILD_DIR=$(pwd) +export TRAVIS_BRANCH=$DRONE_BRANCH +export VCS_COMMIT_ID=$DRONE_COMMIT +export GIT_COMMIT=$DRONE_COMMIT +export REPO_NAME=$DRONE_REPO +export PATH=~/.local/bin:/usr/local/bin:$PATH + +if [ "$DRONE_JOB_BUILDTYPE" == "boost" ]; then + +echo '==================================> INSTALL' + +BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true +cd .. +git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root +cd boost-root +git submodule update --init tools/build +git submodule update --init libs/config +git submodule update --init tools/boostdep +cp -r $TRAVIS_BUILD_DIR/* libs/serialization +python tools/boostdep/depinst/depinst.py serialization +./bootstrap.sh +./b2 headers + +echo '==================================> SCRIPT' + +echo "using $TOOLSET : : $TRAVIS_COMPILER ;" > ~/user-config.jam +./b2 -j 3 libs/serialization/test toolset=$TOOLSET link=${LINK:-shared} + +fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..6de1351c8b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,651 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + - develop + - feature/** + merge_group: + +env: + UBSAN_OPTIONS: print_stacktrace=1 + +jobs: + posix: + strategy: + fail-fast: false + matrix: + include: + - toolset: gcc-7 + cxxstd: "11,14,17" + container: ubuntu:20.04 + os: ubuntu-latest + install: g++-7-multilib + address-model: 32,64 + - toolset: gcc-8 + cxxstd: "11,14,17,2a" + container: ubuntu:20.04 + os: ubuntu-latest + install: g++-8-multilib + address-model: 32,64 + - toolset: gcc-9 + cxxstd: "11,14,17,2a" + container: ubuntu:20.04 + os: ubuntu-latest + install: g++-9-multilib + address-model: 32,64 + - toolset: gcc-10 + cxxstd: "11,14,17,2a" + container: ubuntu:22.04 + os: ubuntu-latest + install: g++-10-multilib + address-model: 32,64 + - toolset: gcc-11 + cxxstd: "11,14,17,20" + container: ubuntu:22.04 + os: ubuntu-latest + install: g++-11-multilib + address-model: 32,64 + - toolset: gcc-12 + cxxstd: "11,14,17,20,2b" + container: ubuntu:22.04 + os: ubuntu-latest + install: g++-12-multilib + address-model: 32,64 + - toolset: gcc-13 + cxxstd: "11,14,17,20,2b" + container: ubuntu:24.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: gcc-15 + cxxstd: "11,14,17,20,23,2c" + container: ubuntu:26.04 + os: ubuntu-latest + install: g++-15-multilib + address-model: 32,64 + - toolset: gcc-16 + cxxstd: "11,14,17,20,23,2c" + container: ubuntu:26.04 + os: ubuntu-latest + install: g++-16-multilib + address-model: 32,64 + - toolset: clang + compiler: clang++-6.0 + cxxstd: "11,14,17" + container: ubuntu:20.04 + os: ubuntu-latest + install: clang-6.0 + - toolset: clang + compiler: clang++-7 + cxxstd: "11,14,17" + container: ubuntu:20.04 + os: ubuntu-latest + install: clang-7 + - toolset: clang + compiler: clang++-8 + cxxstd: "11,14,17" + container: ubuntu:20.04 + os: ubuntu-latest + install: clang-8 + - toolset: clang + compiler: clang++-9 + cxxstd: "11,14,17,2a" + container: ubuntu:20.04 + os: ubuntu-latest + install: clang-9 + - toolset: clang + compiler: clang++-10 + cxxstd: "11,14,17,2a" + container: ubuntu:20.04 + os: ubuntu-latest + install: clang-10 + - toolset: clang + compiler: clang++-11 + cxxstd: "11,14,17,2a" + container: ubuntu:20.04 + os: ubuntu-latest + install: clang-11 + - toolset: clang + compiler: clang++-12 + cxxstd: "11,14,17,20" + container: ubuntu:20.04 + os: ubuntu-latest + install: clang-12 + - toolset: clang + compiler: clang++-13 + cxxstd: "11,14,17,20,2b" + 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:24.04 + os: ubuntu-latest + install: clang-16 + - toolset: clang + compiler: clang++-17 + cxxstd: "11,14,17,20,2b" + container: ubuntu:24.04 + 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 + compiler: clang++-19 + cxxstd: "11,14,17,20,2b" + container: ubuntu:24.04 + os: ubuntu-latest + install: clang-19 + - toolset: clang + compiler: clang++-20 + cxxstd: "11,14,17,20,23,2c" + container: ubuntu:24.04 + os: ubuntu-latest + install: clang-20 + - toolset: clang + compiler: clang++-21 + cxxstd: "11,14,17,20,23,2c" + container: ubuntu:26.04 + os: ubuntu-latest + install: clang-21 + - toolset: clang + compiler: clang++-22 + cxxstd: "11,14,17,20,23,2c" + container: ubuntu:26.04 + os: ubuntu-latest + install: clang-22 + - toolset: clang + cxxstd: "11,14,17,20,2b" + os: macos-14 + - toolset: clang + cxxstd: "11,14,17,20,23,2c" + os: macos-15 + - toolset: clang + cxxstd: "11,14,17,20,23,2c" + os: macos-26 + + runs-on: ${{matrix.os}} + container: ${{matrix.container}} + + defaults: + run: + shell: bash + + steps: + - name: Setup container environment + if: matrix.container + run: | + apt-get update + apt-get -y install sudo python3 git g++ curl + + - uses: actions/checkout@v6 + + - 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 + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python3 tools/boostdep/depinst/depinst.py -I benchmark --git_args "--jobs 3" $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 + + - name: Run examples + run: | + cd ../boost-root + export ADDRMD=${{matrix.address-model}} + # The demos use fixed temp filenames, so run them serially (-j1) + # to avoid concurrent runs clobbering each other's archive files. + ./b2 -j1 libs/$LIBRARY/example toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} ${ADDRMD:+address-model=$ADDRMD} variant=debug,release + + windows: + strategy: + fail-fast: false + matrix: + include: + - toolset: msvc-14.3 + cxxstd: "14,17,20,latest" + addrmd: 32,64 + os: windows-2022 + - toolset: msvc-14.5 + cxxstd: "14,17,20,latest" + addrmd: 32,64 + os: windows-2025-vs2026 + - toolset: clang-win + cxxstd: "14,17,20,latest" + addrmd: 32,64 + os: windows-2025 + - toolset: gcc + cxxstd: "11,14,17,2a" + addrmd: 64 + os: windows-2025 + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v6 + + - 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 -I benchmark --git_args "--jobs 3" %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 + + - name: Run examples + shell: cmd + run: | + cd ../boost-root + rem The demos use fixed temp filenames, so run them serially (-j1) + rem to avoid concurrent runs clobbering each other's archive files. + b2 -j1 libs/%LIBRARY%/example 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-latest + - os: macos-latest + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v6 + + - 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 + mkdir -p libs/$LIBRARY + 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-latest + - os: macos-latest + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v6 + + - 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 + mkdir -p libs/$LIBRARY + 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-latest + - os: macos-latest + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v6 + + - 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 + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py -I benchmark -I example --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-latest + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v6 + + - 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-latest + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v6 + + - 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-latest + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v6 + + - 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 -I benchmark -I example --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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt index 04928ccb8c..2560cf933c 100644 --- a/CMake/CMakeLists.txt +++ b/CMake/CMakeLists.txt @@ -1,6 +1,6 @@ # CMake build control file for Serialization Library tests -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.5) if (POLICY CMP0054) cmake_policy (SET CMP0054 NEW) @@ -10,134 +10,68 @@ if (POLICY CMP0063) cmake_policy (SET CMP0063 NEW) endif (POLICY CMP0063) -if(Boost_USE_STATIC_LIBS) - project("Serialization-Static") -else() - project("Serialization-Shared") -endif() +project("serialization") # # Compiler settings # -message(STATUS "compiler is ${CMAKE_CXX_COMPILER_ID}" ) +message(STATUS "C++ compiler is ${CMAKE_CXX_COMPILER_ID}" ) add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) +message(STATUS "C compiler is ${CMAKE_C_COMPILER_ID}" ) if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) - add_definitions( -ftemplate-depth=300 ) + add_definitions( -ftemplate-depth=255 ) # we use gcc to test for C++03 compatibility - add_definitions( -std=c++03 ) - message(STATUS "compiler is g++ c++03") set(COMPILER_SUPPORTS_CXX11 FALSE) elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" ) add_definitions( /wd4996 ) - message(STATUS "compiler is MSVC") set(COMPILER_SUPPORTS_CXX11 TRUE) elseif( CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=300") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS_DEBUG "-g -O0" ) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3" ) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -dead_strip") - set(COMPILER_SUPPORTS_CXX11 FALSE) + set(COMPILER_SUPPORTS_CXX11 TRUE) endif() +add_definitions( -std=c++11 ) +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + # # Locate Project Prerequisites # # Boost -# note: we're assuming that boost has been built with: -# ./b2 —-layout=versioned toolset=clang-darwin link=static,shared variant=debug,release stage - -########################### -# special notes for Xcode. - -# these three should result in CMake setting the variables -# Boost_SERIALIZATION_LIBRARY_DEBUG … to the correct values. - -# But my current version of CMake doesn't automatically set the library names -# to point to the the libraries to be used. The variables are created -# but they are not initialized. So be prepared to set these variables by hand. -# If you want to use the static libraries - point to the boost libraries ending -# in ".a". If you want to use the shared boost libraries - point to the libraries -# ending in ".dylib". - -# But wait - there's more. -# if both lib.a and lib.dylib both exist in the library directory, Xcode will -# automatically chose the *.dylib one - and there's nothing you can do to fix this. -# So my recommendation is -# a) to place the compiled libraries in two different directories -# - e.g. stage/lib-static/*.a and stage/lib-shared/*.dylib -# and set the CMake variable Boost_LIBRARY_DIR to point to one or the other -# b) create two different CMake build directories - build-static and build-shared -# and switch between projects as desired. I like to test both since -# there are things like dead code elimination and visibility which vary -# between the two environments. # -# caveat - as I write this, I've been unable to get the tests on the shared -# library to function. Problem is that one needs to either put the shared -# libraries in a special known place or set an environmental -# variable which points to the shared library directory. I prefer the latter -# but I've been unable to figure out how to get Xcode to do on a global basis -# and it's not practical to do this for 247 test targets one at a time. - -# c) The targets in the project will by default be built as universal 32/64 binaries -# I have yet to experiment with these yet so I just set the target to 64 bit. - -# end special note for Xcode -############################ - -# -# IDE settings +# Project settings # +option(BUILD_SHARED_LIBS "Build Shared Libraries" true) -set(Boost_DEBUG true) -set(Boost_ADDRESS_MODEL 64 CACHE INTEGER "32/64 bits") -set(Boost_USE_STATIC_LIBS TRUE CACHE BOOL "Use static libraries") -set(Boost_USE_MULTITHREADED ON) -set(Boost_DETAILED_FAILURE_MSG true) +find_package(Boost 1.82 REQUIRED COMPONENTS system filesystem) -get_filename_component(BOOST_ROOT "../../.." ABSOLUTE) -string(CONCAT boost_headers ${BOOST_ROOT} "/boost") -if(NOT IS_DIRECTORY ${boost_headers}) - message(FATAL_ERROR "BOOST_ROOT not found") +if(NOT Boost_FOUND) + message("Boost NOT Found!") else() - message(STATUS "BOOST_ROOT is ${BOOST_ROOT}") -endif() - -if(Boost_USE_STATIC_LIBS) - message(STATUS "Link to Boost static libraries") - set(BUILD_SHARED_LIBS NO) - string(CONCAT boost_stage ${BOOST_ROOT} "/stage/Debug/static") -else() - message(STATUS "Link to Boost shared libraries") - set(BUILD_SHARED_LIBS YES) - add_definitions( "-DBOOST_ALL_DYN_LINK=1") - add_definitions( "-DBOOST_ALL_NO_LIB=1") - add_definitions( "-DBOOST_LIB_DIAGNOSTICS=1") - set(CMAKE_CXX_VISIBILITY_PRESET hidden) - set(VISIBILITY_INLINES_HIDDEN YES) - string(CONCAT boost_stage ${BOOST_ROOT} "/stage/Debug/shared") + message(STATUS "Boost Found!") endif() +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(VISIBILITY_INLINES_HIDDEN YES) +# enable usage of CHECK_INCLUDE_FILE_CXX include(CheckIncludeFileCXX) -message(STATUS "Boost directories found at ${boost_headers}") -message(STATUS "Boost libraries found at ${boost_stage}") -set(CMAKE_LIBRARY_PATH ${boost_stage}) - # list of archive names for which tests should be generated -#set(archive_list text_archive text_warchive binary_archive xml_archive xml_warchive) -set(archive_list text_archive) +set(archive_list text_archive text_warchive binary_archive xml_archive xml_warchive) +# set(archive_list xml_warchive) # list of tests generated by each function call set(test_list) -include_directories(BEFORE ${BOOST_ROOT}) - ########################### # library builds @@ -156,49 +90,51 @@ add_library(serialization ../src/basic_xml_archive.cpp ../src/binary_iarchive.cpp ../src/binary_oarchive.cpp - ../src/extended_type_info_no_rtti.cpp - ../src/extended_type_info_typeid.cpp ../src/extended_type_info.cpp + ../src/extended_type_info_typeid.cpp + ../src/extended_type_info_no_rtti.cpp + ../src/stl_port.cpp + ../src/text_iarchive.cpp + ../src/text_oarchive.cpp ../src/polymorphic_iarchive.cpp ../src/polymorphic_oarchive.cpp ../src/polymorphic_text_iarchive.cpp ../src/polymorphic_text_oarchive.cpp - ../src/stl_port.cpp - ../src/text_iarchive.cpp - ../src/text_oarchive.cpp + ../src/polymorphic_binary_iarchive.cpp + ../src/polymorphic_binary_oarchive.cpp + ../src/polymorphic_xml_iarchive.cpp + ../src/polymorphic_xml_oarchive.cpp ../src/void_cast.cpp - ../src/xml_archive_exception.cpp + ../src/xml_grammar.cpp ../src/xml_iarchive.cpp ../src/xml_oarchive.cpp - ../src/xml_grammar.cpp + ../src/xml_archive_exception.cpp + ../src/codecvt_null.cpp ../src/utf8_codecvt_facet.cpp ../src/basic_xml_grammar.ipp # doesn't show up in "Source Files" in Xcode"' ) +target_include_directories(serialization PUBLIC ${Boost_INCLUDE_DIR}) add_library(wserialization - ../src/codecvt_null.cpp ../src/basic_text_wiprimitive.cpp ../src/basic_text_woprimitive.cpp ../src/text_wiarchive.cpp ../src/text_woarchive.cpp + ../src/polymorphic_text_wiarchive.cpp + ../src/polymorphic_text_woarchive.cpp ../src/xml_wiarchive.cpp ../src/xml_woarchive.cpp + ../src/polymorphic_xml_wiarchive.cpp + ../src/polymorphic_xml_woarchive.cpp ../src/xml_wgrammar.cpp ../src/basic_xml_grammar.ipp # doesn't show up in "Source Files" in Xcode"' ) - -set_property(TARGET wserialization PROPERTY LINK_LIBRARIES serialization) +target_include_directories(wserialization PUBLIC ${Boost_INCLUDE_DIR}) +target_link_libraries(wserialization PUBLIC serialization) # end library build ########################### -add_library(filesystem SHARED IMPORTED GLOBAL ) # or STATIC instead of SHARED -set_target_properties(filesystem PROPERTIES - IMPORTED_LOCATION "${CMAKE_LIBRARY_PATH}/libboost_filesystem-clang-darwin-mt-d-x64-1_69.dylib" -) -get_property(loc TARGET filesystem PROPERTY LOCATION) -message(STATUS "filesystem library located at:${loc}") - ########################### # test targets @@ -209,12 +145,13 @@ function( serialization_test test_name) endforeach() message(STATUS ${test_name}) add_executable( ${test_name} ../test/${test_name}.cpp ${arglist} ) - target_link_libraries(${test_name} serialization wserialization filesystem) + target_include_directories(${test_name} PUBLIC ${Boost_INCLUDE_DIR}) + target_link_libraries(${test_name} serialization wserialization Boost::filesystem) add_test( ${test_name} ${test_name} ) endfunction(serialization_test) function(archive_test test_name) - set(test_list) + set(test_listx) set(arglist) foreach(a IN ITEMS ${ARGN} ) set(arglist ${arglist} ../test/${a}.cpp) @@ -229,15 +166,16 @@ function(archive_test test_name) TARGET ${amended_test_name} PROPERTY COMPILE_DEFINITIONS BOOST_ARCHIVE_TEST=${archive-name}.hpp ) - message(STATUS ${amended_test_name} " " ${arglist} " " ${archive-name}) - target_link_libraries(${amended_test_name} serialization wserialization filesystem) + target_include_directories(${amended_test_name} PUBLIC ${Boost_INCLUDE_DIR}) + target_link_libraries(${amended_test_name} serialization wserialization Boost::filesystem) add_test(${amended_test_name} ${amended_test_name}) - set(test_list ${test_list} ${amended_test_name} PARENT_SCOPE) + set(test_listx ${test_listx} ${amended_test_name}) endforeach() + set(test_list ${test_listx} PARENT_SCOPE) endfunction(archive_test) function(polymorphic_archive_test test_name) - set(test_list) + set(test_listx) set(arglist) foreach(a IN ITEMS ${ARGN} ) set(arglist ${arglist} ../test/${a}.cpp) @@ -254,10 +192,12 @@ function(polymorphic_archive_test test_name) PROPERTY COMPILE_DEFINITIONS BOOST_ARCHIVE_TEST=${amended_archive_name}.hpp ) message(STATUS ${amended_test_name} " " ${arglist} " " ${amended_archive_name}) - target_link_libraries(${amended_test_name} serialization wserialization filesystem) + target_include_directories(${amended_test_name} PUBLIC ${Boost_INCLUDE_DIR}) + target_link_libraries(${amended_test_name} serialization wserialization Boost::filesystem) add_test(${amended_test_name} ${amended_test_name}) - set(test_list ${test_list} ${amended_test_name} PARENT_SCOPE) - endforeach() + set(test_listx ${test_listx} ${amended_test_name}) +endforeach() +set(test_list ${test_listx} PARENT_SCOPE) endfunction(polymorphic_archive_test) enable_testing() @@ -265,8 +205,6 @@ enable_testing() message(STATUS dll_a) add_library(dll_a SHARED ../test/dll_a.cpp) target_link_libraries(dll_a serialization) -serialization_test(test_dll_simple) -target_link_libraries(test_dll_simple dll_a serialization) message(STATUS dll_polymorphic_base) add_library(dll_polymorphic_base SHARED ../test/dll_polymorphic_base.cpp) @@ -281,6 +219,17 @@ target_link_libraries(dll_polymorphic_derived2 dll_polymorphic_base serializatio # in which the dll is stored. I don't know how to extract this from bjam # serialization(test_dll_plugin : : dll_polymorphic_derived2_lib) +if(BUILD_SHARED_LIBS) + # this test can only be made to work if we're linking with shared + # libraries. Basically the build systems like to have all shared + # or all static so if we're building with static C++ libraries + # then linking with a shared one - we need multiple C++ libraries + # and things get complex. So just run this test when we're + # building with shared libraries (dll in windows speak) + serialization_test(test_dll_simple) + target_link_libraries(test_dll_simple dll_a serialization) +endif() + serialization_test(test_private_ctor) serialization_test(test_reset_object_address A) serialization_test(test_void_cast) @@ -290,7 +239,7 @@ serialization_test(test_iterators_base64) serialization_test(test_inclusion) serialization_test(test_inclusion2) serialization_test(test_smart_cast) -serialization_test(test_codecvt_null ../src/codecvt_null) +serialization_test(test_codecvt_null) serialization_test(test_strong_typedef) serialization_test(test_singleton) serialization_test(test_singleton_inherited) @@ -301,6 +250,7 @@ archive_test(test_boost_array A) if(COMPILER_SUPPORTS_CXX11) archive_test(test_array A) endif() + archive_test(test_binary) archive_test(test_bitset) archive_test(test_class_info_save) @@ -314,14 +264,25 @@ archive_test(test_derived) archive_test(test_derived_class A) archive_test(test_diamond) archive_test(test_diamond_complex) -archive_test(test_forward_list A) -archive_test(test_forward_list_ptrs A) +CHECK_INCLUDE_FILE_CXX(forward_list FORWARD_LIST_FOUND) +if(FORWARD_LIST_FOUND) + message(STATUS "forward_list header found") + archive_test(test_forward_list A) + archive_test(test_forward_list_ptrs A) +else() + message(STATUS "forward_list header NOT found") +endif() + archive_test(test_helper_support) archive_test(test_interrupts) archive_test(test_list A) archive_test(test_list_ptrs A) + archive_test(test_map A) -archive_test(test_map_boost_unordered A) +CHECK_INCLUDE_FILE_CXX(hash_map HASH_MAP_FOUND) +if(HASH_MAP_FOUND) + archive_test(test_map_hashed A) +endif() archive_test(test_mi) archive_test(test_multiple_ptrs A) archive_test(test_multiple_inheritance) @@ -340,6 +301,13 @@ archive_test(test_private_base2) archive_test(test_queue A) archive_test(test_recursion A) archive_test(test_registered) + +archive_test(test_set A) +CHECK_INCLUDE_FILE_CXX(hash_set HASH_SET_FOUND) +if(HASH_SET_FOUND) + archive_test(test_set_hashed A) +endif() + archive_test(test_shared_ptr) archive_test(test_shared_ptr_multi_base) archive_test(test_shared_ptr_132) @@ -350,8 +318,6 @@ if(SLIST_FOUND) message(STATUS "slist header found") archive_test(test_slist A) archive_test(test_slist_ptr A) -else() - message(STATUS "slist header NOT found") endif() archive_test(test_stack A) archive_test(test_split) @@ -361,36 +327,19 @@ archive_test(test_unique_ptr) archive_test(test_valarray) archive_test(test_variant A) archive_test(test_vector A) -archive_test(test_set A) -archive_test(test_set_boost_unordered A) -if(COMPILER_SUPPORTS_CXX11) - archive_test(test_set_unordered A) -else() - CHECK_INCLUDE_FILE_CXX(hash_set HASH_SET_FOUND) - if(HASH_SET_FOUND) - archive_test(test_set_hashed A) - endif() -endif() -if(COMPILER_SUPPORTS_CXX11) - archive_test(test_map_unordered A) -else() - CHECK_INCLUDE_FILE_CXX(hash_map HASH_MAP_FOUND) - if(HASH_MAP_FOUND) - archive_test(test_map_hashed A) - endif() -endif() -polymorphic_archive_test(test_dll_exported polymorphic_derived1) -foreach(test_name IN ITEMS ${test_list} ) - target_link_libraries(${test_name} dll_polymorphic_derived2 dll_polymorphic_base) - message(STATUS " " target_link_libraries " " dll_polymorphic_derived2 " " dll_polymorphic_base) -endforeach() +if(BUILD_SHARED_LIBS) + polymorphic_archive_test(test_dll_exported polymorphic_derived1) + foreach(test_name IN ITEMS ${test_list} ) + target_link_libraries(${test_name} dll_polymorphic_derived2 dll_polymorphic_base serialization wserialization) + endforeach() +endif() polymorphic_archive_test(test_no_rtti polymorphic_base polymorphic_derived1 polymorphic_derived2) polymorphic_archive_test(test_exported polymorphic_base polymorphic_derived1 polymorphic_derived2) polymorphic_archive_test(test_polymorphic test_polymorphic_A A) polymorphic_archive_test(test_polymorphic2 test_polymorphic2imp) -polymorphic_archive_test(test_polymorphic_helper) +polymorphic_archive_test(test_p_helper) # end test targets #################### diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..e9caf121d2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,124 @@ +# Copyright 2020, 2021 Peter Dimov +# Distributed under the Boost Software License, Version 1.0. +# https://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.5...3.16) + +project(boost_serialization VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) + +add_library(boost_serialization + src/archive_exception.cpp + src/basic_archive.cpp + src/basic_iarchive.cpp + src/basic_iserializer.cpp + src/basic_oarchive.cpp + src/basic_oserializer.cpp + src/basic_pointer_iserializer.cpp + src/basic_pointer_oserializer.cpp + src/basic_serializer_map.cpp + src/basic_text_iprimitive.cpp + src/basic_text_oprimitive.cpp + src/basic_xml_archive.cpp + src/binary_iarchive.cpp + src/binary_oarchive.cpp + src/codecvt_null.cpp + src/extended_type_info.cpp + src/extended_type_info_no_rtti.cpp + src/extended_type_info_typeid.cpp + src/polymorphic_binary_iarchive.cpp + src/polymorphic_binary_oarchive.cpp + src/polymorphic_iarchive.cpp + src/polymorphic_oarchive.cpp + src/polymorphic_text_iarchive.cpp + src/polymorphic_text_oarchive.cpp + src/polymorphic_xml_iarchive.cpp + src/polymorphic_xml_oarchive.cpp + src/stl_port.cpp + src/text_iarchive.cpp + src/text_oarchive.cpp + src/utf8_codecvt_facet.cpp + src/void_cast.cpp + src/xml_archive_exception.cpp + src/xml_grammar.cpp + src/xml_iarchive.cpp + src/xml_oarchive.cpp +) + +add_library(boost_wserialization + src/basic_text_wiprimitive.cpp + src/basic_text_woprimitive.cpp + src/binary_wiarchive.cpp + src/binary_woarchive.cpp + src/polymorphic_text_wiarchive.cpp + src/polymorphic_text_woarchive.cpp + src/polymorphic_xml_wiarchive.cpp + src/polymorphic_xml_woarchive.cpp + src/text_wiarchive.cpp + src/text_woarchive.cpp + src/xml_wgrammar.cpp + src/xml_wiarchive.cpp + src/xml_woarchive.cpp +) + +add_library(Boost::serialization ALIAS boost_serialization) +add_library(Boost::wserialization ALIAS boost_wserialization) + +target_include_directories(boost_serialization PUBLIC include) +target_include_directories(boost_wserialization PUBLIC include) + +target_link_libraries(boost_serialization + PUBLIC + Boost::array + Boost::assert + Boost::config + Boost::core + Boost::detail + Boost::integer + Boost::io + Boost::iterator + Boost::move + Boost::mpl + Boost::optional + Boost::predef + Boost::preprocessor + Boost::smart_ptr + Boost::spirit + Boost::type_traits + Boost::unordered + Boost::utility + Boost::variant + PRIVATE + Boost::function +) + +target_link_libraries(boost_wserialization PUBLIC boost_serialization) + +target_compile_definitions(boost_serialization + PUBLIC BOOST_SERIALIZATION_NO_LIB + # Source files already define BOOST_SERIALIZATION_SOURCE + # PRIVATE BOOST_SERIALIZATION_SOURCE +) + +target_compile_definitions(boost_wserialization + PUBLIC BOOST_SERIALIZATION_NO_LIB + # Source files already define BOOST_SERIALIZATION_SOURCE + # PRIVATE BOOST_SERIALIZATION_SOURCE +) + +if(BUILD_SHARED_LIBS) + target_compile_definitions(boost_serialization PUBLIC BOOST_SERIALIZATION_DYN_LINK) + target_compile_definitions(boost_wserialization PUBLIC BOOST_SERIALIZATION_DYN_LINK) +else() + target_compile_definitions(boost_serialization PUBLIC BOOST_SERIALIZATION_STATIC_LINK) + target_compile_definitions(boost_wserialization PUBLIC BOOST_SERIALIZATION_STATIC_LINK) +endif() + +if(BOOST_SUPERPROJECT_VERSION AND NOT CMAKE_VERSION VERSION_LESS 3.13) + boost_install(TARGETS boost_serialization boost_wserialization VERSION ${BOOST_SUPERPROJECT_VERSION} HEADER_DIRECTORY include) +endif() + +if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") + + add_subdirectory(test) + +endif() diff --git a/LICENSE_1_0.txt b/LICENSE_1_0.txt new file mode 100644 index 0000000000..36b7cd93cd --- /dev/null +++ b/LICENSE_1_0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/appveyor.yml b/appveyor.yml index dd1c9e0156..51e19e5572 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -56,7 +56,6 @@ install: - git submodule init libs/range - git submodule init libs/smart_ptr - git submodule init libs/spirit - - git submodule init libs/static_assert - git submodule init libs/system - git submodule init libs/throw_exception - git submodule init libs/tuple diff --git a/build.jam b/build.jam new file mode 100644 index 0000000000..1103a56952 --- /dev/null +++ b/build.jam @@ -0,0 +1,45 @@ +# Copyright René Ferdinand Rivera Morell 2023-2024 +# 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) + +require-b2 5.2 ; + +constant boost_dependencies : + /boost/array//boost_array + /boost/assert//boost_assert + /boost/config//boost_config + /boost/core//boost_core + /boost/detail//boost_detail + /boost/integer//boost_integer + /boost/io//boost_io + /boost/iterator//boost_iterator + /boost/move//boost_move + /boost/mp11//boost_mp11 + /boost/mpl//boost_mpl + /boost/optional//boost_optional + /boost/predef//boost_predef + /boost/preprocessor//boost_preprocessor + /boost/smart_ptr//boost_smart_ptr + /boost/spirit//boost_spirit + /boost/throw_exception//boost_throw_exception + /boost/type_traits//boost_type_traits + /boost/utility//boost_utility + /boost/variant//boost_variant + /boost/variant2//boost_variant2 ; + +project /boost/serialization + : common-requirements + include + ; + +explicit + [ alias boost_serialization : build//boost_serialization ] + [ alias boost_wserialization : build//boost_wserialization ] + [ alias all : boost_serialization boost_wserialization example test ] + ; + +call-if : boost-library serialization + : install boost_serialization boost_wserialization + ; + diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 082847a5a6..50fcce7fb3 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -1,15 +1,27 @@ # Boost serialization Library Build Jamfile # (C) Copyright Robert Ramey 2002-2004. -# Use, modification, and distribution are subject to the -# Boost Software License, Version 1.0. (See accompanying file +# Use, modification, and distribution are subject to 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) # # See http://www.boost.org/libs/serialization for the library home page. -project boost/serialization +require-b2 5.0.1 ; +import-search /boost/config/checks ; +import config : requires ; + +constant boost_dependencies_private : + /boost/function//boost_function + ; + +project : source-location ../src + : common-requirements $(boost_dependencies) : requirements @include-spirit + $(boost_dependencies_private) + : usage-requirements + BOOST_SERIALIZATION_NO_LIB=1 ; SPIRIT_ROOT = [ modules.peek : SPIRIT_ROOT ] ; @@ -18,41 +30,42 @@ rule include-spirit ( properties * ) local old-compiler ; if borland in $(properties) { - if ! 6.1.0 in $(properties) - { - old-compiler = true ; - } + if ! 6.1.0 in $(properties) + { + old-compiler = true ; + } } else if msvc in $(properties) { if 6.5 in $(properties) || 7.0 in $(properties) - { + { old-compiler = true ; - } + } } - + local result ; if $(old-compiler) - { + { if $(SPIRIT_ROOT) { - # note - we can't use $(SPIRIT_ROOT) because + # note - we can't use $(SPIRIT_ROOT) because # it puts -I$(SPIRIT_ROOT) AFTER the "../../.." in the command line. - # so use these instead + # so use these instead result = -I$(SPIRIT_ROOT) ; } - else + else { echo **** spirit 1.6x required to build library with this compiler **** ; result = no ; } - } + } return $(result) ; } -SOURCES = +SOURCES = + archive_exception basic_archive basic_iarchive basic_iserializer @@ -81,16 +94,18 @@ SOURCES = polymorphic_xml_iarchive polymorphic_xml_oarchive void_cast - archive_exception xml_grammar xml_iarchive - xml_oarchive xml_archive_exception codecvt_null - utf8_codecvt_facet ; - -WSOURCES = + +SOURCES_HAS_STD_WSTREAMBUF = + xml_oarchive + utf8_codecvt_facet +; + +WSOURCES = basic_text_wiprimitive basic_text_woprimitive text_wiarchive @@ -102,36 +117,28 @@ WSOURCES = xml_woarchive polymorphic_xml_wiarchive polymorphic_xml_woarchive + codecvt_null ; -lib boost_serialization - : $(SOURCES).cpp - : +lib boost_serialization + : ## sources ## + $(SOURCES).cpp + : ## requirements ## + [ check-target-builds /boost/config/checks//std_wstreambuf : ../src/$(SOURCES_HAS_STD_WSTREAMBUF).cpp ] msvc:/Gy msvc:_SCL_SECURE_NO_WARNINGS - clang:"-fvisibility=hidden -fvisibility-inlines-hidden" - gcc:"-fvisibility=hidden -fvisibility-inlines-hidden" - darwin:"-fvisibility=hidden -fvisibility-inlines-hidden" - gcc:"-ftemplate-depth-255" - clang:"-ftemplate-depth-255" - darwin:"-ftemplate-depth-255" + msvc:_CRT_SECURE_NO_WARNINGS shared:BOOST_SERIALIZATION_DYN_LINK=1 ; -lib boost_wserialization - : $(WSOURCES).cpp boost_serialization - : - msvc:/Gy +lib boost_wserialization + : $(WSOURCES).cpp boost_serialization + : + [ requires std_wstreambuf ] + msvc:/Gy msvc:_SCL_SECURE_NO_WARNINGS - clang:"-fvisibility=hidden -fvisibility-inlines-hidden" - gcc:"-fvisibility=hidden -fvisibility-inlines-hidden" - darwin:"-fvisibility=hidden -fvisibility-inlines-hidden" - gcc:"-ftemplate-depth-255" - clang:"-ftemplate-depth-255" - darwin:"-ftemplate-depth-255" + msvc:_CRT_SECURE_NO_WARNINGS # note: both serialization and wserialization are conditioned on the this # switch - don't change it to BOOST_WSERIALIZATION_DYN_LINK shared:BOOST_SERIALIZATION_DYN_LINK=1 ; - -boost-install boost_serialization boost_wserialization ; diff --git a/doc/acknowledgments.html b/doc/acknowledgments.html index e482928247..82e1abba1a 100644 --- a/doc/acknowledgments.html +++ b/doc/acknowledgments.html @@ -2,8 +2,8 @@ @@ -20,7 +20,7 @@

C++ Boost

-

Serialization

+

Serialization

Acknowledgments

@@ -53,7 +53,7 @@

Acknowledgments

Beman Dawes who got the boost serialization ball rolling. It was one or both of these two that invented the much beloved & syntax used to implement both save and - load in one fuction specification. + load in one function specification.
  • Vladimir Prus for evaluating an early draft and contributing the diamond inheritance example.
  • William E. Kempf diff --git a/doc/archive_reference.html b/doc/archive_reference.html index bea3cb3f84..f888cbfb1a 100644 --- a/doc/archive_reference.html +++ b/doc/archive_reference.html @@ -2,8 +2,8 @@ @@ -19,7 +19,7 @@

    C++ Boost

    -

    Serialization

    +

    Serialization

    Archive Class Reference

    @@ -41,7 +41,7 @@

    Trivial Archive

    Our discussion will focus on archives used for saving as the hierarchy is exactly analogous for archives used for loading data. -

    Minimum Requirments

    +

    Minimum Requirements

    The simplest class which will model the Archive concept specifies the functions that a class will look like: @@ -58,10 +58,10 @@

    Minimum Requirments

    typedef boost::mpl::bool_<true> is_saving; typedef boost::mpl::bool_<false> is_loading; template<class T> void register_type(){} - template<class T> trivial_oarchive & operator<<(const T & t){ + template<class T> trivial_oarchive & operator<<(const T & t){ return *this; } - template<class T> trivial_oarchive & operator&(const T & t){ + template<class T> trivial_oarchive & operator&(const T & t){ return *this << t; } void save_binary(void *address, std::size_t count){}; @@ -74,7 +74,7 @@

    Minimum Requirments

    This archive will compile and execute with any types which implement the Serializable concept. For an example see - + demo_trivial_archive.cpp. Of course this program won't produce any output as it is. But it provides the starting point for a simple class which can be used to log formatted @@ -90,16 +90,16 @@

    More Useful Archive Classes

    Our archives have been factored into a tree of classes in order to minimize repetition of code. This is shown in the accompanying -class diagram. +class diagram. Any class which fulfills the following requirements will fit into this hierarchy and implement all the features we require. Deriving from -the base class +the base class common_oarchive.hpp provides all features we desire which are missing from trivial_oarchive above.

    
    -
    +
     #include <cstddef> // std::size_t
     #include <boost/archive/detail/common_oarchive.hpp>
     
    @@ -172,21 +172,16 @@ 

    Optional Overrides

    template<class T> -void save_override(T & t, int); +void save_override(T & t, int);

    -Default:Invokes archive::save(Archive & ar, t)
    +Default:Invokes archive::save(Archive & ar, t)
    This is the main entry into the serialization library.
    Purpose:This can be specialized in cases where the data is to be written to the archive in some special way. For example, XML archives implement special handling for name-value pairs by overriding this function template for name-value pairs. This replaces the default name-value pair handling, which is just to throw away the name, with one appropriate for XML which writes out the start of an XML tag with the correct object name. -

    -The second argument must be part of the function signature even though it is not used. -Its purpose is to be sure that code is portable to compilers which fail to correctly -implement partial function template ordering. For more information see -this.

    @@ -195,7 +190,7 @@

    Types used by the serialization library

    The serialization library injects bookkeeping data into the serialization archive. This data includes things like object ids, version numbers, class names etc. Each of these objects is included in a wrapper so that the archive class can override the -implementation of void save_override(T & t, int);. +implementation of void save_override(T & t, int);. For example, in the XML archive, the override for this type renders an object_id equal to 23 as "object_id=_23". The following table lists the types defined in the boost::archive namespace @@ -218,24 +213,19 @@

    Types used by the serialization library

    for these types.

    These are defined in -basic_archive.hpp. +basic_archive.hpp. All of these types have been assigned an -implementation level of +implementation level of primitive and are convertible to types such as int, unsigned int, etc. so that they have default implementations. This is illustrated by -basic_text_iarchive.hpp. +basic_text_iarchive.hpp. which relies upon the default. However, in some cases, overrides will have to be explicitly provided for these types. For an example see -basic_xml_iarchive.hpp. +basic_xml_iarchive.hpp.

    In real practice, we probably won't be quite done. One or more of the following issues may need to be addressed:

      -
    • Many compilers fail to implement correct partial ordering of - function templates. The archives included with this library work around - this using argument overloading. This technique is described in - - another section of this manual
    • Even if we are using a conforming compiler, we might want our new archive class to be portable to non-conforming compilers.
    • Our archive format might require extra information inserted into it. For @@ -248,7 +238,7 @@

      Types used by the serialization library

      as a template parameter rather than simple classes. Combined with the above, even more issues arise with non-conforming compilers.
    -The attached class diagram +The attached class diagram shows the relationships between classes used to implement the serialization library.

    A close examination of the archives included with the library illustrate @@ -260,7 +250,7 @@

    Usage

    • Instances of a derived class are serialized through a base class pointer.
    • Such instances are not "registered" neither implicitly nor explicitly. That - is, the macro BOOT_CLASS_EXPORT is used + is, the macro BOOST_CLASS_EXPORT is used to instantiate the serialization code for the included archives.
    @@ -281,7 +271,7 @@

    Testing

    Exhaustive testing of the library requires testing the different aspects of object serialization with each archive. There are 46 different tests that can run with any archive. There are 5 "standard archives" included with the system. -(3 in systems that don't support wide charactor i/o). +(3 in systems that don't support wide character i/o).

    In addition, there are 28 other tests which aren't related to any particular archive class.

    @@ -333,7 +323,7 @@

    Motivation

    All archives described so far are implemented as templates. Code to save and load data to archives is regenerated for each combination of archive class and data type. -Under these cirumstances, a good optimizing compiler that can expand +Under these circumstances, a good optimizing compiler that can expand inline functions to enough depth will generate fast code. However:
    - demo_exception.cpp + demo_exception.cpp is a program that illustrates this case.

    diff --git a/doc/exceptions.html b/doc/exceptions.html index cf3007be66..9c55ac0c5f 100644 --- a/doc/exceptions.html +++ b/doc/exceptions.html @@ -2,8 +2,8 @@ @@ -19,7 +19,7 @@

    C++ Boost

    -

    Serialization

    +

    Serialization

    Archive Exceptions

    @@ -45,9 +45,9 @@

    Archive Exceptions

    Archive operators can throw a boost::archive_exception object which can be caught by an application program. These exceptions are defined -in the files +in the files archive_exception.hpp -and +and basic_xml_archive.hpp.
    
     namespace boost {
    @@ -78,7 +78,7 @@ 

    Archive Exceptions

    unregistered_cast, // base - derived relationship not registered with // void_cast_register unsupported_class_version, // type saved with a version # greater than the - // one used by the program. This indicates that the proggram + // one used by the program. This indicates that the program // needs to be rebuilt. multiple_code_instantiation, // code for implementing serialization for some // type has been instantiated in more than one module. @@ -141,23 +141,23 @@

    pointer_conflic To understand what this exception means consider the following scenario
    
     template<class Archive>
    -void T::save(Archive &ar) const
    +void T::save(Archive &ar) const
     {
    -    const A * aptr = &a;
    -    ar << aptr;          // save an instance of object of class A through a pointer
    +    const A * aptr = &a;
    +    ar << aptr;          // save an instance of object of class A through a pointer
         ...
    -    ar << a;             // save an instance of an object of class A
    -    assert(aptr == &a);  // this must be true
    +    ar << a;             // save an instance of an object of class A
    +    assert(aptr == &a);  // this must be true
     }
     
     template<class Archive>
    -void T::load(Archive &ar)
    +void T::load(Archive &ar)
     {
         A * aptr;
    -    ar >> aptr;          // create and initialize a new instance of class A
    +    ar >> aptr;          // create and initialize a new instance of class A
         ...
    -    ar >> a;             // restore state of on object of class A
    -    assert(aptr == &a);  // this won't be true
    +    ar >> a;             // restore state of on object of class A
    +    assert(aptr == &a);  // this won't be true
     }
     
    An object is saved first through a pointer then directly. Upon loading back @@ -184,7 +184,7 @@


    output_stream_error

    -An error has occured during stream input or ouput. Aside from the common +An error has occurred during stream input or ouput. Aside from the common situations such as a corrupted or truncated input file, there are several less obvious ones that sometimes occur.

    diff --git a/doc/extended_type_info.html b/doc/extended_type_info.html index e60c527955..ee37878970 100644 --- a/doc/extended_type_info.html +++ b/doc/extended_type_info.html @@ -2,8 +2,8 @@ @@ -19,7 +19,7 @@

    C++ Boost

    -

    Serialization

    +

    Serialization

    extended_type_info

    @@ -49,7 +49,7 @@

    The problem with std::type_info

    std::typeid()
    is not available in all environments. Support for this function depends upon runtime typing(RTTI) support from the compiler. This may be non-existent - or not enabled for reasons such as a percieved inefficiency. + or not enabled for reasons such as a perceived inefficiency.
  • std::type_info includes a string containing type name. This would seem to satisfy 2) above. @@ -68,13 +68,13 @@

    The problem with std::type_info

    Features

    - + extended_type_info is an implementation of std::type_info functionality with the following features:
    • - Builds a set of + Builds a set of extended_type_info records - one for each type serialized.
    • @@ -95,7 +95,7 @@

      Features

      in order to construct types serialized through a base class pointer.

      Runtime Interface

      -
      
      +
      
       namespace boost { 
       namespace serialization {
       
      @@ -114,9 +114,9 @@ 

      Runtime Interface

      void key_unregister(); public: const char * get_key() const; - bool operator<(const extended_type_info &rhs) const; - bool operator==(const extended_type_info &rhs) const; - bool operator!=(const extended_type_info &rhs) const { + bool operator<(const extended_type_info &rhs) const; + bool operator==(const extended_type_info &rhs) const; + bool operator!=(const extended_type_info &rhs) const { return !(operator==(rhs)); } // for plugins @@ -130,10 +130,10 @@

      Runtime Interface

      Generally, there will be one and only one -extended_type_info +extended_type_info instance created for each type. However, this is enforced only at the executable module level. That is, if a program includes some shared libraries or DLLS, -there may be more than one instance of this class correponding to a particular type. +there may be more than one instance of this class corresponding to a particular type. For this reason the comparison functions below can't just compare the addresses of this instance but rather must be programmed to compare the actual information the instances contain. @@ -183,18 +183,18 @@

      Runtime Interface

      const char *get_key() const;
  • -Retrieves the key for extended_type_info +Retrieves the key for extended_type_info instance. If no key has been associated with the instance, then a NULL is returned.

    
    -bool operator<(const extended_type_info & rhs) const;
    -bool operator==(const extended_type_info & rhs) const;
    -bool operator!=(const extended_type_info & rhs) const;
    +bool operator<(const extended_type_info & rhs) const;
    +bool operator==(const extended_type_info & rhs) const;
    +bool operator!=(const extended_type_info & rhs) const;
     

    These functions are used to compare - + extended_type_info @@ -208,7 +208,7 @@

    Runtime Interface

    Construct a new instance of the type to which this - + extended_type_info @@ -240,7 +240,7 @@

    Runtime Interface

    Given a character string key or GUID, return the address of a -corresponding extended_type_info +corresponding extended_type_info object. @@ -249,7 +249,7 @@

    Requirements for an Implementation

    In order to be used by the serialization library, an implementation of extended_type_info, (referred to as ETI here), must be derived from - + extended_type_info @@ -261,7 +261,7 @@

    Requirements for an Implementation

     template<class ETI>
     const extended_type_info *
    -ETI::get_derived_extended_type_info(const T & t) const;
    +ETI::get_derived_extended_type_info(const T & t) const;
     

    Return a pointer to the @@ -275,7 +275,7 @@

    Requirements for an Implementation

    -virtual bool ETI::is_less_than(const extended_type_info &rhs) const;
    +virtual bool ETI::is_less_than(const extended_type_info &rhs) const;
     

    Compare this instance to another one using the same @@ -283,7 +283,7 @@

    Requirements for an Implementation

    -virtual bool ETI::is_equal(const extended_type_info &rhs) const;
    +virtual bool ETI::is_equal(const extended_type_info &rhs) const;
     

    Compare this instance to another one using the same @@ -320,17 +320,17 @@

    Requirements for an Implementation

    Models

    The serialization library includes two distinct -extended_type_info +extended_type_info implementations.

    -

    +

    extended_type_info_typeid

    is implemented in terms of the standard typeid(). It presumes that RTTI support is enabled by the compiler.

    -

    +

    extended_type_info_no_rtti

    is implemented in a way that doesn't rely on the existence RTTI. -Instead, it requires that all polymorphic types be explictly exported. +Instead, it requires that all polymorphic types be explicitly exported. In addition, if the export facility is to be used to serialize types through base class pointers, those types are required to implement a virtual function with the signature: @@ -344,8 +344,8 @@

    Models

    as described above.

    Example

    -The test program test_no_rtti -implements this function in terms of the +The test program test_no_rtti +implements this function in terms of the extended_type_info API above to return the export key associated with the class. This requires that non-abstract types be exported. It also demonstrates the inter-operability between two different implementations of @@ -354,16 +354,16 @@

    Example

    Requirements for Each Type

    Each type to be managed by the system must be "registered" individually. This is accomplished by instantiating -templates. For example, if the type T is to use the type_info system +templates. For example, if the type T is to use the type_info system one would include the following code:
     namespace boost {
     namespace serialization {
     template
    -struct extended_type_info_typeid>T>;
    +struct extended_type_info_typeid<T>;
     template
    -struct extended_type_info_typeid>const T>;
    +struct extended_type_info_typeid<const T>;
     } // serialization
     } // boost
     
    @@ -375,7 +375,7 @@

    Requirements for Each Type

     BOOST_CLASS_TYPE_INFO(
         my_type, 
    -    extended_type_info_typeid>my_class>
    +    extended_type_info_typeid<my_class>
     )
     
    @@ -399,7 +399,7 @@

    Requirements for Each Type

    }; ... extended_type_info *eti = extended_type_info::find("my_class") -base * b = eti->construct(...); +base * b = eti->construct(...);

    The construct takes an argument count and up to @@ -408,7 +408,7 @@

    Requirements for Each Type

    A complete example of this can be found -here +here

    © Copyright Robert Ramey 2005-2009. Distributed under the Boost Software License, Version 1.0. (See diff --git a/doc/faq.html b/doc/faq.html index 9e724c9d5a..24375dcc3a 100644 --- a/doc/faq.html +++ b/doc/faq.html @@ -2,8 +2,8 @@ @@ -22,7 +22,7 @@

    - Serialization

    + Serialization

    Tips and Tricks

    diff --git a/doc/headers.html b/doc/headers.html index 1028a7607a..5c248b4d27 100644 --- a/doc/headers.html +++ b/doc/headers.html @@ -2,8 +2,8 @@ @@ -19,7 +19,7 @@

    C++ Boost

    -

    Serialization

    +

    Serialization

    Code Structure

    @@ -58,7 +58,7 @@

    Code Structure

    Files Included by User Programs

    Using this library entails including headers listed in this section. -It should not be necessary to explictly include any other header files. +It should not be necessary to explicitly include any other header files.

    Archive Implementations

    @@ -67,57 +67,57 @@

    Archive Implementations

    -
    +
    boost/archive/archive_exception.hpp
    Exceptions which might be invoked by the library.
    -
    +
    boost/archive/binary_iarchive.hpp
    native binary input archive used for loading.
    -
    +
    boost/archive/binary_oarchive.hpp
    native binary output archive used for saving.
    -
    +
    boost/archive/text_iarchive.hpp
    text input archive used for loading.
    -
    +
    boost/archive/text_oarchive.hpp
    text output archive used for saving.
    -
    +
    boost/archive/text_wiarchive.hpp
    wide character text input archive used for loading.
    -
    +
    boost/archive/text_woarchive.hpp
    wide character text input archive used for saving.
    -
    +
    boost/archive/xml_iarchive.hpp
    xml input archive used for loading.
    -
    +
    boost/archive/xml_oarchive.hpp
    xml output archive used for saving.
    -
    +
    boost/archive/xml_wiarchive.hpp
    wide character xml input archive used for loading.
    -
    +
    boost/archive/xml_woarchive.hpp
    wide character xml output archive used for saving.
    @@ -133,35 +133,35 @@

    Serialization Declarations

    -
    +
    boost/serialization/base_object.hpp
    For serialization of base classes.
    -
    +
    boost/serialization/nvp.hpp
    To associate a name tag with a serializable object. This is necessary to properly render an xml archive which includes the object name.
    -
    +
    boost/serialization/split_free.hpp
    To divide implementation of non-intrusive serialization into separate save and load functions.
    -
    +
    boost/serialization/split_member.hpp
    To divide implementation of intrusive serialization into separate save and load functions.
    -
    +
    boost/serialization/export.hpp
    For serialization of pointers to derived classes via key export.
    -
    +
    boost/serialization/assume_abstract.hpp
    This is just a thin wrapper which permits one to explicitly specify that a @@ -177,22 +177,22 @@

    Serialization Declarations

    -
    +
    boost/serialization/version.hpp
    To override the default version index (0) assigned to a class.
    -
    +
    boost/serialization/level.hpp -
    To override the default implementaton level trait for a type.
    +
    To override the default implementation level trait for a type.
    -
    +
    boost/serialization/tracking.hpp
    To override the default tracking trait for a type.
    -
    +
    boost/serialization/type_info_implementation.hpp
    By default, the library uses RTTI, to identify types at runtime. In some cases, E.G. @@ -247,7 +247,7 @@

    Archive Development

    -
    +
    boost/archive/basic_archive.hpp
    @@ -261,10 +261,10 @@

    Archive Development

    text files, or with special code as they are in xml archives.
    -
    +
    boost/archive/basic_text_oprimitive.hpp -
    +
    boost/archive/basic_text_iprimitive.hpp
    @@ -275,10 +275,10 @@

    Archive Development

    of text archives such as user friendly text or windows ini files.
    -
    +
    boost/archive/basic_binary_oprimitive.hpp -
    +
    boost/archive/basic_binary_iprimitive.hpp
    @@ -287,10 +287,10 @@

    Archive Development

    or wide character binary streams.

    -
    +
    boost/archive/basic_binary_oarchive.hpp -
    +
    boost/archive/basic_binary_iarchive.hpp
    @@ -300,17 +300,17 @@

    Archive Development

    other types of binary archives in the future. It also preserves analogy and symmetry with the rest of the library which aids in understanding.
    -
    +
    boost/archive/basic_text_oarchive.hpp -
    +
    boost/archive/basic_text_iarchive.hpp
    -
    +
    boost/archive/basic_xml_oarchive.hpp -
    +
    boost/archive/basic_xml_iarchive.hpp
    @@ -320,12 +320,12 @@

    Archive Development

    behavior on a type by type basis. For example, basic_xml_oarchive.hpp includes code to guarantee that any object not attached to a name will trap during compile time. On the other hand, basic_text_oarchive.hpp -contains code to strip out and ingore any names attached to objects. +contains code to strip out and ignore any names attached to objects.

    -

    +
    boost/archive/detail/common_iarchive.hpp -
    +
    boost/archive/detail/common_oarchive.hpp
    @@ -338,21 +338,21 @@

    Archive Development

    Archive Internals

    -The interface (see
    Archive Concepts) +The interface (see Archive Concepts) and implementation are factored out into separate classes to minimize code duplication. These files are found in the directory -boost/archive/detail. -These are included as necessary by the archive class implemenations listed above. +boost/archive/detail. +These are included as necessary by the archive class implementations listed above. This has the unfortunate side effect of making the implementation less transparent. Users should never find it necessary to change these files.

    The following discussion is based on the -class diagram. +class diagram.

    -

    +
    boost/archive/detail/interface_iarchive.hpp -
    +
    boost/archive/detail/interface_iarchive.hpp
    Here are the declarations and definitions for the @@ -364,34 +364,34 @@

    Archive Internals

    the archive hierarchy.
    
    -template
    -void save_override(T & t, BOOST_PFTO int){
    +template<class T>
    +void save_override(T & t, BOOST_PFTO int){
         // All for otherwise unhandled types are forwarded to the base class.
         // This emulates behavior for function overloading.
    -    this->base::save_override(t, 0);
    +    this->base::save_override(t, 0);
     }
    -void save_override(const some_type & t, int){
    +void save_override(const some_type & t, int){
         // any special handling for some type
         // this will usually entail forwarding some other operation
         // in the most derived class.
    -    this->This()->...
    +    this->This()->...
         // or in one of its parents basic_text_oprimitive
    -    this->This()->save(static_cast<int>(t));
    +    this->This()->save(static_cast<int>(t));
     }
     ... // other special type handling
     
    Note the usage of -Partial Function Template Ordering +Partial Function Template Ordering to permit the correct save implementation to be selected.

    Archive Library Code Modules

    Parts of the library are implemented as library code. All of this code is to be found in -
    libs/serialization/src. +libs/serialization/src. in the form of *.cpp. The directory -boost/archive/impl +boost/archive/impl contains *.ipp files which implement templates. These templates are instantiated only by archive implementation so are generally not included in user code modules.

    @@ -408,7 +408,7 @@

    Archive Library Code Modules

    rather than each time a user's program is recompiled. This can save much development time.
  • Headers which solely related to implementation need only be included - in the library code modules. This prevents a user program from accidently + in the library code modules. This prevents a user program from accidentally depending on an implementation feature of the serialization library.
  • In building the library I came to the conclusions that there can arise situations regarding static code/data instantiation that could not be @@ -434,7 +434,7 @@

    Dataflow Iterators

    The code for these iterators is really independent of this library. But since it hasn't been and probably won't be reviewed outside of this context. I've left it in a directory local to the serialization library: -boost/archive/iterators. +boost/archive/iterators. These iterators are described in Dataflow Iterators.
    diff --git a/doc/history.html b/doc/history.html index 9fdcd37579..9227f36932 100644 --- a/doc/history.html +++ b/doc/history.html @@ -2,8 +2,8 @@ @@ -19,7 +19,7 @@

    C++ Boost

    -

    Serialization

    +

    Serialization

    History

    diff --git a/doc/implementation.html b/doc/implementation.html index 08e9974b03..fa979d4185 100644 --- a/doc/implementation.html +++ b/doc/implementation.html @@ -2,8 +2,8 @@ @@ -19,7 +19,7 @@

    C++ Boost

    -

    Serialization

    +

    Serialization

    Implementation Notes

    @@ -147,7 +147,7 @@

    Visual C++ 7.1

    compile command line, wchar_t will be considered an intrinsic type - otherwise it will be treated as a synonym for a 16 bit integer. The library can be used -either way - BUT - both the libray AND the application +either way - BUT - both the library AND the application must be compiled with the same switch settings. Note that BJAM includes this switch by default. So if want to use the libraries that BJAM builds, you should include this switch @@ -232,7 +232,7 @@

    Dinkumware Library

    archive should be opened with the no_codecvt flag. Note this problem will occur on all compilers shipped with this library.
  • Other issues have been worked around in the file. - dinkumware.hpp + dinkumware.hpp

    STLPort 4.5.3

    diff --git a/doc/index.html b/doc/index.html index 38dc3429ed..b64f94ad75 100644 --- a/doc/index.html +++ b/doc/index.html @@ -1,19 +1,354 @@ - - + + + Serialization + + + + - - - - <a href="overview.html"</a> - + + + + + + +
    +

    C++ Boost

    +
    +

    Serialization

    +

    Contents

    +
    +
    + + +

    +

    +
    Release Notes
    +
    Overview
    +
    +
    Tutorial
    +
    + +
    Reference
    +
    +
    Archive Concepts +
    +
    Serializable Concept +
    +
    Special Considerations +
    +
    Archive Class Reference +
    +
    +
    Implementation Notes +
    +
    Case Studies +
    +
    Other Classes +
    + +
    Tips and Tricks +
    Rationale
    +
    + +
    To Do
    +
    + +
    History + +
    Bibliography
    +
    Acknowledgments
    +
    +
    + diff --git a/doc/new_case_studies.html b/doc/new_case_studies.html index 53ac6a07f2..5348d8856e 100644 --- a/doc/new_case_studies.html +++ b/doc/new_case_studies.html @@ -2,8 +2,8 @@ @@ -19,7 +19,7 @@

    C++ Boost

    -

    Serialization

    +

    Serialization

    Proposed Case Studies

    @@ -32,7 +32,7 @@

    Proposed Case Studies

    These are not part of the library itself, but rather -techiques on how to use the library to address specific situations. +techniques on how to use the library to address specific situations.

    Serializing a Function Object

    An example on how to serialize a function object. I believe this diff --git a/doc/overview.html b/doc/overview.html index 47a87071ad..d89f8a1077 100644 --- a/doc/overview.html +++ b/doc/overview.html @@ -2,8 +2,8 @@ @@ -19,7 +19,7 @@

    C++ Boost

    -

    Serialization

    +

    Serialization

    Overview

    @@ -127,7 +127,7 @@

    Other implementations

    This library has similar goals to this one. Some aspects of the implemenation are also similar. As of this writing, it would seem that: