Skip to content

Commit 32af45d

Browse files
authored
build: add GN build files
PR-URL: nodejs#47637 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent f45bb80 commit 32af45d

36 files changed

+1923
-0
lines changed

BUILD.gn

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##############################################################################
2+
# #
3+
# DO NOT EDIT THIS FILE! #
4+
# #
5+
##############################################################################
6+
7+
# This file is used by GN for building, which is NOT the build system used for
8+
# building official binaries.
9+
# Please modify the gyp files if you are making changes to build system.
10+
11+
import("unofficial.gni")
12+
13+
node_gn_build("node") {
14+
}

deps/ada/BUILD.gn

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##############################################################################
2+
# #
3+
# DO NOT EDIT THIS FILE! #
4+
# #
5+
##############################################################################
6+
7+
# This file is used by GN for building, which is NOT the build system used for
8+
# building official binaries.
9+
# Please modify the gyp files if you are making changes to build system.
10+
11+
import("unofficial.gni")
12+
13+
ada_gn_build("ada") {
14+
}

deps/ada/unofficial.gni

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2023 Microsoft Inc.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
# This file is used by GN for building, which is NOT the build system used for
6+
# building official binaries.
7+
# Please edit the gyp files if you are making changes to build system.
8+
9+
import("../../node.gni")
10+
import("$node_v8_path/gni/v8.gni")
11+
12+
# The actual configurations are put inside a template in unofficial.gni to
13+
# prevent accidental edits from contributors.
14+
template("ada_gn_build") {
15+
config("ada_config") {
16+
include_dirs = [ "." ]
17+
}
18+
19+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
20+
[ rebase_path("ada.gyp") ],
21+
"scope",
22+
[ "ada.gyp" ])
23+
24+
source_set(target_name) {
25+
forward_variables_from(invoker, "*")
26+
public_configs = [ ":ada_config" ]
27+
sources = gypi_values.ada_sources
28+
}
29+
}

deps/base64/BUILD.gn

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##############################################################################
2+
# #
3+
# DO NOT EDIT THIS FILE! #
4+
# #
5+
##############################################################################
6+
7+
# This file is used by GN for building, which is NOT the build system used for
8+
# building official binaries.
9+
# Please modify the gyp files if you are making changes to build system.
10+
11+
import("unofficial.gni")
12+
13+
base64_gn_build("base64") {
14+
}

