Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the directory structure #16

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions appkit_manual.zig → app_kit_manual.zig
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const c = @import("../c.zig");
const ca = @import("../quartz_core/ca.zig");
const cf = @import("../core_foundation/cf.zig");
const ns = @import("../foundation/ns.zig");
const cg = @import("../core_graphics/cg.zig");
const objc = @import("../objc.zig");
const c = @import("c.zig");
const ca = @import("quartz_core.zig");
const cf = @import("core_foundation.zig");
const ns = @import("foundation.zig");
const cg = @import("core_graphics.zig");
const objc = @import("objc.zig");

pub const applicationMain = NSApplicationMain;
extern fn NSApplicationMain(argc: c_int, argv: **c_char) c_int;
extern fn NSApplicationMain(argc: c_int, argv: [*]*c_char) c_int;

// ------------------------------------------------------------------------------------------------
// Shared
Expand Down
6 changes: 3 additions & 3 deletions avf_audio_manual.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const c = @import("../c.zig");
const cf = @import("../core_foundation/cf.zig");
const ns = @import("../foundation/ns.zig");
const c = @import("c.zig");
const cf = @import("core_foundation.zig");
const ns = @import("foundation.zig");

// ------------------------------------------------------------------------------------------------
// Types
Expand Down
6 changes: 3 additions & 3 deletions core_midi_manual.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const c = @import("../c.zig");
const cf = @import("../core_foundation/cf.zig");
const ns = @import("../foundation/ns.zig");
const c = @import("c.zig");
const cf = @import("core_foundation.zig");
const ns = @import("foundation.zig");

// ------------------------------------------------------------------------------------------------
// Types
6 changes: 3 additions & 3 deletions mtl_manual.zig → metal_manual.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const c = @import("../c.zig");
const cf = @import("../core_foundation/cf.zig");
const ns = @import("../foundation/ns.zig");
const c = @import("c.zig");
const cf = @import("core_foundation.zig");
const ns = @import("foundation.zig");

// ------------------------------------------------------------------------------------------------
// Opaque types
Expand Down
14 changes: 7 additions & 7 deletions src/appkit/appkit.zig → src/app_kit.zig
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const c = @import("../c.zig");
const ca = @import("../quartz_core/ca.zig");
const cf = @import("../core_foundation/cf.zig");
const ns = @import("../foundation/ns.zig");
const cg = @import("../core_graphics/cg.zig");
const objc = @import("../objc.zig");
const c = @import("c.zig");
const ca = @import("quartz_core.zig");
const cf = @import("core_foundation.zig");
const ns = @import("foundation.zig");
const cg = @import("core_graphics.zig");
const objc = @import("objc.zig");

pub const applicationMain = NSApplicationMain;
extern fn NSApplicationMain(argc: c_int, argv: **c_char) c_int;
extern fn NSApplicationMain(argc: c_int, argv: [*]*c_char) c_int;

// ------------------------------------------------------------------------------------------------
// Shared
Expand Down
6 changes: 3 additions & 3 deletions src/avf_audio/avaudio.zig → src/avf_audio.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const c = @import("../c.zig");
const cf = @import("../core_foundation/cf.zig");
const ns = @import("../foundation/ns.zig");
const c = @import("c.zig");
const cf = @import("core_foundation.zig");
const ns = @import("foundation.zig");

// ------------------------------------------------------------------------------------------------
// Types
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/core_midi/coremidi.zig → src/core_midi.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const c = @import("../c.zig");
const cf = @import("../core_foundation/cf.zig");
const ns = @import("../foundation/ns.zig");
const c = @import("c.zig");
const cf = @import("core_foundation.zig");
const ns = @import("foundation.zig");

// ------------------------------------------------------------------------------------------------
// Types
Expand Down
2 changes: 1 addition & 1 deletion src/foundation/ns.zig → src/foundation.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const c = @import("../c.zig");
const c = @import("c.zig");

// ------------------------------------------------------------------------------------------------
// Types
Expand Down
18 changes: 10 additions & 8 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,34 @@ const c = @import("c.zig");
pub const objc = @import("objc.zig");

pub const avf_audio = struct {
pub const avaudio = @import("avf_audio/avaudio.zig");
pub const avaudio = @import("avf_audio.zig");
};

pub const core_foundation = struct {
pub const cf = @import("core_foundation/cf.zig");
pub const cf = @import("core_foundation.zig");
};

