Merge branch 'master' into v157_snapshot

This commit is contained in:
Ondrej Stava 2024-01-12 15:11:14 -08:00 committed by GitHub
commit dcce9d0b3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 88 additions and 85 deletions

View File

@ -23,6 +23,7 @@ include(GNUInstallDirs)
# Sets up the draco install targets. Must be called after the static library
# target is created.
macro(draco_setup_install_target)
if(DRACO_INSTALL)
set(bin_path "${CMAKE_INSTALL_BINDIR}")
set(data_path "${CMAKE_INSTALL_DATAROOTDIR}")
set(includes_path "${CMAKE_INSTALL_INCLUDEDIR}")
@ -118,4 +119,5 @@ macro(draco_setup_install_target)
install(FILES "${draco_build}/draco-config.cmake"
"${draco_build}/draco-config-version.cmake"
DESTINATION "${data_path}/cmake/draco")
endif(DRACO_INSTALL)
endmacro()

View File

@ -131,6 +131,10 @@ macro(draco_set_default_options)
NAME DRACO_DEBUG_COMPILER_WARNINGS
HELPSTRING "Turn on more warnings."
VALUE OFF)
draco_option(
NAME DRACO_INSTALL
HELPSTRING "Enable installation."
VALUE ON)
draco_check_deprecated_options()
endmacro()

View File

@ -38,11 +38,10 @@ bool DirectoryExists(const std::string &path_arg) {
struct stat path_stat;
std::string path = path_arg;
#if defined(_WIN32) && not defined(__MINGW32__)
#if defined(_WIN32) && !defined(__MINGW32__)
// Avoid a silly windows issue: stat() will fail on a drive letter missing the
// trailing slash.
if (path.size() > 0 && path[path.size()] != '\\' &&
path[path.size()] != '/') {
// trailing slash. To keep it simple, append a path separator to all paths.
if (!path.empty() && path.back() != '\\' && path.back() != '/') {
path.append("\\");
}
#endif
@ -68,9 +67,7 @@ bool CheckAndCreatePathForFile(const std::string &filename) {
const ghc::filesystem::path ghc_path(path);
ghc::filesystem::create_directories(ghc_path);
#endif // DRACO_TRANSCODER_SUPPORTED
const bool directory_exists = DirectoryExists(path);
return directory_exists;
return DirectoryExists(path);
}
} // namespace draco