blob: c6fc79d74a6f7bd69411ec2058eb3b1ef11954a0 [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001# This file gets passed to gyp with -I so that it gets included everywhere.
2{
3 'variables': {
4 'AOS': '<(DEPTH)/aos',
5# A directory with everything in it ignored from source control.
6 'TMPDIR': '<(DEPTH)/aos/build/temp',
7 'aos_abs': '<!(readlink -f <(DEPTH)/aos)', # for use in non-path contexts
8# the .gyp file that has targets for the various external libraries
9 'EXTERNALS': '<(AOS)/build/externals.gyp',
Brian Silverman14fd0fb2014-01-14 21:42:01 -080010# the directory that gets rsynced to the target
brians343bc112013-02-10 01:53:46 +000011 'rsync_dir': '<(PRODUCT_DIR)/outputs',
12# The directory that loadable_module and shared_library targets get put into
13# There's a target_conditions that puts loadable_modules here and
14# shared_librarys automatically get put here.
15 'so_dir': '<(PRODUCT_DIR)/lib',
16# the directory that executables that depend on <(EXTERNALS):gtest get put into
17 'test_dir': '<(PRODUCT_DIR)/tests',
brians343bc112013-02-10 01:53:46 +000018 },
19 'conditions': [
20 ['OS=="crio"', {
21 'make_global_settings': [
Brian Silvermana67ecc72013-09-28 13:53:53 -070022 ['CC', '<!(readlink -f <(AOS)/build/crio_cc)'],
23 ['CXX', '<!(readlink -f <(AOS)/build/crio_cxx)'],
brians343bc112013-02-10 01:53:46 +000024 ],
brians343bc112013-02-10 01:53:46 +000025 }
Brian Silvermana29ebf92014-04-23 13:08:49 -050026 ], ['PLATFORM=="linux-arm-gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -070027 'make_global_settings': [
28 ['CC', '<!(which arm-linux-gnueabihf-gcc-4.7)'],
29 ['CXX', '<!(which arm-linux-gnueabihf-g++-4.7)'],
30 ],
31 },
Brian Silvermana29ebf92014-04-23 13:08:49 -050032 ], ['PLATFORM=="linux-arm-clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -070033 # TODO(brians): Make this one actually work.
34 },
35 ], ['PLATFORM=="linux-amd64-clang"', {
36 'make_global_settings': [
37 ['CC', '<!(which clang)'],
38 ['CXX', '<!(which clang++)'],
39 ],
40 },
Brian Silvermana29ebf92014-04-23 13:08:49 -050041 ], ['PLATFORM=="linux-amd64-gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -070042 },
brians343bc112013-02-10 01:53:46 +000043 ],
44 ],
45 'target_defaults': {
46 'defines': [
47 '__STDC_FORMAT_MACROS',
48 '_FORTIFY_SOURCE=2',
Brian Silverman6137a502013-04-22 15:41:36 -070049 '__STDC_CONSTANT_MACROS',
50 '__STDC_LIMIT_MACROS',
brians343bc112013-02-10 01:53:46 +000051 ],
52 'ldflags': [
53 '-pipe',
54 ],
55 'cflags': [
56 '-pipe',
57
58 '-Wall',
59 '-Wextra',
60 '-Wswitch-enum',
61 '-Wpointer-arith',
62 '-Wstrict-aliasing=2',
63 '-Wcast-qual',
64 '-Wcast-align',
65 '-Wwrite-strings',
66 '-Wtype-limits',
67 '-Wsign-compare',
68 '-Wformat=2',
69 '-Werror',
Brian Silverman9ba2bc42013-03-17 14:18:33 -070070
71 '-ggdb3',
brians343bc112013-02-10 01:53:46 +000072 ],
73 'cflags_c': [
74 '-std=gnu99',
75 ],
brians343bc112013-02-10 01:53:46 +000076 'include_dirs': [
77 '<(DEPTH)',
78 ],
Brian Silvermand0a52dc2013-09-23 17:55:37 -070079 # These have to be here because apparently gyp evaluates target_conditions
80 # even if the target is never used.
81 'variables': {
82 # Set this to 1 to disable rsyncing the file to the target.
83 'no_rsync%': 0,
Brian Silverman2a36ddb2014-04-08 17:07:28 -070084 # Set this to 1 if this file is a test that should not be run by
Brian Silvermand0a52dc2013-09-23 17:55:37 -070085 # `build.sh tests`.
86 'is_special_test%': 0,
87 },
brians343bc112013-02-10 01:53:46 +000088 'conditions': [
89 ['DEBUG=="yes"', {
90 'cflags': [
brians343bc112013-02-10 01:53:46 +000091 '-O0',
92 ],
brians343bc112013-02-10 01:53:46 +000093 }, {
94 'cflags': [
95 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -070096 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +000097 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -070098 'ldflags': [
99 '-O3',
100 ],
brians343bc112013-02-10 01:53:46 +0000101 'conditions': [['OS=="crio"', {
102 'cflags': [
103 '-fstrength-reduce',
104 '-fno-builtin',
105 '-fno-strict-aliasing',
106 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800107 }],
108 ['PLATFORM=="linux"', {
brians343bc112013-02-10 01:53:46 +0000109 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800110 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800111 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000112 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800113 }],
114 ['PLATFORM=="linux-amd64"', {
115 'cflags': [
116 '-march=atom',
117 '-mfpmath=sse',
118
119 '-fstack-protector-all',
120 ],
121 }],
122 ]
brians343bc112013-02-10 01:53:46 +0000123 }
124 ],
125 ['OS=="crio"', {
126 'target_conditions': [
127 ['_type=="shared_library"', {
128 'ldflags': [
129 '-r',
130 '-nostdlib',
131 '-Wl,-X',
132 ],
133 }
134 ],
135 ],
136 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700137 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000138 '-mstrict-align',
139 '-mlongcall',
140 ],
141 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700142 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
143 # have MPC603e cores according to Freescale docs.
144 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000145 '-mstrict-align',
146 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800147 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/lib/gcc/powerpc-wrs-vxworks/3.4.4/include/',
148 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
149 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
150 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/powerpc-wrs-vxworks/',
brians343bc112013-02-10 01:53:46 +0000151 '-isystem', '<(WIND_BASE)/target/h',
152 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
153 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700154 'cflags_cc': [
155 '-std=gnu++0x',
156 ],
brians343bc112013-02-10 01:53:46 +0000157 'defines': [
158 'CPU=PPC603',
159 'TOOL_FAMILY=gnu',
160 'TOOL=gnu',
161 '_WRS_KERNEL',
162 '__PPC__',
163# This tells eigen to not do anything with alignment at all. See
164# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
165# details. It really doesn't like to work without this.
166 'EIGEN_DONT_ALIGN',
167# prevent the vxworks system headers from being dumb and #defining min and max
168 'NOMINMAX',
169 ],
170 }, {
brians343bc112013-02-10 01:53:46 +0000171 'target_conditions': [
172# default to putting outputs into rsync_dir
173 ['no_rsync==0 and _type!="static_library"', {
174 'product_dir': '<(rsync_dir)',
175 },
176 ],
177 ['_type=="loadable_module"', {
178 'product_dir': '<(so_dir)',
179 }
180 ],
brians343bc112013-02-10 01:53:46 +0000181 ],
182 'ldflags': [
183 '-pthread',
brians343bc112013-02-10 01:53:46 +0000184 ],
brians343bc112013-02-10 01:53:46 +0000185 'cflags': [
186 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700187 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700188 ],
189 'cflags_cc': [
190 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000191 ],
192 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700193 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000194 ],
195 'libraries': [
196 '-lm',
197 '-lrt',
198 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700199 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500200 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700201 'cflags': [
202 '-Wunused-local-typedefs',
203 ],
204 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500205 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700206 'cflags': [
207 '-fcolor-diagnostics',
208 ],
209 'defines': [
210 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
211 '__float128=void',
212 # This tells clang's optimizer the same thing.
213 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
214 ],
215 },
216 ],
217 ],
brians343bc112013-02-10 01:53:46 +0000218 }
219 ]
220 ],
221 },
222}