pub const core_graphics = struct {
pub const cg = @import("core_graphics/cg.zig");
pub const cg = @import("core_graphics.zig");
};

pub const foundation = struct {
pub const ns = @import("foundation/ns.zig");
pub const ns = @import("foundation.zig");
};

pub const metal = struct {
pub const mtl = @import("metal/mtl.zig");
pub const mtl = @import("metal.zig");
};

pub const quartz_core = struct {
pub const ca = @import("quartz_core/ca.zig");
pub const ca = @import("quartz_core.zig");
};

pub const appkit = struct {
pub const ns = @import("appkit/appkit.zig");
pub const app_kit = struct {
pub const ns = @import("app_kit.zig");
};
// TODO: delete `appkit` once Mach is using `app_kit`.
pub const appkit = app_kit;

pub const mach = struct {
pub const AppDelegate = opaque {
Expand Down
6 changes: 3 additions & 3 deletions src/metal/mtl.zig → src/metal.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const c = @import("../c.zig");
const cf = @import("../core_foundation/cf.zig");
const ns = @import("../foundation/ns.zig");
const c = @import("c.zig");
const cf = @import("core_foundation.zig");
const ns = @import("foundation.zig");

// ------------------------------------------------------------------------------------------------
// Opaque types
Expand Down
8 changes: 4 additions & 4 deletions src/quartz_core/ca.zig → src/quartz_core.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const c = @import("../c.zig");
const cg = @import("../core_graphics/cg.zig");
const mtl = @import("../metal/mtl.zig");
const ns = @import("../foundation/ns.zig");
const c = @import("c.zig");
const cg = @import("core_graphics.zig");
const mtl = @import("metal.zig");
const ns = @import("foundation.zig");

pub const Layer = opaque {
pub fn class() *c.objc_class {
Expand Down
28 changes: 12 additions & 16 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,42 @@ git_clone_rev https://github.com/hexops/xcode-frameworks 3d1d9613c39bfc2ebfa2551

zig build -Doptimize=ReleaseFast

rm -rf src/metal/mtl.zig
rm -f src/metal.zig
echo "Generating Metal"
echo "
#include <Metal/Metal.h>
" > headers.m
clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations > headers.json
mkdir -p src/metal/
cat mtl_manual.zig > src/metal/mtl.zig
./zig-out/bin/generator --framework Metal >> src/metal/mtl.zig
cat metal_manual.zig > src/metal.zig
./zig-out/bin/generator --framework Metal >> src/metal.zig
rm headers.json headers.m

rm -rf src/avf_audio/avaudio.zig
rm -f src/avf_audio.zig
echo "Generating AVFAudio"
cp avf_audio_headers.m headers.m
clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations > headers.json
mkdir -p src/avf_audio/
cat avf_audio_manual.zig > src/avf_audio/avaudio.zig
./zig-out/bin/generator --framework AVFAudio >> src/avf_audio/avaudio.zig
cat avf_audio_manual.zig > src/avf_audio.zig
./zig-out/bin/generator --framework AVFAudio >> src/avf_audio.zig
rm headers.json headers.m

rm -rf src/core_midi/coremidi.zig
rm -f src/core_midi.zig
echo "Generating CoreMIDI"
echo "
#include <CoreMIDI/MidiServices.h>
" > headers.m
clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations > headers.json
mkdir -p src/core_midi/
cat core_midi_manual.zig > src/core_midi/coremidi.zig
./zig-out/bin/generator --framework CoreMIDI >> src/core_midi/coremidi.zig
cat core_midi_manual.zig > src/core_midi.zig
./zig-out/bin/generator --framework CoreMIDI >> src/core_midi.zig
rm headers.json headers.m

rm -rf src/appkit/appkit.zig
rm -f src/app_kit.zig
echo "Generating AppKit"
echo "
#include <AppKit/AppKit.h>
" > headers.m
clang headers.m -F ./xcode-frameworks/Frameworks -Xclang -ast-dump=json -fsyntax-only -Wno-deprecated-declarations -Wno-availability > headers.json
mkdir -p src/appkit/
cat appkit_manual.zig > src/appkit/appkit.zig
./zig-out/bin/generator --framework AppKit >> src/appkit/appkit.zig
cat app_kit_manual.zig > src/app_kit.zig
./zig-out/bin/generator --framework AppKit >> src/app_kit.zig
rm headers.json headers.m

zig fmt .
Expand Down
Loading