Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building CHIP with GN #1456

Merged
merged 60 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
8fa2637
Add GN files to gitignore
mspang May 19, 2020
232ef30
Add GN build support using pw_toolchain & pw_build
mspang Jun 16, 2020
2ff962d
Add nlunit-test to GN build
mspang May 18, 2020
57817fa
Add nlassert to GN build
mspang May 18, 2020
8c310f6
Add nlfaultinjection to GN build
mspang May 18, 2020
e60b1ae
Add nlio to GN build
mspang May 19, 2020
50ca2c8
Add lwIP to GN build
mspang May 18, 2020
66dd10f
Add Mbed TLS to GN build
mspang May 19, 2020
6852ab6
Add SystemConfig to GN build
mspang May 19, 2020
5e29e72
Add CHIPConfig to GN build
mspang May 20, 2020
2482c79
Add src/lib/support to GN build
mspang May 20, 2020
39c6871
Add src/system to GN build
mspang May 20, 2020
43d6592
Add src/inet to GN build
mspang May 20, 2020
d2d6e3a
Add BLE to GN build
mspang May 20, 2020
3f186fe
Add src/lib/core to GN build
mspang May 20, 2020
1cd9fbc
Add src/crypto to GN build
mspang May 21, 2020
3a2dc2d
Add transport to GN build
mspang Jun 15, 2020
6fb7847
Add src/controller to GN build
mspang May 20, 2020
300ce26
Add libCHIP.a to GN build
mspang May 20, 2020
a9604a8
Add CHIPVersion.h generation to GN build
mspang May 21, 2020
f06d13b
Add src/lib/support/tests to GN build
mspang May 21, 2020
ef0be27
Add src/system/tests to GN build
mspang May 21, 2020
8ac81f1
Add src/inet/tests to GN build
mspang May 21, 2020
8904fdf
Add src/ble/tests to GN build
mspang May 21, 2020
daf4c47
Add src/lib/core/tests to GN build
mspang May 21, 2020
004ce98
Add src/crypto/tests to GN build
mspang May 21, 2020
55bc623
Add src/app to GN build
mspang May 21, 2020
a4ccc31
Add src/setup_payload to GN build
mspang Jun 15, 2020
ec7b598
Add src/setup_payout/tests to GN build
mspang Jun 15, 2020
2a20fef
Add qrcodetool to GN build
mspang Jun 15, 2020
2e3cabc
Add ARM toolchain support
mspang Jun 16, 2020
885a723
Add support for building nRF5 lock app
mspang May 28, 2020
8682167
Run unit tests with some help from pigweed
mspang Jun 12, 2020
c381ba0
Make the build relocatable
mspang Jun 16, 2020
09ace68
Add nRF5 lock example superproject build
mspang Jun 16, 2020
3acbb8f
Add support for combined build via target_os="all"
mspang Jun 17, 2020
a27c7c9
Remove shared imports
mspang Jun 19, 2020
8c8ec10
Add transport tests to GN build
mspang Jun 29, 2020
42e7b79
Add examples/chip-tool to GN build
mspang Jun 17, 2020
1f9fff8
Add examples/shell to GN build
mspang Jun 29, 2020
f5a65bd
Add GN build wrapper script
mspang Jun 17, 2020
195e65e
Make bootstrap display cleaner
keir Jun 17, 2020
428cc48
Enable building with homebrew openssl on Mac via pkg-config
mspang Jun 23, 2020
6464f67
Add mbedtls build to top level build
mspang Jun 23, 2020
149ea2a
Add tips to gn_build.sh
mspang Jun 23, 2020
39af23b
Add nRF5 lock app back to example build
mspang Jun 29, 2020
fa14181
Harmonize library outputs with automake
mspang Jul 7, 2020
908aac8
Restyled by shfmt
restyled-commits Jul 7, 2020
8febbbd
Move the GN build files to //gn
mspang Jul 7, 2020
714180c
Fix lint warning "Except block directly handles BaseException"
mspang Jul 7, 2020
2a2d95f
Move activate above bootstrap
mspang Jul 7, 2020
b190e78
Add github actions for GN
mspang Jul 7, 2020
6825730
Move project specific build logic to gn/chip
mspang Jul 8, 2020
6658cb2
Add comments to GN build GitHub workflow helpers
mspang Jul 8, 2020
060f322
Fix the nRF5 lock app CI build
mspang Jul 8, 2020
5e21e7f
Merge branch 'master' of https://github.com/project-chip/connectedhom…
woody-apple Jul 8, 2020
80cd16b
Updating Build Version
woody-apple Jul 8, 2020
aa9557b
Re-merge repos.conf with .gitmodules
mspang Jul 8, 2020
ca4f915
Move bootstrap.sh & activate.sh to scripts
mspang Jul 8, 2020
4f3ed84
Fixup activate.sh & bootstrap.sh after moving
mspang Jul 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/gn_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: GN Builds

