| # 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/build.gni") |
| 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") |
| |
| import("//src/platform/device.gni") |
| import("$dir_pw_build/python.gni") |
| |
| # This build file should not be used in superproject builds. |
| assert(chip_root == "//") |
| |
| import("${build_root}/chip/tests.gni") |
| import("${build_root}/chip/tools.gni") |
| |
| if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") { |
| declare_args() { |
| chip_enable_python_modules = |
| (current_os == "mac" || current_os == "linux") && |
| (host_cpu == "x64" || host_cpu == "arm64") |
| } |
| |
| # Python packages for supporting specific targets. |
| pw_python_group("python_packages") { |
| python_deps = [ |
| "$dir_pw_build/py", |
| "$dir_pw_doctor/py", |
| "$dir_pw_env_setup/py", |
| "$dir_pw_hdlc/py", |
| "$dir_pw_module/py", |
| "$dir_pw_protobuf/py", |
| "$dir_pw_protobuf_compiler/py", |
| "$dir_pw_rpc/py", |
| "$dir_pw_status/py", |
| "$dir_pw_toolchain/py", |
| "$dir_pw_unit_test/py", |
| "$dir_pw_watch/py", |
| "integrations/mobly:chip_mobly", |
| "third_party/happy", |
| ] |
| } |
| |
| # This is a real toolchain. Build CHIP. |
| group("default") { |
| deps = [ |
| "${chip_root}/src/app", |
| "${chip_root}/src/ble", |
| "${chip_root}/src/controller", |
| "${chip_root}/src/credentials", |
| "${chip_root}/src/crypto", |
| "${chip_root}/src/inet", |
| "${chip_root}/src/lib", |
| "${chip_root}/src/lib/asn1", |
| "${chip_root}/src/lib/core", |
| "${chip_root}/src/lib/shell", |
| "${chip_root}/src/lib/support", |
| "${chip_root}/src/lwip:all", |
| "${chip_root}/src/messaging", |
| "${chip_root}/src/protocols", |
| "${chip_root}/src/setup_payload", |
| "${chip_root}/src/system", |
| "${chip_root}/src/transport", |
| "${mbedtls_root}:mbedtls", |
| "${nlassert_root}:nlassert", |
| "${nlio_root}:nlio", |
| "${nlunit_test_root}:nlunit-test", |
| ] |
| |
| if (chip_device_platform != "none") { |
| deps += [ "${chip_root}/src/app/server" ] |
| } |
| |
| if (chip_build_tests) { |
| deps += [ "//src:tests" ] |
| } |
| |
| if (chip_build_tools) { |
| deps += [ |
| "${chip_root}/examples/shell/standalone:chip-shell", |
| "${chip_root}/src/app/tests/integration:chip-im-initiator", |
| "${chip_root}/src/app/tests/integration:chip-im-responder", |
| "${chip_root}/src/messaging/tests/echo:chip-echo-requester", |
| "${chip_root}/src/messaging/tests/echo:chip-echo-responder", |
| "${chip_root}/src/qrcodetool", |
| "${chip_root}/src/setup_payload", |
| ] |
| if (chip_enable_python_modules) { |
| deps += [ "${chip_root}/src/controller/python" ] |
| } |
| } |
| |
| if (current_os == "android") { |
| deps += [ |
| "${chip_root}/src/controller/java", |
| "${chip_root}/src/setup_payload/java", |
| ] |
| } |
| } |
| |
| group("check") { |
| if (chip_link_tests) { |
| deps = [ "//src:tests_run" ] |
| } |
| } |
| |
| # We don't always want to run happy tests, make them a seperate group. |
| if (chip_enable_happy_tests) { |
| group("happy_tests") { |
| if (chip_link_tests) { |
| deps = [ "//src:happy_tests" ] |
| } |
| } |
| } |
| } else { |
| # This is the unified build. Configure various real toolchains. |
| import("${build_root}/chip/chip_build.gni") |
| declare_args() { |
| # Set this to false to disable all builds by default. |
| enable_default_builds = true |
| |
| # Enable building for Android. |
| enable_android_builds = false |
| |
| # Set this to true to enable TI builds by default. |
| enable_ti_simplelink_builds = false |
| |
| # Set this to true to enable efr32 builds by default. |
| enable_efr32_builds = false |
| |
| # Set this to true to enable qpg6100 builds by default. |
| enable_qpg6100_builds = false |
| |
| # Set this to true to enable k32w builds by default. |
| enable_k32w_builds = false |
| } |
| |
| declare_args() { |
| # Enable building chip with clang. |
| enable_host_clang_build = enable_default_builds && host_os != "win" |
| |
| # Enable building chip with gcc. |
| enable_host_gcc_build = enable_default_builds && host_os != "win" |
| |
| # Enable building chip with gcc & mbedtls. |
| enable_host_gcc_mbedtls_build = enable_default_builds && host_os != "win" |
| |
| # Build the chip-tool example. |
| enable_standalone_chip_tool_build = |
| enable_default_builds && host_os != "win" |
| |
| # Build the shell example. |
| enable_standalone_shell_build = enable_default_builds && host_os != "win" |
| |
| # Build the Linux all clusters app example. |
| enable_linux_all_clusters_app_build = |
| enable_default_builds && (host_os == "linux" || host_os == "mac") |
| |
| # Build the Linux bridge app example. |
| enable_linux_bridge_app_build = |
| enable_default_builds && (host_os == "linux" || host_os == "mac") |
| |
| # Build the Linux lighting app example. |
| enable_linux_lighting_app_build = |
| enable_default_builds && (host_os == "linux" || host_os == "mac") |
| |
| # Build the cc13x2x7_26x2x7 lock app example. |
| enable_cc13x2x7_26x2x7_lock_app_build = enable_ti_simplelink_builds |
| |
| # Build the efr32 lock app example. |
| enable_efr32_lock_app_build = enable_efr32_builds |
| |
| # Build the qpg6100 lock app example. |
| enable_qpg6100_lock_app_build = enable_qpg6100_builds |
| |
| # Build the efr32 lighting app example. |
| enable_efr32_lighting_app_build = enable_efr32_builds |
| |
| # Build the k32w lock app example. |
| enable_k32w_lock_app_build = enable_k32w_builds |
| } |
| |
| if (enable_host_clang_build) { |
| chip_build("host_clang") { |
| toolchain = "${build_root}/toolchain/host:${host_os}_${host_cpu}_clang" |
| } |
| } |
| |
| if (enable_host_gcc_build) { |
| chip_build("host_gcc") { |
| toolchain = "${build_root}/toolchain/host:${host_os}_${host_cpu}_gcc" |
| } |
| } |
| |
| if (enable_host_gcc_mbedtls_build) { |
| chip_build("host_gcc_mbedtls") { |
| toolchain = "${chip_root}/config/mbedtls/toolchain:${host_os}_${host_cpu}_gcc_mbedtls" |
| } |
| } |
| |
| if (enable_android_builds) { |
| chip_build("android_arm") { |
| toolchain = "${build_root}/toolchain/android:android_arm" |
| } |
| |
| chip_build("android_arm64") { |
| toolchain = "${build_root}/toolchain/android:android_arm64" |
| } |
| |
| chip_build("android_x64") { |
| toolchain = "${build_root}/toolchain/android:android_x64" |
| } |
| |
| chip_build("android_x86") { |
| toolchain = "${build_root}/toolchain/android:android_x86" |
| } |
| } |
| |
| standalone_toolchain = "${chip_root}/config/standalone/toolchain:standalone" |
| not_needed([ "standalone_toolchain" ]) # Might not be needed. |
| |
| if (enable_standalone_chip_tool_build) { |
| group("standalone_chip_tool") { |
| deps = [ "${chip_root}/examples/chip-tool(${standalone_toolchain})" ] |
| } |
| } |
| |
| if (enable_cc13x2x7_26x2x7_lock_app_build) { |
| group("cc13x2x7_26x2x7_lock_app") { |
| deps = [ "${chip_root}/examples/lock-app/cc13x2x7_26x2x7(${chip_root}/config/cc13x2_26x2/toolchain:cc13x2x7_26x2x7_lock_app)" ] |
| } |
| } |
| |
| if (enable_standalone_shell_build) { |
| group("standalone_shell") { |
| deps = |
| [ "${chip_root}/examples/shell/standalone(${standalone_toolchain})" ] |
| } |
| } |
| |
| if (enable_linux_all_clusters_app_build) { |
| group("linux_all_clusters_app") { |
| deps = [ |
| "${chip_root}/examples/all-clusters-app/linux(${standalone_toolchain})", |
| ] |
| } |
| } |
| |
| if (enable_linux_bridge_app_build) { |
| group("linux_bridge_app") { |
| deps = |
| [ "${chip_root}/examples/bridge-app/linux(${standalone_toolchain})" ] |
| } |
| } |
| |
| if (enable_linux_lighting_app_build) { |
| group("linux_lighting_app") { |
| deps = [ |
| "${chip_root}/examples/lighting-app/linux(${standalone_toolchain})", |
| ] |
| } |
| } |
| |
| if (enable_efr32_lock_app_build) { |
| group("efr32_lock_app") { |
| deps = [ "${chip_root}/examples/lock-app/efr32(${chip_root}/config/efr32/toolchain:efr32_lock_app)" ] |
| } |
| } |
| |
| if (enable_qpg6100_lock_app_build) { |
| group("qpg6100_lock_app") { |
| deps = [ "${chip_root}/examples/lock-app/qpg6100(${chip_root}/config/qpg6100/toolchain:qpg6100_lock_app)" ] |
| } |
| } |
| |
| if (enable_efr32_lighting_app_build) { |
| group("efr32_lighting_app") { |
| deps = [ "${chip_root}/examples/lighting-app/efr32(${chip_root}/config/efr32/toolchain:efr32_lighting_app)" ] |
| } |
| } |
| |
| if (enable_k32w_lock_app_build) { |
| group("k32w_lock_app") { |
| deps = [ "${chip_root}/examples/lock-app/k32w(${chip_root}/config/k32w/toolchain:k32w_lock_app)" ] |
| } |
| } |
| |
| group("default") { |
| deps = [] |
| if (enable_host_clang_build) { |
| deps += [ ":host_clang" ] |
| } |
| if (enable_host_gcc_build) { |
| deps += [ ":host_gcc" ] |
| } |
| if (enable_host_gcc_mbedtls_build) { |
| deps += [ ":host_gcc_mbedtls" ] |
| } |
| if (enable_android_builds) { |
| deps += [ |
| ":android_arm", |
| ":android_arm64", |
| ":android_x64", |
| ":android_x86", |
| ] |
| } |
| if (enable_standalone_chip_tool_build) { |
| deps += [ ":standalone_chip_tool" ] |
| } |
| if (enable_standalone_shell_build) { |
| deps += [ ":standalone_shell" ] |
| } |
| if (enable_linux_all_clusters_app_build) { |
| deps += [ ":linux_all_clusters_app" ] |
| } |
| if (enable_linux_bridge_app_build) { |
| deps += [ ":linux_bridge_app" ] |
| } |
| if (enable_linux_lighting_app_build) { |
| deps += [ ":linux_lighting_app" ] |
| } |
| if (enable_efr32_lock_app_build) { |
| deps += [ ":efr32_lock_app" ] |
| } |
| if (enable_efr32_lighting_app_build) { |
| deps += [ ":efr32_lighting_app" ] |
| } |
| if (enable_k32w_lock_app_build) { |
| deps += [ ":k32w_lock_app" ] |
| } |
| if (enable_qpg6100_lock_app_build) { |
| deps += [ ":qpg6100_lock_app" ] |
| } |
| if (enable_cc13x2x7_26x2x7_lock_app_build) { |
| deps += [ ":cc13x2x7_26x2x7_lock_app" ] |
| } |
| } |
| |
| 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_mbedtls_build) { |
| deps += [ ":check_host_gcc_mbedtls" ] |
| } |
| } |
| } |