Skip to content

Commit 0b4c756

Browse files
committed
meson: handle uriparser dependency if not installed in host system
Quite a few more lines added to handle disabling a cmake define Unfortunately Meson doesn't offer an easy way to do dependency('uriparser', default_options: {'URIPARSER_BUILD_DOCS': false}) where the second argument is automatically given to cmake
1 parent 453b156 commit 0b4c756

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

meson.build

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ install_headers(
219219
)
220220

221221
compiler = meson.get_compiler('cpp')
222+
cmake = import('cmake')
222223

223224
deps = [
224225
dependency('boost'),
@@ -246,13 +247,28 @@ deps = [
246247
dependency('pugixml'),
247248
dependency('rtaudio'),
248249
dependency('sndfile'),
249-
dependency('uriparser'),
250250
dependency('utf8cpp'),
251251
dependency('x11-xcb'),
252252
dependency('xcursor'),
253253
compiler.find_library('freeimage', has_headers: ['FreeImage.h']),
254254
]
255255

256+
# We need to treat this dependency independently
257+
# because if it's not installed in the host system,
258+
# we will use the .wrap file in the subprojects file AND
259+
# need to change a define in the cmake subproject
260+
uriparser_dep = dependency('uriparser', required: false)
261+
if not uriparser_dep.found()
262+
# disable the "URIPARSER_BUILD_DOCS" define that is default enabled in the subproject
263+
# which pulls Doxygen dependency uselessly
264+
uripaser_opts = cmake.subproject_options()
265+
uripaser_opts.add_cmake_defines({'URIPARSER_BUILD_DOCS': false})
266+
uripaser_proj = cmake.subproject('uriparser', options: uripaser_opts)
267+
uriparser_dep = uripaser_proj.dependency('uriparser')
268+
endif
269+
270+
deps += [uriparser_dep]
271+
256272
lib = library('openFrameworks',
257273
sources,
258274
include_directories: inc,

subprojects/uriparser.wrap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[wrap-git]
2+
url = https://github.com/uriparser/uriparser.git
3+
revision = uriparser-0.9.8
4+
depth = 1
5+
method = cmake
6+
7+
[provide]
8+
uriparser = uriparser_dep

0 commit comments

Comments
 (0)