Skip to content

Commit cbc9cb6

Browse files
committed
Support C++11 and C++17 filesystem builds on VS 2026
Use Boost.Filesystem when VS 2026 builds below C++17, while retaining std::filesystem for C++17 and adding a targeted CI job for that path. Signed-off-by: Gareth Sylvester-Bradley <garethsb@nvidia.com>
1 parent b193996 commit cbc9cb6

4 files changed

Lines changed: 43 additions & 10 deletions

File tree

.github/workflows/build-test.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
SECRET_RESULTS_SHEET_ID: ${{ secrets.RESULTS_SHEET_ID }}
1313
jobs:
1414
build_and_test:
15-
name: '${{ matrix.os }}: build and test (install mdns: ${{ matrix.install_mdns }}, use conan: ${{ matrix.use_conan }}, force cpprest asio: ${{ matrix.force_cpprest_asio }}, dns-sd mode: ${{ matrix.dns_sd_mode}}, enable_authorization: ${{ matrix.enable_authorization }})'
15+
name: "${{ matrix.os }}: build and test (C++ standard: ${{ matrix.cxx_standard || 'minimum' }}, install mdns: ${{ matrix.install_mdns }}, use conan: ${{ matrix.use_conan }}, force cpprest asio: ${{ matrix.force_cpprest_asio }}, dns-sd mode: ${{ matrix.dns_sd_mode}}, enable_authorization: ${{ matrix.enable_authorization }})"
1616
runs-on: ${{ matrix.os }}
1717
strategy:
1818
fail-fast: false
@@ -49,6 +49,14 @@ jobs:
4949
- os: ubuntu-24.04
5050
force_cpprest_asio: true
5151
include:
52+
# exercise std::filesystem on VS 2026; regular windows-2025 jobs use the minimum standard
53+
- os: windows-2025
54+
install_mdns: false
55+
use_conan: true
56+
force_cpprest_asio: false
57+
dns_sd_mode: multicast
58+
enable_authorization: true
59+
cxx_standard: 17
5260
# keep one VS 2022 job while validating VS 2026 on windows-2025
5361
- os: windows-2022
5462
install_mdns: false
@@ -69,16 +77,21 @@ jobs:
6977
authorization_mode=noauth
7078
fi
7179
80+
if [[ -n "${{ matrix.cxx_standard }}" ]]; then
81+
cxx_standard_suffix="_cxx${{ matrix.cxx_standard }}"
82+
echo "CMAKE_EXTRA_ARGS=${{ env.CMAKE_EXTRA_ARGS }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }}" >> $GITHUB_ENV
83+
fi
84+
7285
if [[ "${{ runner.os }}" == "Linux" ]]; then
7386
if [[ "${{ matrix.install_mdns }}" == "true" ]]; then
74-
echo "BUILD_NAME=${{ matrix.os }}_mdns_${{ matrix.dns_sd_mode }}_$authorization_mode" >> $GITHUB_ENV
87+
echo "BUILD_NAME=${{ matrix.os }}_mdns_${{ matrix.dns_sd_mode }}_$authorization_mode$cxx_standard_suffix" >> $GITHUB_ENV
7588
else
76-
echo "BUILD_NAME=${{ matrix.os }}_avahi_${{ matrix.dns_sd_mode }}_$authorization_mode" >> $GITHUB_ENV
89+
echo "BUILD_NAME=${{ matrix.os }}_avahi_${{ matrix.dns_sd_mode }}_$authorization_mode$cxx_standard_suffix" >> $GITHUB_ENV
7790
fi
7891
elif [[ "${{ matrix.force_cpprest_asio }}" == "true" ]]; then
79-
echo "BUILD_NAME=${{ matrix.os }}_asio_$authorization_mode" >> $GITHUB_ENV
92+
echo "BUILD_NAME=${{ matrix.os }}_asio_$authorization_mode$cxx_standard_suffix" >> $GITHUB_ENV
8093
else
81-
echo "BUILD_NAME=${{ matrix.os }}_$authorization_mode" >> $GITHUB_ENV
94+
echo "BUILD_NAME=${{ matrix.os }}_$authorization_mode$cxx_standard_suffix" >> $GITHUB_ENV
8295
fi
8396
GITHUB_COMMIT=`echo "${{ github.sha }}" | cut -c1-7`
8497
echo "GITHUB_COMMIT=$GITHUB_COMMIT" >> $GITHUB_ENV

