summaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-01-22 23:06:26 -0600
committerDudemanguy <random342@airmail.cc>2023-02-27 17:13:21 +0000
commit80feac62f175173d7a4a002450482e4be6a02a83 (patch)
tree6f939919f6f536a4c3da97ef48ecd608b2ad7be8 /wscript
parent8ea7aa54719f790d64f3d96c63a7c8eaf756ca27 (diff)
downloadmpv-80feac62f175173d7a4a002450482e4be6a02a83.tar.bz2
mpv-80feac62f175173d7a4a002450482e4be6a02a83.tar.xz
command: add platform property
This returns the value of the target OS that mpv was built on as reported by the build system. It is quite conceivable that script writers and API users would need to make OS-dependent choices in some cases. Such people end up writing boilerplate/hacks to guess what OS they are on. Assuming you trust the build system (if you don't, we're in really deep trouble), then mpv actually knows exactly what OS it was built on. Simply take this information at configuration time, make it a define, and let mp_property_platform return the value. Note that mpv has two build systems (waf and meson), so the names of the detected OSes may not be exactly the same. Since meson is the newer build system, the value of this property follows meson's naming conventions*. In the waf build, there is a small function to map known naming deviations to match meson (i.e. changing "win32" to "windows"). waf's documentation is a nightmare to follow, but it seems to simply take the output of sys.platform in python and strip away any trailing numbers if they exist (exception being win32 and os2)*. *: https://mesonbuild.com/Reference-tables.html#operating-system-names *: https://waf.io/apidocs/Utils.html#waflib.Utils.unversioned_sys_platform
Diffstat (limited to 'wscript')
-rw-r--r--wscript2
1 files changed, 2 insertions, 0 deletions
diff --git a/wscript b/wscript
index 567fc67ff0..da90c97253 100644
--- a/wscript
+++ b/wscript
@@ -1054,6 +1054,8 @@ def configure(ctx):
ctx.parse_dependencies(video_output_features)
ctx.parse_dependencies(hwaccel_features)
+ ctx.define('PLATFORM', check_platform(ctx))
+
if ctx.options.SWIFT_FLAGS:
ctx.env.SWIFT_FLAGS.extend(split(ctx.options.SWIFT_FLAGS))