ios: move `sokol` declarations out of builder, and support non-sokol apps too (#9703)
parent
07a6f4e445
commit
cfaba49683
|
@ -12,8 +12,14 @@ pub const (
|
|||
#flag freebsd -L/usr/local/lib -lX11 -lGL -lXcursor -lXi
|
||||
#flag windows -lgdi32
|
||||
// METAL
|
||||
#flag darwin -DSOKOL_METAL
|
||||
#flag darwin -framework Metal -framework Cocoa -framework MetalKit -framework QuartzCore
|
||||
$if darwin {
|
||||
#flag -DSOKOL_METAL
|
||||
#flag -framework Metal -framework Cocoa -framework MetalKit -framework QuartzCore
|
||||
}
|
||||
$if ios {
|
||||
#flag -DSOKOL_METAL
|
||||
#flag -framework Foundation -framework Metal -framework MetalKit -framework UIKit
|
||||
}
|
||||
// OPENGL
|
||||
#flag linux -DSOKOL_GLCORE33
|
||||
#flag freebsd -DSOKOL_GLCORE33
|
||||
|
|
|
@ -202,11 +202,6 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
|
|||
'-Wno-format-nonliteral',
|
||||
]
|
||||
if v.pref.os == .ios {
|
||||
ccoptions.args << '-framework Foundation'
|
||||
ccoptions.args << '-framework UIKit'
|
||||
ccoptions.args << '-framework Metal'
|
||||
ccoptions.args << '-framework MetalKit'
|
||||
ccoptions.args << '-DSOKOL_METAL'
|
||||
ccoptions.args << '-fobjc-arc'
|
||||
}
|
||||
ccoptions.debug_mode = v.pref.is_debug
|
||||
|
|
|
@ -12,7 +12,10 @@ pub fn (mut g Gen) gen_c_main() {
|
|||
}
|
||||
g.out.writeln('')
|
||||
main_fn_start_pos := g.out.len
|
||||
if (g.pref.os == .android && g.pref.is_apk) || g.pref.os == .ios {
|
||||
|
||||
is_sokol := 'sokol' in g.table.imports
|
||||
|
||||
if (g.pref.os == .android && g.pref.is_apk) || (g.pref.os == .ios && is_sokol) {
|
||||
g.gen_c_android_sokol_main()
|
||||
} else {
|
||||
g.gen_c_main_header()
|
||||
|
|
Loading…
Reference in New Issue