Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ecff3f70 authored by Arman Uguray's avatar Arman Uguray
Browse files

build: Add build arguments for libhardware and core dirs

This patch adds GN arguments to add libhardware and core library include
paths in a generic manner.

Example args.gn file:

    libhw_include_path = "../../libhardware/include"
    core_include_path = "../../core/include"

Also introduced in this CL is the "OS_GENERIC" preprocessor define, that
will allow us to conditionally compile Android-specific vs generic code
until we shed the Android-specific dependencies.

BUG=21339022

Change-Id: I42b1cc501738653a6e886a0365c9cbef2e9a525e
parent 71c4001f
Loading
Loading
Loading
Loading
+23 −3
Original line number Diff line number Diff line
@@ -14,10 +14,25 @@
#  limitations under the License.
#

declare_args() {
  # Include path for hardware/bluetooth.h
  libhw_include_path = ""
  core_include_path = ""
}

config("default_include_dirs") {
  # TODO(armansito): Remove "core_include_path" once the cutils includes have
  # been removed.
  assert(libhw_include_path != "", "libhardware_include_path build argument wasn't provided.")
  assert(core_include_path != "", "core_include_path build argument wasn't provided.")
  include_dirs = [
    libhw_include_path,
    core_include_path,
  ]
}

config("linux") {
  # TODO: include from system/core, libhardware
  # TODO: AndroidConfig.h or equivalent
  # TODO: gtest
  # TODO(keybuk): AndroidConfig.h or equivalent

  cflags = [
    "-Wall",
@@ -35,6 +50,11 @@ config("linux") {
    "_GNU_SOURCE",
    "HAS_NO_BDROID_BUILDCFG",
    "LOG_NDEBUG=1",

    # This is a macro to that can be used by source code to detect if the
    # current build is done by GN or via Android.mk. This is a temporary
    # workaround until we can remove all Android-specific dependencies.
    "OS_GENERIC",
  ]
}

+15 −3
Original line number Diff line number Diff line
@@ -17,13 +17,25 @@
set_default_toolchain("//build/toolchain/gcc")

set_defaults("executable") {
  configs = [ "//build:linux", "//build:gc" ]
  configs = [
    "//build:linux",
    "//build:gc",
    "//build:default_include_dirs",
  ]
}

set_defaults("shared_library") {
  configs = [ "//build:linux", "//build:pic" ]
  configs = [
    "//build:linux",
    "//build:gc",
    "//build:default_include_dirs",
  ]
}

set_defaults("source_set") {
  configs = [ "//build:linux", "//build:pic" ]
  configs = [
    "//build:linux",
    "//build:gc",
    "//build:default_include_dirs",
  ]
}