deps/base64/unofficial.gni

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Copyright (c) 2013-2022 GitHub Inc.
2+
# Copyright 2022 the V8 project authors. All rights reserved.
3+
# Copyright 2023 Microsoft Inc.
4+
# Use of this source code is governed by a BSD-style license that can be
5+
# found in the LICENSE file.
6+
7+
# This file is used by GN for building, which is NOT the build system used for
8+
# building official binaries.
9+
# Please edit the gyp files if you are making changes to build system.
10+
11+
# The actual configurations are put inside a template in unofficial.gni to
12+
# prevent accidental edits from contributors.
13+
template("base64_gn_build") {
14+
config("base64_external_config") {
15+
include_dirs = [ "base64/include" ]
16+
if (!is_component_build) {
17+
defines = [ "BASE64_STATIC_DEFINE" ]
18+
}
19+
}
20+
21+
config("base64_internal_config") {
22+
include_dirs = [ "base64/lib" ]
23+
if (is_component_build) {
24+
defines = [ "BASE64_EXPORTS" ]
25+
} else {
26+
defines = []
27+
}
28+
if (target_cpu == "x86" || target_cpu == "x64") {
29+
defines += [
30+
"HAVE_SSSE3=1",
31+
"HAVE_SSE41=1",
32+
"HAVE_SSE42=1",
33+
"HAVE_AVX=1",
34+
"HAVE_AVX2=1",
35+
]
36+
}
37+
if (target_cpu == "arm") {
38+
defines += [ "HAVE_NEON32=1" ]
39+
}
40+
if (target_cpu == "arm64") {
41+
defines += [ "HAVE_NEON64=1" ]
42+
}
43+
if (is_clang || !is_win) {
44+
cflags_c = [
45+
"-Wno-implicit-fallthrough",
46+
"-Wno-shadow",
47+
"-Wno-unused-but-set-variable",
48+
]
49+
}
50+
}
51+
52+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
53+
[ rebase_path("base64.gyp") ],
54+
"scope",
55+
[ "base64.gyp" ])
56+
57+
component(target_name) {
58+
forward_variables_from(invoker, "*")
59+
configs += [ ":base64_internal_config" ]
60+
public_configs = [ ":base64_external_config" ]
61+
sources = gypi_values.base64_sources_common
62+
deps = [
63+
":base64_ssse3",
64+
":base64_sse41",
65+
":base64_sse42",
66+
":base64_avx",
67+
":base64_avx2",
68+
":base64_neon32",
69+
":base64_neon64",
70+
]
71+
}
72+
73+
source_set("base64_ssse3") {
74+
configs += [ ":base64_internal_config" ]
75+
sources = [ "base64/lib/arch/ssse3/codec.c" ]
76+
if (target_cpu == "x86" || target_cpu == "x64") {
77+
if (is_clang || !is_win) {
78+
cflags_c = [ "-mssse3" ]
79+
}
80+
}
81+
}
82+
83+
source_set("base64_sse41") {
84+
configs += [ ":base64_internal_config" ]
85+
sources = [ "base64/lib/arch/sse41/codec.c" ]
86+
if (target_cpu == "x86" || target_cpu == "x64") {
87+
if (is_clang || !is_win) {
88+
cflags_c = [ "-msse4.1" ]
89+
}
90+
}
91+
}
92+
93+
source_set("base64_sse42") {
94+
configs += [ ":base64_internal_config" ]
95+
sources = [ "base64/lib/arch/sse42/codec.c" ]
96+
if (target_cpu == "x86" || target_cpu == "x64") {
97+
if (is_clang || !is_win) {
98+
cflags_c = [ "-msse4.2" ]
99+
}
100+
}
101+
}
102+
103+
source_set("base64_avx") {
104+
configs += [ ":base64_internal_config" ]
105+
sources = [ "base64/lib/arch/avx/codec.c" ]
106+
if (target_cpu == "x86" || target_cpu == "x64") {
107+
if (is_clang || !is_win) {
108+
cflags_c = [ "-mavx" ]
109+
} else if (is_win) {
110+
cflags_c = [ "/arch:AVX" ]
111+
}
112+
}
113+
}
114+
source_set("base64_avx2") {
115+
configs += [ ":base64_internal_config" ]
116+
sources = [ "base64/lib/arch/avx2/codec.c" ]
117+
if (target_cpu == "x86" || target_cpu == "x64") {
118+
if (is_clang || !is_win) {
119+
cflags_c = [ "-mavx2" ]
120+
} else if (is_win) {
121+
cflags_c = [ "/arch:AVX2" ]
122+
}
123+
}
124+
}
125+
126+
source_set("base64_neon32") {
127+
configs += [ ":base64_internal_config" ]
128+
sources = [ "base64/lib/arch/neon32/codec.c" ]
129+
if (target_cpu == "arm") {
130+
if (is_clang || !is_win) {
131+
cflags_c = [ "-mfpu=neon" ]
132+
}
133+
}
134+
}
135+
136+
source_set("base64_neon64") {
137+
configs += [ ":base64_internal_config" ]
138+
sources = [ "base64/lib/arch/neon64/codec.c" ]
139+
# NEON is required in arm64, so no -mfpu flag is needed
140+
}
141+
}

deps/brotli/BUILD.gn

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##############################################################################
2+
# #
3+
# DO NOT EDIT THIS FILE! #
4+
# #
5+
##############################################################################
6+
7+
# This file is used by GN for building, which is NOT the build system used for
8+
# building official binaries.
9+
# Please modify the gyp files if you are making changes to build system.
10+
11+
import("unofficial.gni")
12+
13+
brotli_gn_build("brotli") {
14+
}

deps/brotli/unofficial.gni

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2014 The Chromium Authors. All rights reserved.
2+
# Copyright 2019 the V8 project authors. All rights reserved.
3+
# Copyright 2023 Microsoft Inc.
4+
# Use of this source code is governed by a BSD-style license that can be
5+
# found in the LICENSE file.
6+
7+
# This file is used by GN for building, which is NOT the build system used for
8+
# building official binaries.
9+
# Please edit the gyp files if you are making changes to build system.
10+
11+
# The actual configurations are put inside a template in unofficial.gni to
12+
# prevent accidental edits from contributors.
13+
template("brotli_gn_build") {
14+
config("brotli_config") {
15+
include_dirs = [ "c/include" ]
16+
}
17+
18+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
19+
[ rebase_path("brotli.gyp") ],
20+
"scope",
21+
[ "brotli.gyp" ])
22+
23+
source_set(target_name) {
24+
forward_variables_from(invoker, "*")
25+
public_configs = [ ":brotli_config" ]
26+
sources = gypi_values.brotli_sources
27+
if (is_linux) {
28+
defines = [ "OS_LINUX" ]
29+
} else if (is_mac) {
30+
defines = [ "OS_MACOSX" ]
31+
} else if (target_os == "freebsd") {
32+
defines = [ "OS_FREEBSD" ]
33+
}
34+
if (!is_win) {
35+
libs = [ "m" ]
36+
}
37+
if (is_clang || !is_win) {
38+
cflags_c = [
39+
"-Wno-implicit-fallthrough",
40+
"-Wno-unreachable-code",
41+
"-Wno-unreachable-code-return",
42+
]
43+
}
44+
}
45+
}

