Compare commits

..

1 Commits

Author SHA1 Message Date
Peter Dimov
74403ab06b Update .travis.yml 2021-02-02 19:11:08 +02:00
46 changed files with 344 additions and 1195 deletions

View File

@@ -1,635 +0,0 @@
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:18.04
os: ubuntu-latest
install: g++-4.8
- toolset: gcc-5
cxxstd: "11,14,1z"
container: ubuntu:18.04
os: ubuntu-latest
install: g++-5
- toolset: gcc-6
cxxstd: "11,14,1z"
container: ubuntu:18.04
os: ubuntu-latest
install: g++-6
- toolset: gcc-7
cxxstd: "11,14,17"
container: ubuntu:20.04
os: ubuntu-latest
install: g++-7
- toolset: gcc-8
cxxstd: "11,14,17,2a"
container: ubuntu:20.04
os: ubuntu-latest
install: g++-8
- toolset: gcc-9
cxxstd: "11,14,17,2a"
container: ubuntu:20.04
os: ubuntu-latest
- toolset: gcc-10
cxxstd: "11,14,17,2a"
container: ubuntu:20.04
os: ubuntu-latest
install: g++-10
- toolset: gcc-11
cxxstd: "11,14,17,2a"
container: ubuntu:22.04
os: ubuntu-latest
install: g++-11
- toolset: gcc-12
cxxstd: "11,14,17,20,2b"
container: ubuntu:22.04
os: ubuntu-latest
install: g++-12
- toolset: gcc-13
cxxstd: "11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: g++-13
- 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"
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,2a"
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.10
os: ubuntu-latest
install: clang-17
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-13
- toolset: clang
cxxstd: "11,14,17,20,2b"
os: macos-14
- toolset: clang
cxxstd: "11,14,17,20,23"
os: macos-15
runs-on: ${{matrix.os}}
container:
image: ${{matrix.container}}
volumes:
- /node20217:/node20217:rw,rshared
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }}
defaults:
run:
shell: bash
steps:
- name: Install nodejs20glibc2.17
if: ${{ startsWith( matrix.container, 'ubuntu:1' ) }}
run: |
set -x
apt-get update
apt-get install -y curl xz-utils
curl -LO https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
- 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}}
- uses: actions/checkout@v4
- 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 --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
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} 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,20,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" %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-13
- os: macos-14
- os: macos-15
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-13
- os: macos-14
- os: macos-15
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-13
- os: macos-14
- os: macos-15
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,146 +1,147 @@
# Copyright 2016 Peter Dimov # Copyright 2016-2019 Peter Dimov
# Copyright 2017, 2018 James E. King III
# Distributed under the Boost Software License, Version 1.0. # Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
#
# Generic Travis CI build script for boostorg repositories
#
# Instructions for customizing this script for your library:
#
# 1. Copy the ci/ directory from the same source into your project:
# ci/build.sh runs the build
# ci/codecov.sh is used to run a profiling build and upload results to codecov.io
# ci/coverity.sh is used to run a coverity build and upload results coverity scan
# 2. Customize the compilers and language levels you want. Default is C++03.
# 3. Update the global B2 environment settings to your liking.
# 4. If you have more than include/, src/, and test/ directories then
# add them to the depinst.py line as "--include tools" for tools/ (you
# can put multiple --include on the command line).
# 5. If you want to enable Coverity Scan, you need to provide the environment
# variables COVERITY_SCAN_TOKEN and COVERITY_SCAN_NOTIFICATION_EMAIL in
# your github settings.
# 6. Enable pull request builds in your boostorg/<library> account.
# 7. Change the default C++ version in ci/*.sh (search for CXXSTD)
#
# That's it - the scripts will do everything else for you.
sudo: false
dist: trusty
language: cpp language: cpp
env: dist: xenial
global:
# see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties
# to use the default for a given environment, comment it out; recommend you build debug and release however..
# - B2_ADDRESS_MODEL=address-model=64,32
# - B2_LINK=link=shared,static
# - B2_THREADING=threading=multi,single
- B2_VARIANT=variant=release,debug
install:
- export SELF=`basename $TRAVIS_BUILD_DIR`
- cd ..
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update -q --init tools/boostdep
- git submodule update -q --init tools/build
- git submodule update -q --init tools/inspect
- cp -r $TRAVIS_BUILD_DIR/* libs/$SELF
- export BOOST_ROOT="`pwd`"
- export PATH="`pwd`":$PATH
- python tools/boostdep/depinst/depinst.py $SELF --include example
- ./bootstrap.sh
- ./b2 headers
addons:
apt:
packages:
- binutils-gold
- gdb
- libc6-dbg
branches: branches:
only: only:
- develop
- master - master
- develop
- /feature\/.*/
script: env:
- cd libs/$SELF matrix:
- ci/build.sh - BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
jobs:
include: include:
- os: linux - os: linux
env: compiler: g++-4.4
- COMMENT="C++03" env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x
- TOOLSET=gcc,gcc-7
addons: addons:
apt: apt:
packages: packages:
- g++-7 - g++-4.4
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- os: linux
env:
- COMMENT="C++11"
- TOOLSET=clang
- CXXSTD=11
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
env:
- COMMENT=valgrind
- TOOLSET=clang
- B2_VARIANT=variant=debug
- TESTFLAGS=testing.launcher=valgrind
addons:
apt:
packages:
- clang-5.0
- libstdc++-7-dev
- valgrind
sources:
- llvm-toolchain-trusty-5.0
- ubuntu-toolchain-r-test
- os: linux - os: linux
env: compiler: g++-4.6
- COMMENT=cppcheck env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x
addons:
apt:
packages:
- g++-4.6
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: bionic
compiler: g++-10
env: UBSAN=1 TOOLSET=gcc COMPILER=g++-10 CXXSTD=03,11,14,17,20 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
addons:
apt:
packages:
- g++-10
sources:
- sourceline: "ppa:ubuntu-toolchain-r/test"
- os: linux
dist: trusty
compiler: /usr/bin/clang++
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
addons:
apt:
packages:
- clang-3.3
- os: linux
dist: trusty
compiler: /usr/bin/clang++
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
addons:
apt:
packages:
- clang-3.4
- os: linux
compiler: clang++-11
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-11 CXXSTD=03,11,14,17,20 UBSAN_OPTIONS=print_stacktrace=1
addons:
apt:
packages:
- clang-11
sources:
- ubuntu-toolchain-r-test
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-11 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- os: linux
dist: bionic
compiler: clang++-libc++
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1
addons:
apt:
packages:
- libc++-dev
- os: freebsd
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,17,2a
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z ADDRMD=32,64
osx_image: xcode7.3
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z ADDRMD=32,64
osx_image: xcode8.3
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z ADDRMD=32,64
osx_image: xcode9.4
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
osx_image: xcode10.1
- os: osx
osx_image: xcode11.3
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
- os: osx
osx_image: xcode12.2
compiler: clang++
env: UBSAN=1 TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/boostdep
- cp -r $TRAVIS_BUILD_DIR/* libs/program_options
- python tools/boostdep/depinst/depinst.py program_options
- ./bootstrap.sh
- ./b2 headers
script: script:
- libs/$SELF/ci/cppcheck.sh - |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- os: linux - ./b2 -j3 libs/program_options/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${ADDRMD:+address-model=$ADDRMD} ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined define=UBSAN=1 debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}
env:
- COMMENT=CodeCov
- TOOLSET=gcc-7
addons:
apt:
packages:
- gcc-7
- g++-7
sources:
- ubuntu-toolchain-r-test
script:
- pushd /tmp && git clone https://github.com/linux-test-project/lcov.git && cd lcov && sudo make install && which lcov && lcov --version && popd
- cd libs/$SELF
- ci/codecov.sh
#################### Jobs to run on every pull request ####################
# osx was disabled because it is very slow to start (can delay builds by 30 minutes)
# - os: osx
# osx_image: xcode9
# env:
# - TOOLSET=clang
# - CXXSTD=03,11
#################### Jobs to run on pushes to master, develop ###################
notifications: notifications:
email: email:
false on_success: always

View File

@@ -1,63 +0,0 @@
# Generated by `boostdep --cmake program_options`
# 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.8...3.20)
project(boost_program_options VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_program_options
src/cmdline.cpp
src/config_file.cpp
src/convert.cpp
src/options_description.cpp
src/parsers.cpp
src/positional_options.cpp
src/split.cpp
src/utf8_codecvt_facet.cpp
src/value_semantic.cpp
src/variables_map.cpp
src/winmain.cpp
)
add_library(Boost::program_options ALIAS boost_program_options)
target_include_directories(boost_program_options PUBLIC include)
target_link_libraries(boost_program_options
PUBLIC
Boost::any
Boost::config
Boost::core
Boost::detail
Boost::function
Boost::iterator
Boost::lexical_cast
Boost::smart_ptr
Boost::static_assert
Boost::throw_exception
Boost::type_traits
PRIVATE
Boost::bind
Boost::tokenizer
)
target_compile_features(boost_program_options PUBLIC cxx_std_11)
target_compile_definitions(boost_program_options
PUBLIC BOOST_PROGRAM_OPTIONS_NO_LIB
PRIVATE BOOST_PROGRAM_OPTIONS_SOURCE
)
if(BUILD_SHARED_LIBS)
target_compile_definitions(boost_program_options PUBLIC BOOST_PROGRAM_OPTIONS_DYN_LINK)
else()
target_compile_definitions(boost_program_options PUBLIC BOOST_PROGRAM_OPTIONS_STATIC_LINK)
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()

11
Jamfile Normal file
View File

@@ -0,0 +1,11 @@
# Boost.ProgramOptions Library Jamfile
#
# Copyright (c) 2018 James E. King III
#
# 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)
# please order by name to ease maintenance
build-project example ;
build-project test ;

View File

@@ -14,8 +14,8 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org
|Branch | Travis | Appveyor | codecov.io | Deps | Docs | Tests | |Branch | Travis | Appveyor | codecov.io | Deps | Docs | Tests |
|:-------------: | ------ | -------- | ---------- | ---- | ---- | ----- | |:-------------: | ------ | -------- | ---------- | ---- | ---- | ----- |
|[`master`](https://github.com/boostorg/program_options/tree/master) | [![Build Status](https://travis-ci.org/boostorg/program_options.svg?branch=master)](https://travis-ci.org/boostorg/program_options) | [![Build status](https://ci.appveyor.com/api/projects/status/e0quisadwh1v7ok5/branch/master?svg=true)](https://ci.appveyor.com/project/vprus/program-options/branch/master) | [![codecov](https://codecov.io/gh/boostorg/program_options/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/program_options/branch/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/program_options.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/program_options.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](https://regression.boost.io/master/developer/program_options.html) |[`master`](https://github.com/boostorg/program_options/tree/master) | [![Build Status](https://travis-ci.org/boostorg/program_options.svg?branch=master)](https://travis-ci.org/boostorg/program_options) | [![Build status](https://ci.appveyor.com/api/projects/status/e0quisadwh1v7ok5/branch/master?svg=true)](https://ci.appveyor.com/project/vprus/program-options/branch/master) | [![codecov](https://codecov.io/gh/boostorg/program_options/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/program_options/branch/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/program_options.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/program_options.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/program_options.html)
|[`develop`](https://github.com/boostorg/program_options/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/program_options.svg?branch=develop)](https://travis-ci.org/boostorg/program_options) | [![Build status](https://ci.appveyor.com/api/projects/status/e0quisadwh1v7ok5/branch/develop?svg=true)](https://ci.appveyor.com/project/vprus/program-options/branch/develop) | [![codecov](https://codecov.io/gh/boostorg/program_options/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/program_options/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/program_options.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/program_options.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://regression.boost.io/develop/developer/program_options.html) |[`develop`](https://github.com/boostorg/program_options/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/program_options.svg?branch=develop)](https://travis-ci.org/boostorg/program_options) | [![Build status](https://ci.appveyor.com/api/projects/status/e0quisadwh1v7ok5/branch/develop?svg=true)](https://ci.appveyor.com/project/vprus/program-options/branch/develop) | [![codecov](https://codecov.io/gh/boostorg/program_options/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/program_options/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/program_options.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/program_options.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/program_options.html)
### Directories ### Directories

View File

@@ -1,68 +1,78 @@
# Copyright 2016-2019 Peter Dimov # Copyright 2016, 2017 Peter Dimov
# Copyright (C) 2017, 2018 James E. King III
# Distributed under the Boost Software License, Version 1.0. # Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
# When copying this to a new library, be sure to update the name of the library
# in two places (once each at the top of install: and test_script:)
version: 1.0.{build}-{branch} version: 1.0.{build}-{branch}
shallow_clone: true shallow_clone: true
branches: branches:
only: only:
- master
- develop - develop
- /feature\/.*/ - master
matrix:
allow_failures:
- MAYFAIL: true
environment: environment:
global:
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
# see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties
# to use the default for a given environment, comment it out; recommend you build debug and release however..
# on Windows it is important to exercise all the possibilities, especially shared vs static
# B2_ADDRESS_MODEL: address-model=64,32
# B2_LINK: link=shared,static
# B2_THREADING: threading=multi,single
B2_VARIANT: variant=release,debug
CXXSTD: 03
matrix: matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - FLAVOR: Visual Studio 2017
TOOLSET: msvc-14.0
CXXSTD: 14,latest
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1 TOOLSET: msvc-14.1
CXXSTD: 14,17,latest B2_ADDRESS_MODEL: address-model=64,32
ADDRMD: 32,64 - FLAVOR: Visual Studio 2013
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: clang-win TOOLSET: msvc-12.0
CXXSTD: 14,17,latest - FLAVOR: mingw32
ADDRMD: 64 ARCH: i686
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 B2_ADDRESS_MODEL: address-model=32
TOOLSET: clang-win SCRIPT: ci\mingw.bat
CXXSTD: 14,17,20,latest - FLAVOR: mingw64
ADDRMD: 64 ARCH: x86_64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 B2_ADDRESS_MODEL: address-model=64
ADDPATH: C:\cygwin\bin; SCRIPT: ci\mingw.bat
TOOLSET: gcc - FLAVOR: cygwin (64-bit)
CXXSTD: 11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ADDPATH: C:\cygwin64\bin; ADDPATH: C:\cygwin64\bin;
B2_ADDRESS_MODEL: address-model=64
TOOLSET: gcc TOOLSET: gcc
CXXSTD: 11,14,1z MAYFAIL: true
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - FLAVOR: cygwin (32-bit)
ADDPATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin; ADDPATH: C:\cygwin\bin;
B2_ADDRESS_MODEL: address-model=32
TOOLSET: gcc TOOLSET: gcc
CXXSTD: 11,14,17,2a MAYFAIL: true
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ADDPATH: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;
TOOLSET: gcc
CXXSTD: 11,14,17,2a
install: install:
- set BOOST_BRANCH=develop - set SELF=program_options
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
- cd .. - cd ..
- git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root - git clone -b %APPVEYOR_REPO_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root - cd boost-root
- git submodule update --init tools/boostdep - git submodule update -q --init tools/boostdep
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\program_options\ - git submodule update -q --init tools/build
- python tools/boostdep/depinst/depinst.py program_options - git submodule update -q --init tools/inspect
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\%SELF%
- python tools/boostdep/depinst/depinst.py --include example %SELF%
- cmd /c bootstrap - cmd /c bootstrap
- b2 -d0 headers - b2 headers
build: off build: off
test_script: test_script:
- set SELF=program_options
- PATH=%ADDPATH%%PATH% - PATH=%ADDPATH%%PATH%
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD% - IF DEFINED SCRIPT (call libs\%SELF%\%SCRIPT%) ELSE (b2 libs/%SELF% toolset=%TOOLSET% cxxstd=%CXXSTD% %CXXFLAGS% %DEFINES% %B2_ADDRESS_MODEL% %B2_LINK% %B2_THREADING% %B2_VARIANT% -j3)
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
- b2 -j3 libs/program_options/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release

