OLD | NEW |
1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import("gypi_contents.gni") | 5 import("gypi_contents.gni") |
6 import("../runtime_args.gni") | 6 import("../runtime_args.gni") |
7 import("../../build/compiled_action.gni") | 7 import("../../build/compiled_action.gni") |
8 | 8 |
9 # Generate a resources.cc file for the service isolate without Observatory. | 9 # Generate a resources.cc file for the service isolate without Observatory. |
10 action("gen_resources_cc") { | 10 action("gen_resources_cc") { |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 rebase_path(vm_isolate_snapshot, root_build_dir), | 482 rebase_path(vm_isolate_snapshot, root_build_dir), |
483 "--isolate_output_bin", | 483 "--isolate_output_bin", |
484 rebase_path(isolate_snapshot, root_build_dir), | 484 rebase_path(isolate_snapshot, root_build_dir), |
485 "--target_os", | 485 "--target_os", |
486 current_os, | 486 current_os, |
487 "--timestamp_file", | 487 "--timestamp_file", |
488 rebase_path(gen_snapshot_stamp_file, root_build_dir), | 488 rebase_path(gen_snapshot_stamp_file, root_build_dir), |
489 ] | 489 ] |
490 } | 490 } |
491 | 491 |
492 action("generate_snapshot_file") { | 492 # Generates an assembly file defining a given symbol with the bytes from a |
| 493 # binary file. Places the symbol in a text section if 'executable' is true, |
| 494 # otherwise places the symbol in a read-only data section. |
| 495 template("bin_to_assembly") { |
| 496 assert(defined(invoker.deps), "Must define deps") |
| 497 assert(defined(invoker.input), "Must define input binary file") |
| 498 assert(defined(invoker.output), "Must define output assembly file") |
| 499 assert(defined(invoker.symbol), "Must define symbol name") |
| 500 assert(defined(invoker.executable), "Must define boolean executable") |
| 501 |
| 502 action(target_name) { |
| 503 deps = invoker.deps |
| 504 script = "../tools/bin_to_assembly.py" |
| 505 args = [ |
| 506 "--input", |
| 507 rebase_path(invoker.input), |
| 508 "--output", |
| 509 rebase_path(invoker.output), |
| 510 "--symbol_name", |
| 511 invoker.symbol, |
| 512 "--target_os", |
| 513 target_os, |
| 514 ] |
| 515 if (invoker.executable) { |
| 516 args += [ "--executable" ] |
| 517 } |
| 518 inputs = [ |
| 519 script, |
| 520 invoker.input, |
| 521 ] |
| 522 outputs = [ |
| 523 invoker.output, |
| 524 ] |
| 525 } |
| 526 } |
| 527 |
| 528 bin_to_assembly("vm_snapshot_data_assembly") { |
493 deps = [ | 529 deps = [ |
494 ":generate_snapshot_bin", | 530 ":generate_snapshot_bin", |
495 ] | 531 ] |
| 532 input = "$target_gen_dir/vm_isolate_snapshot.bin" |
| 533 output = "$target_gen_dir/vm_snapshot_data.S" |
| 534 symbol = "kDartVmSnapshotData" |
| 535 executable = false |
| 536 } |
496 | 537 |
497 snapshot_in_cc_file = "snapshot_in.cc" | 538 bin_to_assembly("vm_snapshot_instructions_assembly") { |
498 inputs = [ | 539 deps = [] |
499 "../tools/create_snapshot_file.py", | 540 input = "../tools/empty.bin" |
500 snapshot_in_cc_file, | 541 output = "$target_gen_dir/vm_snapshot_instructions.S" |
501 "$target_gen_dir/vm_isolate_snapshot.bin", | 542 symbol = "kDartVmSnapshotInstructions" |
502 "$target_gen_dir/isolate_snapshot.bin", | 543 executable = true |
| 544 } |
| 545 |
| 546 bin_to_assembly("isolate_snapshot_data_assembly") { |
| 547 deps = [ |
| 548 ":generate_snapshot_bin", |
503 ] | 549 ] |
504 output = "$root_gen_dir/dart_snapshot.cc" | 550 input = "$target_gen_dir/isolate_snapshot.bin" |
505 outputs = [ | 551 output = "$target_gen_dir/isolate_snapshot_data.S" |
506 output, | 552 symbol = "kDartCoreIsolateSnapshotData" |
| 553 executable = false |
| 554 } |
| 555 |
| 556 bin_to_assembly("isolate_snapshot_instructions_assembly") { |
| 557 deps = [] |
| 558 input = "../tools/empty.bin" |
| 559 output = "$target_gen_dir/isolate_snapshot_instructions.S" |
| 560 symbol = "kDartCoreIsolateSnapshotInstructions" |
| 561 executable = true |
| 562 } |
| 563 |
| 564 source_set("dart_snapshot_cc") { |
| 565 deps = [ |
| 566 ":isolate_snapshot_data_assembly", |
| 567 ":isolate_snapshot_instructions_assembly", |
| 568 ":vm_snapshot_data_assembly", |
| 569 ":vm_snapshot_instructions_assembly", |
507 ] | 570 ] |
508 | 571 sources = [ |
509 script = "../tools/create_snapshot_file.py" | 572 "$target_gen_dir/isolate_snapshot_data.S", |
510 args = [ | 573 "$target_gen_dir/isolate_snapshot_instructions.S", |
511 "--vm_input_bin", | 574 "$target_gen_dir/vm_snapshot_data.S", |
512 rebase_path("$target_gen_dir/vm_isolate_snapshot.bin"), | 575 "$target_gen_dir/vm_snapshot_instructions.S", |
513 "--input_bin", | |
514 rebase_path("$target_gen_dir/isolate_snapshot.bin"), | |
515 "--input_cc", | |
516 rebase_path(snapshot_in_cc_file), | |
517 "--output", | |
518 rebase_path(output), | |
519 ] | 576 ] |
520 } | 577 } |
521 | 578 |
522 source_set("dart_snapshot_cc") { | |
523 sources = [ | |
524 "$root_gen_dir/dart_snapshot.cc", | |
525 ] | |
526 | |
527 deps = [ | |
528 ":generate_snapshot_file", | |
529 ] | |
530 } | |
531 | |
532 template("dart_executable") { | 579 template("dart_executable") { |
533 extra_configs = [] | 580 extra_configs = [] |
534 if (defined(invoker.extra_configs)) { | 581 if (defined(invoker.extra_configs)) { |
535 extra_configs += invoker.extra_configs | 582 extra_configs += invoker.extra_configs |
536 } | 583 } |
537 extra_deps = [] | 584 extra_deps = [] |
538 if (defined(invoker.extra_deps)) { | 585 if (defined(invoker.extra_deps)) { |
539 extra_deps += invoker.extra_deps | 586 extra_deps += invoker.extra_deps |
540 } | 587 } |
541 extra_defines = [] | 588 extra_defines = [] |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 ] | 912 ] |
866 if (is_linux || is_android) { | 913 if (is_linux || is_android) { |
867 cflags = [ "-fPIC" ] | 914 cflags = [ "-fPIC" ] |
868 } | 915 } |
869 if (is_win) { | 916 if (is_win) { |
870 libs = [ "dart.lib" ] | 917 libs = [ "dart.lib" ] |
871 abs_root_out_dir = rebase_path(root_out_dir) | 918 abs_root_out_dir = rebase_path(root_out_dir) |
872 ldflags = [ "/LIBPATH:$abs_root_out_dir" ] | 919 ldflags = [ "/LIBPATH:$abs_root_out_dir" ] |
873 } | 920 } |
874 } | 921 } |
OLD | NEW |