diff --git a/.cirrus.yml b/.cirrus.yml index d786910..b188205 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,6 +1,6 @@ freebsd_task: freebsd_instance: - image_family: freebsd-12-1 + image_family: freebsd-14-0 install_script: | pkg install -y cmake pw groupadd testgrp @@ -11,25 +11,24 @@ freebsd_task: test_script: | sudo -u testuser .ci/unix-test.sh -centos7_task: +rockylinux8_task: container: - image: centos:7 + image: docker.io/rockylinux:8 install_script: | - yum install -y centos-release-scl - yum install -y devtoolset-9 - curl -L https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.tar.gz | tar xzvf - -C /usr/local --strip-components 1 + dnf group install -y "Development Tools" + dnf install cmake -y build_script: | - source /opt/rh/devtoolset-9/enable && PATH=$PATH:/usr/local/bin .ci/unix-build.sh + .ci/unix-build.sh test_script: | - PATH=$PATH:/usr/local/bin .ci/unix-test.sh + .ci/unix-test.sh -centos8_task: +rockylinux9_task: container: - image: quay.io/centos/centos:stream8 + image: docker.io/rockylinux:9 install_script: | - yum group install -y "Development Tools" - curl -L https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.tar.gz | tar xzvf - -C /usr/local --strip-components 1 + dnf group install -y "Development Tools" + dnf install cmake -y build_script: | - PATH=$PATH:/usr/local/bin .ci/unix-build.sh + .ci/unix-build.sh test_script: | - PATH=$PATH:/usr/local/bin .ci/unix-test.sh \ No newline at end of file + .ci/unix-test.sh diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index f50664b..c8170ec 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -10,6 +10,42 @@ jobs: fail-fast: false matrix: config: + - name: "Ubuntu 22.04 GCC 11" + os: ubuntu-22.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 22.04 Clang 13.0" + os: ubuntu-22.04 + build_type: Release + packages: ninja-build libc++-13-dev libc++abi-13-dev + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: clang-13 + cxx: clang++-13 + + - name: "Ubuntu 22.04 Clang 15.0" + os: ubuntu-22.04 + build_type: Release + packages: ninja-build libc++-15-dev libc++abi-15-dev + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: clang-15 + cxx: clang++-15 + + - name: "Ubuntu 22.04 GCC 11 coverage" + os: ubuntu-22.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 20.04 GCC 9.3" os: ubuntu-20.04 build_type: Release @@ -46,69 +82,6 @@ jobs: 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 18.04 Clang 6.0" - os: ubuntu-18.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 18.04 Clang 5.0" - os: ubuntu-18.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-2019 build_type: Release @@ -118,8 +91,17 @@ jobs: cc: cl cxx: cl - - name: "macOS 10.15 AppleClang" - os: macos-10.15 + - name: "macOS 13 AppleClang" + os: macos-13 + build_type: Release + packages: ninja + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: clang + cxx: clang++ + + - name: "macOS 12 AppleClang" + os: macos-12 build_type: Release packages: ninja generator: Ninja @@ -127,7 +109,7 @@ jobs: cc: clang cxx: clang++ - - name: "macOS 11.6 AppleClang" + - name: "macOS 11 AppleClang" os: macos-11 build_type: Release packages: ninja diff --git a/CMakeLists.txt b/CMakeLists.txt index 063289c..de97dd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7.2) project( ghcfilesystem, - VERSION 1.5.14 + VERSION 1.5.15 ) if (POLICY CMP0077) diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp index 9213f72..ca82a65 100644 --- a/include/ghc/filesystem.hpp +++ b/include/ghc/filesystem.hpp @@ -4354,7 +4354,7 @@ GHC_INLINE path current_path(std::error_code& ec) } return path(std::wstring(buffer.get()), path::native_format); #elif defined(__GLIBC__) - std::unique_ptr buffer { ::getcwd(NULL, 0), std::free }; + std::unique_ptr buffer { ::get_current_dir_name(), std::free }; if (buffer == nullptr) { ec = detail::make_system_error(); return path(); diff --git a/include/ghc/fs_std.hpp b/include/ghc/fs_std.hpp index d5c1643..f09eeec 100644 --- a/include/ghc/fs_std.hpp +++ b/include/ghc/fs_std.hpp @@ -32,7 +32,7 @@ #ifndef GHC_FILESYSTEM_STD_H #define GHC_FILESYSTEM_STD_H -#if _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) +#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) // ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus // _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/ #if __has_include() // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html @@ -46,12 +46,12 @@ // Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS // released after std::filesystem, where std::filesystem is always available. // (All other ___VERSION_MIN_REQUIREDs will be undefined and thus 0.) - #if __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ - || __IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ - || __TV_OS_VERSION_MIN_REQUIRED && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ - || __WATCH_OS_VERSION_MAX_ALLOWED && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ + || defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 #undef GHC_USE_STD_FS - #endif + #endif #endif #endif #endif diff --git a/include/ghc/fs_std_fwd.hpp b/include/ghc/fs_std_fwd.hpp index d979113..372470f 100644 --- a/include/ghc/fs_std_fwd.hpp +++ b/include/ghc/fs_std_fwd.hpp @@ -34,7 +34,7 @@ #ifndef GHC_FILESYSTEM_STD_FWD_H #define GHC_FILESYSTEM_STD_FWD_H -#if _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) +#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) // ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus // _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/ #if __has_include() // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html @@ -48,12 +48,12 @@ // Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS // released after std::filesystem, where std::filesystem is always available. // (All other ___VERSION_MIN_REQUIREDs will be undefined and thus 0.) - #if __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ - || __IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ - || __TV_OS_VERSION_MIN_REQUIRED && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ - || __WATCH_OS_VERSION_MAX_ALLOWED && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ + || defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 #undef GHC_USE_STD_FS - #endif + #endif #endif #endif #endif diff --git a/include/ghc/fs_std_impl.hpp b/include/ghc/fs_std_impl.hpp index 8ba5733..e21714e 100644 --- a/include/ghc/fs_std_impl.hpp +++ b/include/ghc/fs_std_impl.hpp @@ -31,7 +31,7 @@ // The cpp has to include this before including fs_std_fwd.hpp directly or via a different // header to work. //--------------------------------------------------------------------------------------- -#if _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) +#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) // ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus // _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/ #if __has_include() // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html @@ -45,12 +45,12 @@ // Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS // released after std::filesystem, where std::filesystem is always available. // (All other ___VERSION_MIN_REQUIREDs will be undefined and thus 0.) - #if __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ - || __IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ - || __TV_OS_VERSION_MIN_REQUIRED && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ - || __WATCH_OS_VERSION_MAX_ALLOWED && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ + || defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 #undef GHC_USE_STD_FS - #endif + #endif #endif #endif #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index bf3eec3..df54b7b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,6 +3,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") set(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS ON) include(ParseAndAddCatchTests) +if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND UNIX AND NOT APPLE AND NOT BSD) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + set(CMAKE_EXE_LINKER_FLAGS "-lc++abi") +endif() + function(SetTestCompileOptions target_name) target_compile_options(${target_name} PRIVATE $<$:-s DISABLE_EXCEPTION_CATCHING=0>