Skip to content

Commit

Permalink
Merge pull request #351 from uilianries/testing/no-filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
uilianries authored Jul 10, 2023
2 parents cf639f7 + 86a677a commit 8d73e29
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- clang++-12
build_type: [Debug, Release]

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

env:
CXX: ${{ matrix.compiler }}
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
- clang++-9
build_type: [Debug, Release]

runs-on: ubuntu-latest
runs-on: ubuntu-20.04

env:
CXX: ${{ matrix.compiler }}
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
flags: ["-fno-rtti", "-fms-extensions"]
build_type: [Debug, Release]

runs-on: ubuntu-latest
runs-on: ubuntu-22.04

env:
CXX: clang++
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
xcode: ['11', '12', '13']
xcode: ['13', '14']
build_type: [Debug, Release]

runs-on: macos-latest
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/no-filesystem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: No-Filesystem

on:
push:
paths-ignore:
- 'README.md'
- 'doc/**'
pull_request:
paths-ignore:
- 'README.md'
- 'doc/**'

jobs:
no-exceptions:
strategy:
fail-fast: false
matrix:
compiler: [g++]
build_type: [Release]

runs-on: ubuntu-latest

env:
CXX: ${{ matrix.compiler }}

steps:
- uses: actions/checkout@v2

- run: cmake -E make_directory build

- working-directory: build/
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DPEGTL_USE_FILESYSTEM=OFF -DPEGTL_USE_BOOST_FILESYSTEM=OFF

- working-directory: build/
run: cmake --build .

- working-directory: build/
run: ctest --output-on-failure
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ target_include_directories(pegtl INTERFACE
target_compile_features(pegtl INTERFACE cxx_std_17)

option(PEGTL_USE_BOOST_FILESYSTEM "Override the auto-detection of std::filesystem and use Boost.Filesystem" OFF)
option(PEGTL_USE_FILESYSTEM "Use available implementation of std::filesystem (std::, std::experiemntal, or Boost)" ON)

# Try compiling a test program with std::filesystem or one of its alternatives
function(check_filesystem_impl FILESYSTEM_HEADER FILESYSTEM_NAMESPACE OPTIONAL_LIBS OUT_RESULT)
Expand Down Expand Up @@ -82,7 +83,10 @@ function(check_filesystem_impl FILESYSTEM_HEADER FILESYSTEM_NAMESPACE OPTIONAL_L
set(${OUT_RESULT} ${TEST_RESULT} PARENT_SCOPE)
endfunction()

if(PEGTL_USE_BOOST_FILESYSTEM)
if (NOT PEGTL_USE_FILESYSTEM)
target_compile_definitions(${PROJECT_NAME} INTERFACE TAO_PEGTL_NO_FILESYSTEM)
message(STATUS "Skipping std::filesystem (or variant) in PEGTL; File operations will not work or compile.")
elseif (PEGTL_USE_BOOST_FILESYSTEM)
# Force the use of Boost.Filesystem: #include <boost/filesystem.hpp> // boost::filesystem
find_package(Boost REQUIRED COMPONENTS filesystem)
target_link_libraries(${PROJECT_NAME} INTERFACE Boost::filesystem)
Expand Down

0 comments on commit 8d73e29

Please sign in to comment.