# 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/pigweed.gni")
import("${build_root}/chip/java/config.gni")
import("${build_root}/config/compiler/compiler.gni")
import("${build_root}/config/sysroot.gni")
import("${build_root}/config/target.gni")

if (current_os == "mac" || current_os == "ios") {
  import("${build_root}/config/mac/mac_sdk.gni")
}

declare_args() {
  # Enable -Werror. This can be disabled if using a different compiler
  # with unfixed or unsupported wanings.
  treat_warnings_as_errors = true
}

if (current_cpu == "arm" || current_cpu == "arm64") {
  import("${build_root}/config/arm.gni")
} else if (current_cpu == "x86" || current_cpu == "x86_64") {
  import("${build_root}/config/x86.gni")
} else if (current_cpu == "riscv") {
  import("${build_root}/config/riscv.gni")
}

config("release") {
  defines = [ "NDEBUG" ]
}

config("debug_default") {
  if (!is_debug) {
    configs = [ ":release" ]
  }
}

config("abi_default") {
  cflags = []
  if (current_os == "mac" || current_os == "ios") {
    cflags += [
      "-target",
      mac_target_triple,
    ]
  }

  if (current_os != "mac" && current_os != "ios") {
    if (current_cpu == "arm" || current_cpu == "arm64") {
      if (current_os == "linux" && is_clang) {
        if (current_cpu == "arm") {
          cflags += [ "--target=armv7-linux-gnueabihf" ]
        } else if (current_cpu == "arm64") {
          cflags += [ "--target=aarch64-linux-gnu" ]
        }
      }

      if (arm_arch != "") {
        cflags += [ "-march=${arm_arch}" ]
      }
      if (arm_cpu != "") {
        cflags += [ "-mcpu=${arm_cpu}" ]
      }
      if (arm_tune != "") {
        cflags += [ "-mtune=${arm_tune}" ]
      }
      if (arm_abi != "") {
        cflags += [ "-mabi=${arm_abi}" ]
      }
      if (arm_fpu != "") {
        cflags += [ "-mfpu=${arm_fpu}" ]
      }
      if (arm_float_abi != "") {
        cflags += [ "-mfloat-abi=${arm_float_abi}" ]
      }
      if (arm_use_thumb) {
        cflags += [ "-mthumb" ]
      }
    }
    if (current_cpu == "x86" || current_cpu == "x86_64") {
      if (x86_arch != "") {
        cflags += [ "-march=${x86_arch}" ]
      }
      if (x86_cpu != "") {
        cflags += [ "-mcpu=${x86_cpu}" ]
      }
      if (x86_tune != "") {
        cflags += [ "-mtune=${x86_tune}" ]
      }

      if (current_cpu == "x86_64") {
        cflags += [
          "-msse4.2",
          "-mpopcnt",
          "-m64",
        ]
      } else if (current_cpu == "x86") {
        cflags += [
          "-mssse3",
          "-mfpmath=sse",
          "-m32",
        ]
      }
    }
    if (current_cpu == "riscv") {
      if (riscv_arch != "") {
        cflags += [ "-march=${riscv_arch}" ]
      }
      if (riscv_cpu != "") {
        cflags += [ "-mcpu=${riscv_cpu}" ]
      }
      if (riscv_tune != "") {
        cflags += [ "-mtune=${riscv_tune}" ]
      }
      if (riscv_abi != "") {
        cflags += [ "-mabi=${riscv_abi}" ]
      }
      if (riscv_fpu != "") {
        cflags += [ "-mfpu=${riscv_fpu}" ]
      }
      if (riscv_float_abi != "") {
        cflags += [ "-mfloat-abi=${riscv_float_abi}" ]
      }
    }
  }

  asmflags = cflags
  ldflags = cflags
}

config("dead_code_elimination_default") {
  # Delete unreferenced sections. Helpful with -ffunction-sections.
  if (current_os == "mac" || current_os == "ios") {
    ldflags = [ "-Wl,-dead_strip" ]
  } else {
    ldflags = [ "-Wl,--gc-sections" ]
  }
}

config("target_default") {
  if (current_toolchain == default_toolchain) {
    defines = target_defines
    cflags = target_cflags
    cflags_c = target_cflags_c
    cflags_cc = target_cflags_cc
    ldflags = target_ldflags
  }
}

config("optimize_zero") {
  cflags = [ "-O0" ]
  ldflags = cflags
}

config("optimize_debug") {
  cflags = [ "-O${optimize_debug_level}" ]
  ldflags = cflags
}

config("optimize_default") {
  if (is_debug) {
    if (optimize_debug) {
      configs = [ ":optimize_debug" ]
    } else {
      configs = [ ":optimize_zero" ]
    }
  } else {
    if (optimize_for_size) {
      configs = [ "$dir_pw_build:optimize_size" ]
    } else {
      configs = [ "$dir_pw_build:optimize_speed" ]
    }

    if (current_os != "mac") {
      ldflags = [
        "-Wl,-O2",
        "-Wl,--gc-sections",
      ]
    }
  }
}

