修复macos编译

This commit is contained in:
Nana 2024-03-25 06:17:04 +08:00
parent 00d6b5fb69
commit 19c2b0fe2b
7 changed files with 15 additions and 6 deletions

View File

@ -57,9 +57,8 @@ function(retrieve_files path out_files)
endfunction()
# setup rtaudio
set(RTAUDIO_API_ASIO ON CACHE BOOL "" FORCE)
if (WIN32)
set(RTAUDIO_API_ASIO ON CACHE BOOL "" FORCE)
set(RTAUDIO_API_WASAPI ON CACHE BOOL "" FORCE)
set(RTAUDIO_API_DS OFF CACHE BOOL "" FORCE)
elseif(APPLE)

View File

@ -13,7 +13,7 @@ void audio_buffer::resize(uint32_t channel_num, uint32_t block_size) {
void audio_buffer::clear() {
std::scoped_lock lock(lock_);
for (auto& channel : buffer_) {
std::fill(channel.begin(), channel.end(), 0.f);
std::memset(channel.data(), 0, channel.size() * sizeof(float));
}
}

View File

@ -1,7 +1,11 @@
#pragma once
#ifdef WIN32
#ifdef core_EXPORTS
#define CORE_API __declspec(dllexport)
#else
#define CORE_API __declspec(dllimport)
#endif
#else
#define CORE_API
#endif

View File

@ -18,7 +18,7 @@ public:
#ifdef _WIN32
hModule = LoadLibraryA(library_path.c_str());
#else
handle = dlopen(libraryPath.c_str(), RTLD_LAZY);
handle = dlopen(library_path.c_str(), RTLD_LAZY);
#endif
if (!get_handle()) {
spdlog::error("Failed to load library: {}", library_path);

View File

@ -1,7 +1,9 @@
#include "singleton_manager.h"
#include <cstdint>
#ifdef __APPLE__
#include <__algorithm/ranges_find.h>
#endif
#include "singleton.h"
bool singleton_initliazer::has_init(singleton* s) {

View File

@ -1,7 +1,11 @@
#pragma once
#ifdef WIN32
#ifdef mempool_EXPORTS
#define MEMPOOL_API __declspec(dllexport)
#else
#define MEMPOOL_API __declspec(dllimport)
#endif
#else
#define MEMPOOL_API
#endif

View File

@ -8,5 +8,5 @@ inline uintptr_t getpagesize() {
return systemInfo.dwPageSize;
}
#else
#include <unisid.h>
#include <unistd.h>
#endif