build: [gn] use clang and custom stdlib when building node on linux

This commit is contained in:
Jeremy Apthorp 2018-06-29 13:48:56 -07:00
parent d4cf3cee22
commit 1e1adef9b6
2 changed files with 31 additions and 0 deletions

View file

@ -72,6 +72,9 @@ action("gyp_node") {
# This has _gn suffixed otherwise it gets overridden by a shlib_suffix # This has _gn suffixed otherwise it gets overridden by a shlib_suffix
# that's set in node's gyp files. Don't ask me 🤷 # that's set in node's gyp files. Don't ask me 🤷
"-D", "shlib_suffix_gn=" + shlib_suffix, "-D", "shlib_suffix_gn=" + shlib_suffix,
"-D", "llvm_dir=" + rebase_path("//third_party/llvm-build/Release+Asserts"),
"-D", "libcxx_dir=" + rebase_path("//buildtools/third_party/libc++"),
"-D", "libcxxabi_dir=" + rebase_path("//buildtools/third_party/libc++abi"),
"-Goutput_dir=./$target_out_dir", # bizarrely, gyp generates from the build root instead of from cwd "-Goutput_dir=./$target_out_dir", # bizarrely, gyp generates from the build root instead of from cwd
"-fninja", "-fninja",
rebase_path("//third_party/electron_node/node.gyp", root_build_dir), rebase_path("//third_party/electron_node/node.gyp", root_build_dir),

View file

@ -6,6 +6,34 @@
'shlib_suffix': '<(shlib_suffix_gn)', 'shlib_suffix': '<(shlib_suffix_gn)',
}, },
'conditions': [
['OS=="linux"', {
'make_global_settings': [
['CC', '<(llvm_dir)/bin/clang'],
['CXX', '<(llvm_dir)/bin/clang++'],
['CC.host', '$(CC)'],
['CXX.host', '$(CXX)'],
],
'target_defaults': {
'target_conditions': [
['_toolset=="target"', {
'cflags_cc': [
'-std=gnu++14',
'-nostdinc++',
'-isystem<(libcxx_dir)/trunk/include',
'-isystem<(libcxxabi_dir)/trunk/include',
],
'ldflags': [
'-nostdlib++',
],
'libraries': [
'../../../../../../libc++.so',
],
}]
]
}
}]
],
'target_defaults': { 'target_defaults': {
'target_conditions': [ 'target_conditions': [
['_target_name=="node_lib"', { ['_target_name=="node_lib"', {