ci: add macOS build workflow (#114)

* ci: add macOS build workflow

* macos: add POSIX compatibility guards

* ci: select Xcode 26 for macOS

* macos: add kernel POSIX compatibility

* launcher: support macOS process startup

* ci: fix macOS architecture verification

* ci: cache glslang on Windows

---------

Co-authored-by: Abdullah K. <akjee204@gmail.com>
This commit is contained in:
nmzikandAbdullah K. authored and GitHub committed 2026-07-27 22:01:50 +02:00
1 parent c71bb9fc9e
commit 8fe4765f9e
10 files changed
+150 -19

No files matched your search

+3
View File
@@ -11,6 +11,9 @@
#include <sys/param.h>
#include <sys/types.h>
#include <unistd.h>
#if defined(__APPLE__)
#include <libgen.h> // POSIX basename() lives here on macOS, not in <cstring>
#endif
void SysStackWalk(void** /*stack*/, int* depth) {
*depth = 0;
+2 -2
View File
@@ -31,8 +31,8 @@ void SysVirtualInit() {
pthread_mutexattr_t attr {};
pthread_mutexattr_init(&attr);
#if KYTY_PLATFORM == KYTY_PLATFORM_LINUX
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_FAST_NP);
#if KYTY_PLATFORM == KYTY_PLATFORM_LINUX && !defined(__APPLE__)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_FAST_NP); // glibc-only fast mutex
#else
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
#endif
+1
View File
@@ -40,6 +40,7 @@
#endif
#elif KYTY_PLATFORM == KYTY_PLATFORM_LINUX
#include <cerrno>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/syscall.h>
#include <unistd.h>
+13 -1
View File
@@ -54,9 +54,21 @@ public:
m_handle = nullptr;
}
#elif KYTY_PLATFORM == KYTY_PLATFORM_LINUX
#if defined(__APPLE__)
{
char shm_name[64];
snprintf(shm_name, sizeof(shm_name), "/kyty-dm-%d-%llx", static_cast<int>(getpid()),
static_cast<unsigned long long>(reinterpret_cast<uintptr_t>(this)));
m_fd = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, 0600);
if (m_fd >= 0) {
shm_unlink(shm_name);
}
}
#else
m_fd = static_cast<int>(syscall(SYS_memfd_create, "KytyDirectMemory", 0));
#endif
if (m_fd < 0) {
LOGF_COLOR(Log::Color::Red, "\t direct-memory backing: memfd_create failed: %d\n",
LOGF_COLOR(Log::Color::Red, "\t direct-memory backing: shared fd creation failed: %d\n",
errno);
return;
}
+7 -2
View File
@@ -1056,7 +1056,7 @@ static void PthreadAttrDbgPrint(const PthreadAttr* src) {
"\tstack_addr = 0x%016" PRIx64 "\n"
"\tstack_size = %" PRIu64 "\n",
mask, state, guard_size, inherit_sched, param.sched_priority, policy, solosched,
reinterpret_cast<uint64_t>(stack_addr), reinterpret_cast<uint64_t>(stack_size));
reinterpret_cast<uint64_t>(stack_addr), static_cast<uint64_t>(stack_size));
}
static constexpr int32_t DST_NONE = 0;
@@ -2640,7 +2640,12 @@ int KYTY_SYSV_ABI PthreadCondattrSetclock(PthreadCondattr* attr, KernelClockid c
return KERNEL_ERROR_EINVAL;
}
int result = pthread_condattr_setclock(&(*attr)->p, pclock_id);
#if defined(__APPLE__)
(void)pclock_id;
int result = 0;
#else
int result = pthread_condattr_setclock(&(*attr)->p, pclock_id);
#endif
(*attr)->clock_id = clock_id;
LOGF("\tcondattr setclock: clock_id = %d, native = %d, result = %d\n", clock_id,
+12 -9
View File
@@ -26,7 +26,7 @@
#include "ui_main_dialog.h"
#ifndef __linux__
#if defined(_WIN32)
#include <windows.h> // IWYU pragma: keep
#endif
@@ -36,20 +36,20 @@
class QWidget;
#ifdef __linux__
constexpr char EMULATOR_EXE[] = "kyty_emulator";
#else
#if defined(_WIN32)
constexpr char EMULATOR_EXE[] = "kyty_emulator.exe";
#else
constexpr char EMULATOR_EXE[] = "kyty_emulator";
#endif
#ifndef __linux__
#if defined(_WIN32)
constexpr char CMD_EXE[] = "cmd.exe";
#else
#elif defined(__linux__)
constexpr char GNOME[] = "gnome-terminal";
constexpr char XTERM[] = "xterm";
constexpr char KYTY_BASH_FILE[] = "kyty_run.sh";
#endif
#ifndef __linux__
#if defined(_WIN32)
constexpr DWORD CMD_X_CHARS = 175;
constexpr DWORD CMD_Y_CHARS = 1000;
#endif
@@ -292,7 +292,7 @@ void MainDialog::RunInterpreter(QProcess* process, const Configuration& info) {
process->setProgram(GNOME);
process->setArguments({"--", "bash", "-c", bash_file_name});
}
#else
#elif defined(_WIN32)
{
process->setProgram(CMD_EXE);
QStringList process_args;
@@ -300,9 +300,12 @@ void MainDialog::RunInterpreter(QProcess* process, const Configuration& info) {
process_args += args;
process->setArguments(process_args);
}
#else
process->setProgram(interpreter);
process->setArguments(args);
#endif
process->setWorkingDirectory(dir.path());
#ifndef __linux__
#if defined(_WIN32)
process->setCreateProcessArgumentsModifier([](QProcess::CreateProcessArguments* args) {
args->flags |= static_cast<uint32_t>(CREATE_NEW_CONSOLE);
args->startupInfo->dwFlags &= ~static_cast<DWORD>(STARTF_USESTDHANDLES);
+3 -3
View File
@@ -1919,7 +1919,7 @@ int KYTY_SYSV_ABI Ngs2SystemCreateWithAllocator(const Ngs2SystemOption* optio
option->sample_rate, option->max_voice_channels,
reinterpret_cast<uint64_t>(allocator->alloc_handler),
reinterpret_cast<uint64_t>(allocator->free_handler),
reinterpret_cast<uint64_t>(allocator->user_data));
static_cast<uint64_t>(allocator->user_data));
Ngs2ContextBufferInfo buf {};
buf.host_buffer = nullptr;
@@ -2002,7 +2002,7 @@ int KYTY_SYSV_ABI Ngs2RackCreate(uintptr_t system_handle, uint32_t rack_id,
option->max_input_delay_blocks, option->max_matrices, option->max_ports,
option->max_voice_channels, option->max_output_channels,
reinterpret_cast<uint64_t>(buffer_info->host_buffer),
reinterpret_cast<uint64_t>(buffer_info->host_buffer_size));
static_cast<uint64_t>(buffer_info->host_buffer_size));
auto* ngs = reinterpret_cast<Ngs2Internal*>(system_handle);
auto* rack = static_cast<Ngs2RackInternal*>(buffer_info->host_buffer);
@@ -2106,7 +2106,7 @@ int KYTY_SYSV_ABI Ngs2RackCreateWithAllocator(uintptr_t system_handle, uint32_t
option->max_voice_channels, option->max_output_channels,
reinterpret_cast<uint64_t>(allocator->alloc_handler),
reinterpret_cast<uint64_t>(allocator->free_handler),
reinterpret_cast<uint64_t>(allocator->user_data));
static_cast<uint64_t>(allocator->user_data));
Ngs2ContextBufferInfo buf {};
buf.host_buffer = nullptr;