Merge pull request #2125 from DDRBoxman/appbundle
Fixes to make OBS work on Catalina
This commit is contained in:
commit
def6fcb0ee
@ -8,9 +8,12 @@ hr() {
|
||||
set -e
|
||||
|
||||
# Generate file name variables
|
||||
export GIT_TAG=$(git describe --abbrev=0)
|
||||
export GIT_HASH=$(git rev-parse --short HEAD)
|
||||
export FILE_DATE=$(date +%Y-%m-%d.%H-%M-%S)
|
||||
export FILENAME=$FILE_DATE-$GIT_HASH-$TRAVIS_BRANCH-osx.pkg
|
||||
export FILENAME=$FILE_DATE-$GIT_HASH-$TRAVIS_BRANCH-osx.dmg
|
||||
|
||||
echo "git tag: $GIT_TAG"
|
||||
|
||||
cd ./build
|
||||
|
||||
@ -30,32 +33,44 @@ if [ -n "${TRAVIS_TAG}" ]; then
|
||||
STABLE=true
|
||||
fi
|
||||
|
||||
sudo python ../CI/install/osx/build_app.py --public-key ../CI/install/osx/OBSPublicDSAKey.pem --sparkle-framework ../../sparkle/Sparkle.framework --stable=$STABLE
|
||||
#sudo python ../CI/install/osx/build_app.py --public-key ../CI/install/osx/OBSPublicDSAKey.pem --sparkle-framework ../../sparkle/Sparkle.framework --stable=$STABLE
|
||||
|
||||
../CI/install/osx/packageApp.sh
|
||||
|
||||
# fix obs outputs
|
||||
cp /usr/local/opt/mbedtls/lib/libmbedtls.12.dylib ./OBS.app/Contents/Frameworks/
|
||||
cp /usr/local/opt/mbedtls/lib/libmbedcrypto.3.dylib ./OBS.app/Contents/Frameworks/
|
||||
cp /usr/local/opt/mbedtls/lib/libmbedx509.0.dylib ./OBS.app/Contents/Frameworks/
|
||||
install_name_tool -change /usr/local/opt/mbedtls/lib/libmbedtls.12.dylib @executable_path/../Frameworks/libmbedtls.12.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
|
||||
install_name_tool -change /usr/local/opt/mbedtls/lib/libmbedcrypto.3.dylib @executable_path/../Frameworks/libmbedcrypto.3.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
|
||||
install_name_tool -change /usr/local/opt/mbedtls/lib/libmbedx509.0.dylib @executable_path/../Frameworks/libmbedx509.0.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
|
||||
install_name_tool -change /usr/local/opt/curl/lib/libcurl.4.dylib @executable_path/../Frameworks/libcurl.4.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
|
||||
install_name_tool -change @rpath/libobs.0.dylib @executable_path/../Frameworks/libobs.0.dylib ./OBS.app/Contents/Plugins/obs-outputs.so
|
||||
|
||||
# copy sparkle into the app
|
||||
hr "Copying Sparkle.framework"
|
||||
cp -r ../../sparkle/Sparkle.framework ./OBS.app/Contents/Frameworks/
|
||||
install_name_tool -change @rpath/Sparkle.framework/Versions/A/Sparkle @executable_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle ./OBS.app/Contents/MacOS/obs
|
||||
|
||||
# Copy Chromium embedded framework to app Frameworks directory
|
||||
hr "Copying Chromium Embedded Framework.framework"
|
||||
sudo mkdir -p OBS.app/Contents/Frameworks
|
||||
sudo cp -r ../../cef_binary_${CEF_BUILD_VERSION}_macosx64/Release/Chromium\ Embedded\ Framework.framework OBS.app/Contents/Frameworks/
|
||||
sudo install_name_tool -change \
|
||||
@rpath/Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
|
||||
../../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
|
||||
OBS.app/Contents/Resources/obs-plugins/obs-browser.so
|
||||
sudo install_name_tool -change \
|
||||
@executable_path/../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
|
||||
../../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
|
||||
OBS.app/Contents/Resources/obs-plugins/obs-browser.so
|
||||
sudo install_name_tool -change \
|
||||
@rpath/Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
|
||||
../../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
|
||||
OBS.app/Contents/Resources/obs-plugins/obs-browser-page
|
||||
sudo install_name_tool -change \
|
||||
@executable_path/../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
|
||||
../../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \
|
||||
OBS.app/Contents/Resources/obs-plugins/obs-browser-page
|
||||
|
||||
# Package app
|
||||
hr "Generating .pkg"
|
||||
packagesbuild ../CI/install/osx/CMakeLists.pkgproj
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui ./OBS.app/Contents/Plugins/obs-browser.so
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore ./OBS.app/Contents/Plugins/obs-browser.so
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets ./OBS.app/Contents/Plugins/obs-browser.so
|
||||
|
||||
cp ../CI/install/osx/OBSPublicDSAKey.pem OBS.app/Contents/Resources
|
||||
|
||||
# edit plist
|
||||
plutil -insert CFBundleVersion -string $GIT_TAG ./OBS.app/Contents/Info.plist
|
||||
plutil -insert CFBundleShortVersionString -string $GIT_TAG ./OBS.app/Contents/Info.plist
|
||||
plutil -insert OBSFeedsURL -string https://obsproject.com/osx_update/feeds.xml ./OBS.app/Contents/Info.plist
|
||||
plutil -insert SUFeedURL -string https://obsproject.com/osx_update/stable/updates.xml ./OBS.app/Contents/Info.plist
|
||||
plutil -insert SUPublicDSAKeyFile -string OBSPublicDSAKey.pem ./OBS.app/Contents/Info.plist
|
||||
|
||||
dmgbuild -s ../CI/install/osx/settings.json "OBS" obs.dmg
|
||||
|
||||
if [ -v "$TRAVIS" ]; then
|
||||
# Signing stuff
|
||||
@ -70,12 +85,10 @@ if [ -v "$TRAVIS" ]; then
|
||||
security import ./Certificates.p12 -k build.keychain -T /usr/bin/productsign -P ""
|
||||
# macOS 10.12+
|
||||
security set-key-partition-list -S apple-tool:,apple: -s -k mysecretpassword build.keychain
|
||||
hr "Signing Package"
|
||||
productsign --sign 2MMRE5MTB8 ./OBS.pkg ./$FILENAME
|
||||
else
|
||||
cp ./OBS.pkg ./$FILENAME
|
||||
fi
|
||||
|
||||
cp ./OBS.dmg ./$FILENAME
|
||||
|
||||
# Move to the folder that travis uses to upload artifacts from
|
||||
hr "Moving package to nightly folder for distribution"
|
||||
mkdir ../nightly
|
||||
|
@ -16,6 +16,8 @@ else
|
||||
/bin/bash -c "sudo xcode-select -s /Applications/Xcode_9.4.1.app/Contents/Developer"
|
||||
fi
|
||||
|
||||
git fetch origin --tags
|
||||
|
||||
# Leave obs-studio folder
|
||||
cd ../
|
||||
|
||||
@ -28,10 +30,12 @@ sudo installer -pkg ./Packages.pkg -target /
|
||||
brew update
|
||||
|
||||
#Base OBS Deps and ccache
|
||||
brew install jack speexdsp ccache mbedtls clang-format
|
||||
brew install jack speexdsp ccache mbedtls clang-format freetype fdk-aac
|
||||
brew install https://gist.githubusercontent.com/DDRBoxman/b3956fab6073335a4bf151db0dcbd4ad/raw/ed1342a8a86793ea8c10d8b4d712a654da121ace/qt.rb
|
||||
brew install https://gist.githubusercontent.com/DDRBoxman/4cada55c51803a2f963fa40ce55c9d3e/raw/572c67e908bfbc1bcb8c476ea77ea3935133f5b5/swig.rb
|
||||
|
||||
pip install dmgbuild
|
||||
|
||||
export PATH=/usr/local/opt/ccache/libexec:$PATH
|
||||
ccache -s || echo "CCache is not available."
|
||||
|
||||
|
30
CI/install/osx/Info.plist
Normal file
30
CI/install/osx/Info.plist
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>obs.icns</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>OBS</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>OBS - Free and Open Source Streaming/Recording Software</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>OBS</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.obsproject.obs-studio</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.8.5</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>LSAppNapIsDisabled</key>
|
||||
<true/>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>OBS needs to access the camera to enable camera sources to work.</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>OBS needs to access the microphone to enable audio input.</string>
|
||||
</dict>
|
||||
</plist>
|
BIN
CI/install/osx/background.png
Normal file
BIN
CI/install/osx/background.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
CI/install/osx/background.pxd/QuickLook/Icon.tiff
Normal file
BIN
CI/install/osx/background.pxd/QuickLook/Icon.tiff
Normal file
Binary file not shown.
BIN
CI/install/osx/background.pxd/QuickLook/Preview.tiff
Normal file
BIN
CI/install/osx/background.pxd/QuickLook/Preview.tiff
Normal file
Binary file not shown.
BIN
CI/install/osx/background.pxd/QuickLook/Thumbnail.tiff
Normal file
BIN
CI/install/osx/background.pxd/QuickLook/Thumbnail.tiff
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
CI/install/osx/background.pxd/metadata.info
Normal file
BIN
CI/install/osx/background.pxd/metadata.info
Normal file
Binary file not shown.
BIN
CI/install/osx/background.tiff
Normal file
BIN
CI/install/osx/background.tiff
Normal file
Binary file not shown.
BIN
CI/install/osx/background@2x.png
Normal file
BIN
CI/install/osx/background@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
1
CI/install/osx/buildDMG
Executable file
1
CI/install/osx/buildDMG
Executable file
@ -0,0 +1 @@
|
||||
dmgbuild -s ./settings.json "OBS" obs.dmg
|
BIN
CI/install/osx/dylibBundler
Executable file
BIN
CI/install/osx/dylibBundler
Executable file
Binary file not shown.
1
CI/install/osx/makeRetinaBG
Executable file
1
CI/install/osx/makeRetinaBG
Executable file
@ -0,0 +1 @@
|
||||
tiffutil -cathidpicheck background.png background@2x.png -out background.tiff
|
BIN
CI/install/osx/obs.icns
Normal file
BIN
CI/install/osx/obs.icns
Normal file
Binary file not shown.
66
CI/install/osx/packageApp.sh
Executable file
66
CI/install/osx/packageApp.sh
Executable file
@ -0,0 +1,66 @@
|
||||
rm -rf ./OBS.app
|
||||
|
||||
mkdir OBS.app
|
||||
mkdir OBS.app/Contents
|
||||
mkdir OBS.app/Contents/MacOS
|
||||
mkdir OBS.app/Contents/Plugins
|
||||
mkdir OBS.app/Contents/Resources
|
||||
|
||||
cp -r rundir/RelWithDebInfo/bin/ ./OBS.app/Contents/MacOS
|
||||
cp -r rundir/RelWithDebInfo/data ./OBS.app/Contents/Resources
|
||||
cp ../CI/install/osx/obs.icns ./OBS.app/Contents/Resources
|
||||
cp -r rundir/RelWithDebInfo/obs-plugins/ ./OBS.app/Contents/Plugins
|
||||
cp ../CI/install/osx/Info.plist ./OBS.app/Contents
|
||||
|
||||
../CI/install/osx/dylibBundler -b -cd -d ./OBS.app/Contents/Frameworks -p @executable_path/../Frameworks/ \
|
||||
-s ./OBS.app/Contents/MacOS \
|
||||
-s /usr/local/opt/mbedtls/lib/ \
|
||||
-x ./OBS.app/Contents/Plugins/coreaudio-encoder.so \
|
||||
-x ./OBS.app/Contents/Plugins/decklink-ouput-ui.so \
|
||||
-x ./OBS.app/Contents/Plugins/frontend-tools.so \
|
||||
-x ./OBS.app/Contents/Plugins/image-source.so \
|
||||
-x ./OBS.app/Contents/Plugins/linux-jack.so \
|
||||
-x ./OBS.app/Contents/Plugins/mac-avcapture.so \
|
||||
-x ./OBS.app/Contents/Plugins/mac-capture.so \
|
||||
-x ./OBS.app/Contents/Plugins/mac-decklink.so \
|
||||
-x ./OBS.app/Contents/Plugins/mac-syphon.so \
|
||||
-x ./OBS.app/Contents/Plugins/mac-vth264.so \
|
||||
-x ./OBS.app/Contents/Plugins/obs-browser.so \
|
||||
-x ./OBS.app/Contents/Plugins/obs-browser-page \
|
||||
-x ./OBS.app/Contents/Plugins/obs-ffmpeg.so \
|
||||
-x ./OBS.app/Contents/Plugins/obs-filters.so \
|
||||
-x ./OBS.app/Contents/Plugins/obs-transitions.so \
|
||||
-x ./OBS.app/Contents/Plugins/obs-vst.so \
|
||||
-x ./OBS.app/Contents/Plugins/rtmp-services.so \
|
||||
-x ./OBS.app/Contents/MacOS/obs \
|
||||
-x ./OBS.app/Contents/MacOS/obs-ffmpeg-mux \
|
||||
-x ./OBS.app/Contents/MacOS/obslua.so \
|
||||
-x ./OBS.app/Contents/Plugins/obs-x264.so \
|
||||
-x ./OBS.app/Contents/Plugins/text-freetype2.so \
|
||||
-x ./OBS.app/Contents/Plugins/obs-libfdk.so
|
||||
# -x ./OBS.app/Contents/Plugins/obs-outputs.so \
|
||||
|
||||
/usr/local/Cellar/qt/5.10.1/bin/macdeployqt ./OBS.app
|
||||
|
||||
mv ./OBS.app/Contents/MacOS/libobs-opengl.so ./OBS.app/Contents/Frameworks
|
||||
|
||||
# put qt network in here becasuse streamdeck uses it
|
||||
cp -r /usr/local/opt/qt/lib/QtNetwork.framework ./OBS.app/Contents/Frameworks
|
||||
chmod +w ./OBS.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork
|
||||
install_name_tool -change /usr/local/Cellar/qt/5.10.1/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore ./OBS.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork
|
||||
|
||||
# decklink ui qt
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui ./OBS.app/Contents/Plugins/decklink-ouput-ui.so
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore ./OBS.app/Contents/Plugins/decklink-ouput-ui.so
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets ./OBS.app/Contents/Plugins/decklink-ouput-ui.so
|
||||
|
||||
# frontend tools qt
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui ./OBS.app/Contents/Plugins/frontend-tools.so
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore ./OBS.app/Contents/Plugins/frontend-tools.so
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets ./OBS.app/Contents/Plugins/frontend-tools.so
|
||||
|
||||
# vst qt
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui ./OBS.app/Contents/Plugins/obs-vst.so
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore ./OBS.app/Contents/Plugins/obs-vst.so
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets ./OBS.app/Contents/Plugins/obs-vst.so
|
||||
install_name_tool -change /usr/local/opt/qt/lib/QtMacExtras.framework/Versions/5/QtMacExtras @executable_path/../Frameworks/QtMacExtras.framework/Versions/5/QtMacExtras ./OBS.app/Contents/Plugins/obs-vst.so
|
13
CI/install/osx/settings.json
Normal file
13
CI/install/osx/settings.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"title": "OBS",
|
||||
"background": "../CI/install/osx/background.tiff",
|
||||
"format": "UDZO",
|
||||
"compression-level": 9,
|
||||
"window": { "position": { "x": 100, "y": 100 },
|
||||
"size": { "width": 540, "height": 380 } },
|
||||
"contents": [
|
||||
{ "x": 120, "y": 180, "type": "file",
|
||||
"path": "./OBS.app" },
|
||||
{ "x": 420, "y": 180, "type": "link", "path": "/Applications" }
|
||||
]
|
||||
}
|
@ -28,11 +28,29 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool isInBundle()
|
||||
{
|
||||
NSRunningApplication *app = [NSRunningApplication currentApplication];
|
||||
return [app bundleIdentifier] != nil;
|
||||
}
|
||||
|
||||
bool GetDataFilePath(const char *data, string &output)
|
||||
{
|
||||
stringstream str;
|
||||
str << OBS_DATA_PATH "/obs-studio/" << data;
|
||||
output = str.str();
|
||||
if (isInBundle()) {
|
||||
NSRunningApplication *app =
|
||||
[NSRunningApplication currentApplication];
|
||||
NSURL *bundleURL = [app bundleURL];
|
||||
NSString *path = [NSString
|
||||
stringWithFormat:@"Contents/Resources/data/obs-studio/%@",
|
||||
[NSString stringWithUTF8String:data]];
|
||||
NSURL *dataURL = [bundleURL URLByAppendingPathComponent:path];
|
||||
output = [[dataURL path] UTF8String];
|
||||
} else {
|
||||
stringstream str;
|
||||
str << OBS_DATA_PATH "/obs-studio/" << data;
|
||||
output = str.str();
|
||||
}
|
||||
|
||||
return !access(output.c_str(), R_OK);
|
||||
}
|
||||
|
||||
|
5
deps/obs-scripting/CMakeLists.txt
vendored
5
deps/obs-scripting/CMakeLists.txt
vendored
@ -17,6 +17,11 @@ if(MSVC)
|
||||
w32-pthreads)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(obs-scripting_PLATFORM_DEPS
|
||||
objc)
|
||||
endif()
|
||||
|
||||
option(DISABLE_LUA "Disable Lua scripting support" OFF)
|
||||
option(DISABLE_PYTHON "Disable Python scripting support" OFF)
|
||||
|
||||
|
28
deps/obs-scripting/obs-scripting-lua.c
vendored
28
deps/obs-scripting/obs-scripting-lua.c
vendored
@ -43,7 +43,7 @@ static const char *startup_script_template = "\
|
||||
for val in pairs(package.preload) do\n\
|
||||
package.preload[val] = nil\n\
|
||||
end\n\
|
||||
package.cpath = package.cpath .. \";\" .. \"%s\" .. \"/?." SO_EXT "\"\n\
|
||||
package.cpath = package.cpath .. \";\" .. \"%s/Contents/MacOS/?.so\" .. \";\" .. \"%s\" .. \"/?." SO_EXT "\"\n\
|
||||
require \"obslua\"\n";
|
||||
|
||||
static const char *get_script_path_func = "\
|
||||
@ -1310,7 +1310,31 @@ void obs_lua_load(void)
|
||||
/* ---------------------------------------------- */
|
||||
/* Initialize Lua startup script */
|
||||
|
||||
dstr_printf(&tmp, startup_script_template, SCRIPT_DIR);
|
||||
char* bundlePath = "./";
|
||||
|
||||
#ifdef __APPLE__
|
||||
Class nsRunningApplication = objc_lookUpClass("NSRunningApplication");
|
||||
SEL currentAppSel = sel_getUid("currentApplication");
|
||||
|
||||
typedef id (*running_app_func)(Class, SEL);
|
||||
running_app_func operatingSystemName = (running_app_func)objc_msgSend;
|
||||
id app = operatingSystemName(nsRunningApplication, currentAppSel);
|
||||
|
||||
typedef id (*bundle_url_func)(id, SEL);
|
||||
bundle_url_func bundleURL = (bundle_url_func)objc_msgSend;
|
||||
id url = bundleURL(app, sel_getUid("bundleURL"));
|
||||
|
||||
typedef id (*url_path_func)(id, SEL);
|
||||
url_path_func urlPath = (url_path_func)objc_msgSend;
|
||||
|
||||
id path = urlPath(url, sel_getUid("path"));
|
||||
|
||||
typedef id (*string_func)(id, SEL);
|
||||
string_func utf8String = (string_func)objc_msgSend;
|
||||
bundlePath = (char *)utf8String(path, sel_registerName("UTF8String"));
|
||||
#endif
|
||||
|
||||
dstr_printf(&tmp, startup_script_template, bundlePath, SCRIPT_DIR);
|
||||
startup_script = tmp.array;
|
||||
|
||||
dstr_free(&dep_paths);
|
||||
|
@ -110,7 +110,7 @@ if(WIN32)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
set(libobs_PLATFORM_SOURCES
|
||||
obs-cocoa.c
|
||||
obs-cocoa.m
|
||||
util/threading-posix.c
|
||||
util/pipe-posix.c
|
||||
util/platform-nix.c
|
||||
|
@ -29,6 +29,14 @@
|
||||
#include <IOKit/hid/IOHIDDevice.h>
|
||||
#include <IOKit/hid/IOHIDManager.h>
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
bool is_in_bundle()
|
||||
{
|
||||
NSRunningApplication *app = [NSRunningApplication currentApplication];
|
||||
return [app bundleIdentifier] != nil;
|
||||
}
|
||||
|
||||
const char *get_module_extension(void)
|
||||
{
|
||||
return ".so";
|
||||
@ -51,12 +59,45 @@ void add_default_module_paths(void)
|
||||
{
|
||||
for (int i = 0; i < module_patterns_size; i++)
|
||||
obs_add_module_path(module_bin[i], module_data[i]);
|
||||
|
||||
if (is_in_bundle()) {
|
||||
NSRunningApplication *app =
|
||||
[NSRunningApplication currentApplication];
|
||||
NSURL *bundleURL = [app bundleURL];
|
||||
NSURL *pluginsURL = [bundleURL
|
||||
URLByAppendingPathComponent:@"Contents/Plugins"];
|
||||
NSURL *dataURL = [bundleURL
|
||||
URLByAppendingPathComponent:
|
||||
@"Contents/Resources/data/obs-plugins/%module%"];
|
||||
|
||||
const char *binPath = [[pluginsURL path]
|
||||
cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *dataPath = [[dataURL path]
|
||||
cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
obs_add_module_path(binPath, dataPath);
|
||||
}
|
||||
}
|
||||
|
||||
char *find_libobs_data_file(const char *file)
|
||||
{
|
||||
struct dstr path;
|
||||
dstr_init_copy(&path, OBS_INSTALL_DATA_PATH "/libobs/");
|
||||
|
||||
if (is_in_bundle()) {
|
||||
NSRunningApplication *app =
|
||||
[NSRunningApplication currentApplication];
|
||||
NSURL *bundleURL = [app bundleURL];
|
||||
NSURL *libobsDataURL =
|
||||
[bundleURL URLByAppendingPathComponent:
|
||||
@"Contents/Resources/data/libobs/"];
|
||||
const char *libobsDataPath = [[libobsDataURL path]
|
||||
cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
dstr_init_copy(&path, libobsDataPath);
|
||||
dstr_cat(&path, "/");
|
||||
} else {
|
||||
dstr_init_copy(&path, OBS_INSTALL_DATA_PATH "/libobs/");
|
||||
}
|
||||
|
||||
dstr_cat(&path, file);
|
||||
return path.array;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user