1# Copyright 2020 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/target_types.gni")
18
19declare_args() {
20  # If compiling backends with ThreadX, this variable is set to the path to the
21  # ThreadX include directory. When set, a pw_source_set for the threadx library
22  # is created at "$dir_pw_third_party/threadx".
23  dir_pw_third_party_threadx_include = ""
24
25  # The pw_source_set which provides the port specific includes and sources.
26  pw_third_party_threadx_PORT = ""
27}
28
29# This file defines a GN source_set for an external installation of ThreadX.
30# To use, checkout the threadx source into a directory, then set the build arg
31# dir_pw_third_party_threadx_include to point to that directory. The ThreadX
32# library will be available in GN at "$dir_pw_third_party/threadx".
33if (dir_pw_third_party_threadx_include != "") {
34  config("public_includes") {
35    include_dirs = [ "$dir_pw_third_party_threadx_include" ]
36    visibility = [ ":*" ]
37  }
38
39  pw_source_set("threadx") {
40    public_configs = [ ":public_includes" ]
41    allow_circular_includes_from = [ pw_third_party_threadx_PORT ]
42    public_deps = [ pw_third_party_threadx_PORT ]
43    public = [
44      "$dir_pw_third_party_threadx_include/tx_api.h",
45      "$dir_pw_third_party_threadx_include/tx_port.h",
46    ]
47  }
48} else {
49  group("threadx") {
50  }
51}
52