| # 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") | |
| import("//build/checkout.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_PTHREAD=1", | |
| "HAVE_STDINT_H=1", | |
| "HAVE_STRUCT_TIMESPEC=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", | |
| ] | |
| } | |
| if (is_debug) { | |
| defines += [ "DEBUG=1" ] | |
| } | |
| # TODO(fxbug.dev/42077149) 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", | |
| # TODO(fxbug.dev/42055484): Fix the warning below and remove -Wno-deprecated-builtins: | |
| # src/compiler/glsl/list.h:58:4: error: builtin __has_trivial_destructor is deprecated. | |
| "-Wno-unknown-warning-option", | |
| "-Wno-deprecated-builtins", | |
| "-Wno-ignored-qualifiers", | |
| ] | |
| # Present in the meson build | |
| cflags_c = [ | |
| "-Werror=missing-prototypes", | |
| "-Werror=int-conversion", | |
| ] | |
| } | |
| config("sha1_config") { | |
| include_dirs = [ "$target_gen_dir" ] | |
| } | |
| if (submodules) { | |
| mesa_git_link_path_list = | |
| read_file("../.git", "list lines") | |
| mesa_git_link_path = mesa_git_link_path_list[0] | |
| mesa_relative_git_dir_split = string_split(mesa_git_link_path) | |
| mesa_relative_git_dir = mesa_relative_git_dir_split[1] | |
| mesa_git_head = | |
| "../${mesa_relative_git_dir}/HEAD" | |
| } else { | |
| mesa_git_head = "../.git/HEAD" | |
| } | |
| 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", root_build_dir), | |
| ] | |
| # Ensure that this action reruns when git HEAD moves | |
| inputs = [ mesa_git_head ] | |
| public_configs = [ ":sha1_config" ] | |
| } |