From d87ac130cf543f9ec84132cd450a54fcd36104fa Mon Sep 17 00:00:00 2001 From: Steffen Schuemann Date: Sun, 4 Jul 2021 20:24:13 +0200 Subject: [PATCH] Squashed commit of the following: commit 2bef80eec1fe16a23e34143b9a5a32b04d612ed2 Author: Steffen Schuemann Date: Sun Jul 4 20:11:36 2021 +0200 wip commit e8c063d7ea66d2bdcbd1535b12dac1ca24afc7b9 Author: Steffen Schuemann Date: Sun Jul 4 20:05:04 2021 +0200 wip commit aafdebf274cafacfd6e1472621b015e48d547412 Author: Steffen Schuemann Date: Sun Jul 4 19:50:39 2021 +0200 wip commit b36f13655a09c3bac62afc6079ba010eb934493d Author: Steffen Schuemann Date: Sun Jul 4 18:05:35 2021 +0200 wip commit eee191875c0d6816022342d341eaa43f5f83c4ff Author: Steffen Schuemann Date: Sun Jul 4 17:32:35 2021 +0200 more wip commit 0ff949ab5f21055298aee8d7fcdda3a10f61a69c Author: Steffen Schuemann Date: Sun Jul 4 17:12:18 2021 +0200 wip commit ca68861cb4c4e14079bb3ab2e0c9725b0a3aece8 Author: Steffen Schuemann Date: Sun Jul 4 16:31:32 2021 +0200 wip commit e188a3d2cca4f4bb84c3fa8f49e5de34ec731713 Author: Steffen Schuemann Date: Sun Jul 4 16:21:51 2021 +0200 wip commit b8383ac22cdb5bab3a4f527a1c46dafd009b2f11 Author: Steffen Schuemann Date: Sun Jul 4 16:15:42 2021 +0200 Workflow wip... commit 162416fe2cf2922382c7c7fd34c648b4782d48be Author: Steffen Schuemann Date: Sun Jul 4 15:57:31 2021 +0200 Workflow wip... commit 891be4cdd72b23ec86bdc0935d9201841c2c07bc Author: Steffen Schuemann Date: Sun Jul 4 15:52:24 2021 +0200 Workflow wip... commit 5c2ee653f41a38858cfaf602df639276ae1c7fbb Author: Steffen Schuemann Date: Sun Jul 4 15:44:59 2021 +0200 Workflow wip... commit bca8df081885aed67ce0952f20aa2e4a96072a04 Author: Steffen Schuemann Date: Sun Jul 4 15:40:23 2021 +0200 Workflow wip... commit d94d8de098d954bffae65aec789d72c5c0b1301b Author: Steffen Schuemann Date: Sun Jul 4 15:34:16 2021 +0200 Workflow wip... commit 19f301992b733e699054050fdf552c982fea300c Author: Steffen Schuemann Date: Sat Jul 3 21:54:11 2021 +0200 Workflow wip... commit 495457726fc844d014e49b56acd6367160f4322b Author: Steffen Schuemann Date: Sat Jul 3 18:38:04 2021 +0200 workflow wip commit fde42cd4a5f865807703ff6814d9d0e8dfbde030 Author: Steffen Schuemann Date: Sat Jul 3 18:34:47 2021 +0200 Testing more generic workflow. commit ead40cc153814e23ef3ddcb654ed8c57c10f54a6 Author: Steffen Schuemann Date: Sat Jul 3 16:51:25 2021 +0200 Work on using GitHub workflows. --- .github/workflows/build_cmake.yml | 197 ++++++++++++++++++++++++++++++ .travis.yml | 100 --------------- CMakeLists.txt | 1 + README.md | 37 +++++- cmake/GhcHelper.cmake | 3 +- include/ghc/filesystem.hpp | 2 +- test/CMakeLists.txt | 6 + 7 files changed, 242 insertions(+), 104 deletions(-) create mode 100644 .github/workflows/build_cmake.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml new file mode 100644 index 0000000..2e3fc3d --- /dev/null +++ b/.github/workflows/build_cmake.yml @@ -0,0 +1,197 @@ +name: CMake Build Matrix + +on: [ push, pull_request ] + +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - name: "Ubuntu 20.04 GCC 9.3" + os: ubuntu-20.04 + build_type: Release + packages: ninja-build + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: gcc + cxx: g++ + + - name: "Ubuntu 20.04 Clang 10.0" + os: ubuntu-20.04 + build_type: Release + packages: ninja-build + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: clang-10 + cxx: clang++-10 + + - name: "Ubuntu 20.04 Clang 11.0" + os: ubuntu-20.04 + build_type: Release + packages: ninja-build clang-11 libc++-11-dev libc++abi-11-dev + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: clang-11 + cxx: clang++-11 + + - name: "Ubuntu 20.04 GCC 9.3 coverage" + os: ubuntu-20.04 + build_type: Debug + packages: ninja-build lcov + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: gcc + cxx: g++ + + - name: "Ubuntu 18.04 GCC 8.4" + os: ubuntu-18.04 + build_type: Release + packages: ninja-build gcc-8 g++-8 + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17" + cc: gcc-8 + cxx: g++-8 + + - name: "Ubuntu 18.04 GCC 7.5" + os: ubuntu-18.04 + build_type: Release + packages: ninja-build + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17" + cc: gcc-7 + cxx: g++-7 + + - name: "Ubuntu 18.04 GCC 6.5" + os: ubuntu-18.04 + build_type: Release + packages: ninja-build gcc-6 g++-6 + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17" + cc: gcc-6 + cxx: g++-6 + + - name: "Ubuntu 18.04 GCC 5.5" + os: ubuntu-18.04 + build_type: Release + packages: ninja-build gcc-5 g++-5 + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17" + cc: gcc-5 + cxx: g++-5 + + - name: "Ubuntu 18.04 Clang 9.0" + os: ubuntu-18.04 + build_type: Release + packages: ninja-build libc++-9-dev libc++abi-9-dev + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: clang + cxx: clang++ + + - name: "Ubuntu 16.04 Clang 6.0" + os: ubuntu-16.04 + build_type: Release + packages: ninja-build clang-6.0 + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17" + cc: clang-6.0 + cxx: clang++-6.0 + + - name: "Ubuntu 16.04 Clang 5.0" + os: ubuntu-16.04 + build_type: Release + packages: ninja-build clang-5.0 + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17" + cc: clang-5.0 + cxx: clang++-5.0 + + - name: "Windows MSVC 2019" + os: windows-latest + build_type: Release + packages: ninja + generator: "Visual Studio 16 2019" + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: cl + cxx: cl + + - name: "macOS 10.15 AppleClang" + os: macos-10.15 + build_type: Release + packages: ninja + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17" + cc: clang + cxx: clang++ + + steps: + - uses: actions/checkout@v2 + + - name: print environment + run: | + echo github.event.action: ${{ github.event.action }} + echo github.event_name: ${{ github.event_name }} + + - name: Install dependencies on Ubuntu + if: startsWith(matrix.config.os, 'ubuntu') + shell: bash + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + sudo apt update + sudo apt install ${{ matrix.config.packages }} + + - name: Install dependencies on windows + if: startsWith(matrix.config.os, 'windows') + run: | + choco install ${{ matrix.config.packages }} + + - name: Install dependencies on macOS + if: startsWith(matrix.config.os, 'macos') + run: | + brew install ${{ matrix.config.packages }} + + - name: Configure project + shell: bash + run: | + export CC=${{ matrix.config.cc }} + export CXX=${{ matrix.config.cxx }} + ninja --version + cmake --version + mkdir build + mkdir install + if [[ "${{ matrix.config.build_type }}" == "Debug" ]]; then + cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=Debug -DGHC_COVERAGE=ON -DGHC_FILESYSTEM_TEST_COMPILE_FEATURES="${{ matrix.config.compatibility }}" -DCMAKE_INSTALL_PREFIX:PATH=install + else + cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DGHC_FILESYSTEM_TEST_COMPILE_FEATURES="${{ matrix.config.compatibility }}" -DCMAKE_INSTALL_PREFIX:PATH=install + fi + + - name: Build project + shell: bash + run: | + cmake --build build --config ${{ matrix.config.build_type }} + + - name: Run tests + run: | + cd build && ctest -C ${{ matrix.config.build_type }} + + - name: Collect coverage info + if: startsWith(matrix.config.build_type, 'Debug') + run: | + cd build + lcov --compat-libtool --directory . --capture --output-file coverage_output.info + lcov --remove coverage_output.info '/usr/*' '*/c++/*' '*.h' '*/catch.hpp' -o coverage.info + # sed -i 's|SF:/.*/filesystem/|SF:../|g' coverage.info + + - name: Upload coverage info + if: startsWith(matrix.config.build_type, 'Debug') + env: + COVERALLS_DEBUG: true + NODE_COVERALLS_DEBUG: 1 + uses: coverallsapp/github-action@master + with: + path-to-lcov: ${{ github.workspace }}/build/coverage.info + github-token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6358bad..0000000 --- a/.travis.yml +++ /dev/null @@ -1,100 +0,0 @@ -language: cpp - -dist: xenial # default distribution -os: linux # default os -sudo: false - - -matrix: - fast_finish: true - include: - - env: MATRIX_EVAL="CC=gcc-5 && CXX=g++-5 && GENERATOR='Unix Makefiles' && CONFIG=Release" - addons: { apt: { packages: ["g++-5"], sources: ["ubuntu-toolchain-r-test"] } } - - - env: MATRIX_EVAL="CC=gcc-6 && CXX=g++-6 && GENERATOR='Unix Makefiles' && CONFIG=Release" - addons: { apt: { packages: ["g++-6"], sources: ["ubuntu-toolchain-r-test"] } } - - - env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && GENERATOR='Unix Makefiles' && CONFIG=Release" - addons: { apt: { packages: ["g++-7"], sources: ["ubuntu-toolchain-r-test"] } } - - - env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && GENERATOR='Unix Makefiles' && CONFIG=Debug && GHC_COVERAGE=1" - addons: { apt: { packages: ["g++-7", "lcov"], sources: ["ubuntu-toolchain-r-test"] } } - - - env: MATRIX_EVAL="CC=gcc-8 && CXX=g++-8 && GENERATOR='Unix Makefiles' && CONFIG=Release" - addons: { apt: { packages: ["g++-8"], sources: ["ubuntu-toolchain-r-test"] } } - - - env: MATRIX_EVAL="CC=gcc-9 && CXX=g++-9 && GENERATOR='Unix Makefiles' && CONFIG=Release" - addons: { apt: { packages: ["g++-9"], sources: ["ubuntu-toolchain-r-test"] } } - - - env: MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0 && GENERATOR='Unix Makefiles' && CONFIG=Release" - addons: { apt: { packages: ["clang-5.0"] } } - - - env: MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0 && GENERATOR='Unix Makefiles' && CONFIG=Release" - addons: { apt: { packages: ["clang-6.0"] } } - - - env: MATRIX_EVAL="CC=clang-7 && CXX=clang++-7 && GENERATOR='Unix Makefiles' && CONFIG=Release" - addons: { apt: { packages: ["clang-7", "libc++-7-dev", "libc++abi-7-dev"], sources: ["llvm-toolchain-xenial-7"] } } - - - env: MATRIX_EVAL="CC=clang-8 && CXX=clang++-8 && GENERATOR='Unix Makefiles' && CONFIG=Release" - addons: { apt: { packages: ["clang-8", "libc++-8-dev", "libc++abi-8-dev"], sources: ["llvm-toolchain-xenial-8"] } } - - - env: MATRIX_EVAL="CC=clang-9 && CXX=clang++-9 && GENERATOR='Unix Makefiles' && CONFIG=Release" - addons: { apt: { packages: ["clang-9", "libc++-9-dev", "libc++abi-9-dev"], sources: [{sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main', key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'}] } } - - - os: osx - env: MATRIX_EVAL="CC=clang && CXX=clang++ && GENERATOR=Xcode && CONFIG=Release" - osx_image: xcode9.2 - - - os: osx - env: MATRIX_EVAL="CC=clang && CXX=clang++ && GENERATOR=Xcode && CONFIG=Release" - osx_image: xcode10.1 - - - os: osx - env: MATRIX_EVAL="CC=clang && CXX=clang++ && GENERATOR=Xcode && CONFIG=Release" - osx_image: xcode11.3 - -install: - - eval "${MATRIX_EVAL}" - - | - if [ "${GHC_COVERAGE}" = "1" ]; then - gem install coveralls-lcov - fi - - $CC --version - - $CXX --version - - cmake --version - -before_script: - - eval "${MATRIX_EVAL}" - - mkdir build - - cd build - - export VERBOSE=1 - - | - if [ "${CONFIG}" = "Debug" ]; then - cmake -G"${GENERATOR}" -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} -DCMAKE_BUILD_TYPE=${CONFIG} -DGHC_COVERAGE=ON .. - else - cmake -G"${GENERATOR}" -DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_C_COMPILER=${CC} -DCMAKE_BUILD_TYPE=${CONFIG} .. - fi - -script: - - export VERBOSE=1 - - cmake --build . --config ${CONFIG} --target filesystem_test - - | - if [ "${GHC_COVERAGE}" = "1" ]; then - cmake --build . --config ${CONFIG} --target filesystem_test - test/filesystem_test - else - cmake --build . --config ${CONFIG} - ctest -C ${CONFIG} -E Windows - if [ -f "test/std_filesystem_test" ]; then - test/std_filesystem_test || true - fi - fi - -after_success: - - | - if [ "${GHC_COVERAGE}" = "1" ]; then - lcov --compat-libtool --directory . --capture --output-file coverage_output.info - lcov --remove coverage_output.info '/usr/*' '*/c++/*' '*.h' '*/catch.hpp' -o coverage.info - sed -i 's|SF:/.*/filesystem/|SF:../|g' coverage.info - coveralls-lcov coverage.info - fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d43ebc..f6b7f54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ endif() if(CMAKE_CXX_STANDARD LESS 11) message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 11, ghc::filesystem only works with C++11 and above.") endif() +message(STATUS "CMAKE_CXX_COMPILE_FEATURES: ${CMAKE_CXX_COMPILE_FEATURES}") add_library(ghc_filesystem INTERFACE) target_include_directories(ghc_filesystem INTERFACE diff --git a/README.md b/README.md index 60389bc..9043ab6 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,45 @@ ![Supported Platforms](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows%20%7C%20FreeBSD-blue.svg) ![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg) -[![Build Status](https://travis-ci.org/gulrak/filesystem.svg?branch=master)](https://travis-ci.org/gulrak/filesystem) +[![CMake Build Matrix](https://github.com/gulrak/filesystem/actions/workflows/build_cmake.yml/badge.svg?branch=master)](https://github.com/gulrak/filesystem/actions/workflows/build_cmake.yml) [![Build Status](https://ci.appveyor.com/api/projects/status/t07wp3k2cddo0hpo/branch/master?svg=true)](https://ci.appveyor.com/project/gulrak/filesystem) [![Build Status](https://api.cirrus-ci.com/github/gulrak/filesystem.svg?branch=master)](https://cirrus-ci.com/github/gulrak/filesystem) [![Build Status](https://cloud.drone.io/api/badges/gulrak/filesystem/status.svg?ref=refs/heads/master)](https://cloud.drone.io/gulrak/filesystem) [![Coverage Status](https://coveralls.io/repos/github/gulrak/filesystem/badge.svg?branch=master)](https://coveralls.io/github/gulrak/filesystem?branch=master) [![Latest Release Tag](https://img.shields.io/github/tag/gulrak/filesystem.svg)](https://github.com/gulrak/filesystem/tree/v1.5.8) +- [Filesystem](#filesystem) + - [Motivation](#motivation) + - [Why the namespace GHC?](#why-the-namespace-ghc) + - [Platforms](#platforms) + - [Tests](#tests) + - [Usage](#usage) + - [Downloads](#downloads) + - [Using it as Single-File-Header](#using-it-as-single-file-header) + - [Using it as Forwarding-/Implementation-Header](#using-it-as-forwarding-implementation-header) + - [Git Submodule and CMake](#git-submodule-and-cmake) + - [Versioning](#versioning) + - [Documentation](#documentation) + - [`ghc::filesystem::ifstream`, `ghc::filesystem::ofstream`, `ghc::filesystem::fstream`](#ghcfilesystemifstream-ghcfilesystemofstream-ghcfilesystemfstream) + - [`ghc::filesystem::u8arguments`](#ghcfilesystemu8arguments) + - [Differences](#differences) + - [LWG Defects](#lwg-defects) + - [Not Implemented on C++ before C++17](#not-implemented-on-c-before-c17) + - [Differences in API](#differences-in-api) + - [Differences of Specific Interfaces](#differences-of-specific-interfaces) + - [Differences in Behavior](#differences-in-behavior) + - [fs.path](#fspath-refhttpsencppreferencecomwcppfilesystempath) + - [Open Issues](#open-issues) + - [Windows](#windows) + - [Symbolic Links on Windows](#symbolic-links-on-windows) + - [Permissions](#permissions) + - [Release Notes](#release-notes) + # Filesystem This is a header-only single-file `std::filesystem` compatible helper library, based on the C++17 and C++20 specs, but implemented for C++11, C++14, C++17 or C++20 (tightly following the C++17 standard with very few documented exceptions). It is currently tested on -macOS 10.12/10.14/10.15, Windows 10, Ubuntu 18.04, CentOS 7, CentOS 8, FreeBSD 12 +macOS 10.12/10.14/10.15, Windows 10, Ubuntu 18.04, Ubuntu 20.04, CentOS 7, CentOS 8, FreeBSD 12 and Alpine ARM/ARM64 Linux but should work on other systems too, as long as you have at least a C++11 compatible compiler. It should work with Android NDK, Emscripten and I even had reports of it being used on iOS (within sandboxing constraints) and with v1.5.6 there @@ -556,6 +583,12 @@ to the expected behavior. ## Release Notes +### v1.6.0 (wip) + +* Replaced _travis-ci.org_ with GitHub Workflow for the configurations: + Ubuntu 20.04: GCC 9.3, Ubuntu 18.04: GCC 7.5, GCC 8.4, macOS 10.15: Xcode 12.4, + Windows 10: Visual Studio 2019 + ### [v1.5.8](https://github.com/gulrak/filesystem/releases/tag/v1.5.8) * Fix for [#125]((https://github.com/gulrak/filesystem/issues/124), where diff --git a/cmake/GhcHelper.cmake b/cmake/GhcHelper.cmake index f7cdb52..8fffae9 100644 --- a/cmake/GhcHelper.cmake +++ b/cmake/GhcHelper.cmake @@ -52,7 +52,8 @@ macro(AddTestExecutableWithStdCpp cppStd) $<$,$>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-error=deprecated-declarations> $<$:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-error=deprecated-declarations> $<$:/WX /wd4996> - $<$:-Wa,-mbig-obj>) + $<$:-Wa,-mbig-obj> + $<$:--coverage>) if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS) endif() diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp index 0705cf7..2c7538b 100644 --- a/include/ghc/filesystem.hpp +++ b/include/ghc/filesystem.hpp @@ -301,7 +301,7 @@ //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // ghc::filesystem version in decimal (major * 10000 + minor * 100 + patch) -#define GHC_FILESYSTEM_VERSION 10508L +#define GHC_FILESYSTEM_VERSION 10509L #if !defined(GHC_WITH_EXCEPTIONS) && (defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND)) #define GHC_WITH_EXCEPTIONS diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b926706..f9fdd18 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,6 +13,12 @@ if(GHC_COVERAGE) target_compile_options(filesystem_test PUBLIC --coverage) endif() target_link_libraries(filesystem_test PUBLIC ghc_filesystem --coverage) + if("cxx_std_17" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES) + AddTestExecutableWithStdCpp(17 filesystem_test.cpp catch.hpp) + endif() + if("cxx_std_20" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES) + AddTestExecutableWithStdCpp(20 filesystem_test.cpp catch.hpp) + endif() else() message("Generating test runner for normal test...") add_executable(filesystem_test filesystem_test.cpp catch.hpp)