Add macOS support #34
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...

This commit is contained in:
2025-08-01 04:20:51 +02:00
parent d40ff7d14d
commit a0c412bd66
5 changed files with 19 additions and 14 deletions

View File

@@ -22,7 +22,7 @@
#ifndef REPERTORY_INCLUDE_COMMON_HPP_
#define REPERTORY_INCLUDE_COMMON_HPP_
#if defined(__GNUC__)
#if defined(__GNUC__) && !defined(PROJECT_IS_DARWIN)
// clang-format off
#define REPERTORY_IGNORE_WARNINGS_ENABLE() \
_Pragma("GCC diagnostic push") \

View File

@@ -98,7 +98,7 @@ private:
std::condition_variable notify_;
std::mutex start_stop_mutex_;
stop_type stop_requested_{false};
std::vector<std::unique_ptr<std::jthread>> task_threads_;
std::vector<std::unique_ptr<std::thread>> task_threads_;
std::deque<scheduled_task> tasks_;
private:

View File

@@ -86,8 +86,9 @@ void tasks::start(app_config *config) {
for (std::uint32_t idx = 0U; idx < std::thread::hardware_concurrency() * 2U;
++idx) {
task_threads_.emplace_back(
std::make_unique<std::jthread>([this]() { task_thread(); }));
auto thread{std::make_unique<std::thread>([this]() { task_thread(); })};
thread->detach();
task_threads_.emplace_back(std::move(thread));
}
}
@@ -100,7 +101,7 @@ void tasks::stop() {
stop_requested_ = true;
unique_mutex_lock lock(mutex_);
std::vector<std::unique_ptr<std::jthread>> threads;
std::vector<std::unique_ptr<std::thread>> threads;
std::swap(threads, task_threads_);
std::deque<scheduled_task> task_list;

View File

@@ -118,10 +118,10 @@ auto to_api_error(int err) -> api_error {
#if defined(__APPLE__)
case EBADMSG:
return api_error::download_failed;
#else
#else // !defined(__APPLE__)
case EREMOTEIO:
return api_error::download_failed;
#endif
#endif // defined(__APPLE__)
case EIO:
return api_error::error;
case EEXIST:
@@ -130,8 +130,6 @@ auto to_api_error(int err) -> api_error {
return api_error::file_in_use;
case EINVAL:
return api_error::invalid_operation;
case ENAMETOOLONG:
return api_error::name_too_long;
case ENOENT:
return api_error::item_not_found;
case ENOMEM:
@@ -151,17 +149,19 @@ auto to_api_error(int err) -> api_error {
#if defined(__APPLE__)
case ENOATTR:
return api_error::xattr_not_found;
#else
#else // !defined(__APPLE__)
case ENODATA:
return api_error::xattr_not_found;
#endif
#endif // defined(__APPLE__)
#if defined(__APPLE__)
case ENAMETOOLONG:
return api_error::xattr_too_big;
#else
#else // !defined(__APPLE__)
case ENAMETOOLONG:
return api_error::name_too_long;
case E2BIG:
return api_error::xattr_too_big;
#endif
#endif // defined(__APPLE__)
default:
return api_error::error;
}

View File

@@ -182,7 +182,11 @@ if [ "${PROJECT_STATIC_LINK}" == "ON" ]; then
PROJECT_BUILD_SHARED_LIBS=OFF
PROJECT_ENABLE_BACKWARD_CPP=OFF
PROJECT_LINK_TYPE=static
PROJECT_REQUIRE_ALPINE=ON
if [ "${PROJECT_IS_DARWIN}" == "0" ]; then
PROJECT_REQUIRE_ALPINE=ON
else
PROJECT_REQUIRE_ALPINE=OFF
fi
else
PROJECT_BUILD_SHARED_LIBS=ON
PROJECT_LINK_TYPE=shared