|
1 | 1 | project( |
2 | 2 | 'quickjs-ng', |
3 | 3 | 'c', |
4 | | - version: '0.8.0', |
| 4 | + version: '0.10.1', |
5 | 5 | default_options: [ |
6 | 6 | 'c_std=gnu11,c11', |
7 | 7 | 'warning_level=3', |
@@ -122,12 +122,6 @@ if get_option('debug') |
122 | 122 | language: 'c', |
123 | 123 | ) |
124 | 124 | endif |
125 | | -if get_option('disable_parser') |
126 | | - add_project_arguments( |
127 | | - ['-DQJS_DISABLE_PARSER'], |
128 | | - language: 'c', |
129 | | - ) |
130 | | -endif |
131 | 125 |
|
132 | 126 | qjs_sys_deps = [] |
133 | 127 |
|
@@ -155,10 +149,16 @@ if qjs_libc |
155 | 149 | qjs_hdrs += qjs_libc_hdrs |
156 | 150 | endif |
157 | 151 |
|
| 152 | +qjs_parser = get_option('parser') |
| 153 | + |
158 | 154 | qjs_c_args = ['-D_GNU_SOURCE'] |
159 | 155 |
|
160 | 156 | if host_system == 'windows' |
161 | | - qjs_c_args += ['-DWIN32_LEAN_AND_MEAN', '-D_WIN32_WINNT=0x0602'] |
| 157 | + qjs_c_args += ['-DWIN32_LEAN_AND_MEAN', '-D_WIN32_WINNT=0x0601'] |
| 158 | +endif |
| 159 | + |
| 160 | +if not qjs_parser |
| 161 | + qjs_c_args += ['-DQJS_DISABLE_PARSER'] |
162 | 162 | endif |
163 | 163 |
|
164 | 164 | qjs_libc_lib = static_library( |
@@ -190,10 +190,15 @@ qjs_lib = library( |
190 | 190 | version: meson.project_version(), |
191 | 191 | ) |
192 | 192 |
|
| 193 | +qjs_export_variables = [ |
| 194 | + f'have_parser=@qjs_parser@' |
| 195 | +] |
| 196 | + |
193 | 197 | qjs_dep = declare_dependency( |
194 | 198 | link_with: qjs_lib, |
195 | 199 | dependencies: qjs_sys_deps, |
196 | 200 | include_directories: qjs_lib.private_dir_include(), |
| 201 | + variables: qjs_export_variables, |
197 | 202 | ) |
198 | 203 |
|
199 | 204 | if host_system == 'emscripten' |
@@ -251,8 +256,13 @@ import('pkgconfig').generate( |
251 | 256 | description: 'QuickJS, the Next Generation: a mighty JavaScript engine', |
252 | 257 | url: 'https://github.com/quickjs-ng/quickjs', |
253 | 258 | version: meson.project_version(), |
| 259 | + variables: qjs_export_variables, |
254 | 260 | ) |
255 | 261 |
|
| 262 | +if not qjs_parser |
| 263 | + subdir_done() |
| 264 | +endif |
| 265 | + |
256 | 266 | # QuickJS bytecode compiler |
257 | 267 | qjsc_srcs = files( |
258 | 268 | 'qjsc.c', |
@@ -290,6 +300,7 @@ qjs_exe = executable( |
290 | 300 | c_args: qjs_c_args, |
291 | 301 | link_with: qjs_libc ? [] : qjs_libc_lib, |
292 | 302 | dependencies: [qjs_dep, mimalloc_dep], |
| 303 | + export_dynamic: true, |
293 | 304 |
|
294 | 305 | install: true, |
295 | 306 | ) |
@@ -347,6 +358,7 @@ if meson.is_cross_build() |
347 | 358 | c_args: qjs_c_args, |
348 | 359 | link_with: qjs_native_lib, |
349 | 360 | dependencies: [qjs_sys_native_deps, mimalloc_native_dep], |
| 361 | + export_dynamic: true, |
350 | 362 |
|
351 | 363 | build_by_default: false, |
352 | 364 | native: true, |
@@ -415,20 +427,29 @@ if tests.allowed() |
415 | 427 | 'int_arith', |
416 | 428 | 'float_arith', |
417 | 429 |
|
418 | | - 'set_collection_add', |
| 430 | + 'map_set', |
| 431 | + 'map_delete', |
| 432 | + 'weak_map_set', |
| 433 | + 'weak_map_delete', |
419 | 434 |
|
420 | 435 | 'array_for', |
421 | 436 | 'array_for_in', |
422 | 437 | 'array_for_of', |
423 | 438 |
|
424 | 439 | 'math_min', |
425 | 440 |
|
| 441 | + 'object_null', |
| 442 | + |
426 | 443 | 'regexp_ascii', |
427 | 444 | 'regexp_utf16', |
428 | 445 |
|
429 | 446 | 'string_build1', |
430 | 447 | 'string_build2', |
431 | 448 |
|
| 449 | + 'string_slice1', |
| 450 | + 'string_slice2', |
| 451 | + 'string_slice3', |
| 452 | + |
432 | 453 | 'sort_bench', |
433 | 454 |
|
434 | 455 | 'int_to_string', |
@@ -463,28 +484,121 @@ if tests.allowed() |
463 | 484 |
|
464 | 485 | c_args: qjs_c_args, |
465 | 486 | dependencies: qjs_dep, |
| 487 | + build_by_default: false, |
| 488 | + ), |
| 489 | + ) |
| 490 | + |
| 491 | + # Function.toString() test |
| 492 | + test( |
| 493 | + 'function_source', |
| 494 | + executable( |
| 495 | + 'function_source', |
| 496 | + 'gen/function_source.c', |
| 497 | + qjs_libc_srcs, |
| 498 | + |
| 499 | + c_args: qjs_c_args, |
| 500 | + dependencies: qjs_dep, |
| 501 | + build_by_default: false, |
466 | 502 | ), |
467 | 503 | ) |
468 | 504 | endif |
469 | 505 |
|
470 | 506 | # Unicode generator |
471 | | -executable( |
| 507 | +unicode_gen = executable( |
472 | 508 | 'unicode_gen', |
473 | 509 | 'cutils.c', |
474 | | - 'libunicode.c', |
475 | 510 | 'unicode_gen.c', |
476 | 511 |
|
477 | 512 | c_args: qjs_c_args, |
478 | 513 | build_by_default: false, |
479 | 514 | ) |
480 | 515 |
|
481 | | -executable( |
482 | | - 'function_source', |
483 | | - 'gen/function_source.c', |
484 | | - qjs_libc_srcs, |
| 516 | +run_target( |
| 517 | + 'libunicode-table.h', |
| 518 | + command: [ |
| 519 | + unicode_gen, |
| 520 | + meson.current_source_dir() / 'unicode', |
| 521 | + files('libunicode-table.h'), |
| 522 | + ], |
| 523 | +) |
485 | 524 |
|
486 | | - c_args: qjs_c_args, |
487 | | - dependencies: qjs_dep, |
| 525 | +# bytecode to c source code for builtin and examples |
| 526 | +alias_target('codegen', |
| 527 | + run_target( |
| 528 | + 'codegen_repl.c', |
| 529 | + command: [ |
| 530 | + qjsc_exe, |
| 531 | + '-ss', |
| 532 | + '-o', files('gen/repl.c'), |
| 533 | + '-m', |
| 534 | + '-n', 'repl.js', |
| 535 | + files('repl.js'), |
| 536 | + ], |
| 537 | + ), |
| 538 | + run_target( |
| 539 | + 'codegen_standalone.c', |
| 540 | + command: [ |
| 541 | + qjsc_exe, |
| 542 | + '-ss', |
| 543 | + '-o', files('gen/standalone.c'), |
| 544 | + '-m', |
| 545 | + '-n', 'standalone.js', |
| 546 | + files('standalone.js'), |
| 547 | + ], |
| 548 | + ), |
| 549 | + run_target( |
| 550 | + 'codegen_function_source.c', |
| 551 | + command: [ |
| 552 | + qjsc_exe, |
| 553 | + '-e', |
| 554 | + '-o', files('gen/function_source.c'), |
| 555 | + '-n', 'tests/function_source.js', |
| 556 | + files('tests/function_source.js'), |
| 557 | + ], |
| 558 | + ), |
| 559 | + run_target( |
| 560 | + 'codegen_hello.c', |
| 561 | + command: [ |
| 562 | + qjsc_exe, |
| 563 | + '-e', |
| 564 | + '-o', files('gen/hello.c'), |
| 565 | + '-n', 'examples/hello.js', |
| 566 | + files('examples/hello.js'), |
| 567 | + ], |
| 568 | + ), |
| 569 | + run_target( |
| 570 | + 'codegen_hello_module.c', |
| 571 | + command: [ |
| 572 | + qjsc_exe, |
| 573 | + '-e', |
| 574 | + '-o', files('gen/hello_module.c'), |
| 575 | + '-m', |
| 576 | + '-n', 'examples/hello_module.js', |
| 577 | + files('examples/hello_module.js'), |
| 578 | + ], |
| 579 | + ), |
| 580 | + run_target( |
| 581 | + 'codegen_test_fib.c', |
| 582 | + command: [ |
| 583 | + qjsc_exe, |
| 584 | + '-e', |
| 585 | + '-o', files('gen/test_fib.c'), |
| 586 | + '-m', |
| 587 | + '-n', 'examples/test_fib.js', |
| 588 | + files('examples/test_fib.js'), |
| 589 | + ], |
| 590 | + ), |
| 591 | + run_target( |
| 592 | + 'codegen_builtin-array-fromasync.h', |
| 593 | + command: [ |
| 594 | + qjsc_exe, |
| 595 | + '-C', |
| 596 | + '-ss', |
| 597 | + '-o', files('builtin-array-fromasync.h'), |
| 598 | + '-n', 'builtin-array-fromasync.js', |
| 599 | + files('builtin-array-fromasync.js'), |
| 600 | + ], |
| 601 | + ), |
488 | 602 | ) |
489 | 603 |
|
490 | 604 | if examples.allowed() |
|
0 commit comments