1
1

Compare commits

...

1 Commits

Author SHA1 Message Date
5d1fa2e67a Dependencies: Drop-in replacement for std::filesystem (in extern/)
Introduces the ghc::filesystem library as a (leight weight, header
only) drop-in replacement for std::filesystem. The latter can't be
used on the minimum macOS version we support. Once that changes, we can
switch to using std::filesystem directly.

Part of T90379.

* Add ghc::filesystem to extern/ as platform compatible replacement for
  std::filesystem.
* Add Windows specific code to avoid issues with including Windows.h.
* Add blender::bli::filesystem as alias for ghc::filesystem. That should make
  the ghc -> std transition easier later on since we can just change this
  alias. Also makes it easy to switch between the two at compile time.
2021-08-31 16:49:31 +02:00
4 changed files with 6024 additions and 0 deletions

5
extern/ghc_filesystem/README.blender vendored Normal file
View File

@@ -0,0 +1,5 @@
Project: ghc::filesystem
URL: https://github.com/gulrak/filesystem
License: MIT
Upstream version: 1d3d5f5
Local modifications: None

5944
extern/ghc_filesystem/filesystem.hpp vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,74 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/** \file
* \ingroup bli
*
* Header for a platform compatible replacement of C++17's `std::filesystem`. Access via
* `blender::filesystem`.
*
* The need for this comes from macOS only supporting `std::filesystem` with XCode 11, only
* available on macOS 10.15.
*/
#pragma once
/* ghc::filesystem includes Windows.h, which by default pollutes the global namespace and impacts
* compile time quite a bit. Set some defines to avoid this. */
#ifdef WIN32
# ifndef NOGDI
# define NOGDI
# define NOGDI_CLEANUP
# endif
# ifndef NOMINMAX
# define NOMINMAX
# define NOMINMAX_CLEANUP
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN_CLEANUP
# endif
# ifndef NOCOMM
# define NOCOMM
# define NOCOMM_CLEANUP
# endif
#endif /* _WIN32 */
/* Header for ghc::filesystem. */
#include "filesystem.hpp"
#ifdef WIN32
# ifdef NOGDI_CLEANUP
# undef NOGDI
# undef NOGDI_CLEANUP
# endif
# ifdef NOMINMAX_CLEANUP
# undef NOMINMAX
# undef NOMINMAX_CLEANUP
# endif
# ifdef WIN32_LEAN_AND_MEAN_CLEANUP
# undef WIN32_LEAN_AND_MEAN
# undef WIN32_LEAN_AND_MEAN_CLEANUP
# endif
# ifdef NOCOMM_CLEANUP
# undef NOCOMM
# undef NOCOMM_CLEANUP
# endif
#endif
namespace blender {
namespace filesystem = ghc::filesystem;
}

View File

@@ -26,6 +26,7 @@ set(INC
../../../intern/eigen
../../../intern/guardedalloc
../../../intern/numaapi/include
../../../extern/ghc_filesystem
../../../extern/wcwidth
)