Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: std::filesystem include issues #76

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions impl/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ libSubstrateSrcs = [
]

deps = []
libSubstrateArgs = []

if target_machine.system() == 'windows'
deps += cxx.find_library('ws2_32', required: true)
Expand Down Expand Up @@ -81,6 +82,10 @@ if cxxVersion.version_compare('>=201703')
dependencies: libstdcppFS,
)

if stdFilesystemPath
libSubstrateArgs += ['-DHAVE_FILESYSTEM_PATH']
endif

initializerListTest = '''
#include <array>
#include <cstdint>
Expand Down Expand Up @@ -144,8 +149,6 @@ if library_type == 'both' and isWindows
error('On Windows default_library must be "shared" or "static" but not "both"')
endif

libSubstrateArgs = []

if library_type == 'static' and isWindows
libSubstrateArgs = ['-DSUBSTRATE_BUILD_STATIC']
endif
Expand Down
15 changes: 13 additions & 2 deletions substrate/internal/defs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@
#ifndef SUBSTRATE_INTERNAL_DEFS
#define SUBSTRATE_INTERNAL_DEFS

#if !defined(__has_include)
// NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define __has_include(x) 0
#endif

#if __has_include(<version>)
#include <version>
#endif

#if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__)
# if !defined(_WIN32)
# define _WIN32 1
# endif
#endif

#if !defined(__has_cpp_attribute)
// NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
# define __has_cpp_attribute(x) 0
#endif

Expand Down Expand Up @@ -52,7 +62,7 @@
#elif defined(_WIN32)
# define SUBSTRATE_NOINLINE __declspec(noinline)
#else
# define SUBSTRATE_NOINLINE
# define SUBSTRATE_NOINLINE
#endif

#ifdef _MSC_VER
Expand Down Expand Up @@ -108,7 +118,8 @@
# define SUBSTRATE_DEDUCTION_GUIDE(...)
#endif

#if __cplusplus >= 201703L && defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L
#if __cplusplus >= 201703L && (defined(HAS_FILESYSTEM_PATH) || \
(defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L))
# if !defined(__APPLE__)
# define SUBSTRATE_ALLOW_STD_FILESYSTEM_PATH 1
# else
Expand Down
Loading