#import "modules/compiler.sx";
#import "modules/platform/bundle.sx";

configure_build :: () {
    opts := build_options();
    opts.set_bundle_id("co.swipelab.m3te");
    opts.set_post_link_callback(bundle_main);
    if OS == {
        case .macos: {
            opts.set_output_path("sx-out/macos/M3te");
            opts.set_bundle_path("sx-out/macos/M3te.app");
            // Ad-hoc sign (empty identity) so a local `open` launch isn't
            // Gatekeeper-rejected. SDL3 comes from Homebrew.
            opts.add_link_flag("-L/opt/homebrew/lib");
            opts.add_link_flag("-lSDL3");
            opts.add_asset_dir("assets", "assets");
        }
        case .ios: {
            opts.set_output_path("sx-out/ios/M3te");
            opts.set_bundle_path("sx-out/ios/M3te.app");
            // Device-only: the simulator is ad-hoc signed by the bundler,
            // which also grants get-task-allow for lldb. Embedding a device
            // identity / profile in a sim build blocks install + launch.
            if opts.is_ios_device() {
                opts.set_codesign_identity("Apple Development: Alexandru Agrapine (DC8VVHJ9W4)");
                opts.set_provisioning_profile("/Users/agra/Downloads/SwipeS32DevProfile.mobileprovision");
            }
            opts.add_framework("UIKit");
            opts.add_framework("OpenGLES");
            opts.add_framework("QuartzCore");
            opts.add_framework("Metal");
            opts.add_asset_dir("assets", "assets");
        }
    }
}
