forked from mesonbuild/meson
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mesonbuild#6421 from dcbaker/zlib-system-dep
Add a "system" dependency for zlib
- Loading branch information
Showing
5 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## Add a system type dependency for zlib | ||
|
||
This allows zlib to be detected on macOS and FreeBSD without the use of | ||
pkg-config or cmake, neither of which are part of the base install on those | ||
OSes (but zlib is). | ||
|
||
A side effect of this change is that `dependency('zlib')` also works with | ||
cmake instead of requiring `dependency('ZLIB')`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
project('zlib system dependency', 'c') | ||
|
||
if not ['darwin', 'freebsd', 'dragonfly', 'windows'].contains(host_machine.system()) | ||
error('MESON_SKIP_TEST only applicable on macOS, FreeBSD, DragonflyBSD, and Windows.') | ||
endif | ||
|
||
cc = meson.get_compiler('c') | ||
|
||
if host_machine.system() == 'darwin' and cc.get_id() != 'clang' | ||
# this will only work on mac if using Apple's clang compiler, but there is no | ||
# way in the meson source level to differentiate apple clang and llvm clang | ||
# In the meson CI only apple clang is tested | ||
error('MESON_SKIP_TEST on macOS only clang is supported.') | ||
endif | ||
|
||
if not (cc.find_library('z', required: false).found() or | ||
cc.find_library('zlib', required : false).found() or | ||
cc.find_library('zlib1', required : false).found()) | ||
error('MESON_SKIP_TEST Cannot seem to find zlib via find_library, this test will probably fail.') | ||
endif | ||
|
||
z = dependency('zlib', method : 'system') | ||
assert(z.version().version_compare('>= 1.2'), 'Version does not seem to have been detected correctly.') |