ios: framework embedding in .app + -F search paths
- `-F <dir>` CLI flag adds Apple framework search paths (parallel to `-L`). - `TargetConfig.framework_paths` flows into the iOS link line (`-F<dir>`). - iOS link adds `-Wl,-rpath,@executable_path/Frameworks` so embedded frameworks resolve at runtime. - `createBundle` now takes the framework list; for each one it locates `<name>.framework` in the `-F` paths and `cp -R`s it into `<bundle>.app/Frameworks/`. - `c_import.compileCToObjects` forwards `-target`/`-isysroot` to clang so `#c_import` works under cross-compile (was using host clang implicitly). - iOS SDK is auto-discovered once at startup and shared by both the C compile and the link paths. - `SX_DEBUG_LINK=1` prints the resolved link argv. - `library/modules/sdl3.sx`: drop `#library "SDL3"` — linking is now per-target (build.sx handles `-lSDL3` on macOS, `-framework SDL3` on iOS).
This commit is contained in:
@@ -175,6 +175,7 @@ pub fn processCImport(
|
||||
pub fn compileCToObjects(
|
||||
allocator: std.mem.Allocator,
|
||||
infos: []const CImportInfo,
|
||||
target_config: @import("target.zig").TargetConfig,
|
||||
) ![]c.LLVMMemoryBufferRef {
|
||||
var obj_bufs = std.ArrayList(c.LLVMMemoryBufferRef).empty;
|
||||
|
||||
@@ -183,6 +184,15 @@ pub fn compileCToObjects(
|
||||
|
||||
// Build clang args: -I dirs, -D defines, raw flags
|
||||
var args_list = std.ArrayList([*c]const u8).empty;
|
||||
// Cross-compile target: forward -target / -isysroot when set.
|
||||
if (target_config.triple) |t| {
|
||||
try args_list.append(allocator, "-target");
|
||||
try args_list.append(allocator, t);
|
||||
}
|
||||
if (target_config.sysroot) |sr| {
|
||||
try args_list.append(allocator, "-isysroot");
|
||||
try args_list.append(allocator, (try allocator.dupeZ(u8, sr)).ptr);
|
||||
}
|
||||
for (info.includes) |inc| {
|
||||
const dir = dirName(inc);
|
||||
try args_list.append(allocator, (try allocPrintZ(allocator, "-I{s}", .{dir})).ptr);
|
||||
|
||||
Reference in New Issue
Block a user