|
| 1 | +{ |
| 2 | + 'variables': { |
| 3 | + 'arm_fpu%': '', |
| 4 | + 'target_arch%': '', |
| 5 | + }, |
| 6 | + 'targets': [ |
| 7 | + { |
| 8 | + 'target_name': 'simdutf', |
| 9 | + 'type': 'static_library', |
| 10 | + 'include_dirs': ['.'], |
| 11 | + 'sources': ['simdutf.cpp'], |
| 12 | + 'conditions': [ |
| 13 | + [ 'arm_fpu=="neon" and target_arch=="arm"', { |
| 14 | + 'dependencies': [ 'simdutf_neon32' ], |
| 15 | + }], |
| 16 | + |
| 17 | + # arm64 requires NEON, so it's safe to always use it |
| 18 | + [ 'target_arch=="arm64"', { |
| 19 | + 'dependencies': [ 'simdutf_neon64' ], |
| 20 | + }], |
| 21 | + |
| 22 | + # Runtime detection will happen for x86 CPUs |
| 23 | + [ 'target_arch in "ia32 x64 x32"', { |
| 24 | + 'dependencies': [ |
| 25 | + 'simdutf_sse42', |
| 26 | + 'simdutf_avx', |
| 27 | + 'simdutf_avx2', |
| 28 | + ], |
| 29 | + }], |
| 30 | + ], |
| 31 | + }, |
| 32 | + |
| 33 | + { |
| 34 | + 'target_name': 'simdutf_neon32', |
| 35 | + 'type': 'static_library', |
| 36 | + 'include_dirs': ['.'], |
| 37 | + 'sources': ['simdutf.cpp'], |
| 38 | + 'cflags': [ '-Wno-unused-function' ], |
| 39 | + 'conditions': [ |
| 40 | + [ 'OS!="win"', { |
| 41 | + 'cflags': [ '-mfpu=neon' ], |
| 42 | + 'xcode_settings': { |
| 43 | + 'OTHER_CFLAGS': [ '-mfpu=neon' ] |
| 44 | + }, |
| 45 | + }], |
| 46 | + ], |
| 47 | + }, |
| 48 | + |
| 49 | + { |
| 50 | + 'target_name': 'simdutf_neon64', |
| 51 | + 'type': 'static_library', |
| 52 | + 'include_dirs': ['.'], |
| 53 | + 'sources': ['simdutf.cpp'], |
| 54 | + 'cflags': [ '-Wno-unused-function' ], |
| 55 | + # NEON is required in arm64, so no -mfpu flag is needed |
| 56 | + }, |
| 57 | + |
| 58 | + { |
| 59 | + 'target_name': 'simdutf_avx', |
| 60 | + 'type': 'static_library', |
| 61 | + 'include_dirs': ['.'], |
| 62 | + 'sources': ['simdutf.cpp'], |
| 63 | + 'cflags': [ '-Wno-unused-function' ], |
| 64 | + 'conditions': [ |
| 65 | + [ 'OS!="win"', { |
| 66 | + 'cflags': [ '-mavx' ], |
| 67 | + 'xcode_settings': { |
| 68 | + 'OTHER_CFLAGS': [ '-mavx' ] |
| 69 | + }, |
| 70 | + }, { |
| 71 | + 'msvs_settings': { |
| 72 | + 'VCCLCompilerTool': { |
| 73 | + 'AdditionalOptions': [ |
| 74 | + '/arch:AVX' |
| 75 | + ], |
| 76 | + }, |
| 77 | + }, |
| 78 | + }], |
| 79 | + ], |
| 80 | + }, |
| 81 | + |
| 82 | + { |
| 83 | + 'target_name': 'simdutf_avx2', |
| 84 | + 'type': 'static_library', |
| 85 | + 'include_dirs': ['.'], |
| 86 | + 'sources': ['simdutf.cpp'], |
| 87 | + 'cflags': [ '-Wno-unused-function' ], |
| 88 | + 'conditions': [ |
| 89 | + [ 'OS!="win"', { |
| 90 | + 'cflags': [ '-mavx2' ], |
| 91 | + 'xcode_settings': { |
| 92 | + 'OTHER_CFLAGS': [ '-mavx2' ] |
| 93 | + }, |
| 94 | + }, { |
| 95 | + 'msvs_settings': { |
| 96 | + 'VCCLCompilerTool': { |
| 97 | + 'AdditionalOptions': [ |
| 98 | + '/arch:AVX2' |
| 99 | + ], |
| 100 | + }, |
| 101 | + }, |
| 102 | + }], |
| 103 | + ], |
| 104 | + }, |
| 105 | + |
| 106 | + { |
| 107 | + 'target_name': 'simdutf_sse42', |
| 108 | + 'type': 'static_library', |
| 109 | + 'include_dirs': ['.'], |
| 110 | + 'sources': ['simdutf.cpp'], |
| 111 | + 'cflags': [ '-Wno-unused-function' ], |
| 112 | + 'conditions': [ |
| 113 | + [ 'OS!="win"', { |
| 114 | + 'cflags': [ '-msse4.2' ], |
| 115 | + 'xcode_settings': { |
| 116 | + 'OTHER_CFLAGS': [ '-msse4.2' ] |
| 117 | + }, |
| 118 | + }], |
| 119 | + ], |
| 120 | + }, |
| 121 | + ] |
| 122 | +} |
0 commit comments