mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-09-20 03:03:19 +08:00
Compare commits
No commits in common. "master" and "v1.2.4" have entirely different histories.
@ -24,20 +24,6 @@ environment:
|
||||
compiler: msvc
|
||||
configuration: Release
|
||||
|
||||
- platform: x86
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
generator: "Visual Studio 16 2019"
|
||||
compiler: msvc19
|
||||
configuration: Release
|
||||
arch: Win32
|
||||
|
||||
- platform: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
generator: "Visual Studio 16 2019"
|
||||
compiler: msvc19
|
||||
configuration: Release
|
||||
arch: x64
|
||||
|
||||
- platform: x86
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
generator: "MinGW Makefiles"
|
||||
@ -71,7 +57,6 @@ build_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- if [%compiler%]==[msvc] cmake -G"%generator%" ..
|
||||
- if [%compiler%]==[msvc19] cmake -G"%generator%" -A "%arch%" ..
|
||||
- if [%compiler%]==[mingw] set PATH=%TOOLCHAIN_PATH%;%PATH%
|
||||
- if [%compiler%]==[mingw] cmake -G"%generator%" -DCMAKE_C_COMPILER=%CC% -DCMAKE_CXX_COMPILER=%CXX% -DCMAKE_SH=CMAKE_SH-NOTFOUND -DCMAKE_BUILD_TYPE=%configuration% ..
|
||||
- cmake --build . --config %configuration%
|
||||
@ -80,6 +65,5 @@ test_script:
|
||||
- cd %APPVEYOR_BUILD_FOLDER%\build
|
||||
- set CTEST_OUTPUT_ON_FAILURE=1
|
||||
- ctest -C %configuration%
|
||||
- if exist "test\Release\std_filesystem_test.exe" test\Release\std_filesystem_test.exe & exit 0
|
||||
- cd ..
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
cmake --build .
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd build
|
||||
echo "Tests run as user: $USER"
|
||||
ctest -E Windows
|
||||
if [ -f "test/std_filesystem_test" ]; then
|
||||
test/std_filesystem_test || true
|
||||
fi
|
34
.cirrus.yml
34
.cirrus.yml
@ -1,34 +0,0 @@
|
||||
freebsd_task:
|
||||
freebsd_instance:
|
||||
image_family: freebsd-14-0
|
||||
install_script: |
|
||||
pkg install -y cmake
|
||||
pw groupadd testgrp
|
||||
pw useradd testuser -g testgrp -w none -m
|
||||
chown -R testuser:testgrp .
|
||||
build_script: |
|
||||
sudo -u testuser .ci/unix-build.sh
|
||||
test_script: |
|
||||
sudo -u testuser .ci/unix-test.sh
|
||||
|
||||
rockylinux8_task:
|
||||
container:
|
||||
image: docker.io/rockylinux:8
|
||||
install_script: |
|
||||
dnf group install -y "Development Tools"
|
||||
dnf install cmake -y
|
||||
build_script: |
|
||||
.ci/unix-build.sh
|
||||
test_script: |
|
||||
.ci/unix-test.sh
|
||||
|
||||
rockylinux9_task:
|
||||
container:
|
||||
image: docker.io/rockylinux:9
|
||||
install_script: |
|
||||
dnf group install -y "Development Tools"
|
||||
dnf install cmake -y
|
||||
build_script: |
|
||||
.ci/unix-build.sh
|
||||
test_script: |
|
||||
.ci/unix-test.sh
|
@ -1,3 +0,0 @@
|
||||
---
|
||||
Checks: -modernize-use-nodiscard
|
||||
...
|
@ -1,43 +0,0 @@
|
||||
kind: pipeline
|
||||
name: arm
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: alpine
|
||||
failure: ignore
|
||||
commands:
|
||||
- apk update
|
||||
- apk add --no-cache build-base cmake sudo
|
||||
- addgroup testgrp
|
||||
- adduser --disabled-password testuser testgrp
|
||||
- passwd testuser -u -d
|
||||
- chown -R testuser:testgrp .
|
||||
- sudo -u testuser .ci/unix-build.sh
|
||||
- sudo -u testuser .ci/unix-test.sh
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
name: arm64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: alpine
|
||||
failure: ignore
|
||||
commands:
|
||||
- apk update
|
||||
- apk add --no-cache build-base cmake
|
||||
- addgroup testgrp
|
||||
- adduser --disabled-password testuser testgrp
|
||||
- passwd testuser -u -d
|
||||
- chown -R testuser:testgrp .
|
||||
- su -c "./.ci/unix-build.sh" testuser
|
||||
- su -c "./.ci/unix-test.sh" testuser
|
170
.github/workflows/build_cmake.yml
vendored
170
.github/workflows/build_cmake.yml
vendored
@ -1,170 +0,0 @@
|
||||
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 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
|
||||
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: "Windows MSVC 2019"
|
||||
os: windows-2019
|
||||
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 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++
|
||||
|
||||
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 }}
|
||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,7 +1,2 @@
|
||||
/*build*/
|
||||
.vs/
|
||||
/build*/
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*~
|
||||
.DS_Store
|
||||
|
92
.travis.yml
Normal file
92
.travis.yml
Normal file
@ -0,0 +1,92 @@
|
||||
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=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"] } }
|
||||
|
||||
- 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.2
|
||||
|
||||
install:
|
||||
- eval "${MATRIX_EVAL}"
|
||||
- |
|
||||
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
|
||||
brew update
|
||||
brew upgrade cmake
|
||||
fi
|
||||
- |
|
||||
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
|
||||
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
|
102
CMakeLists.txt
102
CMakeLists.txt
@ -1,90 +1,50 @@
|
||||
cmake_minimum_required(VERSION 3.7.2)
|
||||
project(
|
||||
ghcfilesystem,
|
||||
VERSION 1.5.15
|
||||
)
|
||||
|
||||
if (POLICY CMP0077)
|
||||
cmake_policy(SET CMP0077 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0110)
|
||||
cmake_policy(SET CMP0110 NEW)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
option(GHC_FILESYSTEM_BUILD_TESTING "Enable tests" ON)
|
||||
option(GHC_FILESYSTEM_BUILD_EXAMPLES "Build examples" ON)
|
||||
option(GHC_FILESYSTEM_WITH_INSTALL "With install target" ON)
|
||||
else()
|
||||
option(GHC_FILESYSTEM_BUILD_EXAMPLES "Build examples" OFF)
|
||||
option(GHC_FILESYSTEM_BUILD_TESTING "Enable tests" OFF)
|
||||
option(GHC_FILESYSTEM_WITH_INSTALL "With install target" OFF)
|
||||
endif()
|
||||
option(GHC_FILESYSTEM_BUILD_STD_TESTING "Enable STD tests" ${GHC_FILESYSTEM_BUILD_TESTING})
|
||||
if(NOT DEFINED GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
|
||||
set(GHC_FILESYSTEM_TEST_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES})
|
||||
endif()
|
||||
project(ghcfilesystem)
|
||||
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
if(NOT CYGWIN)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
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()
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
message(STATUS "System name: ${CMAKE_SYSTEM_NAME}")
|
||||
message(STATUS "Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
|
||||
message(STATUS "CMAKE_CXX_COMPILE_FEATURES: ${CMAKE_CXX_COMPILE_FEATURES}")
|
||||
endif()
|
||||
|
||||
add_library(ghc_filesystem INTERFACE)
|
||||
add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem)
|
||||
target_include_directories(ghc_filesystem INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
target_sources(ghc_filesystem INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/filesystem.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_fwd.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_impl.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std_fwd.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std_impl.hpp
|
||||
)
|
||||
target_include_directories(ghc_filesystem INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_compile_options(ghc_filesystem INTERFACE "$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
||||
target_compile_options(ghc_filesystem INTERFACE "$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
|
||||
if(GHC_FILESYSTEM_BUILD_TESTING OR GHC_FILESYSTEM_BUILD_EXAMPLES)
|
||||
get_directory_property(hasParent PARENT_DIRECTORY)
|
||||
if(NOT hasParent)
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
||||
include(GhcHelper)
|
||||
|
||||
if(GHC_FILESYSTEM_BUILD_TESTING)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
if(GHC_FILESYSTEM_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
if(GHC_FILESYSTEM_WITH_INSTALL)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(TARGETS ghc_filesystem EXPORT ghc_filesystem-targets)
|
||||
install(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem")
|
||||
export(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/ghc_filesystem-targets.cmake")
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake"
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem"
|
||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
|
||||
write_basic_package_version_file(
|
||||
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config-version.cmake"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY SameMinorVersion
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake"
|
||||
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config-version.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem"
|
||||
)
|
||||
endif()
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
set(PACKAGECONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
|
||||
|
||||
configure_package_config_file(cmake/config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
||||
INSTALL_DESTINATION ${PACKAGECONFIG_INSTALL_DIR}
|
||||
PATH_VARS INCLUDE_INSTALL_DIR)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
||||
DESTINATION ${PACKAGECONFIG_INSTALL_DIR})
|
||||
|
38
LICENSE
38
LICENSE
@ -1,19 +1,27 @@
|
||||
Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
@ -1,30 +1,20 @@
|
||||
macro(AddExecutableWithStdFS targetName)
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0))
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0))
|
||||
if(APPLE)
|
||||
include_directories(/usr/local/opt/llvm/include)
|
||||
link_directories(/usr/local/opt/llvm/lib)
|
||||
endif()
|
||||
add_executable(${targetName} ${ARGN})
|
||||
set_property(TARGET ${targetName} PROPERTY CXX_STANDARD 17)
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
if(APPLE)
|
||||
target_link_libraries(${targetName} -lc++fs)
|
||||
else()
|
||||
target_compile_options(${targetName} PRIVATE "-stdlib=libc++")
|
||||
target_link_libraries(${targetName} -stdlib=libc++ -lc++fs $<$<PLATFORM_ID:Linux>:rt>)
|
||||
endif()
|
||||
if(APPLE)
|
||||
target_link_libraries(${targetName} -lc++fs)
|
||||
else()
|
||||
if(NOT APPLE)
|
||||
target_compile_options(${targetName} PRIVATE "-stdlib=libc++")
|
||||
target_link_libraries(${targetName} -stdlib=libc++)
|
||||
endif()
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(filesystem_test xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(filesystem_test network)
|
||||
target_compile_options(${targetName} PRIVATE "-stdlib=libc++")
|
||||
target_link_libraries(${targetName} -stdlib=libc++ -lc++fs)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${targetName} -lc++fs)
|
||||
target_compile_definitions(${targetName} PRIVATE USE_STD_FS)
|
||||
endif()
|
||||
|
||||
@ -34,13 +24,6 @@ if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 O
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
target_link_libraries(${targetName} -lstdc++fs)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(${targetName} xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(${targetName} network)
|
||||
endif()
|
||||
target_compile_options(${targetName} PRIVATE $<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
|
||||
target_compile_definitions(${targetName} PRIVATE USE_STD_FS)
|
||||
endif()
|
||||
|
||||
@ -53,29 +36,3 @@ if(CMAKE_CXX_COMPILER_ID MATCHES MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQ
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(AddTestExecutableWithStdCpp cppStd)
|
||||
add_executable(filesystem_test_cpp${cppStd} ${ARGN})
|
||||
set_property(TARGET filesystem_test_cpp${cppStd} PROPERTY CXX_STANDARD ${cppStd})
|
||||
target_link_libraries(filesystem_test_cpp${cppStd} ghc_filesystem)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(filesystem_test_cpp${cppStd} xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(filesystem_test_cpp${cppStd} network)
|
||||
endif()
|
||||
target_compile_options(filesystem_test_cpp${cppStd} PRIVATE
|
||||
$<$<BOOL:${EMSCRIPTEN}>:-s DISABLE_EXCEPTION_CATCHING=0>
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-error=deprecated-declarations>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-error=deprecated-declarations>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
|
||||
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>
|
||||
$<$<BOOL:${GHC_COVERAGE}>:--coverage>)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
if(EMSCRIPTEN)
|
||||
set_target_properties(filesystem_test_cpp${cppStd} PROPERTIES LINK_FLAGS "-g4 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1")
|
||||
endif()
|
||||
ParseAndAddCatchTests(filesystem_test_cpp${cppStd})
|
||||
endmacro()
|
||||
|
@ -1,6 +1,5 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
# import targets
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/ghc_filesystem-targets.cmake")
|
||||
set_and_check(ghcfilesystem_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
|
||||
check_required_components(ghcfilesystem)
|
||||
check_required_components(ghcfilesystem)
|
||||
|
@ -10,8 +10,3 @@ add_executable(fs_du du.cpp)
|
||||
target_link_libraries(fs_du ghc_filesystem)
|
||||
AddExecutableWithStdFS(std_fs_du du.cpp)
|
||||
|
||||
if(EXISTS "${PROJECT_SOURCE_DIR}/examples/benchmark.cpp")
|
||||
add_executable(fs_benchmark benchmark.cpp)
|
||||
set_property(TARGET fs_benchmark PROPERTY CXX_STANDARD 17)
|
||||
target_link_libraries(fs_benchmark ghc_filesystem)
|
||||
endif()
|
File diff suppressed because it is too large
Load Diff
@ -5,27 +5,35 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
// All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// fs_fwd.hpp - The forwarding header for the header/implementation separated usage of
|
||||
// fs_fwd.hpp - The forwarding header for the header/implementation seperated usage of
|
||||
// ghc::filesystem.
|
||||
// This file can be include at any place, where ghc::filesystem api is needed while
|
||||
// not bleeding implementation details (e.g. system includes) into the global namespace,
|
||||
@ -34,5 +42,5 @@
|
||||
#ifndef GHC_FILESYSTEM_FWD_H
|
||||
#define GHC_FILESYSTEM_FWD_H
|
||||
#define GHC_FILESYSTEM_FWD
|
||||
#include "filesystem.hpp"
|
||||
#include <ghc/filesystem.hpp>
|
||||
#endif // GHC_FILESYSTEM_FWD_H
|
||||
|
@ -5,31 +5,39 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
// All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// fs_impl.hpp - The implementation header for the header/implementation separated usage of
|
||||
// fs_impl.hpp - The implementation header for the header/implementation seperated usage of
|
||||
// ghc::filesystem.
|
||||
// This file can be used to hide the implementation of ghc::filesystem into a single cpp.
|
||||
// The cpp has to include this before including fs_fwd.hpp directly or via a different
|
||||
// header to work.
|
||||
//---------------------------------------------------------------------------------------
|
||||
#define GHC_FILESYSTEM_IMPLEMENTATION
|
||||
#include "filesystem.hpp"
|
||||
#include <ghc/filesystem.hpp>
|
||||
|
@ -5,24 +5,32 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
// All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// fs_std.hpp - The dynamic switching header that includes std::filesystem if detected
|
||||
@ -30,48 +38,27 @@
|
||||
// namespace fs.
|
||||
//---------------------------------------------------------------------------------------
|
||||
#ifndef GHC_FILESYSTEM_STD_H
|
||||
#define GHC_FILESYSTEM_STD_H
|
||||
|
||||
#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(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
|
||||
#define GHC_USE_STD_FS
|
||||
|
||||
// Old Apple OSs don't support std::filesystem, though the header is available at compile
|
||||
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
|
||||
// and watchOS 6.0.
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
// 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 __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
|
||||
#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
|
||||
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
|
||||
#if __has_include(<filesystem>)
|
||||
#define GHC_USE_STD_FS
|
||||
#include <filesystem>
|
||||
namespace fs {
|
||||
using namespace std::filesystem;
|
||||
using ifstream = std::ifstream;
|
||||
using ofstream = std::ofstream;
|
||||
using fstream = std::fstream;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GHC_USE_STD_FS
|
||||
#include <filesystem>
|
||||
namespace fs {
|
||||
using namespace std::filesystem;
|
||||
using ifstream = std::ifstream;
|
||||
using ofstream = std::ofstream;
|
||||
using fstream = std::fstream;
|
||||
}
|
||||
#else
|
||||
#include "filesystem.hpp"
|
||||
namespace fs {
|
||||
using namespace ghc::filesystem;
|
||||
using ifstream = ghc::filesystem::ifstream;
|
||||
using ofstream = ghc::filesystem::ofstream;
|
||||
using fstream = ghc::filesystem::fstream;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef GHC_USE_STD_FS
|
||||
#define GHC_WIN_WSTRING_STRING_TYPE
|
||||
#include <ghc/filesystem.hpp>
|
||||
namespace fs {
|
||||
using namespace ghc::filesystem;
|
||||
using ifstream = ghc::filesystem::ifstream;
|
||||
using ofstream = ghc::filesystem::ofstream;
|
||||
using fstream = ghc::filesystem::fstream;
|
||||
}
|
||||
#endif
|
||||
#endif // GHC_FILESYSTEM_STD_H
|
||||
|
||||
|
@ -5,27 +5,35 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
// All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// fs_std_fwd.hpp - The forwarding header for the header/implementation separated usage of
|
||||
// fs_std_fwd.hpp - The forwarding header for the header/implementation seperated usage of
|
||||
// ghc::filesystem that uses std::filesystem if it detects it.
|
||||
// This file can be include at any place, where fs::filesystem api is needed while
|
||||
// not bleeding implementation details (e.g. system includes) into the global namespace,
|
||||
@ -33,47 +41,28 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
#ifndef GHC_FILESYSTEM_STD_FWD_H
|
||||
#define GHC_FILESYSTEM_STD_FWD_H
|
||||
|
||||
#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(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
|
||||
#define GHC_USE_STD_FS
|
||||
|
||||
// Old Apple OSs don't support std::filesystem, though the header is available at compile
|
||||
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
|
||||
// and watchOS 6.0.
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
// 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 __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
|
||||
#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
|
||||
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
|
||||
#if __has_include(<filesystem>)
|
||||
#define GHC_USE_STD_FS
|
||||
#include <filesystem>
|
||||
namespace fs {
|
||||
using namespace std::filesystem;
|
||||
using ifstream = std::ifstream;
|
||||
using ofstream = std::ofstream;
|
||||
using fstream = std::fstream;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GHC_USE_STD_FS
|
||||
#include <filesystem>
|
||||
namespace fs {
|
||||
using namespace std::filesystem;
|
||||
using ifstream = std::ifstream;
|
||||
using ofstream = std::ofstream;
|
||||
using fstream = std::fstream;
|
||||
}
|
||||
#else
|
||||
#include "fs_fwd.hpp"
|
||||
namespace fs {
|
||||
using namespace ghc::filesystem;
|
||||
using ifstream = ghc::filesystem::ifstream;
|
||||
using ofstream = ghc::filesystem::ofstream;
|
||||
using fstream = ghc::filesystem::fstream;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef GHC_USE_STD_FS
|
||||
#define GHC_WIN_WSTRING_STRING_TYPE
|
||||
#define GHC_FILESYSTEM_FWD
|
||||
#include <ghc/filesystem.hpp>
|
||||
namespace fs {
|
||||
using namespace ghc::filesystem;
|
||||
using ifstream = ghc::filesystem::ifstream;
|
||||
using ofstream = ghc::filesystem::ofstream;
|
||||
using fstream = ghc::filesystem::fstream;
|
||||
}
|
||||
#endif
|
||||
#endif // GHC_FILESYSTEM_STD_FWD_H
|
||||
|
||||
|
@ -5,56 +5,47 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
// All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// fs_std_impl.hpp - The implementation header for the header/implementation separated usage of
|
||||
// fs_std_impl.hpp - The implementation header for the header/implementation seperated usage of
|
||||
// ghc::filesystem that does nothing if std::filesystem is detected.
|
||||
// This file can be used to hide the implementation of ghc::filesystem into a single cpp.
|
||||
// The cpp has to include this before including fs_std_fwd.hpp directly or via a different
|
||||
// header to work.
|
||||
//---------------------------------------------------------------------------------------
|
||||
#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(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
|
||||
#define GHC_USE_STD_FS
|
||||
|
||||
// Old Apple OSs don't support std::filesystem, though the header is available at compile
|
||||
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
|
||||
// and watchOS 6.0.
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
// 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 __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
|
||||
#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
|
||||
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
|
||||
#if __has_include(<filesystem>)
|
||||
#define GHC_USE_STD_FS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GHC_USE_STD_FS
|
||||
#include "fs_impl.hpp"
|
||||
#define GHC_WIN_WSTRING_STRING_TYPE
|
||||
#define GHC_FILESYSTEM_IMPLEMENTATION
|
||||
#include <ghc/filesystem.hpp>
|
||||
#endif
|
||||
|
@ -3,20 +3,6 @@ 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
|
||||
$<$<BOOL:${EMSCRIPTEN}>:-s DISABLE_EXCEPTION_CATCHING=0>
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-deprecated-declarations>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-deprecated-declarations>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
|
||||
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
|
||||
endfunction()
|
||||
|
||||
if(GHC_COVERAGE)
|
||||
message("Generating test runner for coverage run...")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMCMAKE_EXE_LINKER_FLAGS} --coverage")
|
||||
@ -27,55 +13,32 @@ if(GHC_COVERAGE)
|
||||
target_compile_options(filesystem_test PUBLIC --coverage)
|
||||
endif()
|
||||
target_link_libraries(filesystem_test PUBLIC ghc_filesystem --coverage)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(filesystem_test PUBLIC xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(filesystem_test PUBLIC network)
|
||||
endif()
|
||||
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)
|
||||
target_link_libraries(filesystem_test ghc_filesystem)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(filesystem_test xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(filesystem_test network)
|
||||
endif()
|
||||
SetTestCompileOptions(filesystem_test)
|
||||
target_compile_options(filesystem_test PRIVATE
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Wshadow -Werror>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Werror>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/WX>)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN NOMINMAX)
|
||||
endif()
|
||||
if(EMSCRIPTEN)
|
||||
set_target_properties(filesystem_test PROPERTIES LINK_FLAGS "-g4 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1")
|
||||
target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
ParseAndAddCatchTests(filesystem_test)
|
||||
if(GHC_FILESYSTEM_BUILD_STD_TESTING)
|
||||
AddExecutableWithStdFS(std_filesystem_test filesystem_test.cpp catch.hpp)
|
||||
endif()
|
||||
AddExecutableWithStdFS(std_filesystem_test filesystem_test.cpp catch.hpp)
|
||||
if(WIN32)
|
||||
add_executable(filesystem_test_char filesystem_test.cpp catch.hpp)
|
||||
target_link_libraries(filesystem_test_char ghc_filesystem)
|
||||
SetTestCompileOptions(filesystem_test_char)
|
||||
add_executable(filesystem_test_wchar filesystem_test.cpp catch.hpp)
|
||||
target_link_libraries(filesystem_test_wchar ghc_filesystem)
|
||||
target_compile_options(filesystem_test_wchar PRIVATE
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Werror>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wall -Werror>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/WX>)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(filesystem_test_char PRIVATE _CRT_SECURE_NO_WARNINGS GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
|
||||
target_compile_definitions(filesystem_test_wchar PRIVATE _CRT_SECURE_NO_WARNINGS GHC_WIN_WSTRING_STRING_TYPE)
|
||||
else()
|
||||
target_compile_definitions(filesystem_test_char PRIVATE GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
|
||||
target_compile_definitions(filesystem_test_wchar PRIVATE GHC_WIN_WSTRING_STRING_TYPE)
|
||||
endif()
|
||||
ParseAndAddCatchTests(filesystem_test_char)
|
||||
endif()
|
||||
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)
|
||||
ParseAndAddCatchTests(filesystem_test_wchar)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -85,21 +48,7 @@ add_test(multifile_test multifile_test)
|
||||
|
||||
add_executable(fwd_impl_test fwd_test.cpp impl_test.cpp)
|
||||
target_link_libraries(fwd_impl_test ghc_filesystem)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(fwd_impl_test xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(fwd_impl_test network)
|
||||
endif()
|
||||
SetTestCompileOptions(fwd_impl_test)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(fwd_impl_test PRIVATE _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN NOMINMAX)
|
||||
target_compile_definitions(fwd_impl_test PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
add_test(fwd_impl_test fwd_impl_test)
|
||||
|
||||
add_executable(exception exception.cpp)
|
||||
if(NOT MSVC)
|
||||
target_compile_options(exception PRIVATE -fno-exceptions)
|
||||
endif()
|
||||
target_include_directories(exception PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
SetTestCompileOptions(exception)
|
||||
|
7857
test/catch.hpp
7857
test/catch.hpp
File diff suppressed because it is too large
Load Diff
@ -144,7 +144,7 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
||||
if("${TestType}" STREQUAL "SCENARIO")
|
||||
set(Name "Scenario: ${Name}")
|
||||
endif()
|
||||
if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" AND TestFixture )
|
||||
if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND TestFixture)
|
||||
set(CTestName "${TestFixture}:${Name}")
|
||||
else()
|
||||
set(CTestName "${Name}")
|
||||
@ -189,29 +189,24 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
||||
# Escape commas in the test spec
|
||||
string(REPLACE "," "\\," Name ${Name})
|
||||
|
||||
# Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were neccessary,
|
||||
# only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
|
||||
if(NOT ${CMAKE_VERSION} VERSION_EQUAL "3.18")
|
||||
set(CTestName "\"${CTestName}\"")
|
||||
endif()
|
||||
# Add the test and set its properties
|
||||
add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
|
||||
add_test(NAME "\"${CTestName}\"" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
|
||||
# Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
|
||||
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
|
||||
set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
|
||||
set_tests_properties("\"${CTestName}\"" PROPERTIES DISABLED ON)
|
||||
else()
|
||||
set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
||||
set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
||||
LABELS "${Labels}")
|
||||
endif()
|
||||
set_property(
|
||||
TARGET ${TestTarget}
|
||||
APPEND
|
||||
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
|
||||
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
|
||||
set_property(
|
||||
SOURCE ${SourceFile}
|
||||
APPEND
|
||||
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
|
||||
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
|
||||
endif()
|
||||
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
#include <ghc/filesystem.hpp>
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@
|
||||
// where exactly one cpp includes fs_impl.hpp and all others use
|
||||
// fs_fwd.hpp (to test this with maximum functionality, the unit tests
|
||||
// are included here, signaling they should only include the fs_fwd.hpp)
|
||||
#define NOMINMAX
|
||||
#include <ghc/fs_impl.hpp>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
|
@ -1,24 +1,32 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
// All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
#define CATCH_CONFIG_MAIN
|
||||
@ -27,7 +35,7 @@
|
||||
#include <ghc/filesystem.hpp>
|
||||
namespace fs = ghc::filesystem;
|
||||
|
||||
// This test and the one in multi2.cpp doesn't actually test relevant functionality,
|
||||
// This test and the one in multi2.cpp doesn't actualy test relevant functionality,
|
||||
// it is just used to check that it is possible to include filesystem.h in multiple
|
||||
// source files.
|
||||
TEST_CASE("Multifile-test 1", "[multi]")
|
||||
|
@ -1,24 +1,32 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
// All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
#include "catch.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user