config("disabled_warnings") {
  cflags = [
    "-Wno-deprecated-declarations",
    "-Wno-missing-field-initializers",
    "-Wno-unknown-warning-option",
    "-Wno-unused-parameter",
  ]
  if (!is_debug) {
    # assert() causes unused variable warnings in release.
    cflags += [ "-Wno-unused" ]
  }
  if (!is_clang) {
    cflags += [
      "-Wno-cast-function-type",
      "-Wno-psabi",
      "-Wno-maybe-uninitialized",
    ]
  }
}

config("warnings_common") {
  cflags = [ "-Wall" ]

  ldflags = []
  if (treat_warnings_as_errors) {
    cflags += [ "-Werror" ]
    ldflags += [ "-Werror" ]
  }

  if (current_os != "mac" && current_os != "ios") {
    ldflags += [ "-Wl,--fatal-warnings" ]
  }

  if (current_os != "mac" && current_os != "ios" && current_os != "linux" &&
      current_os != "win" && current_os != "tizen" && current_os != "webos" &&
      current_os != "cmsis-rtos") {
    cflags += [ "-Wstack-usage=8192" ]
  }
}

config("strict_warnings") {
  cflags = [
    "-Wextra",
    "-Wshadow",
    "-Wunreachable-code",
    "-Wvla",
    "-Wformat",
    "-Wformat-nonliteral",
    "-Wformat-security",
  ]

  if (current_os == "webos") {
    cflags -= [
      "-Wshadow",
      "-Wvla",
    ]
  }

  if (current_os == "mac" || current_os == "ios") {
    cflags += [ "-Wconversion" ]
  }

  if (matter_enable_java_compilation) {
    cflags -= [ "-Wshadow" ]
  }

  cflags_cc = [ "-Wnon-virtual-dtor" ]

  configs = []
  ldflags = []

  if (is_clang) {
    cflags += [
      "-Wimplicit-fallthrough",
      "-Wheader-hygiene",
      "-Wshorten-64-to-32",
      "-Wformat-type-confusion",
    ]

    configs += [ "$dir_pw_build:clang_thread_safety_warnings" ]

    # TODO: can make this back fatal in once pigweed updates can be taken again.
    #       See https://github.com/project-chip/connectedhomeip/pull/22079
    #
    # Currently `./scripts/build/build_examples.py --target linux-arm64-light-rpc-ipv6only-clang build`
    # fails in third_party/pigweed/repo/pw_protobuf
    if (current_cpu == "arm64" && current_os == "linux") {
      cflags += [ "-Wno-error=shorten-64-to-32" ]
    }
  }

  if (!is_asan && (current_os == "linux" || current_os == "android")) {
    ldflags += [ "-Wl,-z,defs" ]
  }
}

config("warnings_default") {
  configs = [
    ":warnings_common",
    ":strict_warnings",
    ":disabled_warnings",
  ]
}

config("disabled_warnings_third_party") {
  cflags = [
    "-Wno-unused",
    "-Wno-format",
    "-Wno-address",
  ]

  if (!is_clang) {
    cflags += [ "-Wno-maybe-uninitialized" ]
  }
}

config("warnings_third_party") {
  configs = [
    ":warnings_common",
    ":disabled_warnings",
    ":disabled_warnings_third_party",
  ]
}

config("symbols_default") {
  cflags = [ "-g${symbol_level}" ]
}

config("std_default") {
  cflags_c = [ "-std=${c_standard}" ]
  cflags_objc = [ "-std=${c_standard}" ]
  cflags_cc = [ "-std=${cpp_standard}" ]
  cflags_objcc = [ "-std=${cpp_standard}" ]
}

config("cosmetic_default") {
  configs = [ "$dir_pw_build:colorize_output" ]
}

config("runtime_default") {
  if (is_clang) {
    configs = [
      "$dir_pw_toolchain/host_clang:no_system_libcpp",
      "$dir_pw_toolchain/host_clang:xcode_sysroot",
    ]
  }
  if (current_os == "linux" || current_os == "tizen" || current_os == "webos") {
    libs = [
      "dl",
      "pthread",
      "rt",
    ]
  }

  cflags = []
  ldflags = []

  if (sysroot != "") {
    cflags += [ "--sysroot=${sysroot}" ]
    ldflags += [ "--sysroot=${sysroot}" ]
  }

  cflags += runtime_library_cflags
  ldflags += runtime_library_ldflags
}

# To use different sanitizer options, use `gn args .` in the out folder and
# use settings like:
#
#   is_clang=true
#   is_debug=true
#   optimize_for_size=false
#   is_asan=true
#   is_sanitize_fatal=false
#

