Skip to content

Commit

Permalink
build: add GN build files
Browse files Browse the repository at this point in the history
PR-URL: #47637
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
zcbenz authored and UlisesGascon committed Dec 11, 2023
1 parent d3870ac commit 8705058
Show file tree
Hide file tree
Showing 36 changed files with 1,923 additions and 0 deletions.
14 changes: 14 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##############################################################################
# #
# DO NOT EDIT THIS FILE! #
# #
##############################################################################

# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please modify the gyp files if you are making changes to build system.

import("unofficial.gni")

node_gn_build("node") {
}
14 changes: 14 additions & 0 deletions deps/ada/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##############################################################################
# #
# DO NOT EDIT THIS FILE! #
# #
##############################################################################

# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please modify the gyp files if you are making changes to build system.

import("unofficial.gni")

ada_gn_build("ada") {
}
29 changes: 29 additions & 0 deletions deps/ada/unofficial.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2023 Microsoft Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please edit the gyp files if you are making changes to build system.

import("../../node.gni")
import("$node_v8_path/gni/v8.gni")

# The actual configurations are put inside a template in unofficial.gni to
# prevent accidental edits from contributors.
template("ada_gn_build") {
config("ada_config") {
include_dirs = [ "." ]
}

gypi_values = exec_script("../../tools/gypi_to_gn.py",
[ rebase_path("ada.gyp") ],
"scope",
[ "ada.gyp" ])

source_set(target_name) {
forward_variables_from(invoker, "*")
public_configs = [ ":ada_config" ]
sources = gypi_values.ada_sources
}
}
14 changes: 14 additions & 0 deletions deps/base64/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##############################################################################
# #
# DO NOT EDIT THIS FILE! #
# #
##############################################################################

# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please modify the gyp files if you are making changes to build system.

import("unofficial.gni")

base64_gn_build("base64") {
}
141 changes: 141 additions & 0 deletions deps/base64/unofficial.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Copyright (c) 2013-2022 GitHub Inc.
# Copyright 2022 the V8 project authors. All rights reserved.
# Copyright 2023 Microsoft Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please edit the gyp files if you are making changes to build system.

# The actual configurations are put inside a template in unofficial.gni to
# prevent accidental edits from contributors.
template("base64_gn_build") {
config("base64_external_config") {
include_dirs = [ "base64/include" ]
if (!is_component_build) {
defines = [ "BASE64_STATIC_DEFINE" ]
}
}

config("base64_internal_config") {
include_dirs = [ "base64/lib" ]
if (is_component_build) {
defines = [ "BASE64_EXPORTS" ]
} else {
defines = []
}
if (target_cpu == "x86" || target_cpu == "x64") {
defines += [
"HAVE_SSSE3=1",
"HAVE_SSE41=1",
"HAVE_SSE42=1",
"HAVE_AVX=1",
"HAVE_AVX2=1",
]
}
if (target_cpu == "arm") {
defines += [ "HAVE_NEON32=1" ]
}
if (target_cpu == "arm64") {
defines += [ "HAVE_NEON64=1" ]
}
if (is_clang || !is_win) {
cflags_c = [
"-Wno-implicit-fallthrough",
"-Wno-shadow",
"-Wno-unused-but-set-variable",
]
}
}

gypi_values = exec_script("../../tools/gypi_to_gn.py",
[ rebase_path("base64.gyp") ],
"scope",
[ "base64.gyp" ])

component(target_name) {
forward_variables_from(invoker, "*")
configs += [ ":base64_internal_config" ]
public_configs = [ ":base64_external_config" ]
sources = gypi_values.base64_sources_common
deps = [
":base64_ssse3",
":base64_sse41",
":base64_sse42",
":base64_avx",
":base64_avx2",
":base64_neon32",
":base64_neon64",
]
}

source_set("base64_ssse3") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/ssse3/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [ "-mssse3" ]
}
}
}

source_set("base64_sse41") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/sse41/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [ "-msse4.1" ]
}
}
}

source_set("base64_sse42") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/sse42/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [ "-msse4.2" ]
}
}
}

source_set("base64_avx") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/avx/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [ "-mavx" ]
} else if (is_win) {
cflags_c = [ "/arch:AVX" ]
}
}
}
source_set("base64_avx2") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/avx2/codec.c" ]
if (target_cpu == "x86" || target_cpu == "x64") {
if (is_clang || !is_win) {
cflags_c = [ "-mavx2" ]
} else if (is_win) {
cflags_c = [ "/arch:AVX2" ]
}
}
}

