# Copyright (C) 2017 The Android Open Source Project
#
# 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("//gn/perfetto_check_build_deps.gni")
import("//gn/standalone/android.gni")
import("//gn/standalone/libc++/libc++.gni")
import("//gn/standalone/sanitizers/sanitizers.gni")
import("//gn/standalone/toolchain/msvc.gni")
import("//gn/standalone/wasm.gni")

# These warnings have been introduced with the newest version of clang (only in
# the hermetic build) and are enabled just with -Werror.
hermetic_clang_suppressions = [ "-Wno-c99-designator" ]

# We deal with three toolchains here:
# 1. Clang, used in most cases.
# 2. GCC, used in some Linux cases.
# 3. MSVC, used in some Windows cases.
# Clang vs gcc is typically not a problem: both support roughly the same
# switches. -Wno-unknown-warning-option fixes the mismatching ones.
# The situation on Windows is a bit trickier: clang-cl.exe really pretends to be
# cl.exe (MSVC), so we should use MSVC-style switches (e.g. /W2). However,
# clang-cl.exe still supports some -Wclang-style-switches for flags that don't
# have a corresponding version in MSVC.
#
# In the rules below, the conditionals should be interpreted as follows:
# is_win -> can be either clang-cl.exe or cl.exe (MSVC). Only MSVC-style
#           switches (the common denominator) should be used.
# is_clang -> could be clang-on-linux, clang-on-mac or clang-cl.exe.

config("extra_warnings") {
  if (is_win) {
    cflags = [
      "/W2",
      "/wd4244",  # conversion from 'float' to 'int', possible loss of data
      "/wd4267",  # conversion from 'size_t' to 'int', possible loss of data
    ]
    if (is_clang) {
      cflags += [
        "-Wno-float-equal",
        "-Wno-unused-macros",
        "-Wno-old-style-cast",
      ]
    }
  } else {
    # Clang or Gcc. On linux, Android and Mac.
    cflags = [
      "-Wall",
      "-Wextra",
      "-Wpedantic",
    ]
  }

  # Disable variadic macro warning as we make extensive use of them in trace
  # processor and client API.
  if (is_clang) {
    if (!is_fuzzer) {
      # Disable Weverything on fuzzers to avoid breakages when new versions of
      # clang are rolled into OSS-fuzz.
      cflags += [ "-Weverything" ]
    }
    cflags += [
      "-Wno-c++98-compat-pedantic",
      "-Wno-c++98-compat",
      "-Wno-disabled-macro-expansion",
      "-Wno-documentation-unknown-command",
      "-Wno-gnu-include-next",
      "-Wno-gnu-statement-expression",
      "-Wno-gnu-zero-variadic-macro-arguments",
      "-Wno-padded",
      "-Wno-poison-system-directories",
      "-Wno-reserved-id-macro",
      "-Wno-reserved-identifier",
      "-Wno-shadow-uncaptured-local",
      "-Wno-unknown-sanitizers",
      "-Wno-unknown-warning-option",
      "-Wno-unsafe-buffer-usage",
    ]
  } else if (!is_clang && !is_win) {
    # Use return std::move(...) for compatibility with old GCC compilers.
    cflags_cc = [ "-Wno-redundant-move" ]

    # Use after free detection in GCC is still not good enough: it still fails
    # on very obvious false-positives in trace processor.
    cflags_cc += [ "-Wno-use-after-free" ]

    # GCC 7's handling of uninitialized std::optional is flaky at best and
    # causes many false positives.
    # TODO(lalitm): remove this when we upgrade to a GCC version which is good
    # enough to handle this.
    cflags_cc += [ "-Wno-maybe-uninitialized" ]

    # GCC's handling of detecting infinite recursion is flaky at best and
    # causes some false positives.
    # TODO(lalitm): remove this when we upgrade to a GCC version which is good
    # enough to handle this.
    cflags_cc += [ "-Wno-infinite-recursion" ]

    # GCC's handling of detecting non null arguments is flaky at best and
    # causes some false positives.
    # TODO(lalitm): remove this when we upgrade to a GCC version which is good
    # enough to handle this.
    cflags_cc += [ "-Wno-nonnull" ]
  }
}

