diff --git a/vlib/v/builder/c.v b/vlib/v/builder/c.v index 77a51ff6fa..9a5434eb4f 100644 --- a/vlib/v/builder/c.v +++ b/vlib/v/builder/c.v @@ -84,13 +84,5 @@ pub fn (mut b Builder) compile_c() { out_name_c = b.get_vtmp_filename(b.pref.out_name, '.tmp.so.c') } b.build_c(files, out_name_c) - if b.pref.os == .ios { - bundle_name := b.pref.out_name.split('/').last() - bundle_id := if b.pref.bundle_id != '' { b.pref.bundle_id } else { 'app.vlang.$bundle_name' } - display_name := if b.pref.display_name != '' { b.pref.display_name } else { bundle_name } - os.mkdir('${display_name}.app') or { panic(err) } - os.write_file('${display_name}.app/Info.plist', make_ios_plist(display_name, bundle_id, - bundle_name, 1)) or { panic(err) } - } b.cc() } diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 1b939614cd..35f54635f6 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -432,12 +432,7 @@ fn (mut v Builder) setup_output_name() { if os.is_dir(v.pref.out_name) { verror("'$v.pref.out_name' is a directory") } - if v.pref.os == .ios { - bundle_name := v.pref.out_name.split('/').last() - v.ccoptions.o_args << '-o "${v.pref.out_name}.app/$bundle_name"' - } else { - v.ccoptions.o_args << '-o "$v.pref.out_name"' - } + v.ccoptions.o_args << '-o "$v.pref.out_name"' } fn (mut v Builder) vjs_cc() bool { @@ -536,7 +531,12 @@ fn (mut v Builder) cc() { ios_sdk := if v.pref.is_ios_simulator { 'iphonesimulator' } else { 'iphoneos' } ios_sdk_path_res := os.execute_or_panic('xcrun --sdk $ios_sdk --show-sdk-path') mut isysroot := ios_sdk_path_res.output.replace('\n', '') - ccompiler = 'xcrun --sdk iphoneos clang -isysroot $isysroot' + arch := if v.pref.is_ios_simulator { + '-arch x86_64' + } else { + '-arch armv7 -arch armv7s -arch arm64' + } + ccompiler = 'xcrun --sdk iphoneos clang -isysroot $isysroot $arch' } v.setup_ccompiler_options(ccompiler) v.build_thirdparty_obj_files() diff --git a/vlib/v/builder/compile.v b/vlib/v/builder/compile.v index 3de6555851..14f4fe3bae 100644 --- a/vlib/v/builder/compile.v +++ b/vlib/v/builder/compile.v @@ -86,44 +86,34 @@ fn (mut b Builder) run_compiled_executable_and_exit() { if b.pref.only_check_syntax { return } - if b.pref.os == .ios && b.pref.is_ios_simulator == false { - panic('Running iOS apps on physical devices is not yet supported. Please run in the simulator using the -simulator flag.') + if b.pref.os == .ios { + panic('Running iOS apps is not supported yet.') } if b.pref.is_verbose { println('============ running $b.pref.out_name ============') } - if b.pref.os == .ios { - device := '"iPhone SE (2nd generation)"' - os.execute_or_panic('xcrun simctl boot $device') - bundle_name := b.pref.out_name.split('/').last() - display_name := if b.pref.display_name != '' { b.pref.display_name } else { bundle_name } - os.execute_or_panic('xcrun simctl install $device ${display_name}.app') - bundle_id := if b.pref.bundle_id != '' { b.pref.bundle_id } else { 'app.vlang.$bundle_name' } - os.execute_or_panic('xcrun simctl launch $device $bundle_id') - } else { - exefile := os.real_path(b.pref.out_name) - mut cmd := '"$exefile"' - if b.pref.backend == .js { - jsfile := os.real_path('${b.pref.out_name}.js') - cmd = 'node "$jsfile"' - } - for arg in b.pref.run_args { - // Determine if there are spaces in the parameters - if arg.index_byte(` `) > 0 { - cmd += ' "' + arg + '"' - } else { - cmd += ' ' + arg - } - } - if b.pref.is_verbose { - println('command to run executable: $cmd') - } - if b.pref.is_test || b.pref.is_run { - ret := os.system(cmd) - b.cleanup_run_executable_after_exit(exefile) - exit(ret) + exefile := os.real_path(b.pref.out_name) + mut cmd := '"$exefile"' + if b.pref.backend == .js { + jsfile := os.real_path('${b.pref.out_name}.js') + cmd = 'node "$jsfile"' + } + for arg in b.pref.run_args { + // Determine if there are spaces in the parameters + if arg.index_byte(` `) > 0 { + cmd += ' "' + arg + '"' + } else { + cmd += ' ' + arg } } + if b.pref.is_verbose { + println('command to run executable: $cmd') + } + if b.pref.is_test || b.pref.is_run { + ret := os.system(cmd) + b.cleanup_run_executable_after_exit(exefile) + exit(ret) + } exit(0) } diff --git a/vlib/v/builder/iosplist.v b/vlib/v/builder/iosplist.v deleted file mode 100644 index 29630a171c..0000000000 --- a/vlib/v/builder/iosplist.v +++ /dev/null @@ -1,39 +0,0 @@ -module builder - -fn make_ios_plist(display_name string, bundle_id string, bundle_name string, bundle_version int) string { - return ' - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - $display_name - CFBundleExecutable - $bundle_name - CFBundleIdentifier - $bundle_id - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $bundle_name - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0.0 - CFBundleSignature - VIOS - CFBundleVersion - $bundle_version - LSRequiresIPhoneOS - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - -' -} diff --git a/vlib/v/gen/c/cmain.v b/vlib/v/gen/c/cmain.v index f3d739ea3e..21e335ecda 100644 --- a/vlib/v/gen/c/cmain.v +++ b/vlib/v/gen/c/cmain.v @@ -12,7 +12,7 @@ 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 { + if (g.pref.os == .android && g.pref.is_apk) || g.pref.os == .ios { g.gen_c_android_sokol_main() } else { g.gen_c_main_header() diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 700466d462..666eb21aee 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -115,8 +115,6 @@ pub mut: vroot string out_name_c string // full os.real_path to the generated .tmp.c file; set by builder. out_name string - display_name string - bundle_id string path string // Path to file/folder to compile // -d vfmt and -d another=0 for `$if vfmt { will execute }` and `$if another ? { will NOT get here }` compile_defines []string // just ['vfmt'] @@ -410,14 +408,6 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences res.custom_prelude = prelude i++ } - '-name' { - res.display_name = cmdline.option(current_args, '-name', '') - i++ - } - '-bundle' { - res.bundle_id = cmdline.option(current_args, '-bundle', '') - i++ - } else { if command == 'build' && is_source_file(arg) { eprintln('Use `v $arg` instead.')