aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-11-02 19:41:48 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-11-11 23:06:48 +0530
commitd2a250412c208a38a4c82a8b2615aad90dc15df9 (patch)
tree5bed892a787aabebccd6e61d552bb276a57b0e18 /mesonbuild/mesonlib.py
parent4405a1297b2d76849b40843f8456d8c086c46516 (diff)
downloadmeson-d2a250412c208a38a4c82a8b2615aad90dc15df9.zip
meson-d2a250412c208a38a4c82a8b2615aad90dc15df9.tar.gz
meson-d2a250412c208a38a4c82a8b2615aad90dc15df9.tar.bz2
compilers: Improve manual library searching
We can now specify the library type we want to search for, and whether we want to prefer static libraries over shared ones or the other way around. This functionality is not exposed to build files yet.
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index 5c4c374..f74c6c1 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -219,6 +219,42 @@ def is_cygwin():
def is_debianlike():
return os.path.isfile('/etc/debian_version')
+def for_windows(is_cross, env):
+ """
+ Host machine is windows?
+
+ Note: 'host' is the machine on which compiled binaries will run
+ """
+ if not is_cross:
+ return is_windows()
+ elif env.cross_info.has_host():
+ return env.cross_info.config['host_machine']['system'] == 'windows'
+ return False
+
+def for_cygwin(is_cross, env):
+ """
+ Host machine is cygwin?
+
+ Note: 'host' is the machine on which compiled binaries will run
+ """
+ if not is_cross:
+ return is_cygwin()
+ elif env.cross_info.has_host():
+ return env.cross_info.config['host_machine']['system'] == 'cygwin'
+ return False
+
+def for_darwin(is_cross, env):
+ """
+ Host machine is Darwin (iOS/OS X)?
+
+ Note: 'host' is the machine on which compiled binaries will run
+ """
+ if not is_cross:
+ return is_osx()
+ elif env.cross_info.has_host():
+ return env.cross_info.config['host_machine']['system'] == 'darwin'
+ return False
+
def exe_exists(arglist):
try:
p = subprocess.Popen(arglist, stdout=subprocess.PIPE, stderr=subprocess.PIPE)