summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2020-09-26 19:25:21 +0100
committerTim-Philipp Müller <tim@centricular.com>2021-01-04 20:08:06 +0000
commitd8d16562ec094593eba4446432e918704590ab20 (patch)
tree13621ce33035d9e8fcb09842aa2d95d165e4004f
parentcb3618f76d10c2e0cd1e6196ed79d4af4d7d5e44 (diff)
downloadcairo-d8d16562ec094593eba4446432e918704590ab20.tar.gz
meson: fix macOS build and add macOS ci
Fixes #441
-rw-r--r--.gitlab-ci.yml26
-rw-r--r--meson.build61
-rw-r--r--meson_options.txt1
3 files changed, 56 insertions, 32 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4c0450d71..98186c490 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -213,3 +213,29 @@ meson android arm64 fedora:
EOF
- meson setup --cross-file android-cross-file.txt build
- meson compile --verbose -C build
+
+meson macOS:
+ tags:
+ - gst-macos-10.15
+ artifacts:
+ name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}"
+ expire_in: '5 days'
+ when: 'always'
+ paths:
+ - "build/meson-logs/*txt"
+ - "build/meson-private/*pc"
+ before_script:
+ - pip3 install --upgrade pip
+ # Make sure meson is up to date
+ - pip3 install -U meson
+ # Need to install certificates for python
+ - pip3 install --upgrade certifi
+ # Anther way to install certificates
+ - open /Applications/Python\ 3.8/Install\ Certificates.command
+ # Get ninja
+ - pip3 install -U ninja
+ script:
+ - CERT_PATH=$(python3 -m certifi) && export SSL_CERT_FILE=${CERT_PATH} && export REQUESTS_CA_BUNDLE=${CERT_PATH}
+ # pixman region-test fails to link on macOS
+ - meson setup -Dpixman:tests=disabled build
+ - meson compile --verbose -C build
diff --git a/meson.build b/meson.build
index 53a9af343..fe7757b1f 100644
--- a/meson.build
+++ b/meson.build
@@ -371,37 +371,34 @@ if qtgui_dep.found() and false
deps += [qtgui_dep]
endif
-# Untested
-if cc.has_header('ApplicationServices/ApplicationServices.h')
- if cc.has_header('CoreGraphics/CoreGraphics.h')
- quartz_extra_libs = ['-Xlinker', '-framework', '-Xlinker', 'CoreGraphics']
- else
- quartz_extra_libs = ['-Xlinker', '-framework', '-Xlinker', 'ApplicationServices']
+if host_machine.system() == 'darwin' and not get_option('quartz').disabled()
+ quartz_deps = dependency('appleframeworks', modules : ['CoreFoundation', 'ApplicationServices'], required: get_option('quartz'))
+
+ if quartz_deps.found()
+ deps += [quartz_deps]
+
+ feature_conf.set('CAIRO_HAS_QUARTZ_SURFACE', 1)
+ feature_conf.set('CAIRO_HAS_QUARTZ_FONT', 1)
+ feature_conf.set('CAIRO_HAS_QUARTZ_IMAGE_SURFACE', 1)
+
+ built_features += [
+ {
+ 'name': 'cairo-quartz',
+ 'description': 'Quartz surface backend',
+ 'deps': quartz_deps,
+ },
+ {
+ 'name': 'cairo-quartz-image',
+ 'description': 'Quartz Image surface backend',
+ 'deps': quartz_deps,
+ },
+ {
+ 'name': 'cairo-quartz-font',
+ 'description': 'Quartz font backend',
+ 'deps': quartz_deps,
+ },
+ ]
endif
-
- extra_link_args += quartz_extra_libs
-
- feature_conf.set('CAIRO_HAS_QUARTZ_SURFACE', 1)
- feature_conf.set('CAIRO_HAS_QUARTZ_FONT', 1)
- feature_conf.set('CAIRO_HAS_QUARTZ_IMAGE_SURFACE', 1)
-
- built_features += [
- {
- 'name': 'cairo-quartz',
- 'description': 'Quartz surface backend',
- 'libs': quartz_extra_libs,
- },
- {
- 'name': 'cairo-quartz-image',
- 'description': 'Quartz Image surface backend',
- 'libs': quartz_extra_libs,
- },
- {
- 'name': 'cairo-quartz-font',
- 'description': 'Quartz font backend',
- 'libs': quartz_extra_libs,
- },
- ]
endif
if host_machine.system() == 'windows'
@@ -887,13 +884,13 @@ foreach feature: built_features
feature_deps = feature.get('deps', [])
feature_libs = feature.get('libs', [])
feature_compile_deps = feature.get('compile-deps', [])
- pkgmod.generate(libraries: [libcairo] + feature_deps + feature_libs,
+ pkgmod.generate(libraries: [libcairo, feature_deps, feature_libs],
name: feature['name'],
description: feature['description'] + ' for cairo graphics library',
)
meson.override_dependency(feature['name'],
declare_dependency(link_with: libcairo,
- dependencies: feature_deps + feature_compile_deps,
+ dependencies: [feature_deps, feature_compile_deps],
link_args: feature_libs,
)
)
diff --git a/meson_options.txt b/meson_options.txt
index ff11fe7ed..5cafe8bda 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -13,6 +13,7 @@ option('glesv3', type : 'feature', value : 'disabled')
option('drm', type : 'feature', value : 'disabled')
option('openvg', type : 'feature', value : 'disabled')
option('png', type : 'feature', value : 'auto') # png and svg surfaces
+option('quartz', type : 'feature', value : 'auto')
option('qt', type : 'feature', value : 'disabled')
option('tee', type : 'feature', value : 'disabled')
option('xcb', type : 'feature', value : 'auto')