Skip to content

Commit 3bfc3ca

Browse files
committed
build/meson: support running codegen
also removed -M during the test_fib.c codegen: 902cc2c ("Add native module support on Windows") switched examples to dynamic import() instead of static import statement and the lookup was deferred to runtime, thus we don't need to hint qjsc this is a declared module and exclude it from bundling.
1 parent 5f176a3 commit 3bfc3ca

File tree

2 files changed

+89
-2
lines changed

2 files changed

+89
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ codegen: $(QJSC)
7979
$(QJSC) -e -o gen/function_source.c tests/function_source.js
8080
$(QJSC) -e -o gen/hello.c examples/hello.js
8181
$(QJSC) -e -o gen/hello_module.c -m examples/hello_module.js
82-
$(QJSC) -e -o gen/test_fib.c -M examples/fib.so,fib -m examples/test_fib.js
82+
$(QJSC) -e -o gen/test_fib.c -m examples/test_fib.js
8383
$(QJSC) -C -ss -o builtin-array-fromasync.h builtin-array-fromasync.js
8484

8585
debug:

meson.build

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ if tests.allowed()
502502
endif
503503

504504
# Unicode generator
505-
executable(
505+
unicode_gen = executable(
506506
'unicode_gen',
507507
'cutils.c',
508508
'libunicode.c',
@@ -512,6 +512,93 @@ executable(
512512
build_by_default: false,
513513
)
514514

515+
run_target(
516+
'libunicode-table.h',
517+
command: [
518+
unicode_gen,
519+
meson.current_source_dir() / 'unicode',
520+
files('libunicode-table.h'),
521+
],
522+
)
523+
524+
# bytecode to c source code for builtin and examples
525+
alias_target('codegen',
526+
run_target(
527+
'codegen_repl.c',
528+
command: [
529+
qjsc_exe,
530+
'-ss',
531+
'-o', files('gen/repl.c'),
532+
'-m',
533+
'-n', 'repl.js',
534+
files('repl.js'),
535+
],
536+
),
537+
run_target(
538+
'codegen_standalone.c',
539+
command: [
540+
qjsc_exe,
541+
'-ss',
542+
'-o', files('gen/standalone.c'),
543+
'-m',
544+
'-n', 'standalone.js',
545+
files('standalone.js'),
546+
],
547+
),
548+
run_target(
549+
'codegen_function_source.c',
550+
command: [
551+
qjsc_exe,
552+
'-e',
553+
'-o', files('gen/function_source.c'),
554+
'-n', 'tests/function_source.js',
555+
files('tests/function_source.js'),
556+
],
557+
),
558+
run_target(
559+
'codegen_hello.c',
560+
command: [
561+
qjsc_exe,
562+
'-e',
563+
'-o', files('gen/hello.c'),
564+
'-n', 'examples/hello.js',
565+
files('examples/hello.js'),
566+
],
567+
),
568+
run_target(
569+
'codegen_hello_module.c',
570+
command: [
571+
qjsc_exe,
572+
'-e',
573+
'-o', files('gen/hello_module.c'),
574+
'-m',
575+
'-n', 'examples/hello_module.js',
576+
files('examples/hello_module.js'),
577+
],
578+
),
579+
run_target(
580+
'codegen_test_fib.c',
581+
command: [
582+
qjsc_exe,
583+
'-e',
584+
'-o', files('gen/test_fib.c'),
585+
'-m',
586+
'-n', 'examples/test_fib.js',
587+
files('examples/test_fib.js'),
588+
],
589+
),
590+
run_target(
591+
'codegen_builtin-array-fromasync.h',
592+
command: [
593+
qjsc_exe,
594+
'-C',
595+
'-ss',
596+
'-o', files('builtin-array-fromasync.h'),
597+
'-n', 'builtin-array-fromasync.js',
598+
files('builtin-array-fromasync.js'),
599+
],
600+
),
601+
)
515602

516603
if examples.allowed()
517604
executable(

0 commit comments

Comments
 (0)