mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 21:46:48 +00:00
build: harmonize Clang checks
- Set the clang variable in `config.gypi` so it depends on compiler checks made by the configure script. - Replace gyp conditions with `llvm_version` and "0.0" with conditions that use the `clang` variable. - Always use `clang==1` or `clang==0` in gyp conditions PR-URL: https://github.com/nodejs/node/pull/52873 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
parent
4338a28391
commit
25c788009f
@ -107,7 +107,6 @@
|
|||||||
'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
|
'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
|
||||||
}],
|
}],
|
||||||
['OS=="mac"', {
|
['OS=="mac"', {
|
||||||
'clang%': 1,
|
|
||||||
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
|
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
|
||||||
'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a',
|
'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a',
|
||||||
}],
|
}],
|
||||||
@ -182,10 +181,10 @@
|
|||||||
}, {
|
}, {
|
||||||
'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
|
'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
|
||||||
}],
|
}],
|
||||||
['llvm_version=="0.0"', {
|
['clang==1', {
|
||||||
'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
|
|
||||||
}, {
|
|
||||||
'lto': ' -flto ', # Clang
|
'lto': ' -flto ', # Clang
|
||||||
|
}, {
|
||||||
|
'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -1042,6 +1042,7 @@ def get_gas_version(cc):
|
|||||||
# quite prepared to go that far yet.
|
# quite prepared to go that far yet.
|
||||||
def check_compiler(o):
|
def check_compiler(o):
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
|
o['variables']['clang'] = 0
|
||||||
o['variables']['llvm_version'] = '0.0'
|
o['variables']['llvm_version'] = '0.0'
|
||||||
if not options.openssl_no_asm and options.dest_cpu in ('x86', 'x64'):
|
if not options.openssl_no_asm and options.dest_cpu in ('x86', 'x64'):
|
||||||
nasm_version = get_nasm_version('nasm')
|
nasm_version = get_nasm_version('nasm')
|
||||||
@ -1051,6 +1052,7 @@ def check_compiler(o):
|
|||||||
return
|
return
|
||||||
|
|
||||||
ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++')
|
ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++')
|
||||||
|
o['variables']['clang'] = B(is_clang)
|
||||||
version_str = ".".join(map(str, clang_version if is_clang else gcc_version))
|
version_str = ".".join(map(str, clang_version if is_clang else gcc_version))
|
||||||
print_verbose(f"Detected {'clang ' if is_clang else ''}C++ compiler (CXX={CXX}) version: {version_str}")
|
print_verbose(f"Detected {'clang ' if is_clang else ''}C++ compiler (CXX={CXX}) version: {version_str}")
|
||||||
if not ok:
|
if not ok:
|
||||||
|
2
deps/openssl/openssl_common.gypi
vendored
2
deps/openssl/openssl_common.gypi
vendored
@ -67,7 +67,7 @@
|
|||||||
'TERMIOS',
|
'TERMIOS',
|
||||||
],
|
],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
[ 'llvm_version=="0.0"', {
|
[ 'clang==0', {
|
||||||
'cflags': ['-Wno-old-style-declaration',],
|
'cflags': ['-Wno-old-style-declaration',],
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
|
7
deps/zlib/zlib.gyp
vendored
7
deps/zlib/zlib.gyp
vendored
@ -7,7 +7,6 @@
|
|||||||
'ZLIB_ROOT': '.',
|
'ZLIB_ROOT': '.',
|
||||||
'use_system_zlib%': 0,
|
'use_system_zlib%': 0,
|
||||||
'arm_fpu%': '',
|
'arm_fpu%': '',
|
||||||
'llvm_version%': '0.0',
|
|
||||||
},
|
},
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['use_system_zlib==0', {
|
['use_system_zlib==0', {
|
||||||
@ -24,7 +23,7 @@
|
|||||||
},{
|
},{
|
||||||
'defines': [ 'X86_NOT_WINDOWS' ],
|
'defines': [ 'X86_NOT_WINDOWS' ],
|
||||||
}],
|
}],
|
||||||
['OS!="win" or llvm_version!="0.0"', {
|
['OS!="win" or clang==1', {
|
||||||
'cflags': [ '-mssse3' ],
|
'cflags': [ '-mssse3' ],
|
||||||
'xcode_settings': {
|
'xcode_settings': {
|
||||||
'OTHER_CFLAGS': [ '-mssse3' ],
|
'OTHER_CFLAGS': [ '-mssse3' ],
|
||||||
@ -65,7 +64,7 @@
|
|||||||
'conditions': [
|
'conditions': [
|
||||||
['OS!="ios"', {
|
['OS!="ios"', {
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['OS!="win" and llvm_version=="0.0"', {
|
['OS!="win" and clang==0', {
|
||||||
'cflags': [ '-march=armv8-a+aes+crc' ],
|
'cflags': [ '-march=armv8-a+aes+crc' ],
|
||||||
}],
|
}],
|
||||||
['OS=="android"', {
|
['OS=="android"', {
|
||||||
@ -111,7 +110,7 @@
|
|||||||
# 'target_name': 'zlib_crc32_simd',
|
# 'target_name': 'zlib_crc32_simd',
|
||||||
# 'type': 'static_library',
|
# 'type': 'static_library',
|
||||||
# 'conditions': [
|
# 'conditions': [
|
||||||
# ['OS!="win" or llvm_version!="0.0"', {
|
# ['OS!="win" or clang==1', {
|
||||||
# 'cflags': [
|
# 'cflags': [
|
||||||
# '-msse4.2',
|
# '-msse4.2',
|
||||||
# '-mpclmul',
|
# '-mpclmul',
|
||||||
|
2
node.gyp
2
node.gyp
@ -504,7 +504,7 @@
|
|||||||
'-Wl,-bnoerrmsg',
|
'-Wl,-bnoerrmsg',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
['OS == "linux" and llvm_version != "0.0"', {
|
['OS=="linux" and clang==1', {
|
||||||
'libraries': ['-latomic'],
|
'libraries': ['-latomic'],
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
|
@ -134,7 +134,7 @@
|
|||||||
'<(V8_ROOT)/include',
|
'<(V8_ROOT)/include',
|
||||||
],
|
],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['clang', {
|
['clang==1', {
|
||||||
'cflags': [ '-Werror', '-Wno-unknown-pragmas' ],
|
'cflags': [ '-Werror', '-Wno-unknown-pragmas' ],
|
||||||
},{
|
},{
|
||||||
'cflags!': [ '-Wall', '-Wextra' ],
|
'cflags!': [ '-Wall', '-Wextra' ],
|
||||||
@ -144,7 +144,7 @@
|
|||||||
'-flax-vector-conversions',
|
'-flax-vector-conversions',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
['clang or OS!="win"', {
|
['clang==1 or OS!="win"', {
|
||||||
'cflags': [ '-Wno-invalid-offsetof' ],
|
'cflags': [ '-Wno-invalid-offsetof' ],
|
||||||
'xcode_settings': {
|
'xcode_settings': {
|
||||||
'WARNING_CFLAGS': ['-Wno-invalid-offsetof']
|
'WARNING_CFLAGS': ['-Wno-invalid-offsetof']
|
||||||
|
@ -1879,7 +1879,7 @@
|
|||||||
['enable_lto=="true"', {
|
['enable_lto=="true"', {
|
||||||
'cflags_cc': [ '-fno-lto' ],
|
'cflags_cc': [ '-fno-lto' ],
|
||||||
}],
|
}],
|
||||||
['clang or OS!="win"', {
|
['clang==1 or OS!="win"', {
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
|
['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
|
||||||
'sources': [
|
'sources': [
|
||||||
|
Loading…
Reference in New Issue
Block a user