1 Star 0 Fork 22

panchengzhong/third_party_pixman

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
meson.build 15.85 KB
一键复制 编辑 原始数据 按行查看 历史
mamingshuai 提交于 2021-06-02 01:26 . update OpenHarmony 2.0 Canary
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
# Copyright © 2018 Intel Corporation
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
project(
'pixman',
['c'],
version : '0.40.0',
license : 'MIT',
meson_version : '>= 0.50.0',
default_options : ['buildtype=debugoptimized'],
)
config = configuration_data()
cc = meson.get_compiler('c')
null_dep = dependency('', required : false)
add_project_arguments(
cc.get_supported_arguments([
'-Wdeclaration-after-statement',
'-fno-strict-aliasing',
'-fvisibility=hidden',
'-Wundef',
]),
language : ['c']
)
# GCC and Clang both ignore -Wno options that they don't recognize, so test for
# -W<opt>, then add -Wno-<opt> if it's ignored
foreach opt : ['unused-local-typedefs']
if cc.has_argument('-W' + opt)
add_project_arguments(['-Wno-' + opt], language : ['c'])
endif
endforeach
use_loongson_mmi = get_option('loongson-mmi')
have_loongson_mmi = false
loongson_mmi_flags = ['-mloongson-mmi']
if not use_loongson_mmi.disabled()
if host_machine.cpu_family() == 'mips64' and cc.compiles('''
#ifndef __mips_loongson_vector_rev
#error "Loongson Multimedia Instructions are only available on Loongson"
#endif
#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))
#error "Need GCC >= 4.4 for Loongson MMI compilation"
#endif
#include "pixman/loongson-mmintrin.h"
int main () {
union {
__m64 v;
char c[8];
} a = { .c = {1, 2, 3, 4, 5, 6, 7, 8} };
int b = 4;
__m64 c = _mm_srli_pi16 (a.v, b);
return 0;
}''',
args : loongson_mmi_flags,
include_directories : include_directories('.'),
name : 'Loongson MMI Intrinsic Support')
have_loongson_mmi = true
endif
endif
if have_loongson_mmi
config.set10('USE_LOONGSON_MMI', true)
elif use_loongson_mmi.enabled()
error('Loongson MMI Support unavailable, but required')
endif
use_mmx = get_option('mmx')
have_mmx = false
mmx_flags = []
if cc.get_id() == 'msvc'
mmx_flags = ['/w14710', '/w14714', '/wd4244']
elif cc.get_id() == 'sun'
mmx_flags = ['-xarch=sse']
else
mmx_flags = ['-mmmx', '-Winline']
endif
if not use_mmx.disabled()
if host_machine.cpu_family() == 'x86_64' or cc.get_id() == 'msvc'
have_mmx = true
elif host_machine.cpu_family() == 'x86' and cc.compiles('''
#include <mmintrin.h>
#include <stdint.h>
/* Check support for block expressions */
#define _mm_shuffle_pi16(A, N) \
({ \
__m64 ret; \
\
/* Some versions of clang will choke on K */ \
asm ("pshufw %2, %1, %0\n\t" \
: "=y" (ret) \
: "y" (A), "K" ((const int8_t)N) \
); \
\
ret; \
})
int main () {
__m64 v = _mm_cvtsi32_si64 (1);
__m64 w;
w = _mm_shuffle_pi16(v, 5);
/* Some versions of clang will choke on this */
asm ("pmulhuw %1, %0\n\t"
: "+y" (w)
: "y" (v)
);
return _mm_cvtsi64_si32 (v);
}''',
args : mmx_flags,
name : 'MMX Intrinsic Support')
have_mmx = true
endif
endif
if have_mmx
# Inline assembly do not work on X64 MSVC, so we use
# compatibility intrinsics there
if cc.get_id() != 'msvc' or host_machine.cpu_family() != 'x86_64'
config.set10('USE_X86_MMX', true)
endif
elif use_mmx.enabled()
error('MMX Support unavailable, but required')
endif
use_sse2 = get_option('sse2')
have_sse2 = false
sse2_flags = []
if cc.get_id() == 'sun'
sse2_flags = ['-xarch=sse2']
elif cc.get_id() != 'msvc'
sse2_flags = ['-msse2', '-Winline']
endif
if not use_sse2.disabled()
if host_machine.cpu_family() == 'x86'
if cc.compiles('''
#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))
# if !defined(__amd64__) && !defined(__x86_64__)
# error "Need GCC >= 4.2 for SSE2 intrinsics on x86"
# endif
#endif
#include <mmintrin.h>
#include <xmmintrin.h>
#include <emmintrin.h>
int param;
int main () {
__m128i a = _mm_set1_epi32 (param), b = _mm_set1_epi32 (param + 1), c;
c = _mm_xor_si128 (a, b);
return _mm_cvtsi128_si32(c);
}''',
args : sse2_flags,
name : 'SSE2 Intrinsic Support')
have_sse2 = true
endif
elif host_machine.cpu_family() == 'x86_64'
have_sse2 = true
endif
endif
if have_sse2
config.set10('USE_SSE2', true)
elif use_sse2.enabled()
error('sse2 Support unavailable, but required')
endif
use_ssse3 = get_option('ssse3')
have_ssse3 = false
ssse3_flags = []
if cc.get_id() != 'msvc'
ssse3_flags = ['-mssse3', '-Winline']
endif
# x64 pre-2010 MSVC compilers crashes when building the ssse3 code
if not use_ssse3.disabled() and not (cc.get_id() == 'msvc' and cc.version().version_compare('<16') and host_machine.cpu_family() == 'x86_64')
if host_machine.cpu_family().startswith('x86')
if cc.compiles('''
#include <mmintrin.h>
#include <xmmintrin.h>
#include <emmintrin.h>
int param;
int main () {
__m128i a = _mm_set1_epi32 (param), b = _mm_set1_epi32 (param + 1), c;
c = _mm_xor_si128 (a, b);
return _mm_cvtsi128_si32(c);
}''',
args : ssse3_flags,
name : 'SSSE3 Intrinsic Support')
have_ssse3 = true
endif
endif
endif
if have_ssse3
config.set10('USE_SSSE3', true)
elif use_ssse3.enabled()
error('ssse3 Support unavailable, but required')
endif
use_vmx = get_option('vmx')
have_vmx = false
vmx_flags = ['-maltivec', '-mabi=altivec']
if not use_vmx.disabled()
if host_machine.cpu_family().startswith('ppc')
if cc.compiles('''
#include <altivec.h>
int main () {
vector unsigned int v = vec_splat_u32 (1);
v = vec_sub (v, v);
return 0;
}''',
args : vmx_flags,
name : 'VMX/Altivec Intrinsic Support')
have_vmx = true
endif
endif
endif
if have_vmx
config.set10('USE_VMX', true)
elif use_vmx.enabled()
error('vmx Support unavailable, but required')
endif
use_armv6_simd = get_option('arm-simd')
have_armv6_simd = false
if not use_armv6_simd.disabled()
if host_machine.cpu_family() == 'arm'
if cc.compiles(files('arm-simd-test.S'), name : 'ARMv6 SIMD Intrinsic Support')
have_armv6_simd = true
endif
endif
endif
if have_armv6_simd
config.set10('USE_ARM_SIMD', true)
elif use_armv6_simd.enabled()
error('ARMv6 SIMD Support unavailable, but required')
endif
use_neon = get_option('neon')
have_neon = false
if not use_neon.disabled()
if host_machine.cpu_family() == 'arm'
if cc.compiles(files('neon-test.S'), name : 'NEON Intrinsic Support')
have_neon = true
endif
endif
endif
if have_neon
config.set10('USE_ARM_NEON', true)
elif use_neon.enabled()
error('NEON Support unavailable, but required')
endif
use_iwmmxt = get_option('iwmmxt')
have_iwmmxt = false
iwmmxt_flags = ['-flax-vector-conversions', '-Winline']
if not use_iwmmxt.disabled()
if get_option('iwmmxt2')
iwmmxt_flags += '-march=iwmmxt2'
else
iwmmxt_flags += '-march=iwmmxt'
endif
if host_machine.cpu_family() == 'arm'
if cc.compiles('''
#ifndef __IWMMXT__
#error "IWMMXT not enabled (with -march=iwmmxt)"
#endif
#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8))
#error "Need GCC >= 4.8 for IWMMXT intrinsics"
#endif
#include <mmintrin.h>
int main () {
union {
__m64 v;
char c[8];
} a = { .c = {1, 2, 3, 4, 5, 6, 7, 8} };
int b = 4;
__m64 c = _mm_srli_si64 (a.v, b);
}
''',
args : iwmmxt_flags,
name : 'IWMMXT Intrinsic Support')
have_iwmmxt = true
endif
endif
endif
if have_iwmmxt
config.set10('USE_ARM_IWMMXT', true)
elif use_iwmmxt.enabled()
error('IWMMXT Support unavailable, but required')
endif
use_mips_dspr2 = get_option('mips-dspr2')
have_mips_dspr2 = false
mips_dspr2_flags = ['-mdspr2']
if not use_mips_dspr2.disabled()
if host_machine.cpu_family() == 'mips32'
if cc.compiles('''
#if !(defined(__mips__) && __mips_isa_rev >= 2)
#error MIPS DSPr2 is currently only available on MIPS32r2 platforms.
#endif
int
main ()
{
int c = 0, a = 0, b = 0;
__asm__ __volatile__ (
"precr.qb.ph %[c], %[a], %[b] \n\t"
: [c] "=r" (c)
: [a] "r" (a), [b] "r" (b)
);
return c;
}''',
args : mipds_dspr2_flags,
name : 'DSPr2 Intrinsic Support')
have_mips_dspr2 = true
endif
endif
endif
if have_mips_dspr2
config.set10('USE_MIPS_DSPR2', true)
elif use_mips_dspr2.enabled()
error('MIPS DSPr2 Support unavailable, but required')
endif
use_gnu_asm = get_option('gnu-inline-asm')
if not use_gnu_asm.disabled()
if cc.compiles('''
int main () {
/* Most modern architectures have a NOP instruction, so this is a fairly generic test. */
asm volatile ( "\tnop\n" : : : "cc", "memory" );
return 0;
}
''',
name : 'GNU Inline ASM support.')
config.set10('USE_GCC_INLINE_ASM', true)
elif use_gnu_asm.enabled()
error('GNU inline assembly support missing but required.')
endif
endif
if get_option('timers')
config.set('PIXMAN_TIMERS', 1)
endif
if get_option('gnuplot')
config.set('PIXMAN_GNUPLOT', 1)
endif
if cc.get_id() != 'msvc'
dep_openmp = dependency('openmp', required : get_option('openmp'))
if dep_openmp.found()
config.set10('USE_OPENMP', true)
elif meson.version().version_compare('<0.51.0')
# In versions of meson before 0.51 the openmp dependency can still
# inject arguments in the the auto case when it is not found, the
# detection does work correctly in that case however, so we just
# replace dep_openmp with null_dep to work around this.
dep_openmp = null_dep
endif
else
# the MSVC implementation of openmp is not compliant enough for our
# uses here, so we disable it here.
# Please see: https://stackoverflow.com/questions/12560243/using-threadprivate-directive-in-visual-studio
dep_openmp = null_dep
endif
dep_gtk = dependency('gtk+-2.0', version : '>= 2.16', required : get_option('gtk'))
dep_glib = dependency('glib-2.0', required : get_option('gtk'))
dep_pixman = dependency('pixman-1', required : get_option('gtk'),
version : '>= ' + meson.project_version())
dep_png = null_dep
if not get_option('libpng').disabled()
dep_png = dependency('libpng', required : false)
# We need to look for the right library to link to for libpng,
# when looking for libpng manually
foreach png_ver : [ '16', '15', '14', '13', '12', '10' ]
if not dep_png.found()
dep_png = cc.find_library('libpng@0@'.format(png_ver), has_headers : ['png.h'], required : false)
endif
endforeach
if get_option('libpng').enabled() and not dep_png.found()
error('libpng support requested but libpng library not found')
endif
endif
if dep_png.found()
config.set('HAVE_LIBPNG', 1)
endif
dep_m = cc.find_library('m', required : false)
dep_threads = dependency('threads')
# MSVC-style compilers do not come with pthreads, so we must link
# to it explicitly, currently pthreads-win32 is supported
pthreads_found = false
if dep_threads.found() and cc.has_header('pthread.h')
if cc.get_argument_syntax() == 'msvc'
pthread_lib = null_dep
foreach pthread_type : ['VC3', 'VSE3', 'VCE3', 'VC2', 'VSE2', 'VCE2']
if not pthread_lib.found()
pthread_lib = cc.find_library('pthread@0@'.format(pthread_type), required : false)
endif
endforeach
if pthread_lib.found()
pthreads_found = true
dep_threads = pthread_lib
endif
else
pthreads_found = true
endif
endif
if pthreads_found
config.set('HAVE_PTHREADS', 1)
endif
funcs = ['sigaction', 'alarm', 'mprotect', 'getpagesize', 'mmap', 'getisax', 'gettimeofday']
# mingw claimes to have posix_memalign, but it doesn't
if host_machine.system() != 'windows'
funcs += 'posix_memalign'
endif
foreach f : funcs
if cc.has_function(f)
config.set('HAVE_@0@'.format(f.to_upper()), 1)
endif
endforeach
# This is only used in one test, that defines _GNU_SOURCE
if cc.has_function('feenableexcept',
prefix : '#define _GNU_SOURCE\n#include <fenv.h>',
dependencies : dep_m)
config.set('HAVE_FEENABLEEXCEPT', 1)
endif
if cc.has_header_symbol('fenv.h', 'FE_DIVBYZERO')
config.set('HAVE_FEDIVBYZERO', 1)
endif
foreach h : ['sys/mman.h', 'fenv.h', 'unistd.h']
if cc.check_header(h)
config.set('HAVE_@0@'.format(h.underscorify().to_upper()), 1)
endif
endforeach
# gcc on Windows only warns that __declspec(thread) isn't supported,
# passing -Werror=attributes makes it fail.
if (host_machine.system() == 'windows' and
cc.compiles('int __declspec(thread) foo;',
args : cc.get_supported_arguments(['-Werror=attributes']),
name : 'TLS via __declspec(thread)'))
config.set('TLS', '__declspec(thread)')
elif cc.compiles('int __thread foo;', name : 'TLS via __thread')
config.set('TLS', '__thread')
endif
if cc.links('''
static int x = 1;
static void __attribute__((constructor)) constructor_function () { x = 0; }
int main (void) { return x; }
''',
name : '__attribute__((constructor))')
config.set('TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR', 1)
endif
if cc.links(
' __float128 a = 1.0Q, b = 2.0Q; int main (void) { return a + b; }',
name : 'Has float128 support')
config.set('HAVE_FLOAT128', 1)
endif
if cc.has_function('clz')
config.set('HAVE_BUILTIN_CLZ', 1)
endif
if cc.links('''
unsigned int __attribute__ ((vector_size(16))) e, a, b;
int main (void) { e = a - ((b << 27) + (b >> (32 - 27))) + 1; return e[0]; }
''',
name : 'Support for GCC vector extensions')
config.set('HAVE_GCC_VECTOR_EXTENSIONS', 1)
endif
if host_machine.endian() == 'big'
config.set('WORDS_BIGENDIAN', 1)
endif
config.set('SIZEOF_LONG', cc.sizeof('long'))
# Required to make pixman-private.h
config.set('PACKAGE', 'foo')
version_conf = configuration_data()
split = meson.project_version().split('.')
version_conf.set('PIXMAN_VERSION_MAJOR', split[0])
version_conf.set('PIXMAN_VERSION_MINOR', split[1])
version_conf.set('PIXMAN_VERSION_MICRO', split[2])
add_project_arguments('-DHAVE_CONFIG_H', language : ['c'])
subdir('pixman')
subdir('test')
subdir('demos')
pkg = import('pkgconfig')
pkg.generate(
name : 'Pixman',
filebase : 'pixman-1',
description : 'The pixman library (version 1)',
libraries : libpixman,
subdirs: 'pixman-1',
version : meson.project_version(),
)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/panchengzhong/third_party_pixman.git
git@gitee.com:panchengzhong/third_party_pixman.git
panchengzhong
third_party_pixman
third_party_pixman
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385