Skip to content

Commit 0094715

Browse files
committed
build: add --shared-gtest configure flag
PR-URL: #61279 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent cd5ddd1 commit 0094715

File tree

2 files changed

+62
-23
lines changed

2 files changed

+62
-23
lines changed

configure.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,28 @@
257257
help='Use the specified path to system CA (PEM format) in addition to '
258258
'the OpenSSL supplied CA store or compiled-in Mozilla CA copy.')
259259

260+
shared_optgroup.add_argument('--shared-gtest',
261+
action='store_true',
262+
dest='shared_gtest',
263+
default=None,
264+
help='link to a shared googletest DLL instead of static linking')
265+
266+
shared_optgroup.add_argument('--shared-gtest-includes',
267+
action='store',
268+
dest='shared_gtest_includes',
269+
help='directory containing googletest header files')
270+
271+
shared_optgroup.add_argument('--shared-gtest-libname',
272+
action='store',
273+
dest='shared_gtest_libname',
274+
default='gtest',
275+
help='alternative lib name to link to [default: %(default)s]')
276+
277+
shared_optgroup.add_argument('--shared-gtest-libpath',
278+
action='store',
279+
dest='shared_gtest_libpath',
280+
help='a directory to search for the shared googletest DLL')
281+
260282
parser.add_argument('--experimental-http-parser',
261283
action='store_true',
262284
dest='experimental_http_parser',
@@ -2298,6 +2320,7 @@ def make_bin_override():
22982320
configure_library('simdutf', output)
22992321
configure_library('brotli', output, pkgname=['libbrotlidec', 'libbrotlienc'])
23002322
configure_library('cares', output, pkgname='libcares')
2323+
configure_library('gtest', output)
23012324
configure_library('nghttp2', output, pkgname='libnghttp2')
23022325
configure_library('nghttp3', output, pkgname='libnghttp3')
23032326
configure_library('ngtcp2', output, pkgname='libngtcp2')

node.gyp

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,36 @@
44
'v8_trace_maps%': 0,
55
'v8_enable_pointer_compression%': 0,
66
'v8_enable_31bit_smis_on_64bit_arch%': 0,
7-
'node_no_browser_globals%': 'false',
8-
'node_snapshot_main%': '',
9-
'node_use_node_snapshot%': 'false',
10-
'node_use_v8_platform%': 'true',
11-
'node_use_bundled_v8%': 'true',
12-
'node_shared%': 'false',
13-
'node_write_snapshot_as_string_literals': 'true',
147
'force_dynamic_crt%': 0,
15-
'ossfuzz' : 'false',
8+
'node_builtin_modules_path%': '',
9+
'node_core_target_name%': 'node',
10+
'node_enable_v8_vtunejit%': 'false',
11+
'node_intermediate_lib_type%': 'static_library',
12+
'node_lib_target_name%': 'libnode',
1613
'node_module_version%': '',
17-
'node_use_amaro%': 'true',
14+
'node_no_browser_globals%': 'false',
1815
'node_shared_brotli%': 'false',
19-
'node_shared_zstd%': 'false',
20-
'node_shared_zlib%': 'false',
21-
'node_shared_http_parser%': 'false',
2216
'node_shared_cares%': 'false',
17+
'node_shared_gtest%': 'false',
18+
'node_shared_http_parser%': 'false',
2319
'node_shared_libuv%': 'false',
20+
'node_shared_nghttp2%': 'false',
21+
'node_shared_openssl%': 'false',
2422
'node_shared_sqlite%': 'false',
2523
'node_shared_uvwasi%': 'false',
26-
'node_shared_nghttp2%': 'false',
24+
'node_shared_zlib%': 'false',
25+
'node_shared_zstd%': 'false',
26+
'node_shared%': 'false',
27+
'node_snapshot_main%': '',
28+
'node_use_amaro%': 'true',
29+
'node_use_bundled_v8%': 'true',
30+
'node_use_node_snapshot%': 'false',
2731
'node_use_openssl%': 'true',
2832
'node_use_sqlite%': 'true',
29-
'node_shared_openssl%': 'false',
33+
'node_use_v8_platform%': 'true',
3034
'node_v8_options%': '',
31-
'node_enable_v8_vtunejit%': 'false',
32-
'node_core_target_name%': 'node',
33-
'node_lib_target_name%': 'libnode',
34-
'node_intermediate_lib_type%': 'static_library',
35-
'node_builtin_modules_path%': '',
35+
'node_write_snapshot_as_string_literals': 'true',
36+
'ossfuzz' : 'false',
3637
'linked_module_files': [
3738
],
3839
# We list the deps/ files out instead of globbing them in js2c.cc since we
@@ -860,7 +861,6 @@
860861
'<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
861862
],
862863
'dependencies': [
863-
'deps/googletest/googletest.gyp:gtest_prod',
864864
'deps/histogram/histogram.gyp:histogram',
865865
'deps/nbytes/nbytes.gyp:nbytes',
866866
'tools/v8_gypfiles/abseil.gyp:abseil',
@@ -924,6 +924,11 @@
924924
'src/node_snapshot_stub.cc',
925925
]
926926
}],
927+
[ 'node_shared_gtest=="false"', {
928+
'dependencies': [
929+
'deps/googletest/googletest.gyp:gtest_prod',
930+
],
931+
}],
927932
[ 'node_use_sqlite=="true"', {
928933
'sources': [
929934
'<@(node_sqlite_sources)',
@@ -1154,7 +1159,6 @@
11541159
'type': 'executable',
11551160
'dependencies': [
11561161
'<(node_lib_target_name)',
1157-
'deps/googletest/googletest.gyp:gtest_prod',
11581162
'deps/histogram/histogram.gyp:histogram',
11591163
'deps/nbytes/nbytes.gyp:nbytes',
11601164
],
@@ -1179,6 +1183,11 @@
11791183
'test/fuzzers/fuzz_strings.cc',
11801184
],
11811185
'conditions': [
1186+
[ 'node_shared_gtest=="false"', {
1187+
'dependencies': [
1188+
'deps/googletest/googletest.gyp:gtest_prod',
1189+
],
1190+
}],
11821191
[ 'node_shared_uvwasi=="false"', {
11831192
'dependencies': [ 'deps/uvwasi/uvwasi.gyp:uvwasi' ],
11841193
'include_dirs': [ 'deps/uvwasi/include' ],
@@ -1202,8 +1211,6 @@
12021211

12031212
'dependencies': [
12041213
'<(node_lib_target_name)',
1205-
'deps/googletest/googletest.gyp:gtest',
1206-
'deps/googletest/googletest.gyp:gtest_main',
12071214
'deps/histogram/histogram.gyp:histogram',
12081215
'deps/nbytes/nbytes.gyp:nbytes',
12091216
'tools/v8_gypfiles/abseil.gyp:abseil',
@@ -1231,6 +1238,15 @@
12311238
'sources': [ '<@(node_cctest_sources)' ],
12321239

12331240
'conditions': [
1241+
[ 'node_shared_gtest=="false"', {
1242+
'dependencies': [
1243+
'deps/googletest/googletest.gyp:gtest',
1244+
'deps/googletest/googletest.gyp:gtest_main',
1245+
],
1246+
}],
1247+
[ 'node_shared_gtest=="true"', {
1248+
'libraries': [ '-lgtest_main' ],
1249+
}],
12341250
[ 'node_use_openssl=="true"', {
12351251
'defines': [
12361252
'HAVE_OPENSSL=1',

0 commit comments

Comments
 (0)