updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
@ -6,15 +6,7 @@ if(PROJECT_ENABLE_SPDLOG)
|
||||
|
||||
include_directories(BEFORE SYSTEM ${SPDLOG_INCLUDE_DIRS})
|
||||
|
||||
if(PROJECT_IS_MINGW_UNIX)
|
||||
if(PROJECT_STATIC_LINK)
|
||||
link_libraries(/mingw64/lib/libspdlog.a)
|
||||
else()
|
||||
link_libraries(/mingw64/lib/libspdlog.dll.a)
|
||||
endif()
|
||||
else()
|
||||
link_libraries(spdlog::spdlog)
|
||||
endif()
|
||||
link_libraries(spdlog::spdlog)
|
||||
elseif(NOT PROJECT_IS_MINGW OR CMAKE_HOST_WIN32)
|
||||
ExternalProject_Add(spdlog_project
|
||||
PREFIX external
|
||||
@ -23,7 +15,6 @@ if(PROJECT_ENABLE_SPDLOG)
|
||||
LIST_SEPARATOR |
|
||||
CMAKE_ARGS ${PROJECT_EXTERNAL_CMAKE_FLAGS}
|
||||
-DBUILD_SHARED_LIBS=${PROJECT_BUILD_SHARED_LIBS}
|
||||
-DBUILD_STATIC_LIBS=ON
|
||||
-DSPDLOG_BUILD_EXAMPLE=OFF
|
||||
-DSPDLOG_FMT_EXTERNAL=OFF
|
||||
-DSPDLOG_FMT_EXTERNAL_HO=OFF
|
||||
|
@ -570,8 +570,7 @@ RUN if [ -f "/3rd_party/spdlog-${MY_SPDLOG_VERSION}.tar.gz" ]; then \
|
||||
&& cd build \
|
||||
&& cmake .. -DCMAKE_TOOLCHAIN_FILE=${MY_TOOLCHAIN_FILE_CMAKE} \
|
||||
-DCMAKE_INSTALL_PREFIX=${MY_MINGW_DIR} \
|
||||
-DSPDLOG_BUILD_SHARED=ON \
|
||||
-DSPDLOG_BUILD_STATIC=ON \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DSPDLOG_BUILD_EXAMPLE=OFF \
|
||||
-DSPDLOG_FMT_EXTERNAL=OFF \
|
||||
-DSPDLOG_FMT_EXTERNAL_HO=OFF \
|
||||
|
@ -271,16 +271,12 @@ template <typename string_t>
|
||||
}
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
format_path(api_path, slash_t, backslash_t);
|
||||
|
||||
while (utils::string::begins_with(api_path, dot_slash_t)) {
|
||||
api_path = api_path.substr(dot_slash_t.size());
|
||||
}
|
||||
|
||||
while (utils::string::begins_with(api_path, dot_t)) {
|
||||
api_path = api_path.substr(dot_t.size());
|
||||
}
|
||||
|
||||
format_path(api_path, slash_t, backslash_t);
|
||||
|
||||
if (api_path.at(0U) != slash_t.at(0U)) {
|
||||
return string_t{slash_t} + api_path;
|
||||
}
|
||||
|
@ -110,28 +110,29 @@ auto file::open_file(std::filesystem::path path, bool read_only) -> file {
|
||||
auto file::open_or_create_file(std::filesystem::path path,
|
||||
bool read_only) -> file {
|
||||
path = utils::path::absolute(path.string());
|
||||
|
||||
if (not utils::file::is_file(path.string())) {
|
||||
#if defined(_WIN32)
|
||||
int old_mode{};
|
||||
_umask_s(077, &old_mode);
|
||||
int old_mode{};
|
||||
_umask_s(077, &old_mode);
|
||||
#else // !defined(_WIN32)
|
||||
auto old_mode = umask(077);
|
||||
auto old_mode = umask(077);
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
#if defined(_WIN32)
|
||||
auto *ptr = _fsopen(path.string().c_str(), "ab+", _SH_DENYNO);
|
||||
auto *ptr = _fsopen(path.string().c_str(), "ab+", _SH_DENYNO);
|
||||
#else // !defined(_WIN32)
|
||||
auto *ptr = fopen(path.string().c_str(), "ab+");
|
||||
auto *ptr = fopen(path.string().c_str(), "ab+");
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
#if defined(_WIN32)
|
||||
_umask_s(old_mode, nullptr);
|
||||
_umask_s(old_mode, nullptr);
|
||||
#else // !defined(_WIN32)
|
||||
umask(old_mode);
|
||||
umask(old_mode);
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
if (ptr != nullptr) {
|
||||
fclose(ptr);
|
||||
if (ptr != nullptr) {
|
||||
fclose(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
return open_file(path, read_only);
|
||||
|
@ -114,6 +114,13 @@ TEST(utils_path, combine) {
|
||||
EXPECT_STREQ("/test/path/again", s.c_str());
|
||||
#endif
|
||||
|
||||
s = utils::path::combine("/home/test/.dest", {".state"});
|
||||
#if defined(_WIN32)
|
||||
EXPECT_STREQ("\\home\\test\\.dest\\.state", s.c_str());
|
||||
#else
|
||||
EXPECT_STREQ("/home/test/.dest/.state", s.c_str());
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
s = utils::path::combine(R"(R:\test)", {R"(\path)", R"(\again\)"});
|
||||
EXPECT_STREQ(R"(r:\test\path\again)", s.c_str());
|
||||
@ -200,6 +207,15 @@ TEST(utils_path, create_api_path) {
|
||||
|
||||
s = utils::path::create_api_path("/cow\\\\/moose\\\\/\\dog\\chicken\\");
|
||||
EXPECT_STREQ("/cow/moose/dog/chicken", s.c_str());
|
||||
|
||||
s = utils::path::create_api_path(".state");
|
||||
EXPECT_STREQ("/.state", s.c_str());
|
||||
|
||||
s = utils::path::create_api_path("/.state/.local");
|
||||
EXPECT_STREQ("/.state/.local", s.c_str());
|
||||
|
||||
s = utils::path::create_api_path("./.state/.local");
|
||||
EXPECT_STREQ("/.state/.local", s.c_str());
|
||||
}
|
||||
|
||||
TEST(utils_path, finalize) {
|
||||
|
Reference in New Issue
Block a user