13a425d941
Change-Id: If63a5b3caa8fe300d97a722c3d42929457bae1e2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326300 Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Jackson Gardner <jacksongardner@google.com> Commit-Queue: Jackson Gardner <jacksongardner@google.com> Reviewed-by: Ömer Ağacan <omersa@google.com>
149 lines
3.7 KiB
Plaintext
149 lines
3.7 KiB
Plaintext
# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
import("../../sdk_args.gni")
|
|
|
|
config("binaryen_flags") {
|
|
if (is_clang) {
|
|
cflags = [ "-Wno-unused-but-set-parameter" ]
|
|
} else if (!is_win) {
|
|
cflags = [
|
|
"-Wno-unused-variable",
|
|
|
|
# Bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86465#c16 triggered by
|
|
# https://github.com/WebAssembly/binaryen/blob/cdb7aeab40b4c522de20b242019f7e88641445d5/src/wasm/wasm-type.cpp#L530.
|
|
"-Wno-maybe-uninitialized",
|
|
]
|
|
}
|
|
|
|
if (is_win) {
|
|
libs = [ "shell32.lib" ]
|
|
}
|
|
}
|
|
|
|
action("generate_needed_files") {
|
|
script = "generate_needed_files.py"
|
|
|
|
inputs = [
|
|
"src/src/passes/wasm-intrinsics.wat",
|
|
"src/src/passes/WasmIntrinsics.cpp.in",
|
|
"src/CMakeLists.txt",
|
|
"src/config.h.in",
|
|
]
|
|
|
|
args = [
|
|
rebase_path("src/src/passes/wasm-intrinsics.wat", root_build_dir),
|
|
rebase_path("src/src/passes/WasmIntrinsics.cpp.in", root_build_dir),
|
|
rebase_path("$target_gen_dir/WasmIntrinsics.cpp", root_build_dir),
|
|
|
|
rebase_path("src/CMakeLists.txt", root_build_dir),
|
|
rebase_path("src/config.h.in", root_build_dir),
|
|
rebase_path("$target_gen_dir/config.h", root_build_dir),
|
|
]
|
|
outputs = [
|
|
"$target_gen_dir/WasmIntrinsics.cpp",
|
|
"$target_gen_dir/config.h",
|
|
]
|
|
}
|
|
|
|
source_set("binaryen_sources") {
|
|
src_dirs = [
|
|
"src/src/analysis",
|
|
"src/src/asmjs",
|
|
"src/src/cfg",
|
|
"src/src/ir",
|
|
"src/src/passes",
|
|
"src/src/support",
|
|
"src/src/wasm",
|
|
"src/src/tools/fuzzing",
|
|
"src/src/emscripten-optimizer",
|
|
]
|
|
|
|
# We avoid listing all sources manually, this means when updating
|
|
# binaryen in DEPS (or manually editing) one has to ensure to
|
|
# re-run GN in DEPS to ensure new dependencies are picked up.
|
|
# (this lowers the maintenance burden of GN build support for binaryen)
|
|
sources = []
|
|
foreach(src_dir, src_dirs) {
|
|
foreach(src_file,
|
|
exec_script("list_sources.py",
|
|
[ rebase_path(src_dir, root_build_dir) ],
|
|
"list lines",
|
|
[ "$default_git_folder/logs/HEAD" ])) {
|
|
sources += [ "$src_dir/$src_file" ]
|
|
}
|
|
}
|
|
|
|
include_dirs = [ "src/src" ]
|
|
|
|
# Ensure WasmIntrinsics.cpp/config.h files are generated.
|
|
deps = [ ":generate_needed_files" ]
|
|
|
|
# Ensure generated WasmIntrinsics.cpp file is included in build.
|
|
sources += [ "$target_gen_dir/WasmIntrinsics.cpp" ]
|
|
|
|
# Ensure generated config.h file is include path.
|
|
include_dirs += [ "$target_gen_dir" ]
|
|
|
|
configs += [
|
|
"//build/config/compiler:enable_exceptions",
|
|
":binaryen_flags",
|
|
]
|
|
}
|
|
|
|
template("wasm_tool") {
|
|
executable(target_name) {
|
|
sources = [ string_join("",
|
|
[
|
|
"src/src/tools/",
|
|
target_name,
|
|
".cpp",
|
|
]) ]
|
|
include_dirs = [ "src/src" ]
|
|
deps = [ ":binaryen_sources" ]
|
|
forward_variables_from(invoker, "*")
|
|
|
|
configs += [
|
|
"//build/config/compiler:enable_exceptions",
|
|
":binaryen_flags",
|
|
]
|
|
}
|
|
}
|
|
|
|
wasm_tool("wasm-opt") {
|
|
}
|
|
wasm_tool("wasm-shell") {
|
|
}
|
|
wasm_tool("wasm-metadce") {
|
|
}
|
|
wasm_tool("wasm-emscripten-finalize") {
|
|
}
|
|
wasm_tool("wasm-as") {
|
|
}
|
|
wasm_tool("wasm-dis") {
|
|
}
|
|
wasm_tool("wasm-ctor-eval") {
|
|
}
|
|
wasm_tool("wasm-reduce") {
|
|
}
|
|
wasm_tool("wasm-fuzz-types") {
|
|
}
|
|
wasm_tool("wasm2js") {
|
|
}
|
|
|
|
group("binaryen_tools") {
|
|
deps = [
|
|
":wasm-as",
|
|
":wasm-ctor-eval",
|
|
":wasm-dis",
|
|
":wasm-emscripten-finalize",
|
|
":wasm-fuzz-types",
|
|
":wasm-metadce",
|
|
":wasm-opt",
|
|
":wasm-reduce",
|
|
":wasm-shell",
|
|
":wasm2js",
|
|
]
|
|
}
|