blob: 2ab2155773e8ea55e961ddd9bb94c599e0147883 [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': [
Brian Silvermanb3d50542014-04-23 14:28:55 -050020 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +000021 '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 Silvermanb3d50542014-04-23 14:28:55 -050085 # `build.py tests`.
Brian Silvermand0a52dc2013-09-23 17:55:37 -070086 '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': [
Brian Silvermanb3d50542014-04-23 14:28:55 -050095 # TODO(brians): -O4 for clang to enable LTO?
brians343bc112013-02-10 01:53:46 +000096 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -070097 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +000098 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -070099 'ldflags': [
100 '-O3',
101 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500102 'conditions': [['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000103 'cflags': [
104 '-fstrength-reduce',
105 '-fno-builtin',
106 '-fno-strict-aliasing',
107 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800108 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500109 ['ARCHITECTURE=="arm"', {
brians343bc112013-02-10 01:53:46 +0000110 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800111 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800112 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000113 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800114 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500115 ['ARCHITECTURE=="amd64"', {
Brian Silverman41abe012014-02-08 18:25:02 -0800116 'cflags': [
Brian Silverman41abe012014-02-08 18:25:02 -0800117 '-fstack-protector-all',
118 ],
119 }],
120 ]
brians343bc112013-02-10 01:53:46 +0000121 }
122 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500123 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000124 'target_conditions': [
125 ['_type=="shared_library"', {
126 'ldflags': [
127 '-r',
128 '-nostdlib',
129 '-Wl,-X',
130 ],
131 }
132 ],
133 ],
134 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700135 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000136 '-mstrict-align',
137 '-mlongcall',
138 ],
139 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700140 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
141 # have MPC603e cores according to Freescale docs.
142 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000143 '-mstrict-align',
144 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800145 '-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/',
146 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
147 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
148 '-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 +0000149 '-isystem', '<(WIND_BASE)/target/h',
150 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
151 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700152 'cflags_cc': [
153 '-std=gnu++0x',
154 ],
brians343bc112013-02-10 01:53:46 +0000155 'defines': [
156 'CPU=PPC603',
157 'TOOL_FAMILY=gnu',
158 'TOOL=gnu',
159 '_WRS_KERNEL',
160 '__PPC__',
161# This tells eigen to not do anything with alignment at all. See
162# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
163# details. It really doesn't like to work without this.
164 'EIGEN_DONT_ALIGN',
165# prevent the vxworks system headers from being dumb and #defining min and max
166 'NOMINMAX',
167 ],
168 }, {
brians343bc112013-02-10 01:53:46 +0000169 'target_conditions': [
170# default to putting outputs into rsync_dir
171 ['no_rsync==0 and _type!="static_library"', {
172 'product_dir': '<(rsync_dir)',
173 },
174 ],
175 ['_type=="loadable_module"', {
176 'product_dir': '<(so_dir)',
177 }
178 ],
brians343bc112013-02-10 01:53:46 +0000179 ],
180 'ldflags': [
181 '-pthread',
brians343bc112013-02-10 01:53:46 +0000182 ],
brians343bc112013-02-10 01:53:46 +0000183 'cflags': [
184 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700185 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700186 ],
187 'cflags_cc': [
188 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000189 ],
190 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700191 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000192 ],
193 'libraries': [
194 '-lm',
195 '-lrt',
196 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700197 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500198 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700199 'cflags': [
200 '-Wunused-local-typedefs',
201 ],
202 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500203 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700204 'cflags': [
205 '-fcolor-diagnostics',
206 ],
207 'defines': [
208 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
209 '__float128=void',
210 # This tells clang's optimizer the same thing.
211 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
212 ],
213 },
214 ],
215 ],
brians343bc112013-02-10 01:53:46 +0000216 }
217 ]
218 ],
219 },
220}