Skip to content

Commit

Permalink
third_party: Add Abseil C++ build support
Browse files Browse the repository at this point in the history
This CL adds the GN files needed to build Abseil C++. These files were
generated by //pw_build/py/pw_build/generate_3p_gn.py

Change-Id: Id58040c22ac64a305585297be4ebf2e256a264ef
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/135957
Commit-Queue: Aaron Green <[email protected]>
Reviewed-by: Rob Mohr <[email protected]>
Reviewed-by: Taylor Cramer <[email protected]>
  • Loading branch information
nopsledder authored and CQ Bot Account committed May 1, 2023
1 parent 34e5a1b commit 1875778
Show file tree
Hide file tree
Showing 35 changed files with 4,448 additions and 0 deletions.
1 change: 1 addition & 0 deletions pw_fuzzer/fuzzer.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import("//build_overrides/pigweed.gni")

import("$dir_pw_build/error.gni")
import("$dir_pw_third_party/abseil-cpp/abseil-cpp.gni")
import("$dir_pw_toolchain/host_clang/toolchains.gni")
import("$dir_pw_unit_test/test.gni")

Expand Down
1 change: 1 addition & 0 deletions pw_package/py/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pw_python_package("py") {
"pw_package/git_repo.py",
"pw_package/package_manager.py",
"pw_package/packages/__init__.py",
"pw_package/packages/abseil_cpp.py",
"pw_package/packages/arduino_core.py",
"pw_package/packages/boringssl.py",
"pw_package/packages/chromium_verifier.py",
Expand Down
46 changes: 46 additions & 0 deletions pw_package/py/pw_package/packages/abseil_cpp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2023 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
"""Install and check status of Abseil C++."""

import pathlib
from typing import Sequence

import pw_package.git_repo
import pw_package.package_manager


class AbseilCPP(pw_package.git_repo.GitRepo):
"""Install and check status of Abseil C++."""

def __init__(self, *args, **kwargs):
super().__init__(
*args,
name='abseil-cpp',
url=(
'https://pigweed.googlesource.com/'
'third_party/github/abseil/abseil-cpp'
),
commit='65109ecdf01a829bdb5e428174b3abb181e75826',
**kwargs,
)

def info(self, path: pathlib.Path) -> Sequence[str]:
return (
f'{self.name} installed in: {path}',
"Enable by running 'gn args out' and adding this line:",
f' dir_pw_third_party_abseil_cpp = "{path}"',
)


pw_package.package_manager.register(AbseilCPP)
1 change: 1 addition & 0 deletions pw_package/py/pw_package/pigweed_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from pw_package import package_manager

# pylint: disable=unused-import
from pw_package.packages import abseil_cpp
from pw_package.packages import arduino_core
from pw_package.packages import boringssl
from pw_package.packages import chromium_verifier
Expand Down
6 changes: 6 additions & 0 deletions pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ def gn_arm_build(ctx: PresubmitContext):
gn_fuzz_build = build.GnGenNinja(
name='gn_fuzz_build',
path_filter=_BUILD_FILE_FILTER,
packages=('abseil-cpp',),
gn_args={
'dir_pw_third_party_abseil_cpp': lambda ctx: '"{}"'.format(
ctx.package_root / 'abseil-cpp'
),
},
ninja_targets=('host_clang_fuzz',),
)

Expand Down
54 changes: 54 additions & 0 deletions third_party/abseil-cpp/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2023 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# DO NOT MANUALLY EDIT!
# This file was automatically generated by pw_build/gn_writer.py

import("//build_overrides/pigweed.gni")

import("$dir_pw_build/target_types.gni")
import("$dir_pw_docgen/docs.gni")
import("$dir_pw_third_party/abseil-cpp/abseil-cpp.gni")

config("abseil_cpp_public_config1") {
include_dirs = [ "$dir_pw_third_party_abseil_cpp" ]
}

config("abseil_cpp_config1") {
cflags = [
"-DNOMINMAX",
"-Wall",
"-Wcast-qual",
"-Wconversion-null",
"-Wextra",
"-Wformat-security",
"-Wmissing-declarations",
"-Woverlength-strings",
"-Wpointer-arith",
"-Wundef",
"-Wunused-local-typedefs",
"-Wunused-result",
"-Wvarargs",
"-Wvla",
"-Wwrite-strings",
]
}

config("abseil_cpp_config2") {
ldflags = [ "-pthread" ]
}

pw_doc_group("docs") {
sources = [ "docs.rst" ]
}
1 change: 1 addition & 0 deletions third_party/abseil-cpp/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[email protected]
23 changes: 23 additions & 0 deletions third_party/abseil-cpp/abseil-cpp.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# DO NOT MANUALLY EDIT!
# This file was automatically generated by pw_build/gn_writer.py

declare_args() {
# If compiling tests with Abseil C++, this variable is set to the path to the
# Abseil C++ installation. When set, a pw_source_set for the Abseil C++ library
# is created at "$dir_pw_third_party/abseil-cpp".
dir_pw_third_party_abseil_cpp = ""
}
50 changes: 50 additions & 0 deletions third_party/abseil-cpp/absl/algorithm/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2023 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# DO NOT MANUALLY EDIT!
# This file was automatically generated by pw_build/gn_writer.py
# It contains GN build targets for absl/algorithm.

import("//build_overrides/pigweed.gni")

import("$dir_pw_build/target_types.gni")
import("$dir_pw_third_party/abseil-cpp/abseil-cpp.gni")

# Generated from //absl/algorithm:algorithm
pw_source_set("algorithm") {
public = [ "$dir_pw_third_party_abseil_cpp/absl/algorithm/algorithm.h" ]
public_configs = [ "../..:abseil_cpp_public_config1" ]
configs = [
"../../configs:internal_disabled_warnings",
"../..:abseil_cpp_config1",
]
remove_configs = [ "$dir_pw_fuzzer:instrumentation" ]
public_deps = [ "../base:config" ]
}

# Generated from //absl/algorithm:container
pw_source_set("container") {
public = [ "$dir_pw_third_party_abseil_cpp/absl/algorithm/container.h" ]
public_configs = [ "../..:abseil_cpp_public_config1" ]
configs = [
"../../configs:internal_disabled_warnings",
"../..:abseil_cpp_config1",
]
remove_configs = [ "$dir_pw_fuzzer:instrumentation" ]
public_deps = [
":algorithm",
"../base:core_headers",
"../meta:type_traits",
]
}
Loading

0 comments on commit 1875778

Please sign in to comment.