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:
agra
2026-05-17 14:38:58 +03:00
parent dc8529e3ea
commit e8bd40f710
4 changed files with 105 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
sdl3 :: #library "SDL3";
// SDL3 bindings. Linking is per-target (handled in build.sx):
// SDL_InitFlags
SDL_INIT_VIDEO :u32: 0x20;
@@ -320,27 +320,27 @@ SDL_Event :: enum struct { tag: u32; _: u32; payload: [30]u32; } {
}
// Functions
SDL_Init :: (flags: u32) -> bool #foreign sdl3;
SDL_Quit :: () -> void #foreign sdl3;
SDL_CreateWindow :: (title: [:0]u8, w: s32, h: s32, flags: u64) -> *void #foreign sdl3;
SDL_DestroyWindow :: (window: *void) -> void #foreign sdl3;
SDL_GL_SetAttribute :: (attr: s32, value: s32) -> bool #foreign sdl3;
SDL_GL_CreateContext :: (window: *void) -> *void #foreign sdl3;
SDL_GL_DestroyContext :: (context: *void) -> bool #foreign sdl3;
SDL_GL_MakeCurrent :: (window: *void, context: *void) -> bool #foreign sdl3;
SDL_GL_SwapWindow :: (window: *void) -> bool #foreign sdl3;
SDL_GL_SetSwapInterval :: (interval: s32) -> bool #foreign sdl3;
SDL_GL_GetProcAddress :: (proc: [:0]u8) -> *void #foreign sdl3;
SDL_PollEvent :: (event: *SDL_Event) -> bool #foreign sdl3;
SDL_AddEventWatch :: (filter: *void, userdata: *void) -> bool #foreign sdl3;
SDL_GetTicks :: () -> u64 #foreign sdl3;
SDL_GetPerformanceCounter :: () -> u64 #foreign sdl3;
SDL_GetPerformanceFrequency :: () -> u64 #foreign sdl3;
SDL_Delay :: (ms: u32) -> void #foreign sdl3;
SDL_GetWindowDisplayScale :: (window: *void) -> f32 #foreign sdl3;
SDL_GetWindowSize :: (window: *void, w: *s32, h: *s32) -> bool #foreign sdl3;
SDL_SetWindowSize :: (window: *void, w: s32, h: s32) -> bool #foreign sdl3;
SDL_GetWindowSizeInPixels :: (window: *void, w: *s32, h: *s32) -> bool #foreign sdl3;
SDL_Init :: (flags: u32) -> bool #foreign;
SDL_Quit :: () -> void #foreign;
SDL_CreateWindow :: (title: [:0]u8, w: s32, h: s32, flags: u64) -> *void #foreign;
SDL_DestroyWindow :: (window: *void) -> void #foreign;
SDL_GL_SetAttribute :: (attr: s32, value: s32) -> bool #foreign;
SDL_GL_CreateContext :: (window: *void) -> *void #foreign;
SDL_GL_DestroyContext :: (context: *void) -> bool #foreign;
SDL_GL_MakeCurrent :: (window: *void, context: *void) -> bool #foreign;
SDL_GL_SwapWindow :: (window: *void) -> bool #foreign;
SDL_GL_SetSwapInterval :: (interval: s32) -> bool #foreign;
SDL_GL_GetProcAddress :: (proc: [:0]u8) -> *void #foreign;
SDL_PollEvent :: (event: *SDL_Event) -> bool #foreign;
SDL_AddEventWatch :: (filter: *void, userdata: *void) -> bool #foreign;
SDL_GetTicks :: () -> u64 #foreign;
SDL_GetPerformanceCounter :: () -> u64 #foreign;
SDL_GetPerformanceFrequency :: () -> u64 #foreign;
SDL_Delay :: (ms: u32) -> void #foreign;
SDL_GetWindowDisplayScale :: (window: *void) -> f32 #foreign;
SDL_GetWindowSize :: (window: *void, w: *s32, h: *s32) -> bool #foreign;
SDL_SetWindowSize :: (window: *void, w: s32, h: s32) -> bool #foreign;
SDL_GetWindowSizeInPixels :: (window: *void, w: *s32, h: *s32) -> bool #foreign;
SDL_Rect :: struct {
x: s32;
@@ -349,5 +349,5 @@ SDL_Rect :: struct {
h: s32;
}
SDL_GetPrimaryDisplay :: () -> u32 #foreign sdl3;
SDL_GetDisplayUsableBounds :: (display_id: u32, rect: *SDL_Rect) -> bool #foreign sdl3;
SDL_GetPrimaryDisplay :: () -> u32 #foreign;
SDL_GetDisplayUsableBounds :: (display_id: u32, rect: *SDL_Rect) -> bool #foreign;