on:
push:
pull_request:

jobs:
build:
name: GN Build

strategy:
matrix:
type: [main, clang, mbedtls]
env:
BUILD_TYPE: ${{ matrix.type }}
BUILD_VERSION: 0.2.14
BUILD_IMAGE: chip-build-openssl
BUILD_ORG: connectedhomeip

runs-on: ubuntu-latest

container:
image: "connectedhomeip/chip-build-openssl:0.2.14"
volumes:
- "/tmp/log_output:/tmp/test_logs"

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout Submodules
run: make -f Makefile-bootstrap repos
- name: Bootstrap
run: scripts/build/gn_bootstrap.sh
- name: Setup Build
run: |
case $BUILD_TYPE in
"main") GN_ARGS='';;
"clang") GN_ARGS='is_clang=true';;
"linux-embedded") GN_ARGS='device_platform="linux"';;
"mbedtls") GN_ARGS='chip_crypto="mbedtls"';;
*) ;;
esac

scripts/build/gn_gen.sh --args="$GN_ARGS"
- name: Run Build
run: scripts/build/gn_build.sh
- name: Run Tests
run: scripts/tests/gn_tests.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ configure
src/include/BuildConfig.h.in
src/include/BuildConfig.h.in~

# GN build system
mspang marked this conversation as resolved.
Show resolved Hide resolved
out/

# Repos stuff
.repos-warning-stamp

Expand Down
28 changes: 28 additions & 0 deletions .gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2020 Project CHIP 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
#
# http://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.

# The location of the build configuration file.
buildconfig = "//build/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

# Allow loading paths relative to //gn.
secondary_source = "//gn/"

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

default_args = {
pw_unit_test_AUTOMATIC_RUNNER = "$dir_pigweed/targets/host/run_test"
}
163 changes: 163 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Copyright (c) 2020 Project CHIP 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
#
# http://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.

import("//build_overrides/chip.gni")
import("//build_overrides/mbedtls.gni")
import("//build_overrides/nlassert.gni")
import("//build_overrides/nlio.gni")
import("//build_overrides/nlunit_test.gni")
import("//build_overrides/pigweed.gni")

# This build file should not be used in superproject builds.
assert(chip_root == "//")

import("${chip_root}/gn/chip/tests.gni")
import("${chip_root}/gn/chip/tools.gni")

