meson: Always enable CPU extensions
Don't enable conditionally based on the buildtype. Further, don't use `add_project_arguments()` to enable the instructions: this will lead to crashes within g-ir-scanner, which can't properly parse these instructions. https://gitlab.gnome.org/GNOME/gimp/-/issues/5053
This commit is contained in:
parent
39a2974cdf
commit
def862bae4
3 changed files with 70 additions and 51 deletions
|
|
@ -16,11 +16,21 @@ appgeglenums = custom_target('gimp-gegl-enums.c',
|
|||
capture: true,
|
||||
)
|
||||
|
||||
libappgegl_loops = simd.check('gimp-gegl-loops-simd',
|
||||
sse2: 'gimp-gegl-loops-sse2.c',
|
||||
compiler: cc,
|
||||
include_directories: [ rootInclude, rootAppInclude, ],
|
||||
dependencies: [
|
||||
cairo,
|
||||
gegl,
|
||||
gdk_pixbuf,
|
||||
],
|
||||
)
|
||||
|
||||
libappgegl_sources = [
|
||||
'gimp-babl-compat.c',
|
||||
'gimp-babl.c',
|
||||
'gimp-gegl-apply-operation.c',
|
||||
'gimp-gegl-loops-sse2.c',
|
||||
'gimp-gegl-loops.cc',
|
||||
'gimp-gegl-mask-combine.cc',
|
||||
'gimp-gegl-mask.c',
|
||||
|
|
@ -35,9 +45,12 @@ libappgegl_sources = [
|
|||
|
||||
libappgegl = static_library('appgegl',
|
||||
libappgegl_sources,
|
||||
link_with: libappgegl_loops[0],
|
||||
include_directories: [ rootInclude, rootAppInclude, ],
|
||||
c_args: '-DG_LOG_DOMAIN="Gimp-GEGL"',
|
||||
dependencies: [
|
||||
cairo, gegl, gdk_pixbuf,
|
||||
cairo,
|
||||
gegl,
|
||||
gdk_pixbuf,
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,27 +1,53 @@
|
|||
libapplayermodes_sources = [
|
||||
libapplayermodes_composite = simd.check('gimpoperationlayermode-composite-simd',
|
||||
sse2: 'gimpoperationlayermode-composite-sse2.c',
|
||||
compiler: cc,
|
||||
include_directories: [ rootInclude, rootAppInclude, ],
|
||||
dependencies: [
|
||||
cairo,
|
||||
gegl,
|
||||
gdk_pixbuf,
|
||||
],
|
||||
)
|
||||
|
||||
libapplayermodes_normal = simd.check('gimpoperationnormal-simd',
|
||||
sse2: 'gimpoperationnormal-sse2.c',
|
||||
sse41: 'gimpoperationnormal-sse4.c',
|
||||
compiler: cc,
|
||||
include_directories: [ rootInclude, rootAppInclude, ],
|
||||
dependencies: [
|
||||
cairo,
|
||||
gegl,
|
||||
gdk_pixbuf,
|
||||
],
|
||||
)
|
||||
|
||||
libapplayermodes_sources = files(
|
||||
'gimp-layer-modes.c',
|
||||
'gimpoperationantierase.c',
|
||||
'gimpoperationbehind.c',
|
||||
'gimpoperationdissolve.c',
|
||||
'gimpoperationerase.c',
|
||||
'gimpoperationlayermode-blend.c',
|
||||
'gimpoperationlayermode-composite-sse2.c',
|
||||
'gimpoperationlayermode-composite.c',
|
||||
'gimpoperationlayermode.c',
|
||||
'gimpoperationmerge.c',
|
||||
'gimpoperationnormal-sse2.c',
|
||||
'gimpoperationnormal-sse4.c',
|
||||
'gimpoperationnormal.c',
|
||||
'gimpoperationpassthrough.c',
|
||||
'gimpoperationreplace.c',
|
||||
'gimpoperationsplit.c',
|
||||
]
|
||||
)
|
||||
|
||||
libapplayermodes = static_library('applayermodes',
|
||||
libapplayermodes_sources,
|
||||
link_with: [
|
||||
libapplayermodes_composite[0],
|
||||
libapplayermodes_normal[0],
|
||||
],
|
||||
include_directories: [ rootInclude, rootAppInclude, ],
|
||||
c_args: '-DG_LOG_DOMAIN="Gimp-Layer-Modes"',
|
||||
dependencies: [
|
||||
cairo, gegl, gdk_pixbuf,
|
||||
cairo,
|
||||
gegl,
|
||||
gdk_pixbuf,
|
||||
],
|
||||
)
|
||||
|
|
|
|||
66
meson.build
66
meson.build
|
|
@ -91,6 +91,7 @@ pkgconfig = import('pkgconfig')
|
|||
i18n = import('i18n')
|
||||
gnome = import('gnome')
|
||||
pythonmod = import('python')
|
||||
simd = import('unstable-simd')
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
cxx = meson.get_compiler('cpp')
|
||||
|
|
@ -178,54 +179,33 @@ endif
|
|||
|
||||
################################################################################
|
||||
# Compiler CPU extensions for optimizations
|
||||
# -- Don't enable these project-wide, since some tools like g-ir-scanner,
|
||||
# will crash on them.
|
||||
|
||||
if (get_option('buildtype') == 'release' or
|
||||
get_option('buildtype') == 'debugoptimized')
|
||||
# Note that Meson has a SIMD module which can also do this for us, but it uses
|
||||
# its own #defines and we want to stay compatible with the autotools build
|
||||
conf.set('USE_MMX', cc.has_argument('-mmx'))
|
||||
conf.set('USE_SSE', cc.has_argument('-sse'))
|
||||
conf.set10('COMPILE_SSE2_INTRINISICS', cc.has_argument('-msse2'))
|
||||
conf.set10('COMPILE_SSE4_1_INTRINISICS', cc.has_argument('-msse4.1'))
|
||||
|
||||
# Check for compiler CPU extensions
|
||||
existing_cpu_exts = [
|
||||
'-mfpmath=sse',
|
||||
'-mmmx',
|
||||
'-msse',
|
||||
'-msse2',
|
||||
'-msse4.1',
|
||||
]
|
||||
supported_cpu_exts = cc.get_supported_arguments(existing_cpu_exts)
|
||||
if host_cpu_family == 'ppc'
|
||||
altivec_args = cc.get_supported_arguments([
|
||||
'-faltivec',
|
||||
'-maltivec',
|
||||
'-mabi=altivec',
|
||||
])
|
||||
|
||||
compiler_args += supported_cpu_exts
|
||||
|
||||
conf.set ('USE_MMX', '-mmmx' in supported_cpu_exts)
|
||||
conf.set ('USE_SSE', '-msse' in supported_cpu_exts)
|
||||
conf.set10('COMPILE_SSE2_INTRINISICS', '-msse2' in supported_cpu_exts)
|
||||
conf.set10('COMPILE_SSE4_1_INTRINISICS','-msse4.1' in supported_cpu_exts)
|
||||
|
||||
|
||||
have_altivec = false
|
||||
have_altivec_sysctl = false
|
||||
if host_cpu_family == 'ppc'
|
||||
altivec_args = cc.get_supported_arguments([
|
||||
'-faltivec',
|
||||
'-maltivec',
|
||||
'-mabi=altivec',
|
||||
])
|
||||
|
||||
if altivec_args != []
|
||||
compiler_args += altivec_args
|
||||
linker_args += altivec_args
|
||||
|
||||
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
|
||||
if altivec_args != []
|
||||
if host_os.contains('darwin')
|
||||
conf.set('USE_ALTIVEC', true)
|
||||
conf.set('HAVE_ALTIVEC_SYSCTL', true)
|
||||
elif cc.compiles('''
|
||||
int main() { asm ("vand %v0, %v0, %v0"); return 0; }
|
||||
''')
|
||||
conf.set('USE_ALTIVEC', true)
|
||||
endif
|
||||
endif
|
||||
conf.set('HAVE_ALTIVEC_SYSCTL', have_altivec_sysctl)
|
||||
conf.set('USE_ALTIVEC', have_altivec)
|
||||
|
||||
endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue