BUILD.gn 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #
  2. # Copyright 2015 Google, Inc.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at:
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. config("default_include_dirs") {
  17. include_dirs = [
  18. "//include/",
  19. "//types/",
  20. ]
  21. }
  22. config("linux") {
  23. # TODO(keybuk): AndroidConfig.h or equivalent
  24. cflags = [
  25. #TODO(jpawlowski): uncomment once we have no warnings on linux build
  26. # "-Wall",
  27. # "-Werror",
  28. "-Wno-gnu-variable-sized-type-not-at-end",
  29. "-g",
  30. "-O0",
  31. "-fpic",
  32. "-fdata-sections",
  33. "-ffunction-sections",
  34. "-fvisibility=hidden",
  35. ]
  36. cflags_c = [ "-std=c99" ]
  37. cflags_cc = [
  38. #TODO(jpawlowski): we should use same c++ version as Android, which is c++11,
  39. # but we use some c++14 features. Uncomment when this get fixed in code.:
  40. "-std=c++14",
  41. "-fno-exceptions",
  42. "-fpermissive",
  43. ]
  44. defines = [
  45. "_FORTIFY_SOURCE=2",
  46. "_GNU_SOURCE",
  47. "HAS_NO_BDROID_BUILDCFG",
  48. "LOG_NDEBUG=1",
  49. "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
  50. "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE",
  51. # This is a macro to that can be used by source code to detect if the
  52. # current build is done by GN or via Android.mk. This is a temporary
  53. # workaround until we can remove all Android-specific dependencies.
  54. "OS_GENERIC",
  55. "FALLTHROUGH_INTENDED",
  56. ]
  57. }
  58. config("pic") {
  59. cflags = [ "-fPIC" ]
  60. }
  61. config("gc") {
  62. ldflags = [ "-Wl,--gc-sections" ]
  63. }