summaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-06-27 13:47:46 +0200
committerwm4 <wm4@nowhere>2017-06-29 10:30:16 +0200
commit7eca787571aab982acaadee79abb0f40f9f14b6a (patch)
tree250369f402ba9b45b32e0d4e78afda3043af5172 /wscript
parent70a70b9da347d7ef25a9862af83731b9b0a0d3f1 (diff)
downloadmpv-7eca787571aab982acaadee79abb0f40f9f14b6a.tar.bz2
mpv-7eca787571aab982acaadee79abb0f40f9f14b6a.tar.xz
build: change how some OS specific source files are selected
In a bunch of cases, we emulate highly platform specific APIs on a higher level across all OSes, such as IPC, terminal, subprocess handling, and more. We have source files for each OS, and they implement all the same mpv internal API. Selecting which source file to use on an OS can be tricky, because there is partially overlapping and emulated APIs (consider Cygwin on Windows). Add a pick_first_matching_dep() function to make this slightly easier and more structured. Also add dummy backends in some cases, to deal with APIs not being available. Clarify the Windows dependency identifiers, as these are the most confusing.
Diffstat (limited to 'wscript')
-rw-r--r--wscript33
1 files changed, 23 insertions, 10 deletions
diff --git a/wscript b/wscript
index 58d64837af..7ac4982da4 100644
--- a/wscript
+++ b/wscript
@@ -12,6 +12,18 @@ from waftools.checks.custom import *
c_preproc.go_absolute=True # enable system folders
c_preproc.standard_includes.append('/usr/local/include')
+"""
+Dependency identifiers (for win32 vs. Unix):
+ wscript / C source meaning
+ --------------------------------------------------------------------------
+ posix / HAVE_POSIX: defined on Linux, OSX, Cygwin
+ (Cygwin emulates POSIX APIs on Windows)
+ mingw / __MINGW32__: defined if posix is not defined
+ (Windows without Cygwin)
+ os-win32 / _WIN32: defined if basic windows.h API is available
+ win32-desktop / HAVE_WIN32_DESKTOP: defined if desktop windows.h API is available
+"""
+
build_options = [
{
'name': '--cplayer',
@@ -132,15 +144,15 @@ main_dependencies = [
'fmsg': 'Unable to find either POSIX or MinGW-w64 environment, ' \
'or compiler does not work.',
}, {
- 'name': 'win32',
- 'desc': 'win32',
+ 'name': 'win32-desktop',
+ 'desc': 'win32 desktop APIs',
'deps_any': [ 'os-win32', 'os-cygwin' ],
'func': check_cc(lib=['winmm', 'gdi32', 'ole32', 'uuid', 'avrt', 'dwmapi']),
}, {
'name': '--win32-internal-pthreads',
'desc': 'internal pthread wrapper for win32 (Vista+)',
'deps_neg': [ 'posix' ],
- 'deps': [ 'win32' ],
+ 'deps': [ 'os-win32' ],
'func': check_true,
}, {
'name': 'pthreads',
@@ -203,10 +215,11 @@ iconv support use --disable-iconv.",
'posix_spawnp(0,0,0,0,0,0); kill(0,0)'),
'deps_neg': ['mingw'],
}, {
- 'name': 'subprocess',
- 'desc': 'posix_spawnp() or MinGW',
+ 'name': 'win32-pipes',
+ 'desc': 'Windows pipe support',
'func': check_true,
- 'deps_any': ['posix-spawn', 'mingw'],
+ 'deps': [ 'win32-desktop' ],
+ 'deps_neg': [ 'posix' ],
}, {
'name': 'glob-win32',
'desc': 'glob() win32 replacement',
@@ -506,7 +519,7 @@ audio_output_features = [
}, {
'name': '--wasapi',
'desc': 'WASAPI audio output',
- 'deps': ['win32'],
+ 'deps': ['win32-desktop'],
'func': check_cc(fragment=load_fragment('wasapi.c')),
}
]
@@ -583,7 +596,7 @@ video_output_features = [
} , {
'name': '--gl-win32',
'desc': 'OpenGL Win32 Backend',
- 'deps': [ 'win32' ],
+ 'deps': [ 'win32-desktop' ],
'groups': [ 'gl' ],
'func': check_statement('windows.h', 'wglCreateContext(0)',
lib='opengl32')
@@ -671,7 +684,7 @@ video_output_features = [
}, {
'name': '--direct3d',
'desc': 'Direct3D support',
- 'deps': [ 'win32' ],
+ 'deps': [ 'win32-desktop' ],
'func': check_cc(header_name='d3d9.h'),
}, {
'name': '--android',
@@ -774,7 +787,7 @@ hwaccel_features = [
}, {
'name': '--d3d-hwaccel',
'desc': 'DXVA2 and D3D11VA hwaccel',
- 'deps': [ 'win32' ],
+ 'deps': [ 'win32-desktop' ],
'func': check_true,
}, {
'name': '--d3d-hwaccel-new',