declare_args() {
  # Enable Thread sanitizer
  is_tsan = false

  # Enable memory sanitizer
  is_msan = false

  # enable undefined behavior sanitizer
  is_ubsan = false

  # Exit on sanitize error. Generally standard libraries may get errors
  # so not stopping on the first error is often useful
  is_sanitize_fatal = true
}

config("sanitize_address") {
  cflags = [
    "-fsanitize=address",
    "-fno-omit-frame-pointer",
  ]
  ldflags = cflags
}

config("sanitize_thread") {
  cflags = [ "-fsanitize=thread" ]
  ldflags = cflags
}

config("sanitize_memory") {
  cflags = [
    "-fsanitize=memory",
    "-fsanitize-memory-track-origins",
    "-fno-omit-frame-pointer",
  ]
  ldflags = cflags
}

config("sanitize_undefined_behavior") {
  cflags = [
    "-fvisibility=hidden",
    "-fsanitize=undefined",
    "-fsanitize=float-divide-by-zero",
  ]
  if (is_clang) {
    cflags += [
      "-fsanitize=unsigned-integer-overflow",
      "-fsanitize=implicit-conversion",
      "-fsanitize=nullability",
      "-fno-sanitize=vptr,function",
    ]
  }

  ldflags = cflags
}

config("sanitize_recover_all") {
  cflags = [ "-fsanitize-recover=all" ]
  ldflags = cflags
}

config("sanitize_default") {
  configs = []

  if (is_tsan) {
    configs += [ ":sanitize_thread" ]
  }

  if (is_asan) {
    configs += [ ":sanitize_address" ]
  }

  if (is_msan) {
    configs += [ ":sanitize_memory" ]
  }

  if (is_ubsan) {
    configs += [ ":sanitize_undefined_behavior" ]
  }

  if (!is_sanitize_fatal) {
    configs += [ ":sanitize_recover_all" ]
  }
}

config("libfuzzer_fuzzing") {
  cflags = [ "-fsanitize=fuzzer" ]
  ldflags = cflags
}

config("oss_fuzz") {
  cflags = string_split(getenv("CFLAGS"))
  ldflags = string_split(getenv("CXXFLAGS"))
  ldflags += [ getenv("LIB_FUZZING_ENGINE") ]
}

config("fuzzing_default") {
  configs = []
  if (is_libfuzzer) {
    configs += [ ":libfuzzer_fuzzing" ]
  }
  if (oss_fuzz) {
    configs += [ ":oss_fuzz" ]
  }
}

config("coverage") {
  cflags = [ "--coverage" ]
  ldflags = cflags
}

config("coverage_default") {
  configs = []
  if (use_coverage) {
    configs += [ ":coverage" ]
  }
}

declare_args() {
  # Enable Runtime Type Information (RTTI)
  enable_rtti = current_os == "mac" || current_os == "ios"
}

config("no_rtti") {
  cflags_cc = [ "-fno-rtti" ]
}

config("rtti") {
  cflags_cc = [ "-frtti" ]
}

config("rtti_default") {
  if (enable_rtti) {
    configs = [ ":rtti" ]
  } else {
    configs = [ ":no_rtti" ]
  }
}

config("no_exceptions") {
  cflags = [ "-fno-exceptions" ]
}

config("exceptions") {
  cflags = [ "-fexceptions" ]
}

config("exceptions_default") {
  configs = [ ":no_exceptions" ]
}

config("unwind_tables") {
  cflags = [ "-funwind-tables" ]
}

config("no_unwind_tables") {
  cflags = [
    "-fno-unwind-tables",
    "-fno-asynchronous-unwind-tables",
  ]
}

config("unwind_tables_default") {
  if (exclude_unwind_tables) {
    configs = [ ":no_unwind_tables" ]
  } else {
    configs = [ ":unwind_tables" ]
  }
}

config("size_default") {
  cflags = [
    "-fno-common",
    "-ffunction-sections",
    "-fdata-sections",
  ]

  # do not export functions in jni, or --gc-sections will not work and will be some undefined issues
  if (current_os == "android") {
    cflags += [ "-fvisibility=hidden" ]
  }
}

config("stack_protector_default") {
  cflags = [ "-fno-stack-protector" ]
}

config("prefix_mappings_default") {
  cflags = []
  foreach(prefix_mapping, prefix_mappings) {
    cflags += [ "-fdebug-prefix-map=${prefix_mapping}" ]
  }
}

config("pic_default") {
  if (enable_pic) {
    cflags = [ "-fPIC" ]
    ldflags = cflags
  }
}

config("pie_default") {
  if (enable_pie) {
    ldflags = [ "-pie" ]
  }
}

config("aliasing_default") {
  cflags = [ "-fno-strict-aliasing" ]
}

config("specs_default") {
  if (current_cpu == "arm" && current_os == "freertos" && !is_clang) {
    cflags = [
      "--specs=nosys.specs",
      "--specs=nano.specs",
    ]

    libs = [ "nosys" ]

    ldflags = cflags
  }
}