config("no_exceptions") {
  # Exceptions are disabled by default on Windows (Use /EHsc to enable them).
  if (!is_win) {
    cflags_cc = [ "-fno-exceptions" ]
  }
}

config("no_rtti") {
  if (is_win) {
    cflags_cc = [ "/GR-" ]
  } else {
    cflags_cc = [ "-fno-rtti" ]
  }
}

# Used in buildtools dependencies for standalone builds.
config("c++17") {
  if (is_win) {
    cflags_cc = [ "/std:c++17" ]
  } else {
    cflags_cc = [ "-std=c++17" ]
  }
}

# Used in buildtools dependencies for standalone builds.
config("c++20") {
  visibility = [ "//buildtools:libc++config" ]
  if (is_win) {
    cflags_cc = [ "/std:c++20" ]
  } else {
    cflags_cc = [ "-std=c++20" ]
  }
}

config("visibility_hidden") {
  if (!is_win) {
    cflags = [ "-fvisibility=hidden" ]
  }
}

config("win32_lean_and_mean") {
  if (is_win) {
    defines = [ "WIN32_LEAN_AND_MEAN" ]
  }
}

config("default") {
  asmflags = []
  cflags = []
  cflags_c = []
  cflags_cc = []
  defines = []
  include_dirs = []
  ldflags = []
  libs = []

  if ((is_android || is_linux) && !is_wasm) {
    ldflags += [ "-Wl,--build-id" ]
  }

  if (is_clang || !is_win) {  # Clang or GCC, but not MSVC.
    cflags += [
      "-fstrict-aliasing",
      "-Wformat",
    ]
  }

  if (is_clang && is_win) {
    # clang-cl from version 16 does not like out-of-line definition of static
    # constexpr, even in C++14 mode. Disable the deprecated warnings to work
    # around the problem.
    cflags += [ "-Wno-deprecated" ]
  }

  if (is_win) {
    cflags += [
      "/bigobj",  # Some of our files are bigger than the regular limits.
      "/Gy",  # Enable function-level linking.
      "/FS",  # Preserve previous PDB behavior.
      "/utf-8",  # Assume UTF-8 by default to avoid code page dependencies.
      "/Zc:__cplusplus",  # Allow use of __cplusplus macro.
    ]
    defines += [
      "_CRT_NONSTDC_NO_WARNINGS",
      "_CRT_SECURE_NO_DEPRECATE",
      "_CRT_SECURE_NO_WARNINGS",  # Disables warnings on some POSIX-compat API.
      "_SCL_SECURE_NO_DEPRECATE",
      "NOMINMAX",
    ]
    if (!use_custom_libcxx) {
      defines += [ "_HAS_EXCEPTIONS=0" ]  # Disables exceptions in MSVC STL.
    }
  } else if (!is_wasm) {  # !is_win
    cflags += [
      "-g",
      "-fPIC",
      "-fstack-protector-strong",
    ]
  }

  # Treat warnings as errors, but give up on fuzzer builds.
  if (!is_fuzzer) {
    if (is_win) {
      cflags += [ "/WX" ]
    } else {
      cflags += [ "-Werror" ]
    }
  }

  if (is_clang) {
    cflags += [ "-fcolor-diagnostics" ]
    if (!is_win) {
      cflags += [ "-fdiagnostics-show-template-tree" ]
    }
  }

  if (is_hermetic_clang && is_linux && !is_wasm) {
    cflags += hermetic_clang_suppressions
  } else {
    not_needed([ "hermetic_clang_suppressions" ])
  }

  if (non_hermetic_clang_stdlib != "") {
    if (is_clang && !is_hermetic_clang && !is_wasm) {
      cflags_cc += [ "-stdlib=" + non_hermetic_clang_stdlib ]
      ldflags += [ "-stdlib=" + non_hermetic_clang_stdlib ]
    }
  }

  if (is_lto) {
    cflags += [ "-flto=full" ]
    ldflags += [ "-flto=full" ]
  }

  if (is_win) {
    # We support only x86/x64 builds on Windows.
    assert(current_cpu == "x64" || current_cpu == "x86")
  } else if (current_cpu == "arm") {
    cflags += [
      "-march=armv7-a",
      "-mfpu=neon",
      "-mthumb",
    ]
  } else if (current_cpu == "riscv64") {
    if (!is_clang) {
      # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
      libs += [ "atomic" ]
    }
  } else if (current_cpu == "x86") {
    asmflags += [ "-m32" ]
    cflags += [
      "-m32",
      "-msse2",
      "-mfpmath=sse",
    ]
    ldflags += [
      "-m32",
      "-lgcc",
    ]
  } else if (current_cpu == "arm64") {
    cflags += [ "-fno-omit-frame-pointer" ]
  } else if (current_cpu == "x64") {
    cflags += [ "-fno-omit-frame-pointer" ]  # For perf profiling.
    if (enable_perfetto_x64_cpu_opt) {
      # When updating these flags, the CheckCpuOptimizations() in utils.cc must
      # be updated accordingly.
      cflags += [
        "-mbmi",
        "-mbmi2",
        "-mavx2",
        "-mpopcnt",
        "-msse4.2",
      ]
    }
  }

  if (is_wasm) {
    # As of writing (2023-06-12) WASM 128bit SIMD is supported on
    # stable Chrome, Safari, and Firefox. See:
    # - https://webassembly.org/roadmap/
    # - https://emscripten.org/docs/porting/simd.html
    cflags += [ "-msimd128" ]
  }

  if (is_linux) {
    # Enable LFS (large file support) for stat() and other syscalls.
    cflags += [
      "-D_FILE_OFFSET_BITS=64",
      "-D_LARGEFILE_SOURCE",
      "-D_LARGEFILE64_SOURCE",
    ]
    libs += [
      "pthread",
      "rt",
    ]
  }

  if (is_win && !is_clang) {
    # When using MSVC we need to manually pass the include dirs. clang-cl.exe
    # doesn't need them because it's smart enough to figure out the right path
    # by querying the registry on its own.
    include_dirs = win_msvc_inc_dirs  # Defined in msvc.gni.
  }

  if (is_debug) {
    if (is_win) {
      cflags += [ "/Z7" ]
      if (is_clang) {
        # Required to see symbols in windbg when building with clang-cl.exe.
        cflags += [ "-gcodeview-ghash" ]
        ldflags = [ "/DEBUG:GHASH" ]
      }
    } else {
      libs += [ "dl" ]
    }
  }

  if (is_android) {
    asmflags += [ "--target=$android_abi_target" ]
    cflags += [
      "--sysroot=$android_compile_sysroot",
      "-DANDROID",
      "-D__ANDROID_API__=${android_api_level}",
      "--target=$android_abi_target",
    ]
    cflags_cc += [
      "-isystem$android_ndk_root/sources/cxx-stl/llvm-libc++/include",
      "-isystem$android_ndk_root/sources/android/support/include",
      "-isystem$android_ndk_root/sources/cxx-stl/llvm-libc++abi/include",
    ]

    # Keep these include paths *after* the above to prevent the wrong include
    # being used for some headers (e.g. math.h).
    # We need to add to each language (cflags_c, cflags_cc etc.) separately as
    # we added to cflags directly, these inludes would end up before the
    # languge and thus the above includes.
    sysroot_cflags = [
      "-isystem$android_compile_sysroot/$android_compile_sysroot_subdir",
      "-isystem$android_compile_sysroot",
    ]
    cflags_c += sysroot_cflags
    cflags_cc += sysroot_cflags

    ldflags += [
      "-Wl,-z,nocopyreloc",
      "-gcc-toolchain",
      "$android_toolchain_root",
      "--sysroot=$android_ndk_root/$android_link_sysroot_subdir",
      "--target=$android_abi_target",
      "-Wl,--exclude-libs,libunwind.a",
      "-Wl,--exclude-libs,libgcc.a",
      "-Wl,--exclude-libs,libc++_static.a",
      "-Wl,--no-undefined",
      "-Wl,-z,noexecstack",
      "-Wl,-z,relro",
      "-Wl,-z,now",
      "-Wl,--warn-shared-textrel",
      "-Wl,--fatal-warnings",

      # New NDKs need setting this to not give "unable to find library -lc++".
      # See https://github.com/android/ndk/issues/951#issuecomment-501017894.
      "-nostdlib++",
    ]
    lib_dirs = [
      "$android_ndk_root/sources/cxx-stl/llvm-libc++/libs/$android_app_abi",
    ]
    libs += [
      "gcc",
      "c++_static",
      "c++abi",
    ]

    if (current_cpu == "arm") {
      # New NDKs don't have libandroid_support for arm64.
      libs += [ "android_support" ]
    }
  }
}

