Skip to content

Commit

Permalink
Make inspector and node core defines consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
hashseed committed Jan 29, 2019
1 parent 362f92e commit d4cf240
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 82 deletions.
111 changes: 51 additions & 60 deletions gn/node/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,51 +58,9 @@ chdir_action("node_js2c") {

config("node_lib_config") {
include_dirs = [ "src" ]

# FIXME(deepak1556): include paths should be corrected,
# refer https://docs.google.com/presentation/d/1oxNHaVjA9Gn_rTzX6HIpJHP7nXRua_0URXxxJ3oYRq0/edit#slide=id.g71ecd450e_2_702
cflags = [ "-Wno-microsoft-include" ]
defines = []
if (node_enable_inspector) {
defines += [ "HAVE_INSPECTOR=1" ]
} else {
defines += [ "HAVE_INSPECTOR=0" ]
}
if (node_use_openssl) {
defines += [ "HAVE_OPENSSL=1" ]
} else {
defines += [ "HAVE_OPENSSL=0" ]
}
if (v8_enable_i18n_support) {
defines += [ "NODE_HAVE_I18N_SUPPORT=1" ]
} else {
defines += [ "NODE_HAVE_I18N_SUPPORT=0" ]
}
}

component("node_lib") {
deps = [
":node_js2c",
"deps/brotli/c:brotli",
"deps/cares",
"deps/http_parser",
"deps/llhttp",
"deps/nghttp2",
"deps/zlib",
"//v8:v8_libplatform",
]
public_deps = [
"deps/uv",
"//v8",
]
public_configs = [
":node_lib_config",
]
include_dirs = [ "src" ]
libs = []
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs -= [ "//build/config/clang:find_bad_constructs" ]
cflags_cc = [
"-Wno-deprecated-declarations",
"-Wno-implicit-fallthrough",
Expand Down Expand Up @@ -140,10 +98,13 @@ component("node_lib") {
"NOMINMAX",
"_UNICODE=1",
]
libs += [ "psapi.lib" ]
} else {
defines += [ "__POSIX__" ]
}

if (is_mac) {
libs += [ "CoreFoundation.framework" ]
}
if (node_tag != "") {
defines += [ "NODE_TAG=\"$node_tag\"" ]
}
Expand All @@ -153,22 +114,62 @@ component("node_lib") {
if (node_release_urlbase != "") {
defines += [ "NODE_RELEASE_URLBASE=\"$node_release_urlbase\"" ]
}

if (node_use_openssl) {
defines += [
"NODE_OPENSSL_SYSTEM_CERT_PATH=\"$node_openssl_system_ca_path\"",
"HAVE_OPENSSL=1",
]
} else {
defines += [ "HAVE_OPENSSL=0" ]
}
if (node_use_v8_platform) {
defines += [ "NODE_USE_V8_PLATFORM=1" ]
} else {
defines += [ "NODE_USE_V8_PLATFORM=0" ]
}
if (node_report) {
defines += [ "NODE_REPORT" ]
}
if (node_enable_inspector) {
defines += [ "HAVE_INSPECTOR=1" ]
} else {
defines += [ "HAVE_INSPECTOR=0" ]
}
if (v8_enable_i18n_support) {
deps += [ "//third_party/icu" ]
defines += [ "NODE_HAVE_I18N_SUPPORT=1" ]
} else {
defines += [ "NODE_HAVE_I18N_SUPPORT=0" ]
}
}

component("node_lib") {
deps = [
":node_js2c",
"deps/brotli/c:brotli",
"deps/cares",
"deps/http_parser",
"deps/llhttp",
"deps/nghttp2",
"deps/zlib",
"//v8:v8_libplatform",
]
public_deps = [
"deps/uv",
"//v8",
]
configs += [ ":node_lib_config" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs -= [ "//build/config/clang:find_bad_constructs" ]

sources = node_files.node_sources
sources += [
"$target_gen_dir/node_javascript.cc",
"src/node_code_cache_stub.cc",
]

if (is_win) {
libs += [ "psapi.lib" ]
}
if (is_mac) {
libs += [ "CoreFoundation.framework" ]
if (v8_enable_i18n_support) {
deps += [ "//third_party/icu" ]
}

if (node_enable_inspector) {
Expand Down Expand Up @@ -200,18 +201,8 @@ component("node_lib") {
"src/tls_wrap.cc",
"src/tls_wrap.h",
]
defines += [
"NODE_OPENSSL_SYSTEM_CERT_PATH=\"$node_openssl_system_ca_path\"",
]
cflags_cc += [ "-Wno-sign-compare" ]
}
if (node_use_v8_platform) {
defines += [ "NODE_USE_V8_PLATFORM=1" ]
} else {
defines += [ "NODE_USE_V8_PLATFORM=0" ]
}
if (node_report) {
defines += [ "NODE_REPORT" ]
sources += [
"src/node_report.cc",
"src/node_report_module.cc",
Expand Down
2 changes: 1 addition & 1 deletion gn/node/deps/openssl/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ config("internal_config") {
if (is_posix || is_fuchsia) {
cflags_c = ["-Wno-implicit-function-declaration" ]
}
cflags_cc = [ "-Wno-sign-compare" ]
include_dirs = [
"openssl",
"openssl/crypto/",
Expand Down Expand Up @@ -748,7 +749,6 @@ component("openssl") {

public_configs = [ ":external_config" ]
configs += [ ":internal_config" ]

configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
31 changes: 10 additions & 21 deletions gn/node/src/inspector/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import("//v8/gni/v8.gni")

inspector_protocol_dir = "../../tools/inspector_protocol"

config("inspector_config") {
include_dirs = [
"$target_gen_dir",
"$target_gen_dir/src",
]
}

_protocol_generated = [
"protocol/Forward.h",
"protocol/Protocol.cpp",
Expand All @@ -20,15 +27,6 @@ _protocol_generated = [
inspector_protocol_package = "src/node/inspector/protocol"
inspector_protocol_output = "node/inspector/protocol"

config("inspector_config") {
include_dirs = [
"$target_gen_dir",
"$target_gen_dir/src",
]

defines = [ "HAVE_INSPECTOR=1" ]
}

source_set("inspector") {
sources = [
"main_thread_interface.cc",
Expand All @@ -45,8 +43,9 @@ source_set("inspector") {
sources += rebase_path(_protocol_generated,
".",
"$target_gen_dir/$inspector_protocol_package/..")
cflags_cc = [ "-Wno-implicit-fallthrough" ]
include_dirs = [
"$target_gen_dir",
"$target_gen_dir/src",
"//v8/include",
"..",
]
Expand All @@ -57,18 +56,8 @@ source_set("inspector") {
"../../deps/llhttp",
"//third_party/icu:icuuc",
]
defines = [ "NODE_WANT_INTERNALS=1" ]

if (is_win) {
defines += [
"NOMINMAX",
"_UNICODE=1",
]
} else {
defines += [ "__POSIX__" ]
}

public_configs = [ ":inspector_config" ]
configs += [ "//node:node_lib_config" ]
}

# This based on the template from //v8/../inspector_protocol.gni
Expand Down

0 comments on commit d4cf240

Please sign in to comment.