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 'HAVE_AVX512=1', 50 ], 51 'dependencies': [ 52 'base64_ssse3', 53 'base64_sse41', 54 'base64_sse42', 55 'base64_avx', 56 'base64_avx2', 57 'base64_avx512', 58 ], 59 }, { 60 'sources': [ 61 'base64/lib/arch/ssse3/codec.c', 62 'base64/lib/arch/sse41/codec.c', 63 'base64/lib/arch/sse42/codec.c', 64 'base64/lib/arch/avx/codec.c', 65 'base64/lib/arch/avx2/codec.c', 66 'base64/lib/arch/avx512/codec.c', 67 ], 68 }], 69 ], 70 }, 71 72 { 73 'target_name': 'base64_ssse3', 74 'type': 'static_library', 75 'include_dirs': [ 'base64/include', 'base64/lib' ], 76 'sources': [ 'base64/lib/arch/ssse3/codec.c' ], 77 'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_SSSE3=1' ], 78 'conditions': [ 79 [ 'OS!="win"', { 80 'cflags': [ '-mssse3' ], 81 'xcode_settings': { 82 'OTHER_CFLAGS': [ '-mssse3' ] 83 }, 84 }], 85 ], 86 }, 87 88 { 89 'target_name': 'base64_sse41', 90 'type': 'static_library', 91 'include_dirs': [ 'base64/include', 'base64/lib' ], 92 'sources': [ 'base64/lib/arch/sse41/codec.c' ], 93 'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_SSE41=1' ], 94 'conditions': [ 95 [ 'OS!="win"', { 96 'cflags': [ '-msse4.1' ], 97 'xcode_settings': { 98 'OTHER_CFLAGS': [ '-msse4.1' ] 99 }, 100 }], 101 ], 102 }, 103 104 { 105 'target_name': 'base64_sse42', 106 'type': 'static_library', 107 'include_dirs': [ 'base64/include', 'base64/lib' ], 108 'sources': [ 'base64/lib/arch/sse42/codec.c' ], 109 'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_SSE42=1' ], 110 'conditions': [ 111 [ 'OS!="win"', { 112 'cflags': [ '-msse4.2' ], 113 'xcode_settings': { 114 'OTHER_CFLAGS': [ '-msse4.2' ] 115 }, 116 }], 117 ], 118 }, 119 120 { 121 'target_name': 'base64_avx', 122 'type': 'static_library', 123 'include_dirs': [ 'base64/include', 'base64/lib' ], 124 'sources': [ 'base64/lib/arch/avx/codec.c' ], 125 'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_AVX=1' ], 126 'conditions': [ 127 [ 'OS!="win"', { 128 'cflags': [ '-mavx' ], 129 'xcode_settings': { 130 'OTHER_CFLAGS': [ '-mavx' ] 131 }, 132 }, { 133 'msvs_settings': { 134 'VCCLCompilerTool': { 135 'AdditionalOptions': [ 136 '/arch:AVX' 137 ], 138 }, 139 }, 140 }], 141 ], 142 }, 143 144 { 145 'target_name': 'base64_avx2', 146 'type': 'static_library', 147 'include_dirs': [ 'base64/include', 'base64/lib' ], 148 'sources': [ 'base64/lib/arch/avx2/codec.c' ], 149 'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_AVX2=1' ], 150 'conditions': [ 151 [ 'OS!="win"', { 152 'cflags': [ '-mavx2' ], 153 'xcode_settings': { 154 'OTHER_CFLAGS': [ '-mavx2' ] 155 }, 156 }, { 157 'msvs_settings': { 158 'VCCLCompilerTool': { 159 'AdditionalOptions': [ 160 '/arch:AVX2' 161 ], 162 }, 163 }, 164 }], 165 ], 166 }, 167 168 { 169 'target_name': 'base64_avx512', 170 'type': 'static_library', 171 'include_dirs': [ 'base64/include', 'base64/lib' ], 172 'sources': [ 'base64/lib/arch/avx512/codec.c' ], 173 'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_AVX512=1' ], 174 'conditions': [ 175 [ 'OS!="win"', { 176 'cflags': [ '-mavx512vl', '-mavx512vbmi' ], 177 'xcode_settings': { 178 'OTHER_CFLAGS': [ '-mavx512vl', '-mavx512vbmi' ] 179 }, 180 }, { 181 'msvs_settings': { 182 'VCCLCompilerTool': { 183 'AdditionalOptions': [ 184 '/arch:AVX512' 185 ], 186 }, 187 }, 188 }], 189 ], 190 }, 191 192 { 193 'target_name': 'base64_neon32', 194 'type': 'static_library', 195 'include_dirs': [ 'base64/include', 'base64/lib' ], 196 'sources': [ 'base64/lib/arch/neon32/codec.c' ], 197 'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_NEON32=1' ], 198 'conditions': [ 199 [ 'OS!="win"', { 200 'cflags': [ '-mfpu=neon' ], 201 'xcode_settings': { 202 'OTHER_CFLAGS': [ '-mfpu=neon' ] 203 }, 204 }], 205 ], 206 }, 207 208 { 209 'target_name': 'base64_neon64', 210 'type': 'static_library', 211 'include_dirs': [ 'base64/include', 'base64/lib' ], 212 'sources': [ 'base64/lib/arch/neon64/codec.c' ], 213 'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_NEON64=1' ], 214 # NEON is required in arm64, so no -mfpu flag is needed 215 } 216 217 ] 218} 219