[gimp/meson] Enable CPU optimizations only in optimized builds
- From: Félix Piédallu <fpiedallu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/meson] Enable CPU optimizations only in optimized builds
- Date: Thu, 15 Feb 2018 09:12:59 +0000 (UTC)
commit eede9cf8125ccc11ce4d3fc41d99685209fb64c9
Author: Félix Piédallu <felix piedallu me>
Date: Wed Feb 14 17:11:39 2018 +0100
Enable CPU optimizations only in optimized builds
meson.build | 87 ++++++++++++++++++++++++++++++----------------------------
1 files changed, 45 insertions(+), 42 deletions(-)
---
diff --git a/meson.build b/meson.build
index 8de1f3c..48b37d0 100644
--- a/meson.build
+++ b/meson.build
@@ -168,51 +168,54 @@ endif
# # # # # # # # # # # # # #
##### # ##### ####### # # # # # ####
-## TODO only for release
-# Check for compiler CPU extensions
-cpuext_args = [
- '-mfpmath=sse',
- '-mmmx',
- '-msse',
- '-msse2',
- '-msse4.1',
-]
-add_project_arguments(cc .get_supported_arguments(cpuext_args), language: 'c')
-add_project_arguments(cxx.get_supported_arguments(cpuext_args), language: 'cpp')
-
-conf.set10('USE_MMX', cc.has_argument('-mmmx'))
-conf.set10('USE_SSE', cc.has_argument('-msse'))
-conf.set10('COMPILE_SSE2_INTRINISICS', cc.has_argument('-msse2'))
-conf.set10('COMPILE_SSE4_1_INTRINISICS',cc.has_argument('-msse4.1'))
-
-
-have_altivec = false
-have_altivec_sysctl = false
-if arch_ppc
- altivec_args = cc.get_supported_arguments([
- '-faltivec',
- '-maltivec',
- '-mabi=altivec',
- ])
- if altivec_args != []
- add_project_arguments (altivec_args, language: [ 'c', 'cpp'])
- add_project_link_arguments(altivec_args, language: [ 'c', 'cpp'])
-
- if host_os.contains('darwin')
- have_altivec = true
- have_altivec_sysctl = true
- elif cc.compiles('''
- int main() { asm ("vand %v0, %v0, %v0"); return 0; }
- ''')
- have_altivec = true
+if (get_option('buildtype') == 'release' or
+ get_option('buildtype') == 'debugoptimized')
+
+ # Check for compiler CPU extensions
+ cpuext_args = [
+ '-mfpmath=sse',
+ '-mmmx',
+ '-msse',
+ '-msse2',
+ '-msse4.1',
+ ]
+ add_project_arguments(cc .get_supported_arguments(cpuext_args), language: 'c')
+ add_project_arguments(cxx.get_supported_arguments(cpuext_args), language: 'cpp')
+
+ conf.set10('USE_MMX', cc.has_argument('-mmmx'))
+ conf.set10('USE_SSE', cc.has_argument('-msse'))
+ conf.set10('COMPILE_SSE2_INTRINISICS', cc.has_argument('-msse2'))
+ conf.set10('COMPILE_SSE4_1_INTRINISICS',cc.has_argument('-msse4.1'))
+
+
+ have_altivec = false
+ have_altivec_sysctl = false
+ if arch_ppc
+ altivec_args = cc.get_supported_arguments([
+ '-faltivec',
+ '-maltivec',
+ '-mabi=altivec',
+ ])
+
+ if altivec_args != []
+ add_project_arguments (altivec_args, language: [ 'c', 'cpp'])
+ add_project_link_arguments(altivec_args, language: [ 'c', 'cpp'])
+
+ if host_os.contains('darwin')
+ have_altivec = true
+ have_altivec_sysctl = true
+ elif cc.compiles('''
+ int main() { asm ("vand %v0, %v0, %v0"); return 0; }
+ ''')
+ have_altivec = true
+ endif
endif
endif
-endif
-conf.set('HAVE_ALTIVEC_SYSCTL', have_altivec_sysctl)
-conf.set('USE_ALTIVEC', have_altivec)
-
+ conf.set('HAVE_ALTIVEC_SYSCTL', have_altivec_sysctl)
+ conf.set('USE_ALTIVEC', have_altivec)
+endif
################################################################################
# Mandatory Dependencies
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]