Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed Oct 26, 2023
1 parent 005f75e commit 30c6cd3
Show file tree
Hide file tree
Showing 90 changed files with 179 additions and 210 deletions.
2 changes: 1 addition & 1 deletion audio/out/ao_wasapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <endpointvolume.h>

#include "common/msg.h"
#include "osdep/windows_utils.h"
#include <osdep/win32/utils.h>
#include "internal.h"
#include "ao.h"

Expand Down
2 changes: 1 addition & 1 deletion input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include "common/common.h"

#if HAVE_COCOA
#include "osdep/macosx_events.h"
#include <osdep/darwin/events.h>
#endif

#define input_lock(ictx) pthread_mutex_lock(&ictx->mutex)
Expand Down
2 changes: 1 addition & 1 deletion input/ipc-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "osdep/io.h"
#include "osdep/threads.h"
#include "osdep/windows_utils.h"
#include <osdep/win32/utils.h>

#include "common/common.h"
#include "common/global.h"
Expand Down
81 changes: 42 additions & 39 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ sources = files(

## osdep
'osdep/io.c',
'osdep/semaphore_osx.c',
'osdep/darwin/semaphore.c',
'osdep/subprocess.c',
'osdep/threads.c',
'osdep/timer.c',
Expand Down Expand Up @@ -395,40 +395,40 @@ cocoa = dependency('appleframeworks', modules: ['Cocoa', 'IOKit', 'QuartzCore'],
features += {'cocoa': cocoa.found()}
if features['cocoa']
dependencies += cocoa
sources += files('osdep/apple_utils.c',
'osdep/language-apple.c',
'osdep/macosx_application.m',
'osdep/macosx_events.m',
'osdep/macosx_menubar.m',
'osdep/main-fn-cocoa.c',
'osdep/path-macosx.m',
sources += files('osdep/darwin/utils.c',
'osdep/darwin/language.c',
'osdep/darwin/application.m',
'osdep/darwin/events.m',
'osdep/darwin/menubar.m',
'osdep/darwin/main-fn.c',
'osdep/darwin/path.m',
'video/out/cocoa_common.m',
'video/out/cocoa/events_view.m',
'video/out/cocoa/video_view.m',
'video/out/cocoa/window.m')
endif

if posix
path_source = files('osdep/path-unix.c')
subprocess_source = files('osdep/subprocess-posix.c')
path_source = files('osdep/unix/path.c')
subprocess_source = files('osdep/unix/subprocess.c')
sources += files('input/ipc-unix.c',
'osdep/poll_wrapper.c',
'osdep/terminal-unix.c',
'osdep/unix/poll_wrapper.c',
'osdep/unix/terminal.c',
'sub/filter_regex.c')
endif

if posix and not features['cocoa']
sources += files('osdep/main-fn-unix.c',
'osdep/language-posix.c')
sources += files('osdep/unix/main-fn.c',
'osdep/unix/language.c')
endif

if darwin
path_source = files('osdep/path-darwin.c')
timer_source = files('osdep/timer-darwin.c')
path_source = files('osdep/darwin/path.c')
timer_source = files('osdep/darwin/timer.c')
endif

if posix and not darwin
timer_source = files('osdep/timer-linux.c')
timer_source = files('osdep/unix/timer.c')
endif

features += {'ppoll': cc.has_function('ppoll', args: '-D_GNU_SOURCE',
Expand Down Expand Up @@ -479,15 +479,15 @@ uwp = cc.find_library('windowsapp', required: uwp_opt)
features += {'uwp': uwp.found()}
if features['uwp']
dependencies += uwp
path_source = files('osdep/path-uwp.c')
path_source = files('osdep/uwp/path.c')
subprocess_source = []
endif

features += {'win32-executable': win32 and get_option('cplayer')}
if win32
timer_source = files('osdep/timer-win32.c')
sources += files('osdep/w32_keyboard.c',
'osdep/windows_utils.c')
timer_source = files('osdep/win32/timer.c')
sources += files('osdep/win32/keyboard.c',
'osdep/win32/utils.c')
endif

features += {'win32-desktop': win32 and not uwp.found()}
Expand All @@ -501,12 +501,12 @@ if features['win32-desktop']
cc.find_library('version'),
cc.find_library('winmm')]
dependencies += win32_desktop_libs
path_source = files('osdep/path-win.c')
subprocess_source = files('osdep/subprocess-win.c')
path_source = files('osdep/win32/path.c')
subprocess_source = files('osdep/win32/subprocess.c')
sources += files('input/ipc-win.c',
'osdep/language-win.c',
'osdep/main-fn-win.c',
'osdep/terminal-win.c',
'osdep/win32/language.c',
'osdep/win32/main-fn.c',
'osdep/win32/terminal.c',
'video/out/w32_common.c',
'video/out/win32/displayconfig.c',
'video/out/win32/droptarget.c')
Expand All @@ -519,12 +519,12 @@ endif

features += {'glob-posix': cc.has_function('glob', prefix: '#include <glob.h>')}

features += {'glob-win32': win32 and not posix}
features += {'glob-win32': win32 and not features['glob-posix']}
if features['glob-win32']
sources += files('osdep/glob-win.c')
sources += files('osdep/win32/glob.c')
endif

features += {'glob': features['glob-posix'] or features['glob-win32']}
features += {'glob': features['glob-posix']}

features += {'vt.h': cc.has_header_symbol('sys/vt.h', 'VT_GETMODE')}

Expand Down Expand Up @@ -589,6 +589,9 @@ if darwin
subdir(join_paths('TOOLS', 'osxbundle'))
endif

if win32
subdir('osdep' / 'win32')
endif

# misc dependencies
features += {'av-channel-layout': libavutil.version().version_compare('>= 57.24.100')}
Expand Down Expand Up @@ -1530,12 +1533,12 @@ features += {'swift': swift.allowed()}

swift_sources = []
if features['cocoa'] and features['swift']
swift_sources += files('osdep/macos/libmpv_helper.swift',
'osdep/macos/log_helper.swift',
'osdep/macos/mpv_helper.swift',
'osdep/macos/precise_timer.swift',
'osdep/macos/swift_compat.swift',
'osdep/macos/swift_extensions.swift',
swift_sources += files('osdep/darwin/libmpv_helper.swift',
'osdep/darwin/log_helper.swift',
'osdep/darwin/mpv_helper.swift',
'osdep/darwin/precise_timer.swift',
'osdep/darwin/swift_compat.swift',
'osdep/darwin/swift_extensions.swift',
'video/out/mac/common.swift',
'video/out/mac/title_bar.swift',
'video/out/mac/view.swift',
Expand Down Expand Up @@ -1563,7 +1566,7 @@ macos_media_player = get_option('macos-media-player').require(
)
features += {'macos-media-player': macos_media_player.allowed()}
if features['macos-media-player']
swift_sources += files('osdep/macos/remote_command_center.swift')
swift_sources += files('osdep/darwin/remote_command_center.swift')
endif

if features['swift'] and swift_sources.length() > 0
Expand All @@ -1576,7 +1579,7 @@ macos_touchbar = get_option('macos-touchbar').require(
)
features += {'macos-touchbar': macos_touchbar.allowed()}
if features['macos-touchbar']
sources += files('osdep/macosx_touchbar.m')
sources += files('osdep/darwin/touchbar.m')
endif


Expand Down Expand Up @@ -1703,9 +1706,9 @@ if win32
'etc/mpv-icon-8bit-64x64.png',
'etc/mpv-icon-8bit-128x128.png',
'etc/mpv-icon.ico',
'osdep/mpv.exe.manifest']
'osdep/win32/mpv.exe.manifest']

sources += windows.compile_resources('osdep/mpv.rc', args: res_flags, depend_files: resources,
sources += windows.compile_resources('osdep/win32/mpv.rc', args: res_flags, depend_files: resources,
depends: version_h, include_directories: res_includes)
endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef MPV_MACOSX_APPLICATION
#define MPV_MACOSX_APPLICATION

#include "osdep/macosx_menubar.h"
#include "menubar.h"
#include "options/m_option.h"

enum {
Expand Down
11 changes: 5 additions & 6 deletions osdep/macosx_application.m β†’ osdep/darwin/application.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
#include "options/m_config.h"
#include "options/options.h"

#import "osdep/macosx_application_objc.h"
#include "osdep/macosx_compat.h"
#import "osdep/macosx_events_objc.h"
#import "application_objc.h"
#include "compat.h"
#import "events_objc.h"
#include "osdep/threads.h"
#include "osdep/main-fn.h"

#if HAVE_MACOS_TOUCHBAR
#import "osdep/macosx_touchbar.h"
#import "touchbar.h"
#endif
#if HAVE_MACOS_COCOA_CB
#include "osdep/macOS_swift.h"
#include "swift.h"
#endif

#define MPV_PROTOCOL @"mpv://"
Expand Down Expand Up @@ -377,4 +377,3 @@ int cocoa_main(int argc, char *argv[])
return 1;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/

#import <Cocoa/Cocoa.h>
#include "osdep/macosx_application.h"
#import "osdep/macosx_menubar_objc.h"
#include "application.h"
#import "menubar_objc.h"

@class CocoaCB;
struct mpv_event;
Expand Down
2 changes: 1 addition & 1 deletion osdep/macosx_compat.h β†’ osdep/darwin/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define MPV_MACOSX_COMPAT

#import <Cocoa/Cocoa.h>
#include "osdep/macosx_versions.h"
#include "versions.h"

#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12)

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions osdep/macosx_events.m β†’ osdep/darwin/events.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
// doesn't make much sense, but needed to access keymap functionality
#include "video/out/vo.h"

#include "osdep/macosx_compat.h"
#import "osdep/macosx_events_objc.h"
#import "osdep/macosx_application_objc.h"
#include "compat.h"
#import "events_objc.h"
#import "application_objc.h"

#include "config.h"

#if HAVE_MACOS_COCOA_CB
#include "osdep/macOS_swift.h"
#include "swift.h"
#endif

@interface EventsResponder ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

#import <Cocoa/Cocoa.h>
#include "osdep/macosx_events.h"
#include "events.h"

@class RemoteCommandCenter;
struct input_ctx;
Expand Down
2 changes: 1 addition & 1 deletion osdep/language-apple.c β†’ osdep/darwin/language.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "misc/language.h"

#include "apple_utils.h"
#include "utils.h"
#include "mpv_talloc.h"

char **mp_get_user_langs(void)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion osdep/main-fn-cocoa.c β†’ osdep/darwin/main-fn.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "osdep/macosx_application.h"
#include "application.h"

// This is needed because Cocoa absolutely requires creating the NSApplication
// singleton and running it in the "main" thread. It is apparently not
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions osdep/macosx_menubar.m β†’ osdep/darwin/menubar.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include "config.h"
#include "common/common.h"

#import "macosx_menubar_objc.h"
#import "osdep/macosx_application_objc.h"
#include "osdep/macosx_compat.h"
#import "menubar_objc.h"
#import "application_objc.h"
#include "compat.h"

@implementation MenuBar
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

#import <Cocoa/Cocoa.h>
#include "osdep/macosx_menubar.h"
#include "menubar.h"

@interface MenuBar : NSObject

Expand Down
59 changes: 59 additions & 0 deletions osdep/darwin/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# custom swift targets
bridge = join_paths(source_root, 'osdep/darwin/swift_bridge.h')
header = join_paths(build_root, 'osdep/darwin/swift.h')
module = join_paths(build_root, 'osdep/darwin/swift.swiftmodule')
target = join_paths(build_root, 'osdep/darwin/swift.o')

swift_flags = ['-frontend', '-c', '-sdk', macos_sdk_path,
'-enable-objc-interop', '-emit-objc-header', '-parse-as-library']

if swift_ver.version_compare('>=6.0')
swift_flags += ['-swift-version', '5']
endif

if get_option('debug')
swift_flags += '-g'
endif

if get_option('optimization') != '0'
swift_flags += '-O'
endif

if macos_10_11_features.allowed()
swift_flags += ['-D', 'HAVE_MACOS_10_11_FEATURES']
endif

if macos_10_14_features.allowed()
swift_flags += ['-D', 'HAVE_MACOS_10_14_FEATURES']
endif

extra_flags = get_option('swift-flags').split()
swift_flags += extra_flags

swift_compile = [swift_prog, swift_flags, '-module-name', 'swift',
'-emit-module-path', '@OUTPUT0@', '-import-objc-header', bridge,
'-emit-objc-header-path', '@OUTPUT1@', '-o', '@OUTPUT2@',
'@INPUT@', '-I.', '-I' + source_root,
'-I' + libplacebo.get_variable('includedir',
default_value: source_root / 'subprojects' / 'libplacebo' / 'src' / 'include')]

swift_targets = custom_target('swift_targets',
input: swift_sources,
output: ['swift.swiftmodule', 'swift.h', 'swift.o'],
command: swift_compile,
)
sources += swift_targets

swift_lib_dir_py = find_program(join_paths(tools_directory, 'macos-swift-lib-directory.py'))
swift_lib_dir = run_command(swift_lib_dir_py, swift_prog.full_path(), check: true).stdout()
message('Detected Swift library directory: ' + swift_lib_dir)

# linker flags
swift_link_flags = ['-L' + swift_lib_dir, '-Xlinker', '-rpath',
'-Xlinker', swift_lib_dir, '-rdynamic', '-Xlinker',
'-add_ast_path', '-Xlinker', module]
if swift_ver.version_compare('>=5.0')
swift_link_flags += ['-Xlinker', '-rpath', '-Xlinker',
'/usr/lib/swift', '-L/usr/lib/swift']
endif
add_project_link_arguments(swift_link_flags, language: ['c', 'objc'])
File renamed without changes.
2 changes: 1 addition & 1 deletion osdep/path-darwin.c β†’ osdep/darwin/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <pthread.h>

#include "options/path.h"
#include "path.h"
#include <osdep/path.h>

#include "config.h"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 30c6cd3

Please sign in to comment.