diff options
-rw-r--r-- | header_checks/meson.build | 16 | ||||
-rw-r--r-- | meson.build | 83 | ||||
-rw-r--r-- | meson_options.txt | 23 | ||||
-rw-r--r-- | src/lib/ector/software/meson.build | 2 | ||||
-rw-r--r-- | src/lib/evas/meson.build | 2 | ||||
-rw-r--r-- | src/static_libs/draw/meson.build | 2 |
6 files changed, 44 insertions, 84 deletions
diff --git a/header_checks/meson.build b/header_checks/meson.build index 01e557e95f..cb47b040d4 100644 --- a/header_checks/meson.build +++ b/header_checks/meson.build | |||
@@ -1,3 +1,19 @@ | |||
1 | if get_option('native-arch-optimization') | ||
2 | if target_machine.cpu_family() == 'x86' or target_machine.cpu_family() == 'x86_64' | ||
3 | native_header = 'immintrin.h' | ||
4 | elif target_machine.cpu_family() == 'arm' | ||
5 | native_header = 'arm_neon.h' | ||
6 | elif target_machine.cpu_family() == 'aarch64' | ||
7 | native_header = 'arm_neon.h' | ||
8 | elif target_machine.cpu_family() == 'ppc' or target_machine.cpu_family() == 'ppc64' | ||
9 | native_header = 'altivec.h' | ||
10 | endif | ||
11 | |||
12 | if cc.has_header(native_header) == false | ||
13 | error('Error, header '+native_header+' is required') | ||
14 | endif | ||
15 | endif | ||
16 | |||
1 | header_checks = [ | 17 | header_checks = [ |
2 | 'alloca.h', | 18 | 'alloca.h', |
3 | 'asm/hwcap.h', | 19 | 'asm/hwcap.h', |
diff --git a/meson.build b/meson.build index ba6d84a4b3..4b9d766f2f 100644 --- a/meson.build +++ b/meson.build | |||
@@ -112,73 +112,37 @@ if compiler.compiles(code, args : '-lc', name : 'environ check') == true | |||
112 | endif | 112 | endif |
113 | 113 | ||
114 | ## or should this be target_machine? | 114 | ## or should this be target_machine? |
115 | cpu_mmx = false | ||
116 | cpu_sse3 = false | 115 | cpu_sse3 = false |
117 | cpu_neon = false | 116 | cpu_neon = false |
118 | cpu_neon_intrinsics = false | 117 | cpu_neon_intrinsics = false |
119 | cpu_altivec = false | 118 | native_arch_opt_c_args = [ '-msse3' ] |
120 | evas_opt_c_args = [ ] | ||
121 | draw_opt_c_args = [ ] | ||
122 | ector_opt_c_args = [ ] | ||
123 | machine_c_args = [ ] | ||
124 | compiler = meson.get_compiler('c') | ||
125 | 119 | ||
126 | if host_machine.endian() == 'big' | 120 | if host_machine.endian() == 'big' |
127 | config_h.set10('WORDS_BIGENDIAN', true) | 121 | config_h.set10('WORDS_BIGENDIAN', true) |
128 | endif | 122 | endif |
129 | 123 | ||
130 | if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64' | 124 | if get_option('native-arch-optimization') |
131 | if compiler.has_header('immintrin.h') == true | 125 | if target_machine.cpu_family() == 'x86' or target_machine.cpu_family() == 'x86_64' |
132 | if (get_option('cpu-mmx') == true) | 126 | config_h.set10('BUILD_MMX', true) |
133 | config_h.set10('BUILD_MMX', true) | 127 | message('x86 build - MMX enabled') |
134 | cpu_mmx = true | 128 | config_h.set10('BUILD_SSE3', true) |
135 | message('x86 build - MMX enabled') | 129 | cpu_sse3 = true |
136 | if (get_option('cpu-sse3') == true) | 130 | message('x86 build - SSE3 enabled') |
137 | config_h.set10('BUILD_SSE3', true) | 131 | elif target_machine.cpu_family() == 'arm' |
138 | evas_opt_c_args += [ '-msse3' ] | 132 | config_h.set10('BUILD_NEON', true) |
139 | draw_opt_c_args += [ '-msse3' ] | 133 | cpu_neon = true |
140 | ector_opt_c_args += [ '-msse3' ] | 134 | message('ARM build - NEON enabled') |
141 | cpu_sse3 = true | 135 | elif target_machine.cpu_family() == 'aarch64' |
142 | message('x86 build - SSE3 enabled') | 136 | config_h.set10('BUILD_NEON', true) |
143 | endif | 137 | config_h.set10('BUILD_NEON_INTRINSICS', true) |
144 | endif | 138 | add_global_arguments('-ftree-vectorize', language: 'c') |
145 | else | 139 | cpu_neon = true |
146 | error('Perhaps you wish to disble MMX with -Dcpu-mmx=false') | 140 | cpu_neon_intrinsics = true |
147 | endif | 141 | message('ARM64 build - NEON + intrinsics enabled') |
148 | elif host_machine.cpu_family() == 'arm' | 142 | elif target_machine.cpu_family() == 'ppc' or target_machine.cpu_family() == 'ppc64' |
149 | if compiler.has_header('arm_neon.h') == true | 143 | config_h.set10('BUILD_ALTIVEC', true) |
150 | if (get_option('cpu-neon') == true) | 144 | add_global_arguments('-maltivec-vectorize', language: 'c') |
151 | config_h.set10('BUILD_NEON', true) | 145 | message('PPC/POWER build - ALTIVEC enabled') |
152 | machine_c_args += ['-mfpu=neon', '-ftree-vectorize'] | ||
153 | cpu_neon = true | ||
154 | message('ARM build - NEON enabled') | ||
155 | endif | ||
156 | else | ||
157 | error('Perhaps you wish to disble NEON with -Dcpu-neon=false') | ||
158 | endif | ||
159 | elif host_machine.cpu_family() == 'aarch64' | ||
160 | if compiler.has_header('arm_neon.h') == true | ||
161 | if (get_option('cpu-neon') == true) | ||
162 | config_h.set10('BUILD_NEON', true) | ||
163 | config_h.set10('BUILD_NEON_INTRINSICS', true) | ||
164 | machine_c_args += ['-ftree-vectorize'] | ||
165 | cpu_neon = true | ||
166 | cpu_neon_intrinsics = true | ||
167 | message('ARM64 build - NEON + intrinsics enabled') | ||
168 | endif | ||
169 | else | ||
170 | error('Perhaps you wish to disble NEON with -Dcpu-neon=false') | ||
171 | endif | ||
172 | elif host_machine.cpu_family() == 'ppc' or host_machine.cpu_family() == 'ppc64' | ||
173 | if compiler.has_header('altivec.h') == true | ||
174 | if (get_option('cpu-akltivec') == true) | ||
175 | config_h.set10('BUILD_ALTIVEC', true) | ||
176 | machine_c_args += [ '-maltivec' ] | ||
177 | cpu_altivec = true | ||
178 | message('PPC/POWER build - ALTIVEC enabled') | ||
179 | endif | ||
180 | else | ||
181 | error('Perhaps you wish to disble NEON with -Dcpu-altivec=false') | ||
182 | endif | 146 | endif |
183 | endif | 147 | endif |
184 | 148 | ||
@@ -303,7 +267,6 @@ foreach package : subprojects | |||
303 | package_c_args = [ | 267 | package_c_args = [ |
304 | '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"', | 268 | '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"', |
305 | '-DNEED_RUN_IN_TREE=1', | 269 | '-DNEED_RUN_IN_TREE=1', |
306 | machine_c_args | ||
307 | ] | 270 | ] |
308 | automatic_pkgfile = true | 271 | automatic_pkgfile = true |
309 | if package[1].length() == 0 or get_option(package[1][0]) | 272 | if package[1].length() == 0 or get_option(package[1][0]) |
diff --git a/meson_options.txt b/meson_options.txt index 94d3007d58..296b3b88d8 100644 --- a/meson_options.txt +++ b/meson_options.txt | |||
@@ -328,27 +328,8 @@ option('mono', | |||
328 | description: 'Flag for handling c# bindings' | 328 | description: 'Flag for handling c# bindings' |
329 | ) | 329 | ) |
330 | 330 | ||
331 | option('cpu-mmx', | 331 | option('native-arch-optimization', |
332 | type: 'boolean', | 332 | type: 'boolean', |
333 | value: true, | 333 | value: true, |
334 | description: 'Build MMX support when building for intel' | 334 | description: 'Flag for enabling architecture native optimizations' |
335 | ) | 335 | ) |
336 | |||
337 | option('cpu-sse3', | ||
338 | type: 'boolean', | ||
339 | value: true, | ||
340 | description: 'Build SSE3 support when building for intel' | ||
341 | ) | ||
342 | |||
343 | option('cpu-neon', | ||
344 | type: 'boolean', | ||
345 | value: true, | ||
346 | description: 'Build NEON support when building for ARM' | ||
347 | ) | ||
348 | |||
349 | option('cpu-altivec', | ||
350 | type: 'boolean', | ||
351 | value: true, | ||
352 | description: 'Build ALTIVEC support when building for PPC/POWER' | ||
353 | ) | ||
354 | |||
diff --git a/src/lib/ector/software/meson.build b/src/lib/ector/software/meson.build index b587ca9024..cef9c957c8 100644 --- a/src/lib/ector/software/meson.build +++ b/src/lib/ector/software/meson.build | |||
@@ -40,7 +40,7 @@ if cpu_sse3 == true | |||
40 | sources: pub_eo_file_target + [ 'ector_software_gradient_sse3.c' ], | 40 | sources: pub_eo_file_target + [ 'ector_software_gradient_sse3.c' ], |
41 | dependencies: ector_pub_deps + [triangulator, freetype, draw, m] + ector_deps, | 41 | dependencies: ector_pub_deps + [triangulator, freetype, draw, m] + ector_deps, |
42 | include_directories: config_dir + [ include_directories('..') ], | 42 | include_directories: config_dir + [ include_directories('..') ], |
43 | c_args: ector_opt_c_args, | 43 | c_args: native_arch_opt_c_args, |
44 | ) | 44 | ) |
45 | ector_opt_lib += [ ector_opt ] | 45 | ector_opt_lib += [ ector_opt ] |
46 | endif | 46 | endif |
diff --git a/src/lib/evas/meson.build b/src/lib/evas/meson.build index adea8b2393..f9f038dc93 100644 --- a/src/lib/evas/meson.build +++ b/src/lib/evas/meson.build | |||
@@ -188,7 +188,7 @@ if cpu_sse3 == true or cpu_neon == true and cpu_neon_intrinsics == false | |||
188 | [ include_directories('../../..') ] + | 188 | [ include_directories('../../..') ] + |
189 | evas_include_directories + | 189 | evas_include_directories + |
190 | [vg_common_inc_dir], | 190 | [vg_common_inc_dir], |
191 | c_args: evas_opt_c_args, | 191 | c_args: native_arch_opt_c_args, |
192 | dependencies: [eina, eo, ector, emile, evas_deps, m], | 192 | dependencies: [eina, eo, ector, emile, evas_deps, m], |
193 | ) | 193 | ) |
194 | evas_link += [ evas_opt ] | 194 | evas_link += [ evas_opt ] |
diff --git a/src/static_libs/draw/meson.build b/src/static_libs/draw/meson.build index 54c72160d2..250e021fb7 100644 --- a/src/static_libs/draw/meson.build +++ b/src/static_libs/draw/meson.build | |||
@@ -13,7 +13,7 @@ if cpu_sse3 == true | |||
13 | draw_opt = static_library('draw_opt', | 13 | draw_opt = static_library('draw_opt', |
14 | sources: [ 'draw_main_sse2.c' ], | 14 | sources: [ 'draw_main_sse2.c' ], |
15 | include_directories: config_dir + [include_directories(join_paths('..', '..', 'lib'))], | 15 | include_directories: config_dir + [include_directories(join_paths('..', '..', 'lib'))], |
16 | c_args: draw_opt_c_args, | 16 | c_args: native_arch_opt_c_args, |
17 | dependencies : [eina, efl] | 17 | dependencies : [eina, efl] |
18 | ) | 18 | ) |
19 | draw_opt_lib += [ draw_opt ] | 19 | draw_opt_lib += [ draw_opt ] |