aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-11-16 16:49:53 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-11-16 17:29:05 +0100
commit46422187d81145f87b5f2ec023aaea4554999f74 (patch)
tree628de080ef4173d3d2c616663d734091bef53230 /meson.build
parentmeson: fix build break (diff)
downloadefl-46422187d81145f87b5f2ec023aaea4554999f74.tar.gz
meson: cleanup the native-cpu optimization build code
you were not able to disable the header checks, so if the header was not there it indicated that you could turn it of. However, the option check was in the has_header if not outside of it. Further more, header checks are done in the subdirectory that is done for header checks, unneccessary cpu_**** flags are removed, global optimization options are added to the global_arguments instead of just the package_c_args, which leads to the fact that also all binaries etc. are build by default with those optimization flags. This also reduces the amount of options to a minimum of 1 option, to just control if there should be the optimization or not. This also changes from host_maschine to target_mschine, since we probebly want to enable the optimization for the target maschine, not the host. Differential Revision: https://phab.enlightenment.org/D7296
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build83
1 files changed, 23 insertions, 60 deletions
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
endif
## or should this be target_machine?
-cpu_mmx = false
cpu_sse3 = false
cpu_neon = false
cpu_neon_intrinsics = false
-cpu_altivec = false
-evas_opt_c_args = [ ]
-draw_opt_c_args = [ ]
-ector_opt_c_args = [ ]
-machine_c_args = [ ]
-compiler = meson.get_compiler('c')
+native_arch_opt_c_args = [ '-msse3' ]
if host_machine.endian() == 'big'
config_h.set10('WORDS_BIGENDIAN', true)
endif
-if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64'
- if compiler.has_header('immintrin.h') == true
- if (get_option('cpu-mmx') == true)
- config_h.set10('BUILD_MMX', true)
- cpu_mmx = true
- message('x86 build - MMX enabled')
- if (get_option('cpu-sse3') == true)
- config_h.set10('BUILD_SSE3', true)
- evas_opt_c_args += [ '-msse3' ]
- draw_opt_c_args += [ '-msse3' ]
- ector_opt_c_args += [ '-msse3' ]
- cpu_sse3 = true
- message('x86 build - SSE3 enabled')
- endif
- endif
- else
- error('Perhaps you wish to disble MMX with -Dcpu-mmx=false')
- endif
-elif host_machine.cpu_family() == 'arm'
- if compiler.has_header('arm_neon.h') == true
- if (get_option('cpu-neon') == true)
- config_h.set10('BUILD_NEON', true)
- machine_c_args += ['-mfpu=neon', '-ftree-vectorize']
- cpu_neon = true
- message('ARM build - NEON enabled')
- endif
- else
- error('Perhaps you wish to disble NEON with -Dcpu-neon=false')
- endif
-elif host_machine.cpu_family() == 'aarch64'
- if compiler.has_header('arm_neon.h') == true
- if (get_option('cpu-neon') == true)
- config_h.set10('BUILD_NEON', true)
- config_h.set10('BUILD_NEON_INTRINSICS', true)
- machine_c_args += ['-ftree-vectorize']
- cpu_neon = true
- cpu_neon_intrinsics = true
- message('ARM64 build - NEON + intrinsics enabled')
- endif
- else
- error('Perhaps you wish to disble NEON with -Dcpu-neon=false')
- endif
-elif host_machine.cpu_family() == 'ppc' or host_machine.cpu_family() == 'ppc64'
- if compiler.has_header('altivec.h') == true
- if (get_option('cpu-akltivec') == true)
- config_h.set10('BUILD_ALTIVEC', true)
- machine_c_args += [ '-maltivec' ]
- cpu_altivec = true
- message('PPC/POWER build - ALTIVEC enabled')
- endif
- else
- error('Perhaps you wish to disble NEON with -Dcpu-altivec=false')
+if get_option('native-arch-optimization')
+ if target_machine.cpu_family() == 'x86' or target_machine.cpu_family() == 'x86_64'
+ config_h.set10('BUILD_MMX', true)
+ message('x86 build - MMX enabled')
+ config_h.set10('BUILD_SSE3', true)
+ cpu_sse3 = true
+ message('x86 build - SSE3 enabled')
+ elif target_machine.cpu_family() == 'arm'
+ config_h.set10('BUILD_NEON', true)
+ cpu_neon = true
+ message('ARM build - NEON enabled')
+ elif target_machine.cpu_family() == 'aarch64'
+ config_h.set10('BUILD_NEON', true)
+ config_h.set10('BUILD_NEON_INTRINSICS', true)
+ add_global_arguments('-ftree-vectorize', language: 'c')
+ cpu_neon = true
+ cpu_neon_intrinsics = true
+ message('ARM64 build - NEON + intrinsics enabled')
+ elif target_machine.cpu_family() == 'ppc' or target_machine.cpu_family() == 'ppc64'
+ config_h.set10('BUILD_ALTIVEC', true)
+ add_global_arguments('-maltivec-vectorize', language: 'c')
+ message('PPC/POWER build - ALTIVEC enabled')
endif
endif
@@ -303,7 +267,6 @@ foreach package : subprojects
package_c_args = [
'-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
'-DNEED_RUN_IN_TREE=1',
- machine_c_args
]
automatic_pkgfile = true
if package[1].length() == 0 or get_option(package[1][0])