blob: 7c0be40e93f29dd8edf078504e287fc94ab11974 [file] [log] [blame]
# Copyright 2016 Google, LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
import("../mesa.gni")
config("common_config") {
mesa_version = read_file("../VERSION", "trim string")
defines = [
"STDC_HEADERS=1",
"HAVE_ENDIAN_H=1",
"HAVE_SYS_TYPES_H=1",
"HAVE_SYS_STAT_H=1",
"HAVE_STDLIB_H=1",
"HAVE_STRING_H=1",
"HAVE_MEMORY_H=1",
"HAVE_STRINGS_H=1",
"HAVE_INTTYPES_H=1",
"HAVE_STDINT_H=1",
"HAVE_TIMESPEC_GET=1",
"HAVE_UNISTD_H=1",
"HAVE_DLFCN_H=1",
"YYTEXT_POINTER=1",
"HAVE___BUILTIN_BSWAP32=1",
"HAVE___BUILTIN_BSWAP64=1",
"HAVE___BUILTIN_CLZ=1",
"HAVE___BUILTIN_CLZLL=1",
"HAVE___BUILTIN_CTZ=1",
"HAVE___BUILTIN_EXPECT=1",
"HAVE___BUILTIN_FFS=1",
"HAVE___BUILTIN_FFSLL=1",
"HAVE___BUILTIN_POPCOUNT=1",
"HAVE___BUILTIN_POPCOUNTLL=1",
"HAVE___BUILTIN_UNREACHABLE=1",
"HAVE_FUNC_ATTRIBUTE_CONST=1",
"HAVE_FUNC_ATTRIBUTE_FLATTEN=1",
"HAVE_FUNC_ATTRIBUTE_FORMAT=1",
"HAVE_FUNC_ATTRIBUTE_MALLOC=1",
"HAVE_FUNC_ATTRIBUTE_PACKED=1",
"HAVE_FUNC_ATTRIBUTE_PURE=1",
"HAVE_FUNC_ATTRIBUTE_UNUSED=1",
"HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT=1",
"HAVE_FUNC_ATTRIBUTE_NORETURN=1",
"HAVE_DLADDR=1",
"HAVE_DL_ITERATE_PHDR=1",
"HAVE_CLOCK_GETTIME=1",
"PACKAGE_NAME=\"Mesa\" ",
"PACKAGE_TARNAME=\"mesa\" ",
"PACKAGE_VERSION=\"$mesa_version\" ",
"PACKAGE_STRING=\"Mesa $mesa_version\" ",
"PACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi\?product=Mesa\" ",
"PACKAGE_URL=\"\" ",
"PACKAGE=\"mesa\" ",
"VERSION=\"$mesa_version\"",
"_DEFAULT_SOURCE",
"_GNU_SOURCE=1",
]
if (current_os == "linux") {
defines += [
"HAVE_LINUX_FUTEX_H",
"HAVE_MEMFD_CREATE",
]
}
if (is_debug) {
defines += [ "DEBUG=1" ]
}
# TODO(fxbug.dev/12640) fix these warnings and remove the -Wno*
cflags = [
"-Wno-missing-field-initializers",
"-Wno-initializer-overrides",
"-Wno-sign-compare",
"-Wno-overloaded-virtual",
"-Wno-absolute-value",
"-Wno-missing-braces",
"-Wno-unused-function",
"-Wno-mismatched-tags",
"-Wno-enum-conversion",
"-Wno-implicit-fallthrough",
"-Wno-unused-variable",
"-Wno-unused-private-field",
"-Wno-sometimes-uninitialized",
"-Wno-implicit-int-float-conversion",
"-Wno-incompatible-pointer-types-discards-qualifiers",
"-Wno-unused-label",
"-Wno-switch",
"-Wno-gnu-variable-sized-type-not-at-end",
"-Wno-extra-semi",
"-Wno-newline-eof",
"-Wno-tautological-overlap-compare",
"-Wno-tautological-constant-out-of-range-compare",
"-Wno-unknown-pragmas",
"-Wno-int-in-bool-context",
"-Wno-conversion",
"-Wno-deprecated-anon-enum-enum-conversion",
]
# Present in the meson build
cflags_c = [
"-Werror=missing-prototypes",
"-Werror=int-conversion",
"-Werror=incompatible-pointer-types-discards-qualifiers"
]
}
config("sha1_config") {
include_dirs = [ "$target_gen_dir" ]
}
mesa_python_action("sha1") {
output_name = "git_sha1.h"
outputs = [ "$target_gen_dir/$output_name" ]
script = "$mesa_build_root/bin/git_sha1_gen.py"
args = [
"--output",
rebase_path("$target_gen_dir/$output_name"),
]
# Ensure that this action reruns when git HEAD moves
inputs += [ ".git/HEAD" ]
# The above makes it safe to ignore other .git/* accesses.
hermetic_action_ignored_prefixes = [ ".git/" ]
public_configs = [ ":sha1_config" ]
}