source_set("base64_neon32") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/neon32/codec.c" ]
if (target_cpu == "arm") {
if (is_clang || !is_win) {
cflags_c = [ "-mfpu=neon" ]
}
}
}

source_set("base64_neon64") {
configs += [ ":base64_internal_config" ]
sources = [ "base64/lib/arch/neon64/codec.c" ]
# NEON is required in arm64, so no -mfpu flag is needed
}
}
14 changes: 14 additions & 0 deletions deps/brotli/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##############################################################################
# #
# DO NOT EDIT THIS FILE! #
# #
##############################################################################

# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please modify the gyp files if you are making changes to build system.

import("unofficial.gni")

brotli_gn_build("brotli") {
}
45 changes: 45 additions & 0 deletions deps/brotli/unofficial.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Copyright 2019 the V8 project authors. All rights reserved.
# Copyright 2023 Microsoft Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please edit the gyp files if you are making changes to build system.

# The actual configurations are put inside a template in unofficial.gni to
# prevent accidental edits from contributors.
template("brotli_gn_build") {
config("brotli_config") {
include_dirs = [ "c/include" ]
}

gypi_values = exec_script("../../tools/gypi_to_gn.py",
[ rebase_path("brotli.gyp") ],
"scope",
[ "brotli.gyp" ])

source_set(target_name) {
forward_variables_from(invoker, "*")
public_configs = [ ":brotli_config" ]
sources = gypi_values.brotli_sources
if (is_linux) {
defines = [ "OS_LINUX" ]
} else if (is_mac) {
defines = [ "OS_MACOSX" ]
} else if (target_os == "freebsd") {
defines = [ "OS_FREEBSD" ]
}
if (!is_win) {
libs = [ "m" ]
}
if (is_clang || !is_win) {
cflags_c = [
"-Wno-implicit-fallthrough",
"-Wno-unreachable-code",
"-Wno-unreachable-code-return",
]
}
}
}
14 changes: 14 additions & 0 deletions deps/cares/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##############################################################################
# #
# DO NOT EDIT THIS FILE! #
# #
##############################################################################

# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please modify the gyp files if you are making changes to build system.

import("unofficial.gni")

cares_gn_build("cares") {
}
81 changes: 81 additions & 0 deletions deps/cares/unofficial.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright (c) 2013-2019 GitHub Inc.
# Copyright 2019 the V8 project authors. All rights reserved.
# Copyright 2023 Microsoft Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please edit the gyp files if you are making changes to build system.

# The actual configurations are put inside a template in unofficial.gni to
# prevent accidental edits from contributors.
template("cares_gn_build") {
config("cares_config") {
include_dirs = [ "include" ]
if (!is_component_build) {
defines = [ "CARES_STATICLIB" ]
}
}

gypi_values = exec_script("../../tools/gypi_to_gn.py",
[ rebase_path("cares.gyp") ],
"scope",
[ "cares.gyp" ])

component(target_name) {
forward_variables_from(invoker, "*")
public_configs = [ ":cares_config" ]
if (is_component_build) {
defines = [ "CARES_BUILDING_LIBRARY" ]
} else {
defines = []
}
if (is_win) {
defines += [ "CARES_PULL_WS2TCPIP_H=1" ]
}
if (is_posix) {
defines += [
"_DARWIN_USE_64_BIT_INODE=1",
"_LARGEFILE_SOURCE",
"_FILE_OFFSET_BITS=64",
"_GNU_SOURCE",
"HAVE_CONFIG_H",
]
}

include_dirs = [ "src/lib" ]
if (is_win) {
include_dirs += [ "config/win32" ]
} else if (is_linux) {
include_dirs += [ "config/linux" ]
} else if (is_mac) {
include_dirs += [ "config/darwin" ]
}

if (is_win) {
libs = [
"ws2_32.lib",
"iphlpapi.lib",
]
}

sources = gypi_values.cares_sources_common
if (is_win) {
sources += gypi_values.cares_sources_win
}
if (is_linux) {
sources += [ "config/linux/ares_config.h" ]
}
if (is_mac) {
sources += [ "config/darwin/ares_config.h" ]
}

if (is_clang || !is_win) {
cflags_c = [
"-Wno-implicit-fallthrough",
"-Wno-unreachable-code",
]
}
}
}
14 changes: 14 additions & 0 deletions deps/googletest/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##############################################################################
# #
# DO NOT EDIT THIS FILE! #
# #
##############################################################################

# This file is used by GN for building, which is NOT the build system used for
# building official binaries.
# Please modify the gyp files if you are making changes to build system.

import("unofficial.gni")

googletest_gn_build("googletest") {
}
Loading

0 comments on commit 8705058

Please sign in to comment.