Skip to content

Commit 13c10aa

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 12b06a5 commit 13c10aa

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('assimp'),
@@ -247,13 +248,28 @@ deps = [
247248
dependency('pugixml'),
248249
dependency('rtaudio'),
249250
dependency('sndfile'),
250-
dependency('uriparser'),
251251
dependency('utf8cpp'),
252252
dependency('x11-xcb'),
253253
dependency('xcursor'),
254254
compiler.find_library('freeimage', has_headers: ['FreeImage.h']),
255255
]
256256

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