if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {
# This is a real toolchain. Build CHIP.
group("default") {
deps = [ ":all" ]
}

group("all") {
deps = [
"${chip_root}/src/app",
"${chip_root}/src/ble",
"${chip_root}/src/controller",
"${chip_root}/src/crypto",
"${chip_root}/src/inet",
"${chip_root}/src/lib",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/lwip:all",
"${chip_root}/src/system",
"${chip_root}/src/transport",
"${mbedtls_root}:mbedtls",
"${nlassert_root}:nlassert",
"${nlio_root}:nlio",
"${nlunit_test_root}:nlunit-test",
]

if (chip_build_tests) {
deps += [ ":tests" ]
}

if (chip_build_tools) {
deps += [
"${chip_root}/examples/chip-tool",
"${chip_root}/examples/shell",
"${chip_root}/src/lib/shell",
"${chip_root}/src/qrcodetool",
"${chip_root}/src/setup_payload",
]
}
}

if (chip_build_tests) {
import("${chip_root}/gn/chip/chip_test_group.gni")

chip_test_group("tests") {
deps = [
"${chip_root}/src/app/plugin/tests",
"${chip_root}/src/ble/tests",
"${chip_root}/src/crypto/tests",
"${chip_root}/src/inet/tests",
"${chip_root}/src/lib/core/tests",
"${chip_root}/src/lib/support/tests",
"${chip_root}/src/lwip/tests",
"${chip_root}/src/setup_payload/tests",
"${chip_root}/src/system/tests",
"${chip_root}/src/transport/tests",
]
}

group("check") {
deps = [ ":tests_run" ]
}
}
} else {
# This is the dummy toolchain. Configure various real toolchains.
import("${chip_root}/gn/chip/chip_build.gni")
declare_args() {
# Set this to false to disable all builds by default.
enable_default_builds = true
}

declare_args() {
# Enable building chip with clang.
enable_host_clang_build = enable_default_builds

# Enable building chip with gcc.
enable_host_gcc_build = enable_default_builds

# Build building chip with gcc & mbedtls.
enable_host_gcc_mbdtls_build = enable_default_builds

# Build the nRF5 lock app example.
enable_nrf5_lock_app_build = false
}

if (enable_nrf5_lock_app_build) {
import("//build_overrides/nrf5_lock_app.gni")
}

import("//build/toolchain/host_clang/toolchains.gni")
import("//build/toolchain/host_gcc/toolchains.gni")
chip_build("host_clang") {
toolchain = "//build/toolchain/host_clang:${host_os}_${host_cpu}_clang"
}

chip_build("host_gcc") {
toolchain = "//build/toolchain/host_gcc:${host_os}_${host_cpu}_gcc"
}

chip_build("host_gcc_mbedtls") {
toolchain = "//build/toolchain/host_gcc:${host_os}_${host_cpu}_gcc_mbedtls"
}

group("default") {
deps = []
if (enable_host_clang_build) {
deps += [ ":all_host_clang" ]
}
if (enable_host_gcc_build) {
deps += [ ":all_host_gcc" ]
}
if (enable_host_gcc_mbdtls_build) {
deps += [ ":all_host_gcc_mbedtls" ]
}
if (enable_nrf5_lock_app_build) {
deps += [ "${nrf5_lock_app_root}:nrf5(${nrf5_lock_app_root}/toolchain:nrf5_lock_app)" ]
}
}

if (chip_build_tests) {
group("check") {
deps = []
if (enable_host_clang_build) {
deps += [ ":check_host_clang" ]
}
if (enable_host_gcc_build) {
deps += [ ":check_host_gcc" ]
}
if (enable_host_gcc_mbdtls_build) {
deps += [ ":check_host_gcc_mbedtls" ]
}
if (enable_nrf5_lock_app_build) {
deps += [ ":default" ]
}
}
}
}
4 changes: 3 additions & 1 deletion activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
# limitations under the License.
#

CHIP_ROOT="$(dirname "$0")"
if [[ ! -d "${CHIP_ROOT}" ]]; then
CHIP_ROOT="$(dirname "$0")"
fi

export PW_BRANDING_BANNER="$CHIP_ROOT/.chip-banner.txt"
export PW_BRANDING_BANNER_COLOR="bold_white"
Expand Down
31 changes: 31 additions & 0 deletions examples/chip-tool/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2020 Project CHIP 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
#
# http://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.

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

import("${chip_root}/gn/chip/tools.gni")

assert(chip_build_tools)

executable("chip-standalone-demo") {
sources = [ "main.cpp" ]

public_deps = [ "${chip_root}/src/lib" ]

output_dir = "${root_out_dir}/bin"
}

group("chip-tool") {
deps = [ ":chip-standalone-demo" ]
}
26 changes: 26 additions & 0 deletions examples/lock-app/nrf5/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2020 Project CHIP 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
#
# http://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.

# The location of the build configuration file.
buildconfig = "//build/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

# Allow loading paths relative to //gn.
secondary_source = "//third_party/connectedhomeip/gn/"

default_args = {
import("//args.gni")
}
Loading