config("debug_symbols") {
  cflags = []
  if (is_win) {
    cflags = [ "/Od" ]
  } else {
    cflags = [ "-O0" ]
  }
  if (is_android || is_linux) {
    cflags += [ "-funwind-tables" ]
  }
}

config("release") {
  # Compiler flags for release builds.
  if (is_win) {
    cflags = [
      "/O2",
      "/Zc:inline",
    ]
  } else if (is_android) {
    cflags = [ "-O2" ]
  } else if (is_fuzzer) {
    cflags = [ "-O1" ]
  } else {
    cflags = [ "-O3" ]
  }
  if (!is_win) {
    cflags += [
      "-fdata-sections",
      "-ffunction-sections",
    ]
  }

  # Linker flags for release builds.
  if (is_win) {
    ldflags = [
      "/OPT:REF",
      "/OPT:ICF",
      "/INCREMENTAL:NO",
      "/FIXED:NO",
    ]
  } else if (is_mac) {
    ldflags = [ "-dead_strip" ]
  } else if (!is_win && !is_wasm) {
    ldflags = [
      "-Wl,--gc-sections",
      "-Wl,--icf=all",
      "-Wl,-O1",
    ]
  }
  defines = [ "NDEBUG" ]
}

config("shared_library") {
  if (is_android || is_linux) {
    ldflags = [ "-fPIC" ]
  }
}

