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