native: fix again v -os macos -experimental -b native -o hw.macos examples/hello_world.v, after the latest changes to the backend

This commit is contained in:
Delyan Angelov 2025-06-12 13:26:02 +03:00
parent 36bef926fb
commit 9e2462a876
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
4 changed files with 32 additions and 1 deletions

View File

@ -75,6 +75,8 @@ jobs:
run: v run ci/linux_ci.vsh test_leak_detector_tcc
- name: Test leak detector not being active for normal compile
run: v run ci/linux_ci.vsh test_leak_detector_not_active_tcc
- name: native cross compilation to macos
run: v run ci/linux_ci.vsh native_cross_compilation_to_macos
gcc-linux:
runs-on: ubuntu-24.04
@ -121,6 +123,8 @@ jobs:
run: v run ci/linux_ci.vsh build_modules_gcc
- name: native machine code generation
run: v run ci/linux_ci.vsh native_machine_code_generation_gcc
- name: native cross compilation to macos
run: v run ci/linux_ci.vsh native_cross_compilation_to_macos
- name: compile vdoctor.v with -prod
run: v run ci/linux_ci.vsh compile_vdoctor_prod_gcc
- name: compile vup.v with -prod
@ -167,3 +171,5 @@ jobs:
run: v run ci/linux_ci.vsh build_modules_clang
- name: native machine code generation
run: v run ci/linux_ci.vsh native_machine_code_generation_clang
- name: native cross compilation to macos
run: v run ci/linux_ci.vsh native_cross_compilation_to_macos

View File

@ -14,6 +14,22 @@ pub fn exec(command string) {
}
}
pub fn file_size_greater_than(fpath string, min_fsize u64) {
log.info('path should exist `${fpath}` ...')
if !os.exists(fpath) {
exit(1)
}
log.info('path exists, and should be a file: `${fpath}` ...')
if !os.is_file(fpath) {
exit(2)
}
real_size := os.file_size(fpath)
log.info('actual file size of `${fpath}` is ${real_size}, wanted: ${min_fsize}, diff: ${real_size - min_fsize}.')
if real_size < min_fsize {
exit(3)
}
}
const self_command = 'v ' +
os.real_path(os.executable()).replace_once(os.real_path(@VROOT), '').trim_left('/\\') + '.vsh'

View File

@ -363,6 +363,12 @@ fn native_machine_code_generation_clang() {
native_machine_code_generation_common()
}
fn native_cross_compilation_to_macos() {
exec('v -os macos -experimental -b native -o hw.macos examples/hello_world.v')
common.file_size_greater_than('hw.macos', 8000)
exec('rm -f hw.macos')
}
//
// Collect all tasks
//
@ -409,7 +415,6 @@ const all_tasks = {
'build_option_test_autofree_gcc': Task{build_option_test_autofree_gcc, 'Build option_test.c.v with -autofree (gcc)'}
'v_self_compilation_parallel_cc_gcc': Task{v_self_compilation_parallel_cc_gcc, 'V self compilation with -parallel-cc (gcc)'}
'build_modules_gcc': Task{build_modules_gcc, 'Build modules (gcc)'}
'native_machine_code_generation_gcc': Task{native_machine_code_generation_gcc, 'native machine code generation (gcc)'}
'compile_vdoctor_prod_gcc': Task{compile_vdoctor_prod_gcc, 'compile vdoctor with -prod (gcc)'}
'compile_vup_prod_gcc': Task{compile_vup_prod_gcc, 'compile vup with -prod (gcc)'}
// clang tasks
@ -429,6 +434,8 @@ const all_tasks = {
'build_examples_autofree_clang': Task{build_examples_autofree_clang, 'Build examples with -autofree (clang)'}
'build_modules_clang': Task{build_modules_clang, 'Build modules (clang)'}
'native_machine_code_generation_clang': Task{native_machine_code_generation_clang, 'native machine code generation (clang)'}
'native_machine_code_generation_gcc': Task{native_machine_code_generation_gcc, 'native machine code generation (gcc)'}
'native_cross_compilation_to_macos': Task{native_cross_compilation_to_macos, 'native cross compilation to macos'}
}
common.run(all_tasks)

View File

@ -196,6 +196,8 @@ fn (mut g Gen) extern_var_ident(var ExternVar) {
g.extern_vars[g.pos()] = var.name
g.code_gen.mov64(main_reg, Number(i64(0)))
g.code_gen.mov_deref(main_reg, main_reg, ast.u64_type_idx)
} else if g.pref.os == .macos {
eprintln('## TODO, macos, extern_var_ident, var: ${var}')
} else {
g.n_error('${@LOCATION} unsupported os for ${var}')
}