-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Not all options are configurable through GN args yet, just a few examples.
- Loading branch information
Showing
5 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 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. | ||
|
||
config("includes") { | ||
include_dirs = [ "." ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# 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/tests.gni") | ||
import("system.gni") | ||
|
||
declare_args() { | ||
# Extra header to include in CHIPConfig.h for project. | ||
# TODO - This should probably be in src/core but src/system also uses it. | ||
chip_project_config_include = "" | ||
|
||
# Extra header to include in CHIPConfig.h for platform. | ||
# TODO - This should probably be in src/core but src/system also uses it. | ||
chip_platform_config_include = "" | ||
|
||
# Extra header to include in SystemConfig.h for project. | ||
system_project_config_include = "" | ||
|
||
# Extra header to include in SystemConfig.h for platform. | ||
system_platform_config_include = "" | ||
} | ||
|
||
config("system_config") { | ||
configs = [ "//src:includes" ] | ||
|
||
defines = [] | ||
if (chip_project_config_include != "") { | ||
defines += [ "CHIP_PROJECT_CONFIG_INCLUDE=${chip_project_config_include}" ] | ||
} | ||
if (chip_platform_config_include != "") { | ||
defines += | ||
[ "CHIP_PLATFORM_CONFIG_INCLUDE=${chip_platform_config_include}" ] | ||
} | ||
if (system_project_config_include != "") { | ||
defines += | ||
[ "SYSTEM_PROJECT_CONFIG_INCLUDE=${system_project_config_include}" ] | ||
} | ||
if (system_platform_config_include != "") { | ||
defines += | ||
[ "SYSTEM_PLATFORM_CONFIG_INCLUDE=${system_platform_config_include}" ] | ||
} | ||
if (chip_build_tests) { | ||
defines += [ "CHIP_SYSTEM_CONFIG_TEST=1" ] | ||
} else { | ||
defines += [ "CHIP_SYSTEM_CONFIG_TEST=0" ] | ||
} | ||
if (chip_with_nlfaultinjection) { | ||
defines += [ "CHIP_WITH_NLFAULTINJECTION=1" ] | ||
} else { | ||
defines += [ "CHIP_WITH_NLFAULTINJECTION=0" ] | ||
} | ||
if (chip_system_config_use_lwip) { | ||
defines += [ "CHIP_SYSTEM_CONFIG_USE_LWIP=1" ] | ||
} else { | ||
defines += [ "CHIP_SYSTEM_CONFIG_USE_LWIP=0" ] | ||
} | ||
if (chip_system_config_use_sockets) { | ||
defines += [ "CHIP_SYSTEM_CONFIG_USE_SOCKETS=1" ] | ||
} else { | ||
defines += [ "CHIP_SYSTEM_CONFIG_USE_SOCKETS=0" ] | ||
} | ||
if (chip_system_config_locking == "posix") { | ||
defines += [ "CHIP_SYSTEM_CONFIG_POSIX_LOCKING=1" ] | ||
} else { | ||
defines += [ "CHIP_SYSTEM_CONFIG_POSIX_LOCKING=0" ] | ||
} | ||
if (chip_system_config_locking == "freertos") { | ||
defines += [ "CHIP_SYSTEM_CONFIG_FREERTOS_LOCKING=1" ] | ||
} else { | ||
defines += [ "CHIP_SYSTEM_CONFIG_FREERTOS_LOCKING=0" ] | ||
} | ||
if (chip_system_config_locking == "none") { | ||
defines += [ "CHIP_SYSTEM_CONFIG_NO_LOCKING=1" ] | ||
} else { | ||
defines += [ "CHIP_SYSTEM_CONFIG_NO_LOCKING=0" ] | ||
} | ||
if (chip_system_config_provide_statistics) { | ||
defines += [ "CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS=1" ] | ||
} else { | ||
defines += [ "CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS=0" ] | ||
} | ||
if (chip_system_config_clock == "clock_gettime") { | ||
defines += [ "HAVE_CLOCK_GETTIME=1" ] | ||
defines += [ "HAVE_CLOCK_SETTIME=1" ] | ||
} | ||
if (chip_system_config_clock == "gettimeofday") { | ||
defines += [ "HAVE_GETTIMEOFDAY=1" ] | ||
} | ||
} | ||
|
||
source_set("system_config_header") { | ||
sources = [ "SystemConfig.h" ] | ||
|
||
public_configs = [ ":system_config" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# 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. | ||
|
||
declare_args() { | ||
# Build tests. | ||
chip_system_config_test = true | ||
|
||
# Use the lwIP library. | ||
chip_system_config_use_lwip = current_os == "freertos" | ||
|
||
# Use BSD/POSIX socket API. | ||
chip_system_config_use_sockets = current_os != "freertos" | ||
|
||
# Mutex implementation: posix, freertos, none. | ||
chip_system_config_locking = "" | ||
|
||
# Clock implementation: clock_gettime, gettimeofday | ||
chip_system_config_clock = "clock_gettime" | ||
|
||
# Enable metrics collection. | ||
chip_system_config_provide_statistics = true | ||
} | ||
|
||
if (chip_system_config_locking == "") { | ||
if (current_os != "freertos") { | ||
chip_system_config_locking = "posix" | ||
} else { | ||
chip_system_config_locking = "none" | ||
} | ||
} | ||
|
||
assert(chip_system_config_locking == "posix" || | ||
chip_system_config_locking == "freertos" || | ||
chip_system_config_locking == "none", | ||
"Please select a valid mutex implementation: posix, freertos, none") | ||
|
||
assert( | ||
chip_system_config_clock == "clock_gettime" || | ||
chip_system_config_clock == "gettimeofday", | ||
"Please select a valid clock implementation: clock_gettime, gettimeofday") |