diff --git a/README.md b/README.md index 840236ede..7569ae22a 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,10 @@ yarn install git submodule update --init --recursive mkdir build cd build -cmake .. -DCMAKE_INSTALL_PREFIX=~/streamlabs/desktop/node_modules/obs-studio-node/OSN.app/distribute/obs-studio-node -DCMAKE_OSX_ARCHITECTURES=arm64 -G Xcode +cmake .. -DCMAKE_INSTALL_PREFIX=/Users//streamlabs/desktop/node_modules/obs-studio-node/OSN.app/distribute/obs-studio-node -DCMAKE_OSX_ARCHITECTURES=arm64 -G Xcode cmake --build . --target install --config RelWithDebInfo ``` -Note, the only gotcha is that if you later run `yarn package:mac` command in the desktop folder instead, then you should remove *OSN.app* from the `CMAKE_INSTALL_PREFIX` path. This is because the electron-builder scripts will throw an error this is not a fully formed app bundle during codesign. +Note, the only gotcha is that if you later run `yarn package:mac-arm64` command in the desktop folder instead, then you should remove *OSN.app* from the `CMAKE_INSTALL_PREFIX` path. This is because the electron-builder scripts will throw an error this is not a fully formed app bundle during codesign. ### Custom OBS Build By default, we download a pre-built version of libobs if none is specified. However, this pre-built version may not be what you want to use or maybe you're testing a new obs feature. diff --git a/js/module.js b/js/module.js index e90a2c339..9ca431d08 100644 --- a/js/module.js +++ b/js/module.js @@ -1,9 +1,13 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NodeObs = exports.getSourcesSize = exports.createSources = exports.addItems = exports.AdvancedReplayBufferFactory = exports.SimpleReplayBufferFactory = exports.AudioEncoderFactory = exports.AdvancedRecordingFactory = exports.SimpleRecordingFactory = exports.AudioTrackFactory = exports.NetworkFactory = exports.ReconnectFactory = exports.DelayFactory = exports.AdvancedStreamingFactory = exports.SimpleStreamingFactory = exports.ServiceFactory = exports.VideoEncoderFactory = exports.IPC = exports.ModuleFactory = exports.AudioFactory = exports.Audio = exports.FaderFactory = exports.VolmeterFactory = exports.DisplayFactory = exports.TransitionFactory = exports.FilterFactory = exports.SceneFactory = exports.InputFactory = exports.VideoFactory = exports.Video = exports.Global = exports.DefaultPluginPathMac = exports.DefaultPluginDataPath = exports.DefaultPluginPath = exports.DefaultDataPath = exports.DefaultBinPath = exports.DefaultDrawPluginPath = exports.DefaultOpenGLPath = exports.DefaultD3D11Path = void 0; -const obs = require('./obs_studio_client.node'); const path = require("path"); const fs = require("fs"); +// Mac- search for optional OSN.app bundle (Chromium requires an app bundle to find obs64 helper apps) +const hasDeveloperApp = process.platform === 'darwin' && fs.existsSync(path.join(__dirname, 'OSN.app')); +const obs = hasDeveloperApp + ? require('./OSN.app/distribute/obs-studio-node/obs_studio_client.node') + : require('./obs_studio_client.node'); exports.DefaultD3D11Path = path.resolve(__dirname, `libobs-d3d11.dll`); exports.DefaultOpenGLPath = path.resolve(__dirname, `libobs-opengl.dll`); exports.DefaultDrawPluginPath = path.resolve(__dirname, `simple_draw.dll`); @@ -117,7 +121,9 @@ function getSourcesSize(sourcesNames) { return sourcesSize; } exports.getSourcesSize = getSourcesSize; -const __dirnameApple = fs.existsSync(__dirname + '/OSN.app') ? __dirname + '/OSN.app/distribute/obs-studio-node/bin' : __dirname + '/bin'; // search for local developer OSN.app bundle which stores CEF helper apps +const __dirnameApple = hasDeveloperApp + ? path.join(__dirname, 'OSN.app', 'distribute', 'obs-studio-node', 'bin') + : path.join(__dirname, 'bin'); if (fs.existsSync(path.resolve(__dirnameApple).replace('app.asar', 'app.asar.unpacked'))) { obs.IPC.setServerPath(path.resolve(__dirnameApple, `obs64`).replace('app.asar', 'app.asar.unpacked'), path.resolve(__dirnameApple).replace('app.asar', 'app.asar.unpacked')); } diff --git a/js/module.ts b/js/module.ts index 1712cfc67..e3c03b84b 100644 --- a/js/module.ts +++ b/js/module.ts @@ -1,6 +1,10 @@ -const obs = require('./obs_studio_client.node'); import * as path from 'path'; import * as fs from 'fs'; +// Mac- search for optional OSN.app bundle (Chromium requires an app bundle to find obs64 helper apps) +const hasDeveloperApp = process.platform === 'darwin' && fs.existsSync(path.join(__dirname, 'OSN.app')); +const obs = hasDeveloperApp + ? require('./OSN.app/distribute/obs-studio-node/obs_studio_client.node') + : require('./obs_studio_client.node'); /* Convenient paths to modules */ export const DefaultD3D11Path: string = @@ -1895,7 +1899,9 @@ export const enum VCamOutputType { }; // Initialization and other stuff which needs local data. -const __dirnameApple = fs.existsSync(__dirname + '/OSN.app') ? __dirname + '/OSN.app/distribute/obs-studio-node/bin' : __dirname + '/bin'; // search for local developer OSN.app bundle which stores CEF helper apps +const __dirnameApple = hasDeveloperApp + ? path.join(__dirname, 'OSN.app', 'distribute', 'obs-studio-node', 'bin') + : path.join(__dirname, 'bin'); if (fs.existsSync(path.resolve(__dirnameApple).replace('app.asar', 'app.asar.unpacked'))) { obs.IPC.setServerPath(path.resolve(__dirnameApple, `obs64`).replace('app.asar', 'app.asar.unpacked'), path.resolve(__dirnameApple).replace('app.asar', 'app.asar.unpacked')); } diff --git a/obs-studio-server/source/main.cpp b/obs-studio-server/source/main.cpp index c94e6ab2e..6e7f7b71b 100644 --- a/obs-studio-server/source/main.cpp +++ b/obs-studio-server/source/main.cpp @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) // Check versions if (receivedVersion != myVersion) { - std::cerr << "Versions mismatch. Server version: " << myVersion << "but received client version: " << receivedVersion; + std::cerr << "Versions mismatch. Server version: " << myVersion << " but received client version: " << receivedVersion << std::endl; return ipc::ProcessInfo::ExitCode::VERSION_MISMATCH; }