19ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#
25b790feeeb211c42bf78ca3ae9c26aa30e516765Jakub Pawlowski#  Copyright 2015 Google, Inc.
39ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#
49ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#  Licensed under the Apache License, Version 2.0 (the "License");
59ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#  you may not use this file except in compliance with the License.
69ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#  You may obtain a copy of the License at:
79ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#
89ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#  http://www.apache.org/licenses/LICENSE-2.0
99ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#
109ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#  Unless required by applicable law or agreed to in writing, software
119ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#  distributed under the License is distributed on an "AS IS" BASIS,
129ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#  See the License for the specific language governing permissions and
149ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#  limitations under the License.
159ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray#
169ca3fb824639c2f15c104ca99be872e0e55035cbArman Uguray
17cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Ugurayconfig("default_include_dirs") {
18cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Uguray  include_dirs = [
19f2f207a91cc2548f32428d2006e1fec4179371e1Jakub Pawlowski    "//include/",
20d3988fd73cd67cf0c5817064761ee56fef460676Jakub Pawlowski    "//types/",
21cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Uguray  ]
22cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Uguray}
23cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Uguray
244c29231500d8315dc4e2a31415497e2d133d695bScott James Remnantconfig("linux") {
25cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Uguray  # TODO(keybuk): AndroidConfig.h or equivalent
264c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant
274c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant  cflags = [
28d7a05a0c5bead54b50a70ffe50d3f371a57ae7ffJakub Pawlowski    #TODO(jpawlowski): uncomment once we have no warnings on linux build
29d7a05a0c5bead54b50a70ffe50d3f371a57ae7ffJakub Pawlowski    #    "-Wall",
30d7a05a0c5bead54b50a70ffe50d3f371a57ae7ffJakub Pawlowski    #    "-Werror",
3199e4aec27b36343a163fe30e5559f09ff23b2082Jakub Pawlowski    "-Wno-gnu-variable-sized-type-not-at-end",
324c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant    "-g",
334c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant    "-O0",
34e4477781e54bd54ff8628f5ec1ce4594324c9e9eArman Uguray    "-fpic",
35e4477781e54bd54ff8628f5ec1ce4594324c9e9eArman Uguray    "-fdata-sections",
36e4477781e54bd54ff8628f5ec1ce4594324c9e9eArman Uguray    "-ffunction-sections",
37e4477781e54bd54ff8628f5ec1ce4594324c9e9eArman Uguray    "-fvisibility=hidden",
384c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant  ]
394c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant
40d7a05a0c5bead54b50a70ffe50d3f371a57ae7ffJakub Pawlowski  cflags_c = [ "-std=c99" ]
414c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant
420ca99052be04bfd85c9c1ae2601214bedf90b238Arman Uguray  cflags_cc = [
43219d4b6a542ade76b6069ee99cd0af0548139c9cJakub Pawlowski#TODO(jpawlowski): we should use same c++ version as Android, which is c++11,
44219d4b6a542ade76b6069ee99cd0af0548139c9cJakub Pawlowski# but we use some c++14 features. Uncomment when this get fixed in code.:
45219d4b6a542ade76b6069ee99cd0af0548139c9cJakub Pawlowski    "-std=c++14",
46065d0f709343129f82ff3d072dcb36f612038598Arman Uguray    "-fno-exceptions",
47713993d1784ab7c23aee1fa3cf1ab8676cc0aa69Jakub Pawlowski    "-fpermissive",
480ca99052be04bfd85c9c1ae2601214bedf90b238Arman Uguray  ]
490ca99052be04bfd85c9c1ae2601214bedf90b238Arman Uguray
504c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant  defines = [
514c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant    "_FORTIFY_SOURCE=2",
524c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant    "_GNU_SOURCE",
534c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant    "HAS_NO_BDROID_BUILDCFG",
544c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant    "LOG_NDEBUG=1",
55e4477781e54bd54ff8628f5ec1ce4594324c9e9eArman Uguray    "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
56d7a05a0c5bead54b50a70ffe50d3f371a57ae7ffJakub Pawlowski    "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE",
57cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Uguray
58cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Uguray    # This is a macro to that can be used by source code to detect if the
59cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Uguray    # current build is done by GN or via Android.mk. This is a temporary
60cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Uguray    # workaround until we can remove all Android-specific dependencies.
61cdc6f3a3efb18bdbed6dad93d9537c18d15af717Arman Uguray    "OS_GENERIC",
624c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant  ]
634c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant}
644c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant
654c29231500d8315dc4e2a31415497e2d133d695bScott James Remnantconfig("pic") {
664c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant  cflags = [ "-fPIC" ]
674c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant}
684c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant
694c29231500d8315dc4e2a31415497e2d133d695bScott James Remnantconfig("gc") {
704c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant  ldflags = [ "-Wl,--gc-sections" ]
714c29231500d8315dc4e2a31415497e2d133d695bScott James Remnant}
72