View File

@@ -1,32 +0,0 @@
# 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/any//boost_any
/boost/config//boost_config
/boost/core//boost_core
/boost/detail//boost_detail
/boost/function//boost_function
/boost/iterator//boost_iterator
/boost/lexical_cast//boost_lexical_cast
/boost/smart_ptr//boost_smart_ptr
/boost/static_assert//boost_static_assert
/boost/throw_exception//boost_throw_exception
/boost/type_traits//boost_type_traits ;
project /boost/program_options
;
explicit
[ alias boost_program_options : build//boost_program_options ]
[ alias all : boost_program_options example test ]
;
call-if : boost-library program_options
: install boost_program_options
;

View File

@@ -1,13 +1,6 @@
constant boost_dependencies_private : project boost/program_options
/boost/bind//boost_bind
/boost/tokenizer//boost_tokenizer
;
project
: source-location ../src : source-location ../src
: common-requirements <include>../include <library>$(boost_dependencies)
: requirements <library>$(boost_dependencies_private)
; ;
SOURCES = SOURCES =
@@ -16,10 +9,8 @@ SOURCES =
convert winmain split convert winmain split
; ;
lib boost_program_options boost-lib program_options
: $(SOURCES).cpp : $(SOURCES).cpp
: # See https://svn.boost.org/trac/boost/ticket/5049 : # See https://svn.boost.org/trac/boost/ticket/5049
<target-os>hpux,<toolset>gcc:<define>_INCLUDE_STDC__SOURCE_199901 <target-os>hpux,<toolset>gcc:<define>_INCLUDE_STDC__SOURCE_199901
<link>shared:<define>BOOST_PROGRAM_OPTIONS_DYN_LINK=1
<define>BOOST_PROGRAM_OPTIONS_NO_LIB=1
; ;

View File

@@ -10,7 +10,7 @@ boostbook program_option
; ;
doxygen autodoc doxygen autodoc
: [ glob ../include/boost/program_options/*.hpp ] ; : [ glob ../../../boost/program_options/*.hpp ] ;
############################################################################### ###############################################################################
alias boostdoc alias boostdoc

View File

@@ -8,7 +8,7 @@
<section> <section>
<title>Acknowledgements</title> <title>Acknowledgements</title>
<para>I'm very grateful to all the people who helped with the development, <para>I'm very gratefull to all the people who helped with the development,
by discussion, fixes, and as users. It was pleasant by discussion, fixes, and as users. It was pleasant
to see all that involvement, which made the library much better than it to see all that involvement, which made the library much better than it
would be otherwise. would be otherwise.
@@ -25,7 +25,7 @@
<para>The formal review lead to numerous comments and enhancements. Pavol <para>The formal review lead to numerous comments and enhancements. Pavol
Droba helped with the option description semantic. Gennadiy Rozental has Droba helped with the option description semantic. Gennadiy Rozental has
criticised many aspects of the library which caused various simplifications. criticised many aspects of the library which caused various simplifications.
Pavel Vozenilek did careful review of the implementation. A number of Pavel Vozenilek did carefull review of the implementation. A number of
comments were made by: comments were made by:
<itemizedlist> <itemizedlist>
<listitem><para>David Abrahams</para></listitem> <listitem><para>David Abrahams</para></listitem>

View File

@@ -74,7 +74,7 @@
of the library -- ascii and Unicode. of the library -- ascii and Unicode.
</para> </para>
<para>Another important point is that ascii strings are passed through <para>Another important point is that ascii strings are passed though
without modification. In other words, it's not possible to just convert without modification. In other words, it's not possible to just convert
ascii to Unicode and process the Unicode further. The problem is that the ascii to Unicode and process the Unicode further. The problem is that the
default conversion mechanism -- the <code>codecvt</code> facet -- might default conversion mechanism -- the <code>codecvt</code> facet -- might
@@ -85,7 +85,7 @@
don't support Unicode option names. Unicode support is hard and don't support Unicode option names. Unicode support is hard and
requires a Boost-wide solution. Even comparing two arbitrary Unicode requires a Boost-wide solution. Even comparing two arbitrary Unicode
strings is non-trivial. Finally, using Unicode in option names is strings is non-trivial. Finally, using Unicode in option names is
related to internationalization, which has its own related to internationalization, which has it's own
complexities. E.g. if option names depend on current locale, then all complexities. E.g. if option names depend on current locale, then all
program parts and other parts which use the name must be program parts and other parts which use the name must be
internationalized too. internationalized too.

View File

@@ -23,7 +23,7 @@ options groups/hidden options
<title>Non-conventional Syntax</title> <title>Non-conventional Syntax</title>
<para>Sometimes, standard command line syntaxes are not enough. For <para>Sometimes, standard command line syntaxes are not enough. For
example, the gcc compiler has "-frtti" and "-fno-rtti" options, and this example, the gcc compiler has "-frtti" and -fno-rtti" options, and this
syntax is not directly supported. syntax is not directly supported.
</para> </para>
@@ -66,7 +66,7 @@ store(command_line_parser(ac, av).options(desc).extra_parser(reg_foo)
<indexterm><primary>response files</primary></indexterm> <indexterm><primary>response files</primary></indexterm>
<para>Some operating systems have very low limits of the command line <para>Some operating system have very low limits of the command line
length. The common way to work around those limitations is using length. The common way to work around those limitations is using
<firstterm>response files</firstterm>. A response file is just a <firstterm>response files</firstterm>. A response file is just a
configuration file which uses the same syntax as the command line. If configuration file which uses the same syntax as the command line. If
@@ -346,7 +346,7 @@ void validate(boost::any& v,
<emphasis>some</emphasis> Unicode-aware options. They are different from <emphasis>some</emphasis> Unicode-aware options. They are different from
ordinary options in that they accept <code>wstring</code> input, and ordinary options in that they accept <code>wstring</code> input, and
process it using wide character streams. Creating an Unicode-aware option process it using wide character streams. Creating an Unicode-aware option
is easy: just use the <code>wvalue</code> function instead of the is easy: just use the the <code>wvalue</code> function instead of the
regular <code>value</code>. regular <code>value</code>.
</para> </para>
@@ -379,7 +379,7 @@ locale::global(locale(""));
implementation, though. The quick test involves three steps: implementation, though. The quick test involves three steps:
<orderedlist> <orderedlist>
<listitem> <listitem>
<para>Go to the "test" directory and build the "test_convert" binary.</para> <para>Go the the "test" directory and build the "test_convert" binary.</para>
</listitem> </listitem>
<listitem> <listitem>
<para>Set some non-ascii locale in the environment. On Linux, one can <para>Set some non-ascii locale in the environment. On Linux, one can

View File

@@ -50,7 +50,7 @@
provides a class which stores all option values and that class can be provides a class which stores all option values and that class can be
freely passed around your program to modules which need access to the freely passed around your program to modules which need access to the
options. All the other components can be used only in the place where options. All the other components can be used only in the place where
the actual parsing is done. However, it might also make sense for the the actual parsing is the done. However, it might also make sense for the
individual program modules to describe their options and pass them to the individual program modules to describe their options and pass them to the
main module, which will merge all options. Of course, this is only main module, which will merge all options. Of course, this is only
important when the number of options is large and declaring them in one important when the number of options is large and declaring them in one
@@ -185,9 +185,9 @@ desc.add_options()
("email", value&lt;string&gt;()->multitoken(), "email to send to") ("email", value&lt;string&gt;()->multitoken(), "email to send to")
; ;
</programlisting> </programlisting>
For the first option, we specify only the name and the For the first parameter, we specify only the name and the
description. No value can be specified in the parsed source. description. No value can be specified in the parsed source.
For the second option, the user must specify a value, using a single For the first option, the user must specify a value, using a single
token. For the third option, the user may either provide a single token token. For the third option, the user may either provide a single token
for the value, or no token at all. For the last option, the value can for the value, or no token at all. For the last option, the value can
span several tokens. For example, the following command line is OK: span several tokens. For example, the following command line is OK:
@@ -208,7 +208,7 @@ desc.add_options()
<para>The description string has one or more paragraphs, separated by <para>The description string has one or more paragraphs, separated by
the newline character ('\n'). When an option is output, the library the newline character ('\n'). When an option is output, the library
will compute the indentation for options's description. Each of the will compute the indentation for options's description. Each of the
paragraph is output as a separate line with that indentation. If paragraph is output as a separate line with that intentation. If
a paragraph does not fit on one line it is spanned over multiple a paragraph does not fit on one line it is spanned over multiple
lines (which will have the same indentation). lines (which will have the same indentation).
</para> </para>
@@ -538,7 +538,7 @@ desc.add_options()
</para> </para>
<para>The environment variables can be parsed with the <para>The environment variables can be parsed with the
&parse_environment; function. The function has several overloaded &parse_environment; function. The function have several overloaded
versions. The first parameter is always an &options_description; versions. The first parameter is always an &options_description;
instance, and the second specifies what variables must be processed, and instance, and the second specifies what variables must be processed, and
what option names must correspond to it. To describe the second what option names must correspond to it. To describe the second
@@ -546,13 +546,13 @@ desc.add_options()
variables.</para> variables.</para>
<para>If you have an option that should be specified via environment <para>If you have an option that should be specified via environment
variable, you need to make up the variable's name. To avoid name clashes, variable, you need make up the variable's name. To avoid name clashes,
we suggest that you use a sufficiently unique prefix for environment we suggest that you use a sufficiently unique prefix for environment
variables. Also, while option names are most likely in lower case, variables. Also, while option names are most likely in lower case,
environment variables conventionally use upper case. So, for an option environment variables conventionally use upper case. So, for an option
name <literal>proxy</literal> the environment variable might be called name <literal>proxy</literal> the environment variable might be called
<envar>BOOST_PROXY</envar>. During parsing, we need to perform reverse <envar>BOOST_PROXY</envar>. During parsing, we need to perform reverse
conversion of the names. This is accomplished by passing the chosen conversion of the names. This is accomplished by passing the choosen
prefix as the second parameter of the &parse_environment; function. prefix as the second parameter of the &parse_environment; function.
Say, if you pass <literal>BOOST_</literal> as the prefix, and there are Say, if you pass <literal>BOOST_</literal> as the prefix, and there are
two variables, <envar>CVSROOT</envar> and <envar>BOOST_PROXY</envar>, the two variables, <envar>CVSROOT</envar> and <envar>BOOST_PROXY</envar>, the
@@ -588,7 +588,7 @@ desc.add_options()
representations that are available in C++ literals are not supported by representations that are available in C++ literals are not supported by
lexical_cast, and thus will not work with program_options.</para> lexical_cast, and thus will not work with program_options.</para>
<para>Booleans are special in that there are multiple ways to come at them. <para>Booleans a special in that there are multiple ways to come at them.
Similar to another value type, it can be specified as <code>("my-option", Similar to another value type, it can be specified as <code>("my-option",
value&lt;bool&gt;())</code>, and then set as:</para> value&lt;bool&gt;())</code>, and then set as:</para>
<screen> <screen>
@@ -648,7 +648,7 @@ example --other-switch
<row> <row>
<entry>&parse_command_line;</entry> <entry>&parse_command_line;</entry>
<entry>parses command line (simplified interface)</entry> <entry>parses command line (simpified interface)</entry>
</row> </row>
<row> <row>

View File

@@ -70,7 +70,7 @@
</para> </para>
<para> <para>
Now let's see some examples of the library usage in <xref Now let's see some examples of the library usage in the <xref
linkend="program_options.tutorial"/>. linkend="program_options.tutorial"/>.
</para> </para>

View File

@@ -9,7 +9,7 @@
namespace boost { namespace program_options { namespace command_line_style { namespace boost { namespace program_options { namespace command_line_style {
/** Various possible styles of options. /** Various possible styles of options.
There are "long" options, which start with "--", and "short", There are "long" options, which start with "--" and "short",
which start with either "-" or "/". Both kinds can be allowed or which start with either "-" or "/". Both kinds can be allowed or
disallowed, see allow_long and allow_short. The allowed character disallowed, see allow_long and allow_short. The allowed character
for short options is also configurable. for short options is also configurable.
@@ -51,7 +51,7 @@ namespace boost { namespace program_options { namespace command_line_style {
/** Allow to merge several short options together, /** Allow to merge several short options together,
so that "-s -k" become "-sk". All of the options so that "-s -k" become "-sk". All of the options
but last should accept no parameter. For example, if but last should accept no parameter. For example, if
"-s" accepts a parameter, then "k" will be taken as "-s" accept a parameter, then "k" will be taken as
parameter, not another short option. parameter, not another short option.
Dos-style short options cannot be sticky. Dos-style short options cannot be sticky.
*/ */

View File

@@ -76,7 +76,7 @@ namespace boost { namespace program_options { namespace detail {
const std::set<std::string>& allowed_options, const std::set<std::string>& allowed_options,
bool allow_unregistered = false); bool allow_unregistered = false);
BOOST_DEFAULTED_FUNCTION(virtual ~common_config_file_iterator(), {}) virtual ~common_config_file_iterator() {}
public: // Method required by eof_iterator public: // Method required by eof_iterator

View File

@@ -24,7 +24,7 @@ namespace boost { namespace program_options {
basic_command_line_parser<charT>:: basic_command_line_parser<charT>::
basic_command_line_parser(int argc, const charT* const argv[]) basic_command_line_parser(int argc, const charT* const argv[])
: detail::cmdline( : detail::cmdline(
to_internal(std::vector<std::basic_string<charT> >(argc ? argv+1 : argv, argv+argc))), to_internal(std::vector<std::basic_string<charT> >(argv+1, argv+argc))),
m_desc() m_desc()
{} {}

View File

@@ -8,24 +8,18 @@
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
# include <optional>
#endif
// forward declaration // forward declaration
namespace boost { template<class T> class optional; } namespace boost { template<class T> class optional; }
namespace boost { namespace program_options { namespace boost { namespace program_options {
namespace detail {
extern BOOST_PROGRAM_OPTIONS_DECL std::string arg; extern BOOST_PROGRAM_OPTIONS_DECL std::string arg;
}
template<class T, class charT> template<class T, class charT>
std::string std::string
typed_value<T, charT>::name() const typed_value<T, charT>::name() const
{ {
std::string const& var = (m_value_name.empty() ? detail::arg : m_value_name); std::string const& var = (m_value_name.empty() ? arg : m_value_name);
if (!m_implicit_value.empty() && !m_implicit_value_as_text.empty()) { if (!m_implicit_value.empty() && !m_implicit_value_as_text.empty()) {
std::string msg = "[=" + var + "(=" + m_implicit_value_as_text + ")]"; std::string msg = "[=" + var + "(=" + m_implicit_value_as_text + ")]";
if (!m_default_value.empty() && !m_default_value_as_text.empty()) if (!m_default_value.empty() && !m_default_value_as_text.empty())
@@ -152,7 +146,7 @@ namespace boost { namespace program_options {
boost::any a; boost::any a;
std::vector<std::basic_string<charT> > cv; std::vector<std::basic_string<charT> > cv;
cv.push_back(s[i]); cv.push_back(s[i]);
validate(a, cv, static_cast<T*>(nullptr), 0); validate(a, cv, (T*)0, 0);
tv->push_back(boost::any_cast<T>(a)); tv->push_back(boost::any_cast<T>(a));
} }
catch(const bad_lexical_cast& /*e*/) { catch(const bad_lexical_cast& /*e*/) {
@@ -171,26 +165,10 @@ namespace boost { namespace program_options {
validators::check_first_occurrence(v); validators::check_first_occurrence(v);
validators::get_single_string(s); validators::get_single_string(s);
boost::any a; boost::any a;
validate(a, s, static_cast<T*>(nullptr), 0); validate(a, s, (T*)0, 0);
v = boost::any(boost::optional<T>(boost::any_cast<T>(a))); v = boost::any(boost::optional<T>(boost::any_cast<T>(a)));
} }
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
/** Validates std::optional arguments. */
template<class T, class charT>
void validate(boost::any& v,
const std::vector<std::basic_string<charT> >& s,
std::optional<T>*,
int)
{
validators::check_first_occurrence(v);
validators::get_single_string(s);
boost::any a;
validate(a, s, static_cast<T*>(nullptr), 0);
v = boost::any(std::optional<T>(boost::any_cast<T>(a)));
}
#endif
template<class T, class charT> template<class T, class charT>
void void
typed_value<T, charT>:: typed_value<T, charT>::
@@ -203,7 +181,7 @@ namespace boost { namespace program_options {
if (new_tokens.empty() && !m_implicit_value.empty()) if (new_tokens.empty() && !m_implicit_value.empty())
value_store = m_implicit_value; value_store = m_implicit_value;
else else
validate(value_store, new_tokens, static_cast<T*>(nullptr), 0); validate(value_store, new_tokens, (T*)0, 0);
} }
template<class T> template<class T>

View File

@@ -11,12 +11,12 @@
namespace boost { namespace boost {
/** The 'eof_iterator' class is useful for constructing forward iterators /** The 'eof_iterator' class is useful for constructing forward iterators
in cases where the iterator extracts data from some source and it's easy in cases where iterator extract data from some source and it's easy
to detect 'eof' \-- i.e. the situation where there's no data. One to detect 'eof' \-- i.e. the situation where there's no data. One
apparent example is reading lines from a file. apparent example is reading lines from a file.
Implementing such iterators using 'iterator_facade' directly would Implementing such iterators using 'iterator_facade' directly would
require to create class with three core operations, a couple of require to create class with three core operation, a couple of
constructors. When using 'eof_iterator', the derived class should define constructors. When using 'eof_iterator', the derived class should define
only one method to get new value, plus a couple of constructors. only one method to get new value, plus a couple of constructors.

View File

@@ -35,7 +35,7 @@ namespace boost { namespace program_options {
} }
/** Base class for all errors in the library. */ /** Base class for all errors in the library. */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE error : public std::logic_error { class BOOST_PROGRAM_OPTIONS_DECL error : public std::logic_error {
public: public:
error(const std::string& xwhat) : std::logic_error(xwhat) {} error(const std::string& xwhat) : std::logic_error(xwhat) {}
}; };
@@ -44,15 +44,15 @@ namespace boost { namespace program_options {
/** Class thrown when there are too many positional options. /** Class thrown when there are too many positional options.
This is a programming error. This is a programming error.
*/ */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE too_many_positional_options_error : public error { class BOOST_PROGRAM_OPTIONS_DECL too_many_positional_options_error : public error {
public: public:
too_many_positional_options_error() too_many_positional_options_error()
: error("too many positional options have been specified on the command line") : error("too many positional options have been specified on the command line")
{} {}
}; };
/** Class thrown when there are programming errors related to style */ /** Class thrown when there are programming error related to style */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_command_line_style : public error { class BOOST_PROGRAM_OPTIONS_DECL invalid_command_line_style : public error {
public: public:
invalid_command_line_style(const std::string& msg) invalid_command_line_style(const std::string& msg)
: error(msg) : error(msg)
@@ -60,7 +60,7 @@ namespace boost { namespace program_options {
}; };
/** Class thrown if config file can not be read */ /** Class thrown if config file can not be read */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE reading_file : public error { class BOOST_PROGRAM_OPTIONS_DECL reading_file : public error {
public: public:
reading_file(const char* filename) reading_file(const char* filename)
: error(std::string("can not read options configuration file '").append(filename).append("'")) : error(std::string("can not read options configuration file '").append(filename).append("'"))
@@ -83,7 +83,7 @@ namespace boost { namespace program_options {
* Options are displayed in "canonical" form * Options are displayed in "canonical" form
* This is the most unambiguous form of the * This is the most unambiguous form of the
* *parsed* option name and would correspond to * *parsed* option name and would correspond to
* option_description::format_name(), * option_description::format_name()
* i.e. what is shown by print_usage() * i.e. what is shown by print_usage()
* *
* The "canonical" form depends on whether the option is * The "canonical" form depends on whether the option is
@@ -91,7 +91,7 @@ namespace boost { namespace program_options {
* or without a prefix (from a configuration file) * or without a prefix (from a configuration file)
* *
* */ * */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE error_with_option_name : public error { class BOOST_PROGRAM_OPTIONS_DECL error_with_option_name : public error {
protected: protected:
/** can be /** can be
@@ -121,7 +121,7 @@ namespace boost { namespace program_options {
/** gcc says that throw specification on dtor is loosened /** gcc says that throw specification on dtor is loosened
* without this line * without this line
* */ * */
BOOST_DEFAULTED_FUNCTION(~error_with_option_name() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~error_with_option_name() throw() {}
//void dump() const //void dump() const
@@ -183,7 +183,7 @@ namespace boost { namespace program_options {
/** Creates the error_message on the fly /** Creates the error_message on the fly
* Currently a thin wrapper for substitute_placeholders() */ * Currently a thin wrapper for substitute_placeholders() */
virtual const char* what() const BOOST_NOEXCEPT_OR_NOTHROW override; virtual const char* what() const throw();
protected: protected:
/** Used to hold the error text returned by what() */ /** Used to hold the error text returned by what() */
@@ -204,28 +204,28 @@ namespace boost { namespace program_options {
/** Class thrown when there are several option values, but /** Class thrown when there are several option values, but
user called a method which cannot return them all. */ user called a method which cannot return them all. */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE multiple_values : public error_with_option_name { class BOOST_PROGRAM_OPTIONS_DECL multiple_values : public error_with_option_name {
public: public:
multiple_values() multiple_values()
: error_with_option_name("option '%canonical_option%' only takes a single argument"){} : error_with_option_name("option '%canonical_option%' only takes a single argument"){}
BOOST_DEFAULTED_FUNCTION(~multiple_values() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~multiple_values() throw() {}
}; };
/** Class thrown when there are several occurrences of an /** Class thrown when there are several occurrences of an
option, but user called a method which cannot return option, but user called a method which cannot return
them all. */ them all. */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE multiple_occurrences : public error_with_option_name { class BOOST_PROGRAM_OPTIONS_DECL multiple_occurrences : public error_with_option_name {
public: public:
multiple_occurrences() multiple_occurrences()
: error_with_option_name("option '%canonical_option%' cannot be specified more than once"){} : error_with_option_name("option '%canonical_option%' cannot be specified more than once"){}
BOOST_DEFAULTED_FUNCTION(~multiple_occurrences() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~multiple_occurrences() throw() {}
}; };
/** Class thrown when a required/mandatory option is missing */ /** Class thrown when a required/mandatory option is missing */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE required_option : public error_with_option_name { class BOOST_PROGRAM_OPTIONS_DECL required_option : public error_with_option_name {
public: public:
// option name is constructed by the option_descriptor and never on the fly // option name is constructed by the option_descriptor and never on the fly
required_option(const std::string& option_name) required_option(const std::string& option_name)
@@ -233,7 +233,7 @@ namespace boost { namespace program_options {
{ {
} }
BOOST_DEFAULTED_FUNCTION(~required_option() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~required_option() throw() {}
}; };
/** Base class of unparsable options, /** Base class of unparsable options,
@@ -243,11 +243,11 @@ namespace boost { namespace program_options {
* It makes no sense to have an option name, when we can't match an option to the * It makes no sense to have an option name, when we can't match an option to the
* parameter * parameter
* *
* Having this as part of the error_with_option_name hierarchy makes error handling * Having this a part of the error_with_option_name hierachy makes error handling
* a lot easier, even if the name indicates some sort of conceptual dissonance! * a lot easier, even if the name indicates some sort of conceptual dissonance!
* *
* */ * */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE error_with_no_option_name : public error_with_option_name { class BOOST_PROGRAM_OPTIONS_DECL error_with_no_option_name : public error_with_option_name {
public: public:
error_with_no_option_name(const std::string& template_, error_with_no_option_name(const std::string& template_,
const std::string& original_token = "") const std::string& original_token = "")
@@ -256,40 +256,40 @@ namespace boost { namespace program_options {
} }
/** Does NOT set option name, because no option name makes sense */ /** Does NOT set option name, because no option name makes sense */
virtual void set_option_name(const std::string&) override {} virtual void set_option_name(const std::string&) {}
BOOST_DEFAULTED_FUNCTION(~error_with_no_option_name() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~error_with_no_option_name() throw() {}
}; };
/** Class thrown when option name is not recognized. */ /** Class thrown when option name is not recognized. */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE unknown_option : public error_with_no_option_name { class BOOST_PROGRAM_OPTIONS_DECL unknown_option : public error_with_no_option_name {
public: public:
unknown_option(const std::string& original_token = "") unknown_option(const std::string& original_token = "")
: error_with_no_option_name("unrecognised option '%canonical_option%'", original_token) : error_with_no_option_name("unrecognised option '%canonical_option%'", original_token)
{ {
} }
BOOST_DEFAULTED_FUNCTION(~unknown_option() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~unknown_option() throw() {}
}; };
/** Class thrown when there's ambiguity among several possible options. */ /** Class thrown when there's ambiguity amoung several possible options. */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE ambiguous_option : public error_with_no_option_name { class BOOST_PROGRAM_OPTIONS_DECL ambiguous_option : public error_with_no_option_name {
public: public:
ambiguous_option(const std::vector<std::string>& xalternatives) ambiguous_option(const std::vector<std::string>& xalternatives)
: error_with_no_option_name("option '%canonical_option%' is ambiguous"), : error_with_no_option_name("option '%canonical_option%' is ambiguous"),
m_alternatives(xalternatives) m_alternatives(xalternatives)
{} {}
BOOST_DEFAULTED_FUNCTION(~ambiguous_option() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~ambiguous_option() throw() {}
const std::vector<std::string>& alternatives() const BOOST_NOEXCEPT_OR_NOTHROW {return m_alternatives;} const std::vector<std::string>& alternatives() const throw() {return m_alternatives;}
protected: protected:
/** Makes all substitutions using the template */ /** Makes all substitutions using the template */
virtual void substitute_placeholders(const std::string& error_template) const override; virtual void substitute_placeholders(const std::string& error_template) const;
private: private:
// TODO: copy ctor might throw // TODO: copy ctor might throw
std::vector<std::string> m_alternatives; std::vector<std::string> m_alternatives;
@@ -299,7 +299,7 @@ namespace boost { namespace program_options {
/** Class thrown when there's syntax error either for command /** Class thrown when there's syntax error either for command
* line or config file options. See derived children for * line or config file options. See derived children for
* concrete classes. */ * concrete classes. */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_syntax : public error_with_option_name { class BOOST_PROGRAM_OPTIONS_DECL invalid_syntax : public error_with_option_name {
public: public:
enum kind_t { enum kind_t {
long_not_allowed = 30, long_not_allowed = 30,
@@ -320,7 +320,7 @@ namespace boost { namespace program_options {
{ {
} }
BOOST_DEFAULTED_FUNCTION(~invalid_syntax() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~invalid_syntax() throw() {}
kind_t kind() const {return m_kind;} kind_t kind() const {return m_kind;}
@@ -332,7 +332,7 @@ namespace boost { namespace program_options {
kind_t m_kind; kind_t m_kind;
}; };
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_config_file_syntax : public invalid_syntax { class BOOST_PROGRAM_OPTIONS_DECL invalid_config_file_syntax : public invalid_syntax {
public: public:
invalid_config_file_syntax(const std::string& invalid_line, kind_t kind): invalid_config_file_syntax(const std::string& invalid_line, kind_t kind):
invalid_syntax(kind) invalid_syntax(kind)
@@ -340,27 +340,27 @@ namespace boost { namespace program_options {
m_substitutions["invalid_line"] = invalid_line; m_substitutions["invalid_line"] = invalid_line;
} }
BOOST_DEFAULTED_FUNCTION(~invalid_config_file_syntax() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~invalid_config_file_syntax() throw() {}
/** Convenience functions for backwards compatibility */ /** Convenience functions for backwards compatibility */
virtual std::string tokens() const override {return m_substitutions.find("invalid_line")->second; } virtual std::string tokens() const {return m_substitutions.find("invalid_line")->second; }
}; };
/** Class thrown when there are syntax errors in given command line */ /** Class thrown when there are syntax errors in given command line */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_command_line_syntax : public invalid_syntax { class BOOST_PROGRAM_OPTIONS_DECL invalid_command_line_syntax : public invalid_syntax {
public: public:
invalid_command_line_syntax(kind_t kind, invalid_command_line_syntax(kind_t kind,
const std::string& option_name = "", const std::string& option_name = "",
const std::string& original_token = "", const std::string& original_token = "",
int option_style = 0): int option_style = 0):
invalid_syntax(kind, option_name, original_token, option_style) {} invalid_syntax(kind, option_name, original_token, option_style) {}
BOOST_DEFAULTED_FUNCTION(~invalid_command_line_syntax() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~invalid_command_line_syntax() throw() {}
}; };
/** Class thrown when value of option is incorrect. */ /** Class thrown when value of option is incorrect. */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE validation_error : public error_with_option_name { class BOOST_PROGRAM_OPTIONS_DECL validation_error : public error_with_option_name {
public: public:
enum kind_t { enum kind_t {
multiple_values_not_allowed = 30, multiple_values_not_allowed = 30,
@@ -380,7 +380,7 @@ namespace boost { namespace program_options {
{ {
} }
BOOST_DEFAULTED_FUNCTION(~validation_error() BOOST_NOEXCEPT_OR_NOTHROW, {}) ~validation_error() throw() {}
kind_t kind() const { return m_kind; } kind_t kind() const { return m_kind; }
@@ -391,7 +391,7 @@ namespace boost { namespace program_options {
}; };
/** Class thrown if there is an invalid option value given */ /** Class thrown if there is an invalid option value given */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_option_value class BOOST_PROGRAM_OPTIONS_DECL invalid_option_value
: public validation_error : public validation_error
{ {
public: public:
@@ -402,7 +402,7 @@ namespace boost { namespace program_options {
}; };
/** Class thrown if there is an invalid bool value given */ /** Class thrown if there is an invalid bool value given */
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_bool_value class BOOST_PROGRAM_OPTIONS_DECL invalid_bool_value
: public validation_error : public validation_error
{ {
public: public:

View File

@@ -105,7 +105,7 @@ namespace program_options {
/** Returns the canonical name for the option description to enable the user to /** Returns the canonical name for the option description to enable the user to
recognise a matching option. recognised a matching option.
1) For short options ('-', '/'), returns the short name prefixed. 1) For short options ('-', '/'), returns the short name prefixed.
2) For long options ('--' / '-') returns the first long name prefixed 2) For long options ('--' / '-') returns the first long name prefixed
3) All other cases, returns the first long name (if present) or the short 3) All other cases, returns the first long name (if present) or the short

View File

@@ -30,7 +30,7 @@ namespace boost { namespace program_options {
/** Results of parsing an input source. /** Results of parsing an input source.
The primary use of this class is passing information from parsers The primary use of this class is passing information from parsers
component to value storage component. This class does not make component to value storage component. This class does not makes
much sense itself. much sense itself.
*/ */
template<class charT> template<class charT>
@@ -120,11 +120,7 @@ namespace boost { namespace program_options {
basic_command_line_parser(const std::vector< basic_command_line_parser(const std::vector<
std::basic_string<charT> >& args); std::basic_string<charT> >& args);
/** Creates a command line parser for the specified arguments /** Creates a command line parser for the specified arguments
list. The parameters should be the same as passed to 'main', meaning: list. The parameters should be the same as passed to 'main'.
@param argc Must be non-negative i.e. >= 0
@param argv Argv[argc] must be 0 e.g. nullptr and
if argc is >0 argv[0] up to argv[argc-1] must point to
null terminated strings
*/ */
basic_command_line_parser(int argc, const charT* const argv[]); basic_command_line_parser(int argc, const charT* const argv[]);
@@ -150,7 +146,7 @@ namespace boost { namespace program_options {
instance of basic_option<charT> will be added to result, instance of basic_option<charT> will be added to result,
with 'unrecognized' field set to 'true'. It's possible to with 'unrecognized' field set to 'true'. It's possible to
collect all unrecognized options with the 'collect_unrecognized' collect all unrecognized options with the 'collect_unrecognized'
function. funciton.
*/ */
basic_command_line_parser& allow_unregistered(); basic_command_line_parser& allow_unregistered();
@@ -214,7 +210,7 @@ namespace boost { namespace program_options {
/** Collects the original tokens for all named options with /** Collects the original tokens for all named options with
'unregistered' flag set. If 'mode' is 'include_positional' 'unregistered' flag set. If 'mode' is 'include_positional'
also collects all positional options. also collects all positional options.
Returns the vector of original tokens for all collected Returns the vector of origianl tokens for all collected
options. options.
*/ */
template<class charT> template<class charT>
@@ -254,8 +250,8 @@ namespace boost { namespace program_options {
/** Splits a given string to a collection of single strings which /** Splits a given string to a collection of single strings which
can be passed to command_line_parser. The second parameter is can be passed to command_line_parser. The second parameter is
used to specify a collection of possible separator chars used used to specify a collection of possible seperator chars used
for splitting. The separator is defaulted to space " ". for splitting. The seperator is defaulted to space " ".
Splitting is done in a unix style way, with respect to quotes '"' Splitting is done in a unix style way, with respect to quotes '"'
and escape characters '\' and escape characters '\'
*/ */

View File

@@ -37,7 +37,7 @@ namespace boost { namespace program_options {
public: public:
positional_options_description(); positional_options_description();
/** Specifies that up to 'max_count' next positional options /** Species that up to 'max_count' next positional options
should be given the 'name'. The value of '-1' means 'unlimited'. should be given the 'name'. The value of '-1' means 'unlimited'.
No calls to 'add' can be made after call with 'max_value' equal to No calls to 'add' can be made after call with 'max_value' equal to
'-1'. '-1'.

View File

@@ -51,7 +51,7 @@ namespace boost { namespace program_options {
/** Parses a group of tokens that specify a value of option. /** Parses a group of tokens that specify a value of option.
Stores the result in 'value_store', using whatever representation Stores the result in 'value_store', using whatever representation
is desired. May be called several times if value of the same is desired. May be be called several times if value of the same
option is specified more than once. option is specified more than once.
*/ */
virtual void parse(boost::any& value_store, virtual void parse(boost::any& value_store,
@@ -71,7 +71,7 @@ namespace boost { namespace program_options {
virtual ~value_semantic() {} virtual ~value_semantic() {}
}; };
/** Helper class which performs necessary character conversions in the /** Helper class which perform necessary character conversions in the
'parse' method and forwards the data further. 'parse' method and forwards the data further.
*/ */
template<class charT> template<class charT>
@@ -92,7 +92,7 @@ namespace boost { namespace program_options {
private: // base overrides private: // base overrides
void parse(boost::any& value_store, void parse(boost::any& value_store,
const std::vector<std::string>& new_tokens, const std::vector<std::string>& new_tokens,
bool utf8) const override; bool utf8) const;
protected: // interface for derived classes. protected: // interface for derived classes.
virtual void xparse(boost::any& value_store, virtual void xparse(boost::any& value_store,
const std::vector<std::string>& new_tokens) const std::vector<std::string>& new_tokens)
@@ -112,7 +112,7 @@ namespace boost { namespace program_options {
private: // base overrides private: // base overrides
void parse(boost::any& value_store, void parse(boost::any& value_store,
const std::vector<std::string>& new_tokens, const std::vector<std::string>& new_tokens,
bool utf8) const override; bool utf8) const;
protected: // interface for derived classes. protected: // interface for derived classes.
#if !defined(BOOST_NO_STD_WSTRING) #if !defined(BOOST_NO_STD_WSTRING)
virtual void xparse(boost::any& value_store, virtual void xparse(boost::any& value_store,
@@ -130,34 +130,34 @@ namespace boost { namespace program_options {
: m_zero_tokens(zero_tokens) : m_zero_tokens(zero_tokens)
{} {}
std::string name() const override; std::string name() const;
unsigned min_tokens() const override; unsigned min_tokens() const;
unsigned max_tokens() const override; unsigned max_tokens() const;
bool is_composing() const override { return false; } bool is_composing() const { return false; }
bool is_required() const override { return false; } bool is_required() const { return false; }
/** If 'value_store' is already initialized, or new_tokens /** If 'value_store' is already initialized, or new_tokens
has more than one element, throws. Otherwise, assigns has more than one elements, throws. Otherwise, assigns
the first string from 'new_tokens' to 'value_store', without the first string from 'new_tokens' to 'value_store', without
any modifications. any modifications.
*/ */
void xparse(boost::any& value_store, void xparse(boost::any& value_store,
const std::vector<std::string>& new_tokens) const override; const std::vector<std::string>& new_tokens) const;
/** Does nothing. */ /** Does nothing. */
bool apply_default(boost::any&) const override { return false; } bool apply_default(boost::any&) const { return false; }
/** Does nothing. */ /** Does nothing. */
void notify(const boost::any&) const override {} void notify(const boost::any&) const {}
private: private:
bool m_zero_tokens; bool m_zero_tokens;
}; };
#ifndef BOOST_NO_RTTI #ifndef BOOST_NO_RTTI
/** Base class for all options that have a fixed type, and are /** Base class for all option that have a fixed type, and are
willing to announce this type to the outside world. willing to announce this type to the outside world.
Any 'value_semantics' for which you want to find out the Any 'value_semantics' for which you want to find out the
type can be dynamic_cast-ed to typed_value_base. If conversion type can be dynamic_cast-ed to typed_value_base. If conversion
@@ -218,7 +218,7 @@ namespace boost { namespace program_options {
/** Specifies an implicit value, which will be used /** Specifies an implicit value, which will be used
if the option is given, but without an adjacent value. if the option is given, but without an adjacent value.
Using this implies that an explicit value is optional. Using this implies that an explicit value is optional,
*/ */
typed_value* implicit_value(const T &v) typed_value* implicit_value(const T &v)
{ {
@@ -228,7 +228,7 @@ namespace boost { namespace program_options {
return this; return this;
} }
/** Specifies the name used for the value in the help message. */ /** Specifies the name used to to the value in help message. */
typed_value* value_name(const std::string& name) typed_value* value_name(const std::string& name)
{ {
m_value_name = name; m_value_name = name;
@@ -278,7 +278,7 @@ namespace boost { namespace program_options {
} }
/** Specifies that no tokens may be provided as the value of /** Specifies that no tokens may be provided as the value of
this option, which means that only presence of the option this option, which means that only presense of the option
is significant. For such option to be useful, either the is significant. For such option to be useful, either the
'validate' function should be specialized, or the 'validate' function should be specialized, or the
'implicit_value' method should be also used. In most 'implicit_value' method should be also used. In most
@@ -299,11 +299,11 @@ namespace boost { namespace program_options {
public: // value semantic overrides public: // value semantic overrides
std::string name() const override; std::string name() const;
bool is_composing() const override { return m_composing; } bool is_composing() const { return m_composing; }
unsigned min_tokens() const override unsigned min_tokens() const
{ {
if (m_zero_tokens || !m_implicit_value.empty()) { if (m_zero_tokens || !m_implicit_value.empty()) {
return 0; return 0;
@@ -312,7 +312,7 @@ namespace boost { namespace program_options {
} }
} }
unsigned max_tokens() const override { unsigned max_tokens() const {
if (m_multitoken) { if (m_multitoken) {
return std::numeric_limits<unsigned>::max BOOST_PREVENT_MACRO_SUBSTITUTION(); return std::numeric_limits<unsigned>::max BOOST_PREVENT_MACRO_SUBSTITUTION();
} else if (m_zero_tokens) { } else if (m_zero_tokens) {
@@ -322,19 +322,19 @@ namespace boost { namespace program_options {
} }
} }
bool is_required() const override { return m_required; } bool is_required() const { return m_required; }
/** Creates an instance of the 'validator' class and calls /** Creates an instance of the 'validator' class and calls
its operator() to perform the actual conversion. */ its operator() to perform the actual conversion. */
void xparse(boost::any& value_store, void xparse(boost::any& value_store,
const std::vector< std::basic_string<charT> >& new_tokens) const std::vector< std::basic_string<charT> >& new_tokens)
const override; const;
/** If default value was specified via previous call to /** If default value was specified via previous call to
'default_value', stores that value into 'value_store'. 'default_value', stores that value into 'value_store'.
Returns true if default value was stored. Returns true if default value was stored.
*/ */
virtual bool apply_default(boost::any& value_store) const override virtual bool apply_default(boost::any& value_store) const
{ {
if (m_default_value.empty()) { if (m_default_value.empty()) {
return false; return false;
@@ -347,12 +347,12 @@ namespace boost { namespace program_options {
/** If an address of variable to store value was specified /** If an address of variable to store value was specified
when creating *this, stores the value there. Otherwise, when creating *this, stores the value there. Otherwise,
does nothing. */ does nothing. */
void notify(const boost::any& value_store) const override; void notify(const boost::any& value_store) const;
public: // typed_value_base overrides public: // typed_value_base overrides
#ifndef BOOST_NO_RTTI #ifndef BOOST_NO_RTTI
const std::type_info& value_type() const override const std::type_info& value_type() const
{ {
return typeid(T); return typeid(T);
} }

View File

@@ -62,7 +62,7 @@ namespace boost { namespace program_options {
: v(xv), m_defaulted(xdefaulted) : v(xv), m_defaulted(xdefaulted)
{} {}
/** If stored value is of type T, returns that value. Otherwise, /** If stored value if of type T, returns that value. Otherwise,
throws boost::bad_any_cast exception. */ throws boost::bad_any_cast exception. */
template<class T> template<class T>
const T& as() const { const T& as() const {
@@ -138,7 +138,7 @@ namespace boost { namespace program_options {
const abstract_variables_map* m_next; const abstract_variables_map* m_next;
}; };
/** Concrete variables map which stores variables in real map. /** Concrete variables map which store variables in real map.
This class is derived from std::map<std::string, variable_value>, This class is derived from std::map<std::string, variable_value>,
so you can use all map operators to examine its content. so you can use all map operators to examine its content.
@@ -162,7 +162,7 @@ namespace boost { namespace program_options {
private: private:
/** Implementation of abstract_variables_map::get /** Implementation of abstract_variables_map::get
which does 'find' in *this. */ which does 'find' in *this. */
const variable_value& get(const std::string& name) const override; const variable_value& get(const std::string& name) const;
/** Names of option with 'final' values \-- which should not /** Names of option with 'final' values \-- which should not
be changed by subsequence assignments. */ be changed by subsequence assignments. */

View File

@@ -11,6 +11,5 @@
], ],
"maintainers": [ "maintainers": [
"Vladimir Prus <vladimir.prus -at- gmail.com>" "Vladimir Prus <vladimir.prus -at- gmail.com>"
], ]
"cxxstd": "11"
} }

View File

@@ -3,9 +3,7 @@
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt) // or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/config.hpp> #include <boost/program_options/config.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>

View File

@@ -3,9 +3,8 @@
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt) // or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/config.hpp> #include <boost/program_options/config.hpp>
#include <boost/program_options/detail/config_file.hpp> #include <boost/program_options/detail/config_file.hpp>

View File

@@ -13,9 +13,7 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/config.hpp> #include <boost/program_options/config.hpp>
#include <boost/program_options/detail/convert.hpp> #include <boost/program_options/detail/convert.hpp>
#include <boost/program_options/detail/utf8_codecvt_facet.hpp> #include <boost/program_options/detail/utf8_codecvt_facet.hpp>

View File

@@ -4,9 +4,8 @@
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt) // or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/config.hpp> #include <boost/program_options/config.hpp>
#include <boost/program_options/options_description.hpp> #include <boost/program_options/options_description.hpp>
// FIXME: this is only to get multiple_occurrences class // FIXME: this is only to get multiple_occurrences class

View File

@@ -6,9 +6,7 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/config.hpp> #include <boost/program_options/config.hpp>
#include <boost/program_options/parsers.hpp> #include <boost/program_options/parsers.hpp>
#include <boost/program_options/options_description.hpp> #include <boost/program_options/options_description.hpp>
@@ -155,16 +153,7 @@ namespace boost { namespace program_options {
{ {
boost::throw_exception(reading_file(filename)); boost::throw_exception(reading_file(filename));
} }
return parse_config_file(strm, desc, allow_unregistered);
basic_parsed_options<charT> result
= parse_config_file(strm, desc, allow_unregistered);
if (strm.bad())
{
boost::throw_exception(reading_file(filename));
}
return result;
} }
template template

View File

@@ -3,9 +3,7 @@
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt) // or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/config.hpp> #include <boost/program_options/config.hpp>
#include <boost/program_options/positional_options.hpp> #include <boost/program_options/positional_options.hpp>

View File

@@ -3,9 +3,7 @@
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt) // or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/parsers.hpp> #include <boost/program_options/parsers.hpp>
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>

View File

@@ -3,9 +3,7 @@
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt) // or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/config.hpp> #include <boost/program_options/config.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \ #define BOOST_UTF8_BEGIN_NAMESPACE \

View File

@@ -3,9 +3,7 @@
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt) // or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/config.hpp> #include <boost/program_options/config.hpp>
#include <boost/program_options/value_semantic.hpp> #include <boost/program_options/value_semantic.hpp>
#include <boost/program_options/detail/convert.hpp> #include <boost/program_options/detail/convert.hpp>
@@ -84,14 +82,12 @@ namespace boost { namespace program_options {
} }
#endif #endif
namespace detail {
BOOST_PROGRAM_OPTIONS_DECL std::string arg("arg"); BOOST_PROGRAM_OPTIONS_DECL std::string arg("arg");
}
std::string std::string
untyped_value::name() const untyped_value::name() const
{ {
return detail::arg; return arg;
} }
unsigned unsigned
@@ -262,7 +258,7 @@ namespace boost { namespace program_options {
} }
const char* error_with_option_name::what() const BOOST_NOEXCEPT_OR_NOTHROW const char* error_with_option_name::what() const throw()
{ {
// will substitute tokens each time what is run() // will substitute tokens each time what is run()
substitute_placeholders(m_error_template); substitute_placeholders(m_error_template);

View File

@@ -3,9 +3,8 @@
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt) // or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/config.hpp> #include <boost/program_options/config.hpp>
#include <boost/program_options/parsers.hpp> #include <boost/program_options/parsers.hpp>
#include <boost/program_options/options_description.hpp> #include <boost/program_options/options_description.hpp>

View File

@@ -3,9 +3,7 @@
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt) // or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
#define BOOST_PROGRAM_OPTIONS_SOURCE #define BOOST_PROGRAM_OPTIONS_SOURCE
#endif
#include <boost/program_options/parsers.hpp> #include <boost/program_options/parsers.hpp>
#include <cctype> #include <cctype>

View File

@@ -1,27 +0,0 @@
# Copyright 2018-2020 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(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(NOT HAVE_BOOST_TEST)
return()
endif()
set(BOOST_TEST_LINK_LIBRARIES Boost::program_options)
boost_test(TYPE run SOURCES options_description_test.cpp)
boost_test(TYPE run SOURCES parsers_test.cpp ARGUMENTS ${CMAKE_CURRENT_SOURCE_DIR}/config_test.cfg)
boost_test(TYPE run SOURCES variable_map_test.cpp)
boost_test(TYPE run SOURCES cmdline_test.cpp)
boost_test(TYPE run SOURCES positional_options_test.cpp)
boost_test(TYPE run SOURCES unicode_test.cpp)
boost_test(TYPE run SOURCES winmain.cpp)
boost_test(TYPE run SOURCES exception_test.cpp)
boost_test(TYPE run SOURCES split_test.cpp)
boost_test(TYPE run SOURCES unrecognized_test.cpp)
boost_test(TYPE run SOURCES required_test.cpp ARGUMENTS ${CMAKE_CURRENT_SOURCE_DIR}/required_test.cfg)
boost_test(TYPE run SOURCES exception_txt_test.cpp)
boost_test(TYPE run SOURCES optional_test.cpp)
boost_test(TYPE run SOURCES quick.cpp ARGUMENTS --path=initial LINK_LIBRARIES Boost::core)

View File

@@ -38,7 +38,7 @@ test-suite program_options :
[ run options_description_test.cpp : : : <rtti>off : options_description_no_rtti_test ] [ run options_description_test.cpp : : : <rtti>off : options_description_no_rtti_test ]
; ;
exe test_convert : test_convert.cpp /boost/timer//boost_timer ; exe test_convert : test_convert.cpp ;
# `quick` target (for CI) # `quick` target (for CI)
run quick.cpp : --path=initial ; run quick.cpp : --path=initial ;

View File

@@ -1,18 +0,0 @@
# 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_program_options REQUIRED)
find_package(boost_core REQUIRED)
add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::program_options Boost::core)
enable_testing()
add_test(NAME quick COMMAND quick --path=initial)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@@ -1,18 +0,0 @@
# 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_subdir_test LANGUAGES CXX)
set(BOOST_INCLUDE_LIBRARIES program_options)
add_subdirectory(../../../.. boostorg/boost)
add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::program_options Boost::core)
enable_testing()
add_test(NAME quick COMMAND quick --path=initial)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@@ -7,9 +7,6 @@ namespace po = boost::program_options;
#include <boost/optional.hpp> #include <boost/optional.hpp>
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
# include <optional>
#endif
#include <string> #include <string>
#include "minitest.hpp" #include "minitest.hpp"
@@ -22,10 +19,9 @@ std::vector<std::string> sv(const char* array[], unsigned size)
return r; return r;
} }
template<template<typename> class OptionalType>
void test_optional() void test_optional()
{ {
OptionalType<int> foo, bar, baz; boost::optional<int> foo, bar, baz;
po::options_description desc; po::options_description desc;
desc.add_options() desc.add_options()
@@ -52,9 +48,6 @@ void test_optional()
int main(int, char*[]) int main(int, char*[])
{ {
test_optional<boost::optional>(); test_optional();
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
test_optional<std::optional>();
#endif
return 0; return 0;
} }

View File

@@ -300,10 +300,6 @@ void test_config_file(const char* config_file)
check_value(a2[6], "m1.v3", "3"); check_value(a2[6], "m1.v3", "3");
} }
#if defined(__CYGWIN__)
extern "C" int putenv (char *__string);
#endif
void test_environment() void test_environment()
{ {
options_description desc; options_description desc;
@@ -312,7 +308,7 @@ void test_environment()
("bar", new untyped_value, "") ("bar", new untyped_value, "")
; ;
#if defined(_WIN32) && ! defined(BOOST_BORLANDC) && ! defined(BOOST_EMBTC) #if (defined(_WIN32) && ! defined(BOOST_BORLANDC) && ! defined(BOOST_EMBTC)) || (defined(__CYGWIN__))
_putenv("PO_TEST_FOO=1"); _putenv("PO_TEST_FOO=1");
#else #else
putenv(const_cast<char*>("PO_TEST_FOO=1")); putenv(const_cast<char*>("PO_TEST_FOO=1"));

View File

@@ -3,9 +3,6 @@
// (See accompanying file LICENSE_1_0.txt // (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt) // or copy at http://www.boost.org/LICENSE_1_0.txt)
// This will eventually stop working when <boost/progress.hpp> is removed
#define BOOST_TIMER_ENABLE_DEPRECATED
#include <cstring> #include <cstring>
#include <cassert> #include <cassert>
#include <string> #include <string>

View File

@@ -14,7 +14,7 @@
using namespace std; using namespace std;
using namespace boost::program_options; using namespace boost::program_options;
void check_equal(const std::vector<string>& actual, const char **expected, int n) void check_equal(const std::vector<string>& actual, char **expected, int n)
{ {
if (actual.size() != n) if (actual.size() != n)
{ {
@@ -38,7 +38,7 @@ void test_winmain()
#define C , #define C ,
#define TEST(input, expected) \ #define TEST(input, expected) \
const char* BOOST_PP_CAT(e, __LINE__)[] = expected;\ char* BOOST_PP_CAT(e, __LINE__)[] = expected;\
vector<string> BOOST_PP_CAT(v, __LINE__) = split_winmain(input);\ vector<string> BOOST_PP_CAT(v, __LINE__) = split_winmain(input);\
check_equal(BOOST_PP_CAT(v, __LINE__), BOOST_PP_CAT(e, __LINE__),\ check_equal(BOOST_PP_CAT(v, __LINE__), BOOST_PP_CAT(e, __LINE__),\
sizeof(BOOST_PP_CAT(e, __LINE__))/sizeof(char*)); sizeof(BOOST_PP_CAT(e, __LINE__))/sizeof(char*));