config("executable") {
  ldflags = []

  # Android will refuse to run executables if they aren't position independent.
  # Instead on Linux there isn't any need and they break ASan (goo.gl/paFR6K).
  # The OSS-Fuzz provided AFL library is not PIC, so we we cannot use -fPIE
  # for the fuzzer executables.
  if ((is_android || is_linux) && !is_wasm && !is_fuzzer) {
    asmflags = [ "-fPIE" ]
    cflags = [ "-fPIE" ]
    ldflags += [ "-pie" ]
  }

  # -rpath stores the path to the linked shared libraries into the binary, so
  # that they can be launched without passing any LD_LIBRARY_PATH. It's
  # supported only by Linux, not Android. But concretely we need this only when
  # use_custom_libcxx=true && custom_libcxx_is_static=false, which happens only
  # on Linux right now.
  if (is_linux && !is_wasm) {
    ldflags += [
      "-Wl,-rpath=\$ORIGIN/.",
      "-Wl,-rpath-link=.",
    ]
  }
}

# This config is only added to certain leaf target types (see BUILDCONFIG.gn).
# This allows us to remove the config (and thus the dependency) on a per-target
# basis. If the config was applied to source_sets, then they would unavoidably
# carry the dependency onto liblog to the final target.
config("android_liblog") {
  if (is_android) {
    libs = [ "log" ]
  }
}

# Checks that tools/install-build-deps has been run since it last changed.
perfetto_check_build_deps("check_build_deps") {
  args = []
}

perfetto_check_build_deps("check_build_deps_android") {
  args = [ "--android" ]
}