.github/workflows/src/build-test.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
SECRET_RESULTS_SHEET_ID: ${{ secrets.RESULTS_SHEET_ID }}
1313
jobs:
1414
build_and_test:
15-
name: '${{ matrix.os }}: build and test (install mdns: ${{ matrix.install_mdns }}, use conan: ${{ matrix.use_conan }}, force cpprest asio: ${{ matrix.force_cpprest_asio }}, dns-sd mode: ${{ matrix.dns_sd_mode}}, enable_authorization: ${{ matrix.enable_authorization }})'
15+
name: "${{ matrix.os }}: build and test (C++ standard: ${{ matrix.cxx_standard || 'minimum' }}, install mdns: ${{ matrix.install_mdns }}, use conan: ${{ matrix.use_conan }}, force cpprest asio: ${{ matrix.force_cpprest_asio }}, dns-sd mode: ${{ matrix.dns_sd_mode}}, enable_authorization: ${{ matrix.enable_authorization }})"
1616
runs-on: ${{ matrix.os }}
1717
strategy:
1818
fail-fast: false
@@ -49,6 +49,14 @@ jobs:
4949
- os: ubuntu-24.04
5050
force_cpprest_asio: true
5151
include:
52+
# exercise std::filesystem on VS 2026; regular windows-2025 jobs use the minimum standard
53+
- os: windows-2025
54+
install_mdns: false
55+
use_conan: true
56+
force_cpprest_asio: false
57+
dns_sd_mode: multicast
58+
enable_authorization: true
59+
cxx_standard: 17
5260
# keep one VS 2022 job while validating VS 2026 on windows-2025
5361
- os: windows-2022
5462
install_mdns: false
@@ -69,16 +77,21 @@ jobs:
6977
authorization_mode=noauth
7078
fi
7179
80+
if [[ -n "${{ matrix.cxx_standard }}" ]]; then
81+
cxx_standard_suffix="_cxx${{ matrix.cxx_standard }}"
82+
echo "CMAKE_EXTRA_ARGS=${{ env.CMAKE_EXTRA_ARGS }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx_standard }}" >> $GITHUB_ENV
83+
fi
84+
7285
if [[ "${{ runner.os }}" == "Linux" ]]; then
7386
if [[ "${{ matrix.install_mdns }}" == "true" ]]; then
74-
echo "BUILD_NAME=${{ matrix.os }}_mdns_${{ matrix.dns_sd_mode }}_$authorization_mode" >> $GITHUB_ENV
87+
echo "BUILD_NAME=${{ matrix.os }}_mdns_${{ matrix.dns_sd_mode }}_$authorization_mode$cxx_standard_suffix" >> $GITHUB_ENV
7588
else
76-
echo "BUILD_NAME=${{ matrix.os }}_avahi_${{ matrix.dns_sd_mode }}_$authorization_mode" >> $GITHUB_ENV
89+
echo "BUILD_NAME=${{ matrix.os }}_avahi_${{ matrix.dns_sd_mode }}_$authorization_mode$cxx_standard_suffix" >> $GITHUB_ENV
7790
fi
7891
elif [[ "${{ matrix.force_cpprest_asio }}" == "true" ]]; then
79-
echo "BUILD_NAME=${{ matrix.os }}_asio_$authorization_mode" >> $GITHUB_ENV
92+
echo "BUILD_NAME=${{ matrix.os }}_asio_$authorization_mode$cxx_standard_suffix" >> $GITHUB_ENV
8093
else
81-
echo "BUILD_NAME=${{ matrix.os }}_$authorization_mode" >> $GITHUB_ENV
94+
echo "BUILD_NAME=${{ matrix.os }}_$authorization_mode$cxx_standard_suffix" >> $GITHUB_ENV
8295
fi
8396
GITHUB_COMMIT=`echo "${{ github.sha }}" | cut -c1-7`
8497
echo "GITHUB_COMMIT=$GITHUB_COMMIT" >> $GITHUB_ENV

Development/bst/filesystem.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
// From VS2026, or more precisely, MSVC Build Tools v14.51, <experimental/filesystem> is finally removed
2020
// See https://learn.microsoft.com/en-us/visualstudio/releases/2026/release-notes
2121
// and https://github.com/microsoft/STL/pull/5765
22+
#if _MSVC_LANG >= 201703L
2223
#define BST_FILESYSTEM_STD
24+
#else
25+
#define BST_FILESYSTEM_BOOST
26+
#endif
2327
#elif _MSC_VER >= 1910
2428
// From VS2017, /std:c++17 switch is introduced, but this is only indicated in __cplusplus if /Zc:__cplusplus is also specified
2529
#if __cplusplus >= 201703L

Development/cmake/NmosCppDependencies.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwi
1212
# add filesystem (for bst/filesystem.h, used by nmos/filesystem_route.cpp)
1313
list(APPEND FIND_BOOST_COMPONENTS filesystem)
1414
endif()
15+
elseif(MSVC AND MSVC_VERSION GREATER_EQUAL 1951 AND (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 17))
16+
# MSVC 14.51 removed <experimental/filesystem>, so C++11/14 builds use Boost.Filesystem
17+
list(APPEND FIND_BOOST_COMPONENTS filesystem)
1518
endif()
1619
# since std::shared_mutex is not available until C++17
1720
# see bst/shared_mutex.h

0 commit comments

Comments
 (0)