Skip to content

Commit b0a0174

Browse files
committed
build: add GN build files
1 parent 3e74590 commit b0a0174

File tree

21 files changed

+1547
-0
lines changed

21 files changed

+1547
-0
lines changed

BUILD.gn

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file is used by GN for building, which is NOT the build system used for
2+
# building official binaries.
3+
# Please take a look at node.gyp if you are making changes to build system.
4+
5+
import("unofficial.gni")
6+
7+
node_gn_build("node") {
8+
}

deps/ada/BUILD.gn

Lines changed: 29 additions & 0 deletions
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+
config("ada_config") {
13+
include_dirs = [ "." ]
14+
}
15+
16+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
17+
[ rebase_path("ada.gyp") ],
18+
"scope",
19+
[ "ada.gyp" ])
20+
21+
source_set("ada") {
22+
public_configs = [ ":ada_config" ]
23+
sources = gypi_values.ada_sources
24+
if (is_clang || !is_win) {
25+
cflags_cc = [
26+
"-Wno-unreachable-code-break",
27+
]
28+
}
29+
}

deps/base64/BUILD.gn

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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+
config("base64_external_config") {
12+
include_dirs = [ "base64/include" ]
13+
if (!is_component_build) {
14+
defines = [ "BASE64_STATIC_DEFINE" ]
15+
}
16+
}
17+
18+
config("base64_internal_config") {
19+
include_dirs = [ "base64/lib" ]
20+
if (is_component_build) {
21+
defines = [ "BASE64_EXPORTS" ]
22+
} else {
23+
defines = []
24+
}
25+
if (target_cpu == "x86" || target_cpu == "x64") {
26+
defines += [
27+
"HAVE_SSSE3=1",
28+
"HAVE_SSE41=1",
29+
"HAVE_SSE42=1",
30+
"HAVE_AVX=1",
31+
"HAVE_AVX2=1",
32+
]
33+
}
34+
if (target_cpu == "arm") {
35+
defines += [ "HAVE_NEON32=1" ]
36+
}
37+
if (target_cpu == "arm64") {
38+
defines += [ "HAVE_NEON64=1" ]
39+
}
40+
if (is_clang || !is_win) {
41+
cflags_c = [
42+
"-Wno-implicit-fallthrough",
43+
"-Wno-shadow",
44+
"-Wno-unused-but-set-variable",
45+
]
46+
}
47+
}
48+
49+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
50+
[ rebase_path("base64.gyp") ],
51+
"scope",
52+
[ "base64.gyp" ])
53+
54+
component("base64") {
55+
configs += [ ":base64_internal_config" ]
56+
public_configs = [ ":base64_external_config" ]
57+
sources = gypi_values.base64_sources_common
58+
deps = [
59+
":base64_ssse3",
60+
":base64_sse41",
61+
":base64_sse42",
62+
":base64_avx",
63+
":base64_avx2",
64+
":base64_neon32",
65+
":base64_neon64",
66+
]
67+
}
68+
69+
source_set("base64_ssse3") {
70+
configs += [ ":base64_internal_config" ]
71+
sources = [ "base64/lib/arch/ssse3/codec.c" ]
72+
if (target_cpu == "x86" || target_cpu == "x64") {
73+
if (is_clang || !is_win) {
74+
cflags_c = [ "-mssse3" ]
75+
}
76+
}
77+
}
78+
79+
source_set("base64_sse41") {
80+
configs += [ ":base64_internal_config" ]
81+
sources = [ "base64/lib/arch/sse41/codec.c" ]
82+
if (target_cpu == "x86" || target_cpu == "x64") {
83+
if (is_clang || !is_win) {
84+
cflags_c = [ "-msse4.1" ]
85+
}
86+
}
87+
}
88+
89+
source_set("base64_sse42") {
90+
configs += [ ":base64_internal_config" ]
91+
sources = [ "base64/lib/arch/sse42/codec.c" ]
92+
if (target_cpu == "x86" || target_cpu == "x64") {
93+
if (is_clang || !is_win) {
94+
cflags_c = [ "-msse4.2" ]
95+
}
96+
}
97+
}
98+
99+
source_set("base64_avx") {
100+
configs += [ ":base64_internal_config" ]
101+
sources = [ "base64/lib/arch/avx/codec.c" ]
102+
if (target_cpu == "x86" || target_cpu == "x64") {
103+
if (is_clang || !is_win) {
104+
cflags_c = [ "-mavx" ]
105+
} else if (is_win) {
106+
cflags_c = [ "/arch:AVX" ]
107+
}
108+
}
109+
}
110+
source_set("base64_avx2") {
111+
configs += [ ":base64_internal_config" ]
112+
sources = [ "base64/lib/arch/avx2/codec.c" ]
113+
if (target_cpu == "x86" || target_cpu == "x64") {
114+
if (is_clang || !is_win) {
115+
cflags_c = [ "-mavx2" ]
116+
} else if (is_win) {
117+
cflags_c = [ "/arch:AVX2" ]
118+
}
119+
}
120+
}
121+
122+
source_set("base64_neon32") {
123+
configs += [ ":base64_internal_config" ]
124+
sources = [ "base64/lib/arch/neon32/codec.c" ]
125+
if (target_cpu == "arm") {
126+
if (is_clang || !is_win) {
127+
cflags_c = [ "-mfpu=neon" ]
128+
}
129+
}
130+
}
131+
132+
source_set("base64_neon64") {
133+
configs += [ ":base64_internal_config" ]
134+
sources = [ "base64/lib/arch/neon64/codec.c" ]
135+
# NEON is required in arm64, so no -mfpu flag is needed
136+
}

