Skip to content

Commit af31789

Browse files
committed
build: add --shared-gtest configure flag
1 parent 6218d14 commit af31789

File tree

5 files changed

+66
-23
lines changed

5 files changed

+66
-23
lines changed

.github/workflows/test-shared.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818
- deps/cares/**
1919
- deps/crates/**
2020
- deps/corepack/**
21+
- deps/googletest/**
2122
- deps/icu-small/**
2223
- deps/icu-tmp/**
2324
- deps/llhttp/**
@@ -64,6 +65,7 @@ on:
6465
- deps/cares/**
6566
- deps/crates/**
6667
- deps/corepack/**
68+
- deps/googletest/**
6769
- deps/icu-small/**
6870
- deps/icu-tmp/**
6971
- deps/llhttp/**

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
12371237
$(RM) -r $(TARNAME)/deps/brotli
12381238
$(RM) -r $(TARNAME)/deps/cares
12391239
$(RM) -r $(TARNAME)/deps/crates
1240+
$(RM) -r $(TARNAME)/deps/googletest
12401241
$(RM) -r $(TARNAME)/deps/icu-small
12411242
$(RM) -r $(TARNAME)/deps/icu-tmp
12421243
$(RM) -r $(TARNAME)/deps/llhttp

configure.py

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

266+
shared_optgroup.add_argument('--shared-gtest',
267+
action='store_true',
268+
dest='shared_gtest',
269+
default=None,
270+
help='link to a shared googletest DLL instead of static linking')
271+
272+
shared_optgroup.add_argument('--shared-gtest-includes',
273+
action='store',
274+
dest='shared_gtest_includes',
275+
help='directory containing googletest header files')
276+
277+
shared_optgroup.add_argument('--shared-gtest-libname',
278+
action='store',
279+
dest='shared_gtest_libname',
280+
default='gtest',
281+
help='alternative lib name to link to [default: %(default)s]')
282+
283+
shared_optgroup.add_argument('--shared-gtest-libpath',
284+
action='store',
285+
dest='shared_gtest_libpath',
286+
help='a directory to search for the shared googletest DLL')
287+
266288
parser.add_argument('--experimental-http-parser',
267289
action='store_true',
268290
dest='experimental_http_parser',
@@ -2409,6 +2431,7 @@ def make_bin_override():
24092431
configure_library('simdutf', output)
24102432
configure_library('brotli', output, pkgname=['libbrotlidec', 'libbrotlienc'])
24112433
configure_library('cares', output, pkgname='libcares')
2434+
configure_library('gtest', output)
24122435
configure_library('nghttp2', output, pkgname='libnghttp2')
24132436
configure_library('nghttp3', output, pkgname='libnghttp3')
24142437
configure_library('ngtcp2', output, pkgname='libngtcp2')

node.gyp

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,37 @@
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_temporal_capi%': 'false',
2624
'node_shared_uvwasi%': 'false',
27-
'node_shared_nghttp2%': 'false',
25+
'node_shared_zlib%': 'false',
26+
'node_shared_zstd%': 'false',
27+
'node_shared%': 'false',
28+
'node_snapshot_main%': '',
29+
'node_use_amaro%': 'true',
30+
'node_use_bundled_v8%': 'true',
31+
'node_use_node_snapshot%': 'false',
2832
'node_use_openssl%': 'true',
2933
'node_use_sqlite%': 'true',
30-
'node_shared_openssl%': 'false',
34+
'node_use_v8_platform%': 'true',
3135
'node_v8_options%': '',
32-
'node_enable_v8_vtunejit%': 'false',
33-
'node_core_target_name%': 'node',
34-
'node_lib_target_name%': 'libnode',
35-
'node_intermediate_lib_type%': 'static_library',
36-
'node_builtin_modules_path%': '',
36+
'node_write_snapshot_as_string_literals': 'true',
37+
'ossfuzz' : 'false',
3738
'linked_module_files': [
3839
],
3940
# We list the deps/ files out instead of globbing them in js2c.cc since we
@@ -865,7 +866,6 @@
865866
'<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
866867
],
867868
'dependencies': [
868-
'deps/googletest/googletest.gyp:gtest_prod',
869869
'deps/histogram/histogram.gyp:histogram',
870870
'deps/nbytes/nbytes.gyp:nbytes',
871871
'tools/v8_gypfiles/abseil.gyp:abseil',
@@ -929,6 +929,11 @@
929929
'src/node_snapshot_stub.cc',
930930
]
931931
}],
932+
[ 'node_shared_gtest=="false"', {
933+
'dependencies': [
934+
'deps/googletest/googletest.gyp:gtest_prod',
935+
],
936+
}],
932937
[ 'node_use_sqlite=="true"', {
933938
'sources': [
934939
'<@(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',

tools/nix/sharedLibDeps.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
ada
1010
brotli
1111
c-ares
12+
gtest
1213
libuv
1314
nghttp3
1415
ngtcp2

0 commit comments

Comments
 (0)