# 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/nlassert.gni")
import("//build_overrides/nlfaultinjection.gni")

import("${chip_root}/src/platform/device.gni")
import("${chip_root}/gn/chip/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 = "<CHIPProjectConfig.h>"

  # Extra header to include in SystemConfig.h for project.
  system_project_config_include = "<SystemProjectConfig.h>"

  # Extra include dirs for project configs.
  project_config_include_dirs = []
}

if (project_config_include_dirs == [] &&
    chip_project_config_include == "<CHIPProjectConfig.h>" &&
    system_project_config_include == "<SystemProjectConfig.h>") {
  project_config_include_dirs += [ "${chip_root}/config/standalone" ]
}

config("system_config") {
  configs = [ "${chip_root}/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" ]
  }

  include_dirs = project_config_include_dirs
}

source_set("system_config_header") {
  sources = [ "SystemConfig.h" ]

  public_configs = [ ":system_config" ]

  public_deps = []

  if (chip_system_config_use_lwip) {
    public_deps += [ "${chip_root}/src/lwip" ]
  }
}

static_library("system") {
  output_name = "libSystemLayer"

  sources = [
    "SystemAlignSize.h",
    "SystemClock.cpp",
    "SystemClock.h",
    "SystemConfig.h",
    "SystemError.cpp",
    "SystemError.h",
    "SystemEvent.h",
    "SystemFaultInjection.h",
    "SystemLayer.cpp",
    "SystemLayer.h",
    "SystemLayerPrivate.h",
    "SystemMutex.cpp",
    "SystemMutex.h",
    "SystemObject.cpp",
    "SystemObject.h",
    "SystemPacketBuffer.cpp",
    "SystemPacketBuffer.h",
    "SystemStats.cpp",
    "SystemStats.h",
    "SystemTimer.cpp",
    "SystemTimer.h",
    "SystemWakeEvent.cpp",
    "SystemWakeEvent.h",
    "TimeSource.h",
  ]

  public_deps = [
    "${chip_root}/src/lib/support",
    "${nlassert_root}:nlassert",
  ]

  allow_circular_includes_from = [ "${chip_root}/src/lib/support" ]

  if (chip_with_nlfaultinjection) {
    sources += [ "SystemFaultInjection.cpp" ]
    public_deps += [ "${nlfaultinjection_root}:nlfaultinjection" ]
  }
}
