• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{
2  'variables': {
3    'arm_fpu%': '',
4    'target_arch%': '',
5  },
6  'targets': [
7    {
8      'target_name': 'base64',
9      'type': 'static_library',
10      'include_dirs': [ 'base64/include', 'base64/lib' ],
11      'direct_dependent_settings': {
12        'include_dirs': [ 'base64/include' ],
13        'defines': [ 'BASE64_STATIC_DEFINE' ],
14      },
15      'defines': [ 'BASE64_STATIC_DEFINE' ],
16      'sources': [
17        'base64/include/libbase64.h',
18        'base64/lib/arch/generic/codec.c',
19        'base64/lib/tables/tables.c',
20        'base64/lib/codec_choose.c',
21        'base64/lib/codecs.h',
22        'base64/lib/lib.c',
23      ],
24
25      'conditions': [
26        [ 'arm_fpu=="neon" and target_arch=="arm"', {
27          'defines': [ 'HAVE_NEON32=1' ],
28          'dependencies': [ 'base64_neon32' ],
29        }, {
30          'sources': [ 'base64/lib/arch/neon32/codec.c' ],
31        }],
32
33        # arm64 requires NEON, so it's safe to always use it
34        [ 'target_arch=="arm64"', {
35          'defines': [ 'HAVE_NEON64=1' ],
36          'dependencies': [ 'base64_neon64' ],
37        }, {
38          'sources': [ 'base64/lib/arch/neon64/codec.c' ],
39        }],
40
41        # Runtime detection will happen for x86 CPUs
42        [ 'target_arch in "ia32 x64 x32"', {
43          'defines': [
44            'HAVE_SSSE3=1',
45            'HAVE_SSE41=1',
46            'HAVE_SSE42=1',
47            'HAVE_AVX=1',
48            'HAVE_AVX2=1',
49          ],
50          'dependencies': [
51            'base64_ssse3',
52            'base64_sse41',
53            'base64_sse42',
54            'base64_avx',
55            'base64_avx2',
56          ],
57        }, {
58          'sources': [
59            'base64/lib/arch/ssse3/codec.c',
60            'base64/lib/arch/sse41/codec.c',
61            'base64/lib/arch/sse42/codec.c',
62            'base64/lib/arch/avx/codec.c',
63            'base64/lib/arch/avx2/codec.c',
64          ],
65        }],
66      ],
67    },
68
69    {
70      'target_name': 'base64_ssse3',
71      'type': 'static_library',
72      'include_dirs': [ 'base64/include', 'base64/lib' ],
73      'sources': [ 'base64/lib/arch/ssse3/codec.c' ],
74      'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_SSSE3=1' ],
75      'conditions': [
76        [ 'OS!="win"', {
77          'cflags': [ '-mssse3' ],
78          'xcode_settings': {
79            'OTHER_CFLAGS': [ '-mssse3' ]
80          },
81        }],
82      ],
83    },
84
85    {
86      'target_name': 'base64_sse41',
87      'type': 'static_library',
88      'include_dirs': [ 'base64/include', 'base64/lib' ],
89      'sources': [ 'base64/lib/arch/sse41/codec.c' ],
90      'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_SSE41=1' ],
91      'conditions': [
92        [ 'OS!="win"', {
93          'cflags': [ '-msse4.1' ],
94          'xcode_settings': {
95            'OTHER_CFLAGS': [ '-msse4.1' ]
96          },
97        }],
98      ],
99    },
100
101    {
102      'target_name': 'base64_sse42',
103      'type': 'static_library',
104      'include_dirs': [ 'base64/include', 'base64/lib' ],
105      'sources': [ 'base64/lib/arch/sse42/codec.c' ],
106      'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_SSE42=1' ],
107      'conditions': [
108        [ 'OS!="win"', {
109          'cflags': [ '-msse4.2' ],
110          'xcode_settings': {
111            'OTHER_CFLAGS': [ '-msse4.2' ]
112          },
113        }],
114      ],
115    },
116
117    {
118      'target_name': 'base64_avx',
119      'type': 'static_library',
120      'include_dirs': [ 'base64/include', 'base64/lib' ],
121      'sources': [ 'base64/lib/arch/avx/codec.c' ],
122      'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_AVX=1' ],
123      'conditions': [
124        [ 'OS!="win"', {
125          'cflags': [ '-mavx' ],
126          'xcode_settings': {
127            'OTHER_CFLAGS': [ '-mavx' ]
128          },
129        }, {
130          'msvs_settings': {
131            'VCCLCompilerTool': {
132              'AdditionalOptions': [
133                '/arch:AVX'
134              ],
135            },
136          },
137        }],
138      ],
139    },
140
141    {
142      'target_name': 'base64_avx2',
143      'type': 'static_library',
144      'include_dirs': [ 'base64/include', 'base64/lib' ],
145      'sources': [ 'base64/lib/arch/avx2/codec.c' ],
146      'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_AVX2=1' ],
147      'conditions': [
148        [ 'OS!="win"', {
149          'cflags': [ '-mavx2' ],
150          'xcode_settings': {
151            'OTHER_CFLAGS': [ '-mavx2' ]
152          },
153        }, {
154          'msvs_settings': {
155            'VCCLCompilerTool': {
156              'AdditionalOptions': [
157                '/arch:AVX2'
158              ],
159            },
160          },
161        }],
162      ],
163    },
164
165    {
166      'target_name': 'base64_neon32',
167      'type': 'static_library',
168      'include_dirs': [ 'base64/include', 'base64/lib' ],
169      'sources': [ 'base64/lib/arch/neon32/codec.c' ],
170      'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_NEON32=1' ],
171      'conditions': [
172        [ 'OS!="win"', {
173          'cflags': [ '-mfpu=neon' ],
174          'xcode_settings': {
175            'OTHER_CFLAGS': [ '-mfpu=neon' ]
176          },
177        }],
178      ],
179    },
180
181    {
182      'target_name': 'base64_neon64',
183      'type': 'static_library',
184      'include_dirs': [ 'base64/include', 'base64/lib' ],
185      'sources': [ 'base64/lib/arch/neon64/codec.c' ],
186      'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_NEON64=1' ],
187      # NEON is required in arm64, so no -mfpu flag is needed
188    }
189
190  ]
191}
192