Fix-ups for macOS (#291)

* Do not use precomp headers target with GCC on Apple

* CMakeLists: also link to AudioUnit on Apple

* platform.cpp: add missing <unistd.h>

---------

Co-authored-by: ouwou <26526779+ouwou@users.noreply.github.com>
This commit is contained in:
Sergey Fedorov 2024-05-19 07:07:04 +08:00 committed by GitHub
parent ada3420dce
commit cba2f6c66e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -66,7 +66,9 @@ if (ENABLE_QRCODE_LOGIN)
target_compile_definitions(abaddon PRIVATE WITH_QRLOGIN) target_compile_definitions(abaddon PRIVATE WITH_QRLOGIN)
endif () endif ()
target_precompile_headers(abaddon PRIVATE <gtkmm.h> src/abaddon.hpp src/util.hpp) if (NOT (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
target_precompile_headers(abaddon PRIVATE <gtkmm.h> src/abaddon.hpp src/util.hpp)
endif()
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
@ -146,6 +148,7 @@ if (APPLE)
target_link_libraries(abaddon "-framework CoreFoundation") target_link_libraries(abaddon "-framework CoreFoundation")
target_link_libraries(abaddon "-framework CoreAudio") target_link_libraries(abaddon "-framework CoreAudio")
target_link_libraries(abaddon "-framework AudioToolbox") target_link_libraries(abaddon "-framework AudioToolbox")
target_link_libraries(abaddon "-framework AudioUnit")
endif () endif ()
if (ENABLE_VOICE) if (ENABLE_VOICE)

View File

@ -4,6 +4,10 @@
#include <fstream> #include <fstream>
#include <string> #include <string>
#ifdef __APPLE__
#include <unistd.h>
#endif
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
using namespace std::literals::string_literals; using namespace std::literals::string_literals;