Changes
4 changed files (+0/-186)
-
-
@@ -103,90 +103,6 @@ step.dependOn(&artifact.step);b.default_step.dependOn(step); } // XCFramework // https://mitchellh.com/writing/zig-and-swiftui if (target.result.os.tag.isDarwin()) { const arm = b.addLibrary(.{ .name = "plac_apple_arm", .linkage = .static, .root_module = b.createModule(.{ .root_source_file = b.path("src/main.apple.zig"), .target = b.resolveTargetQuery(.{ .os_tag = .macos, .cpu_arch = .aarch64, }), .optimize = optimize, }), }); // While I could have dedicated unit just for copying, this is simpler and easier. arm.installHeader(b.path("src/plac.h"), "plac.h"); arm.installHeader(b.path("src/plac.modulemap"), "module.modulemap"); const intel = b.addLibrary(.{ .name = "plac_apple_intel", .linkage = .static, .root_module = b.createModule(.{ .root_source_file = b.path("src/main.apple.zig"), .target = b.resolveTargetQuery(.{ .os_tag = .macos, .cpu_arch = .x86_64, }), .optimize = optimize, }), }); inline for (.{ arm, intel }) |compile| { compile.linkLibC(); // Without bundling those, XCode is unable to resolve symbols. compile.bundle_compiler_rt = true; compile.bundle_ubsan_rt = true; setupModule(b, compile.root_module, opts); } const universal_lib = universal: { const lipo = b.addSystemCommand(&.{"lipo"}); lipo.addArg("-create"); lipo.addArg("-output"); const output = lipo.addOutputFileArg("libplac.a"); lipo.addFileArg(arm.getEmittedBin()); lipo.addFileArg(intel.getEmittedBin()); break :universal output; }; const xcframework = xcframework: { const xcodebuild = b.addSystemCommand(&.{"xcodebuild"}); xcodebuild.addArg("-create-xcframework"); xcodebuild.addArg("-library"); xcodebuild.addFileArg(universal_lib); xcodebuild.addArg("-headers"); xcodebuild.addDirectoryArg(arm.getEmittedIncludeTree()); xcodebuild.addArg("-output"); break :xcframework xcodebuild.addOutputDirectoryArg("PlacCore.xcframework"); }; b.addNamedLazyPath("xcframeworks", xcframework); const step = b.step("apple", "Build xcframework file for Apple platforms"); step.dependOn(&b.addInstallDirectory(.{ .source_dir = xcframework, .install_dir = .{ .custom = "xcframeworks" }, .install_subdir = "PlacCore.xcframework", }).step); b.default_step.dependOn(step); } } fn setupModule(b: *std.Build, mod: *std.Build.Module, opts: ModuleOptions) void {
-
-
core/src/main.apple.zig (deleted)
-
@@ -1,29 +0,0 @@// Copyright 2025 Shota FUJI // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 //! This file is an entrypoint of library for Apple platforms. const std = @import("std"); const main = @import("./main.zig"); pub const std_options = std.Options{ .log_level = .debug, }; comptime { main.export_capi(); }
-
-
macos/build.zig (deleted)
-
@@ -1,43 +0,0 @@// Copyright 2025 Shota FUJI // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 const std = @import("std"); pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.option(std.builtin.OptimizeMode, "optimize", "Optimization mode") orelse .ReleaseSafe; const freelog = b.option(bool, "freelog", "Enable logging memory releases") orelse false; // FIXME: Debug build for macOS crashes on WebSocket client creation for some reason. if (optimize == .Debug) { std.log.err("Debug build is unavailable as third-party library triggers runtime panic in that build mode", .{}); return error.BrokenOptimizeMode; } const core = b.dependency("core", .{ .target = target, .optimize = optimize, .freelog = freelog, .@"extension-id" = @as([]const u8, "jp.pocka.plac.macos"), .@"extension-name" = @as([]const u8, "Plac macOS"), }); b.installDirectory(.{ .source_dir = core.namedLazyPath("xcframeworks"), .install_dir = .{ .custom = "xcframeworks" }, .install_subdir = "PlacCore.xcframework", }); }
-
-
macos/build.zig.zon (deleted)
-
@@ -1,30 +0,0 @@// Copyright 2025 Shota FUJI // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // SPDX-License-Identifier: Apache-2.0 .{ .name = .plac_macos, .version = "0.0.0", .fingerprint = 0x7793d22cd47816ab, .minimum_zig_version = "0.14.0", .dependencies = .{ .core = .{ .path = "../core", }, }, .paths = .{ "build.zig", "build.zig.zon", }, }
-