deps/cares/BUILD.gn

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##############################################################################
2+
# #
3+
# DO NOT EDIT THIS FILE! #
4+
# #
5+
##############################################################################
6+
7+
# This file is used by GN for building, which is NOT the build system used for
8+
# building official binaries.
9+
# Please modify the gyp files if you are making changes to build system.
10+
11+
import("unofficial.gni")
12+
13+
cares_gn_build("cares") {
14+
}

deps/cares/unofficial.gni

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Copyright (c) 2013-2019 GitHub Inc.
2+
# Copyright 2019 the V8 project authors. All rights reserved.
3+
# Copyright 2023 Microsoft Inc.
4+
# Use of this source code is governed by a BSD-style license that can be
5+
# found in the LICENSE file.
6+
7+
# This file is used by GN for building, which is NOT the build system used for
8+
# building official binaries.
9+
# Please edit the gyp files if you are making changes to build system.
10+
11+
# The actual configurations are put inside a template in unofficial.gni to
12+
# prevent accidental edits from contributors.
13+
template("cares_gn_build") {
14+
config("cares_config") {
15+
include_dirs = [ "include" ]
16+
if (!is_component_build) {
17+
defines = [ "CARES_STATICLIB" ]
18+
}
19+
}
20+
21+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
22+
[ rebase_path("cares.gyp") ],
23+
"scope",
24+
[ "cares.gyp" ])
25+
26+
component(target_name) {
27+
forward_variables_from(invoker, "*")
28+
public_configs = [ ":cares_config" ]
29+
if (is_component_build) {
30+
defines = [ "CARES_BUILDING_LIBRARY" ]
31+
} else {
32+
defines = []
33+
}
34+
if (is_win) {
35+
defines += [ "CARES_PULL_WS2TCPIP_H=1" ]
36+
}
37+
if (is_posix) {
38+
defines += [
39+
"_DARWIN_USE_64_BIT_INODE=1",
40+
"_LARGEFILE_SOURCE",
41+
"_FILE_OFFSET_BITS=64",
42+
"_GNU_SOURCE",
43+
"HAVE_CONFIG_H",
44+
]
45+
}
46+
47+
include_dirs = [ "src/lib" ]
48+
if (is_win) {
49+
include_dirs += [ "config/win32" ]
50+
} else if (is_linux) {
51+
include_dirs += [ "config/linux" ]
52+
} else if (is_mac) {
53+
include_dirs += [ "config/darwin" ]
54+
}
55+
56+
if (is_win) {
57+
libs = [
58+
"ws2_32.lib",
59+
"iphlpapi.lib",
60+
]
61+
}
62+
63+
sources = gypi_values.cares_sources_common
64+
if (is_win) {
65+
sources += gypi_values.cares_sources_win
66+
}
67+
if (is_linux) {
68+
sources += [ "config/linux/ares_config.h" ]
69+
}
70+
if (is_mac) {
71+
sources += [ "config/darwin/ares_config.h" ]
72+
}
73+
74+
if (is_clang || !is_win) {
75+
cflags_c = [
76+
"-Wno-implicit-fallthrough",
77+
"-Wno-unreachable-code",
78+
]
79+
}
80+
}
81+
}

deps/googletest/BUILD.gn

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##############################################################################
2+
# #
3+
# DO NOT EDIT THIS FILE! #
4+
# #
5+
##############################################################################
6+
7+
# This file is used by GN for building, which is NOT the build system used for
8+
# building official binaries.
9+
# Please modify the gyp files if you are making changes to build system.
10+
11+
import("unofficial.gni")
12+
13+
googletest_gn_build("googletest") {
14+
}

0 commit comments

Comments
 (0)