mirror of
https://github.com/boostorg/program_options.git
synced 2026-01-20 16:52:14 +00:00
Compare commits
32 Commits
boost-1.68
...
feature/ap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1ddaa8a0e | ||
|
|
c832f18c08 | ||
|
|
8f848d8b75 | ||
|
|
1d7cceff6c | ||
|
|
5f233f00be | ||
|
|
fafcca13d8 | ||
|
|
2b8bac66a9 | ||
|
|
3aae04bf65 | ||
|
|
f941ba88a7 | ||
|
|
dbec456b8a | ||
|
|
9f29f8e104 | ||
|
|
93f4114948 | ||
|
|
a97daf413d | ||
|
|
3777e67b9f | ||
|
|
c8cd11ddf5 | ||
|
|
847b130e19 | ||
|
|
0a1e54ba90 | ||
|
|
7bcbb4ea23 | ||
|
|
827426db9c | ||
|
|
e9403da22d | ||
|
|
36052766c7 | ||
|
|
ddfaf00542 | ||
|
|
ce6a40b81a | ||
|
|
7a7f0ce1fa | ||
|
|
f1e9b5dc15 | ||
|
|
df8412fe9e | ||
|
|
3c0d0fa6ee | ||
|
|
f62555fa75 | ||
|
|
43cc2af3b1 | ||
|
|
0414abe3f4 | ||
|
|
a2379420f6 | ||
|
|
fcffe08c83 |
609
.github/workflows/ci.yml
vendored
Normal file
609
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,609 @@
|
||||
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"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:18.04
|
||||
install: g++-4.8
|
||||
- toolset: gcc-5
|
||||
cxxstd: "11,14,1z"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:18.04
|
||||
install: g++-5
|
||||
- toolset: gcc-6
|
||||
cxxstd: "11,14,1z"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:18.04
|
||||
install: g++-6
|
||||
- toolset: gcc-7
|
||||
cxxstd: "11,14,17"
|
||||
os: ubuntu-20.04
|
||||
install: g++-7
|
||||
- toolset: gcc-8
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
install: g++-8
|
||||
- toolset: gcc-9
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
- toolset: gcc-10
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
install: g++-10
|
||||
- toolset: gcc-11
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
install: g++-11
|
||||
- toolset: gcc-12
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
install: g++-12
|
||||
- toolset: gcc-13
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:23.04
|
||||
install: g++-13
|
||||
- toolset: clang
|
||||
compiler: clang++-3.9
|
||||
cxxstd: "11,14"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:18.04
|
||||
install: clang-3.9
|
||||
- toolset: clang
|
||||
compiler: clang++-4.0
|
||||
cxxstd: "11,14"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:18.04
|
||||
install: clang-4.0
|
||||
- toolset: clang
|
||||
compiler: clang++-5.0
|
||||
cxxstd: "11,14,1z"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:18.04
|
||||
install: clang-5.0
|
||||
- toolset: clang
|
||||
compiler: clang++-6.0
|
||||
cxxstd: "11,14,17"
|
||||
os: ubuntu-20.04
|
||||
install: clang-6.0
|
||||
- toolset: clang
|
||||
compiler: clang++-7
|
||||
cxxstd: "11,14,17"
|
||||
os: ubuntu-20.04
|
||||
install: clang-7
|
||||
- toolset: clang
|
||||
compiler: clang++-8
|
||||
cxxstd: "11,14,17"
|
||||
os: ubuntu-20.04
|
||||
install: clang-8
|
||||
- toolset: clang
|
||||
compiler: clang++-9
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
install: clang-9
|
||||
- toolset: clang
|
||||
compiler: clang++-10
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
install: clang-10
|
||||
- toolset: clang
|
||||
compiler: clang++-11
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
install: clang-11
|
||||
- toolset: clang
|
||||
compiler: clang++-12
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
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:23.04
|
||||
os: ubuntu-latest
|
||||
install: clang-16
|
||||
- toolset: clang
|
||||
compiler: clang++-17
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
container: ubuntu:23.10
|
||||
os: ubuntu-latest
|
||||
install: clang-17
|
||||
- toolset: clang
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: macos-11
|
||||
- toolset: clang
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: macos-12
|
||||
- toolset: clang
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: macos-13
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
container: ${{matrix.container}}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup container environment
|
||||
if: matrix.container
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get -y install sudo python3 git g++
|
||||
|
||||
- name: Install packages
|
||||
if: matrix.install
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install ${{matrix.install}}
|
||||
|
||||
- name: Setup Boost
|
||||
run: |
|
||||
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
|
||||
LIBRARY=${GITHUB_REPOSITORY#*/}
|
||||
echo LIBRARY: $LIBRARY
|
||||
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
|
||||
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
|
||||
echo GITHUB_REF: $GITHUB_REF
|
||||
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||
REF=${REF#refs/heads/}
|
||||
echo REF: $REF
|
||||
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
||||
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||
cd ..
|
||||
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||
git submodule update --init tools/boostdep
|
||||
python3 tools/boostdep/depinst/depinst.py --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-11
|
||||
- os: macos-12
|
||||
- os: macos-13
|
||||
|
||||
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-11
|
||||
- os: macos-12
|
||||
- os: macos-13
|
||||
|
||||
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-11
|
||||
- os: macos-12
|
||||
- os: macos-13
|
||||
|
||||
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
|
||||
63
CMakeLists.txt
Normal file
63
CMakeLists.txt
Normal file
@@ -0,0 +1,63 @@
|
||||
# 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()
|
||||
94
appveyor.yml
94
appveyor.yml
@@ -1,78 +1,68 @@
|
||||
# Copyright 2016, 2017 Peter Dimov
|
||||
# Copyright (C) 2017, 2018 James E. King III
|
||||
# Copyright 2016-2019 Peter Dimov
|
||||
# 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)
|
||||
|
||||
# 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}
|
||||
|
||||
shallow_clone: true
|
||||
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- MAYFAIL: true
|
||||
- develop
|
||||
- /feature\/.*/
|
||||
|
||||
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:
|
||||
- FLAVOR: Visual Studio 2017
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
TOOLSET: msvc-14.0
|
||||
CXXSTD: 14,latest
|
||||
ADDRMD: 32,64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
TOOLSET: msvc-14.1
|
||||
B2_ADDRESS_MODEL: address-model=64,32
|
||||
- FLAVOR: Visual Studio 2013
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
TOOLSET: msvc-12.0
|
||||
- FLAVOR: mingw32
|
||||
ARCH: i686
|
||||
B2_ADDRESS_MODEL: address-model=32
|
||||
SCRIPT: ci\mingw.bat
|
||||
- FLAVOR: mingw64
|
||||
ARCH: x86_64
|
||||
B2_ADDRESS_MODEL: address-model=64
|
||||
SCRIPT: ci\mingw.bat
|
||||
- FLAVOR: cygwin (64-bit)
|
||||
ADDPATH: C:\cygwin64\bin;
|
||||
B2_ADDRESS_MODEL: address-model=64
|
||||
TOOLSET: gcc
|
||||
MAYFAIL: true
|
||||
- FLAVOR: cygwin (32-bit)
|
||||
CXXSTD: 14,17,latest
|
||||
ADDRMD: 32,64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
TOOLSET: clang-win
|
||||
CXXSTD: 14,17,latest
|
||||
ADDRMD: 64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
TOOLSET: clang-win
|
||||
CXXSTD: 14,17,20,latest
|
||||
ADDRMD: 64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\cygwin\bin;
|
||||
B2_ADDRESS_MODEL: address-model=32
|
||||
TOOLSET: gcc
|
||||
MAYFAIL: true
|
||||
CXXSTD: 11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\cygwin64\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
ADDPATH: C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 11,14,17,2a
|
||||
- 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:
|
||||
- set SELF=program_options
|
||||
- set BOOST_BRANCH=develop
|
||||
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
|
||||
- cd ..
|
||||
- git clone -b %APPVEYOR_REPO_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
- git clone -b %BOOST_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
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\%SELF%
|
||||
- python tools/boostdep/depinst/depinst.py --include example %SELF%
|
||||
- git submodule update --init tools/boostdep
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\program_options\
|
||||
- python tools/boostdep/depinst/depinst.py program_options
|
||||
- cmd /c bootstrap
|
||||
- b2 headers
|
||||
- b2 -d0 headers
|
||||
|
||||
build: off
|
||||
|
||||
test_script:
|
||||
- set SELF=program_options
|
||||
- PATH=%ADDPATH%%PATH%
|
||||
- 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 "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
||||
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
|
||||
- b2 -j3 libs/program_options/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace boost { namespace program_options { namespace detail {
|
||||
const std::set<std::string>& allowed_options,
|
||||
bool allow_unregistered = false);
|
||||
|
||||
virtual ~common_config_file_iterator() {}
|
||||
BOOST_DEFAULTED_FUNCTION(virtual ~common_config_file_iterator(), {})
|
||||
|
||||
public: // Method required by eof_iterator
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace boost { namespace program_options {
|
||||
basic_command_line_parser<charT>::
|
||||
basic_command_line_parser(int argc, const charT* const argv[])
|
||||
: detail::cmdline(
|
||||
to_internal(std::vector<std::basic_string<charT> >(argv+1, argv+argc))),
|
||||
to_internal(std::vector<std::basic_string<charT> >(argc ? argv+1 : argv, argv+argc))),
|
||||
m_desc()
|
||||
{}
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
|
||||
# include <optional>
|
||||
#endif
|
||||
|
||||
// forward declaration
|
||||
namespace boost { template<class T> class optional; }
|
||||
|
||||
@@ -169,6 +173,22 @@ namespace boost { namespace program_options {
|
||||
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, (T*)0, 0);
|
||||
v = boost::any(std::optional<T>(boost::any_cast<T>(a)));
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class T, class charT>
|
||||
void
|
||||
typed_value<T, charT>::
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace boost { namespace program_options {
|
||||
}
|
||||
|
||||
/** Base class for all errors in the library. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL error : public std::logic_error {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE error : public std::logic_error {
|
||||
public:
|
||||
error(const std::string& xwhat) : std::logic_error(xwhat) {}
|
||||
};
|
||||
@@ -44,7 +44,7 @@ namespace boost { namespace program_options {
|
||||
/** Class thrown when there are too many positional options.
|
||||
This is a programming error.
|
||||
*/
|
||||
class BOOST_PROGRAM_OPTIONS_DECL too_many_positional_options_error : public error {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE too_many_positional_options_error : public error {
|
||||
public:
|
||||
too_many_positional_options_error()
|
||||
: error("too many positional options have been specified on the command line")
|
||||
@@ -52,7 +52,7 @@ namespace boost { namespace program_options {
|
||||
};
|
||||
|
||||
/** Class thrown when there are programming error related to style */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_command_line_style : public error {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_command_line_style : public error {
|
||||
public:
|
||||
invalid_command_line_style(const std::string& msg)
|
||||
: error(msg)
|
||||
@@ -60,7 +60,7 @@ namespace boost { namespace program_options {
|
||||
};
|
||||
|
||||
/** Class thrown if config file can not be read */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL reading_file : public error {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE reading_file : public error {
|
||||
public:
|
||||
reading_file(const char* filename)
|
||||
: error(std::string("can not read options configuration file '").append(filename).append("'"))
|
||||
@@ -91,7 +91,7 @@ namespace boost { namespace program_options {
|
||||
* or without a prefix (from a configuration file)
|
||||
*
|
||||
* */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL error_with_option_name : public error {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE error_with_option_name : public error {
|
||||
|
||||
protected:
|
||||
/** can be
|
||||
@@ -121,7 +121,7 @@ namespace boost { namespace program_options {
|
||||
/** gcc says that throw specification on dtor is loosened
|
||||
* without this line
|
||||
* */
|
||||
~error_with_option_name() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~error_with_option_name() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
|
||||
|
||||
//void dump() const
|
||||
@@ -183,7 +183,7 @@ namespace boost { namespace program_options {
|
||||
|
||||
/** Creates the error_message on the fly
|
||||
* Currently a thin wrapper for substitute_placeholders() */
|
||||
virtual const char* what() const throw();
|
||||
virtual const char* what() const BOOST_NOEXCEPT_OR_NOTHROW;
|
||||
|
||||
protected:
|
||||
/** 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
|
||||
user called a method which cannot return them all. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL multiple_values : public error_with_option_name {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE multiple_values : public error_with_option_name {
|
||||
public:
|
||||
multiple_values()
|
||||
: error_with_option_name("option '%canonical_option%' only takes a single argument"){}
|
||||
|
||||
~multiple_values() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~multiple_values() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
};
|
||||
|
||||
/** Class thrown when there are several occurrences of an
|
||||
option, but user called a method which cannot return
|
||||
them all. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL multiple_occurrences : public error_with_option_name {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE multiple_occurrences : public error_with_option_name {
|
||||
public:
|
||||
multiple_occurrences()
|
||||
: error_with_option_name("option '%canonical_option%' cannot be specified more than once"){}
|
||||
|
||||
~multiple_occurrences() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~multiple_occurrences() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
|
||||
};
|
||||
|
||||
/** Class thrown when a required/mandatory option is missing */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL required_option : public error_with_option_name {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE required_option : public error_with_option_name {
|
||||
public:
|
||||
// option name is constructed by the option_descriptor and never on the fly
|
||||
required_option(const std::string& option_name)
|
||||
@@ -233,7 +233,7 @@ namespace boost { namespace program_options {
|
||||
{
|
||||
}
|
||||
|
||||
~required_option() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~required_option() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
};
|
||||
|
||||
/** Base class of unparsable options,
|
||||
@@ -247,7 +247,7 @@ namespace boost { namespace program_options {
|
||||
* a lot easier, even if the name indicates some sort of conceptual dissonance!
|
||||
*
|
||||
* */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL error_with_no_option_name : public error_with_option_name {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE error_with_no_option_name : public error_with_option_name {
|
||||
public:
|
||||
error_with_no_option_name(const std::string& template_,
|
||||
const std::string& original_token = "")
|
||||
@@ -258,34 +258,34 @@ namespace boost { namespace program_options {
|
||||
/** Does NOT set option name, because no option name makes sense */
|
||||
virtual void set_option_name(const std::string&) {}
|
||||
|
||||
~error_with_no_option_name() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~error_with_no_option_name() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
};
|
||||
|
||||
|
||||
/** Class thrown when option name is not recognized. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL unknown_option : public error_with_no_option_name {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE unknown_option : public error_with_no_option_name {
|
||||
public:
|
||||
unknown_option(const std::string& original_token = "")
|
||||
: error_with_no_option_name("unrecognised option '%canonical_option%'", original_token)
|
||||
{
|
||||
}
|
||||
|
||||
~unknown_option() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~unknown_option() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** Class thrown when there's ambiguity amoung several possible options. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL ambiguous_option : public error_with_no_option_name {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE ambiguous_option : public error_with_no_option_name {
|
||||
public:
|
||||
ambiguous_option(const std::vector<std::string>& xalternatives)
|
||||
: error_with_no_option_name("option '%canonical_option%' is ambiguous"),
|
||||
m_alternatives(xalternatives)
|
||||
{}
|
||||
|
||||
~ambiguous_option() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~ambiguous_option() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
|
||||
const std::vector<std::string>& alternatives() const throw() {return m_alternatives;}
|
||||
const std::vector<std::string>& alternatives() const BOOST_NOEXCEPT_OR_NOTHROW {return m_alternatives;}
|
||||
|
||||
protected:
|
||||
/** Makes all substitutions using the template */
|
||||
@@ -299,7 +299,7 @@ namespace boost { namespace program_options {
|
||||
/** Class thrown when there's syntax error either for command
|
||||
* line or config file options. See derived children for
|
||||
* concrete classes. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_syntax : public error_with_option_name {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_syntax : public error_with_option_name {
|
||||
public:
|
||||
enum kind_t {
|
||||
long_not_allowed = 30,
|
||||
@@ -320,7 +320,7 @@ namespace boost { namespace program_options {
|
||||
{
|
||||
}
|
||||
|
||||
~invalid_syntax() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~invalid_syntax() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
|
||||
kind_t kind() const {return m_kind;}
|
||||
|
||||
@@ -332,7 +332,7 @@ namespace boost { namespace program_options {
|
||||
kind_t m_kind;
|
||||
};
|
||||
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_config_file_syntax : public invalid_syntax {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_config_file_syntax : public invalid_syntax {
|
||||
public:
|
||||
invalid_config_file_syntax(const std::string& invalid_line, kind_t kind):
|
||||
invalid_syntax(kind)
|
||||
@@ -340,7 +340,7 @@ namespace boost { namespace program_options {
|
||||
m_substitutions["invalid_line"] = invalid_line;
|
||||
}
|
||||
|
||||
~invalid_config_file_syntax() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~invalid_config_file_syntax() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
|
||||
/** Convenience functions for backwards compatibility */
|
||||
virtual std::string tokens() const {return m_substitutions.find("invalid_line")->second; }
|
||||
@@ -348,19 +348,19 @@ namespace boost { namespace program_options {
|
||||
|
||||
|
||||
/** Class thrown when there are syntax errors in given command line */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_command_line_syntax : public invalid_syntax {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_command_line_syntax : public invalid_syntax {
|
||||
public:
|
||||
invalid_command_line_syntax(kind_t kind,
|
||||
const std::string& option_name = "",
|
||||
const std::string& original_token = "",
|
||||
int option_style = 0):
|
||||
invalid_syntax(kind, option_name, original_token, option_style) {}
|
||||
~invalid_command_line_syntax() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~invalid_command_line_syntax() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
};
|
||||
|
||||
|
||||
/** Class thrown when value of option is incorrect. */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL validation_error : public error_with_option_name {
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE validation_error : public error_with_option_name {
|
||||
public:
|
||||
enum kind_t {
|
||||
multiple_values_not_allowed = 30,
|
||||
@@ -380,7 +380,7 @@ namespace boost { namespace program_options {
|
||||
{
|
||||
}
|
||||
|
||||
~validation_error() throw() {}
|
||||
BOOST_DEFAULTED_FUNCTION(~validation_error() BOOST_NOEXCEPT_OR_NOTHROW, {})
|
||||
|
||||
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 BOOST_PROGRAM_OPTIONS_DECL invalid_option_value
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_option_value
|
||||
: public validation_error
|
||||
{
|
||||
public:
|
||||
@@ -402,7 +402,7 @@ namespace boost { namespace program_options {
|
||||
};
|
||||
|
||||
/** Class thrown if there is an invalid bool value given */
|
||||
class BOOST_PROGRAM_OPTIONS_DECL invalid_bool_value
|
||||
class BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_VISIBLE invalid_bool_value
|
||||
: public validation_error
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -120,7 +120,11 @@ namespace boost { namespace program_options {
|
||||
basic_command_line_parser(const std::vector<
|
||||
std::basic_string<charT> >& args);
|
||||
/** Creates a command line parser for the specified arguments
|
||||
list. The parameters should be the same as passed to 'main'.
|
||||
list. The parameters should be the same as passed to 'main', meaning:
|
||||
@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[]);
|
||||
|
||||
|
||||
@@ -11,5 +11,6 @@
|
||||
],
|
||||
"maintainers": [
|
||||
"Vladimir Prus <vladimir.prus -at- gmail.com>"
|
||||
]
|
||||
],
|
||||
"cxxstd": "11"
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
#include <boost/program_options/config.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
@@ -15,7 +17,7 @@
|
||||
#include <boost/program_options/positional_options.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/bind/bind.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -29,6 +31,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace boost::placeholders;
|
||||
|
||||
namespace boost { namespace program_options {
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
#include <boost/program_options/config.hpp>
|
||||
|
||||
#include <boost/program_options/detail/config_file.hpp>
|
||||
|
||||
@@ -13,15 +13,18 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
#include <boost/program_options/config.hpp>
|
||||
#include <boost/program_options/detail/convert.hpp>
|
||||
#include <boost/program_options/detail/utf8_codecvt_facet.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/bind/bind.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace boost::placeholders;
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
#include <boost/program_options/config.hpp>
|
||||
#include <boost/program_options/options_description.hpp>
|
||||
// FIXME: this is only to get multiple_occurrences class
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
#include <boost/program_options/config.hpp>
|
||||
#include <boost/program_options/parsers.hpp>
|
||||
#include <boost/program_options/options_description.hpp>
|
||||
@@ -16,7 +18,7 @@
|
||||
#include <boost/program_options/environment_iterator.hpp>
|
||||
#include <boost/program_options/detail/convert.hpp>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <cctype>
|
||||
@@ -61,6 +63,7 @@ extern char** environ;
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace boost::placeholders;
|
||||
|
||||
namespace boost { namespace program_options {
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
#include <boost/program_options/config.hpp>
|
||||
|
||||
#include <boost/program_options/positional_options.hpp>
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
|
||||
#include <boost/program_options/parsers.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
#include <boost/program_options/config.hpp>
|
||||
|
||||
#define BOOST_UTF8_BEGIN_NAMESPACE \
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
#include <boost/program_options/config.hpp>
|
||||
#include <boost/program_options/value_semantic.hpp>
|
||||
#include <boost/program_options/detail/convert.hpp>
|
||||
@@ -258,7 +260,7 @@ namespace boost { namespace program_options {
|
||||
}
|
||||
|
||||
|
||||
const char* error_with_option_name::what() const throw()
|
||||
const char* error_with_option_name::what() const BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
// will substitute tokens each time what is run()
|
||||
substitute_placeholders(m_error_template);
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
#include <boost/program_options/config.hpp>
|
||||
#include <boost/program_options/parsers.hpp>
|
||||
#include <boost/program_options/options_description.hpp>
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#ifndef BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
# define BOOST_PROGRAM_OPTIONS_SOURCE
|
||||
#endif
|
||||
#include <boost/program_options/parsers.hpp>
|
||||
#include <cctype>
|
||||
|
||||
|
||||
27
test/CMakeLists.txt
Normal file
27
test/CMakeLists.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
# 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)
|
||||
@@ -35,7 +35,7 @@ test-suite program_options :
|
||||
[ po-test required_test.cpp : required_test.cfg ]
|
||||
[ po-test exception_txt_test.cpp ]
|
||||
[ po-test optional_test.cpp ]
|
||||
[ run options_description_test.cpp : : : <rtti>off <define>BOOST_NO_RTTI <define>BOOST_NO_TYPEID : options_description_no_rtti_test ]
|
||||
[ run options_description_test.cpp : : : <rtti>off : options_description_no_rtti_test ]
|
||||
;
|
||||
|
||||
exe test_convert : test_convert.cpp ;
|
||||
|
||||
18
test/cmake_install_test/CMakeLists.txt
Normal file
18
test/cmake_install_test/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
# 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>)
|
||||
18
test/cmake_subdir_test/CMakeLists.txt
Normal file
18
test/cmake_subdir_test/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
# 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>)
|
||||
@@ -7,6 +7,9 @@ namespace po = boost::program_options;
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
|
||||
# include <optional>
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
#include "minitest.hpp"
|
||||
@@ -19,9 +22,10 @@ std::vector<std::string> sv(const char* array[], unsigned size)
|
||||
return r;
|
||||
}
|
||||
|
||||
template<template<typename> class OptionalType>
|
||||
void test_optional()
|
||||
{
|
||||
boost::optional<int> foo, bar, baz;
|
||||
OptionalType<int> foo, bar, baz;
|
||||
|
||||
po::options_description desc;
|
||||
desc.add_options()
|
||||
@@ -48,6 +52,9 @@ void test_optional()
|
||||
|
||||
int main(int, char*[])
|
||||
{
|
||||
test_optional();
|
||||
test_optional<boost::optional>();
|
||||
#ifndef BOOST_NO_CXX17_HDR_OPTIONAL
|
||||
test_optional<std::optional>();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -300,6 +300,10 @@ void test_config_file(const char* config_file)
|
||||
check_value(a2[6], "m1.v3", "3");
|
||||
}
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
extern "C" int putenv (char *__string);
|
||||
#endif
|
||||
|
||||
void test_environment()
|
||||
{
|
||||
options_description desc;
|
||||
@@ -308,7 +312,7 @@ void test_environment()
|
||||
("bar", new untyped_value, "")
|
||||
;
|
||||
|
||||
#if (defined(_WIN32) && ! defined(__BORLANDC__)) || (defined(__CYGWIN__))
|
||||
#if defined(_WIN32) && ! defined(BOOST_BORLANDC) && ! defined(BOOST_EMBTC)
|
||||
_putenv("PO_TEST_FOO=1");
|
||||
#else
|
||||
putenv(const_cast<char*>("PO_TEST_FOO=1"));
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
// (See accompanying file 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 <cassert>
|
||||
#include <string>
|
||||
|
||||
@@ -9,13 +9,12 @@
|
||||
#include <cctype>
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <boost/program_options/parsers.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include <boost/program_options/parsers.hpp>
|
||||
using namespace boost::program_options;
|
||||
|
||||
void check_equal(const std::vector<string>& actual, char **expected, int n)
|
||||
void check_equal(const std::vector<string>& actual, const char **expected, int n)
|
||||
{
|
||||
if (actual.size() != n)
|
||||
{
|
||||
@@ -39,7 +38,7 @@ void test_winmain()
|
||||
|
||||
#define C ,
|
||||
#define TEST(input, expected) \
|
||||
char* BOOST_PP_CAT(e, __LINE__)[] = expected;\
|
||||
const char* BOOST_PP_CAT(e, __LINE__)[] = expected;\
|
||||
vector<string> BOOST_PP_CAT(v, __LINE__) = split_winmain(input);\
|
||||
check_equal(BOOST_PP_CAT(v, __LINE__), BOOST_PP_CAT(e, __LINE__),\
|
||||
sizeof(BOOST_PP_CAT(e, __LINE__))/sizeof(char*));
|
||||
|
||||
Reference in New Issue
Block a user