deps/brotli/BUILD.gn

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
config("brotli_config") {
12+
include_dirs = [ "c/include" ]
13+
}
14+
15+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
16+
[ rebase_path("brotli.gyp") ],
17+
"scope",
18+
[ "brotli.gyp" ])
19+
20+
source_set("brotli") {
21+
public_configs = [ ":brotli_config" ]
22+
sources = gypi_values.brotli_sources
23+
if (is_linux) {
24+
defines = [ "OS_LINUX" ]
25+
} else if (is_mac) {
26+
defines = [ "OS_MACOSX" ]
27+
} else if (target_os == "freebsd") {
28+
defines = [ "OS_FREEBSD" ]
29+
}
30+
if (!is_win) {
31+
libs = [ "m" ]
32+
}
33+
if (is_clang || !is_win) {
34+
cflags_c = [
35+
"-Wno-implicit-fallthrough",
36+
"-Wno-unreachable-code",
37+
"-Wno-unreachable-code-return",
38+
]
39+
}
40+
}

deps/cares/BUILD.gn

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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+
config("cares_config") {
12+
include_dirs = [ "include" ]
13+
if (!is_component_build) {
14+
defines = [ "CARES_STATICLIB" ]
15+
}
16+
}
17+
18+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
19+
[ rebase_path("cares.gyp") ],
20+
"scope",
21+
[ "cares.gyp" ])
22+
23+
component("cares") {
24+
public_configs = [ ":cares_config" ]
25+
if (is_component_build) {
26+
defines = [ "CARES_BUILDING_LIBRARY" ]
27+
} else {
28+
defines = []
29+
}
30+
if (is_win) {
31+
defines += [ "CARES_PULL_WS2TCPIP_H=1" ]
32+
}
33+
if (is_posix) {
34+
defines += [
35+
"_DARWIN_USE_64_BIT_INODE=1",
36+
"_LARGEFILE_SOURCE",
37+
"_FILE_OFFSET_BITS=64",
38+
"_GNU_SOURCE",
39+
"HAVE_CONFIG_H",
40+
]
41+
}
42+
43+
include_dirs = [ "src/lib" ]
44+
if (is_win) {
45+
include_dirs += [ "config/win32" ]
46+
} else if (is_linux) {
47+
include_dirs += [ "config/linux" ]
48+
} else if (is_mac) {
49+
include_dirs += [ "config/darwin" ]
50+
}
51+
52+
if (is_win) {
53+
libs = [
54+
"ws2_32.lib",
55+
"iphlpapi.lib",
56+
]
57+
}
58+
59+
sources = gypi_values.cares_sources_common
60+
if (is_win) {
61+
sources += gypi_values.cares_sources_win
62+
}
63+
if (is_linux) {
64+
sources += [ "config/linux/ares_config.h" ]
65+
}
66+
if (is_mac) {
67+
sources += [ "config/darwin/ares_config.h" ]
68+
}
69+
70+
if (is_clang || !is_win) {
71+
cflags_c = [
72+
"-Wno-implicit-fallthrough",
73+
]
74+
}
75+
}

deps/googletest/BUILD.gn

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2021 the V8 project authors. All rights reserved.
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+
config("googletest_config") {
10+
include_dirs = [ "include" ]
11+
}
12+
13+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
14+
[ rebase_path("googletest.gyp") ],
15+
"scope",
16+
[ "googletest.gyp" ])
17+
18+
source_set("googletest") {
19+
testonly = true
20+
include_dirs = [
21+
"include",
22+
".",
23+
]
24+
defines = [
25+
"GTEST_HAS_POSIX_RE=0",
26+
"GTEST_LANG_CXX11=1",
27+
]
28+
sources = gypi_values.googletest_sources
29+
}

deps/histogram/BUILD.gn

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
config("histogram_config") {
12+
include_dirs = [ "src" ]
13+
}
14+
15+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
16+
[ rebase_path("histogram.gyp") ],
17+
"scope",
18+
[ "histogram.gyp" ])
19+
20+
source_set("histogram") {
21+
public_configs = [ ":histogram_config" ]
22+
sources = gypi_values.histogram_sources
23+
if (is_clang || !is_win) {
24+
cflags_c = [
25+
"-Wno-atomic-alignment",
26+
"-Wno-incompatible-pointer-types",
27+
"-Wno-unused-function",
28+
]
29+
}
30+
if (is_linux) {
31+
libs = [ "atomic" ]
32+
}
33+
}

deps/llhttp/BUILD.gn

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2013-2019 GitHub Inc.
2+
# Copyright 2019 the V8 project authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
6+
# This file is used by GN for building, which is NOT the build system used for
7+
# building official binaries.
8+
# Please edit the gyp files if you are making changes to build system.
9+
10+
config("llhttp_config") {
11+
include_dirs = [ "include" ]
12+
}
13+
14+
gypi_values = exec_script("../../tools/gypi_to_gn.py",
15+
[ rebase_path("llhttp.gyp") ],
16+
"scope",
17+
[ "llhttp.gyp" ])
18+
19+
source_set("llhttp") {
20+
public_configs = [ ":llhttp_config" ]
21+
include_dirs = [ "include" ]
22+
sources = gypi_values.llhttp_sources
23+
if (is_clang || !is_win) {
24+
cflags_c = [
25+
"-Wno-implicit-fallthrough",
26+
"-Wno-unreachable-code",
27+
]
28+
}
29+
}

0 commit comments

Comments
 (0)