Skip to content

Commit 25eaa10

Browse files
sandboxcodersummeroff
authored andcommitted
Re-enable MacOS Build / Fix compiler issues
* Updating MacOS to latest version to be in-line with Windows * Fixing compiler issues on XCode * Updating cmake to copy over libraries so we can debug from XCode (also for tests) * Creating osn-multitrack-video-system-info-osx.mm to handle specific MacOS hardware queries. Adjusted cmake to add this file for Apple builds (Windows will have its' own file for windows api) Updated tests & other misc changes * ignore distribution package folder generated after a "cmake --target install" * bump deployment target to 10.15 to eliminate the minimum target warning from xcode * obs-client/utility.cpp - use _getpid for msvc (according to the docs this is preferred). other platforms should use getpid * util-osx-impl.mm - fix issue where obs64 would not closed when requested. reduced sleep to 50ms to handle exit better * updating tests that would timeout on mac build agent to not run on macos for now. Adding isDarwin() to obs-handler * launch OSN tests from visual studio code. * callback-manager.cpp - fixed "jump bypasses variable initialization" error in xcode * callback-manager.cpp - resolves crash issue on streamlabs-desktop-mac since the transition callback is not currently being set remove unused headers from osn-mulitrack-video-osx.mm / bump libobs ver
1 parent 7b20693 commit 25eaa10

26 files changed

+403
-180
lines changed

.github/workflows/main.yml

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -22,98 +22,98 @@ env:
2222
SLGenerator: Visual Studio 17 2022
2323
SLDistributeDirectory: distribute
2424
SLFullDistributePath: "streamlabs-build.app/distribute" # The .app extension is required to run macOS tests correctly.
25-
LibOBSVersion: 30.2.4sl17
25+
LibOBSVersion: 30.2.4sl18
2626
PACKAGE_NAME: osn
2727

2828
jobs:
29-
# macos64:
30-
# name: 'macOS'
31-
# runs-on: ${{ matrix.image }}
32-
# strategy:
33-
# matrix:
34-
# BuildReleases: [Release-x86_64, Release-arm64]
35-
# include:
36-
# - BuildReleases: Release-x86_64
37-
# image: macos-13
38-
# BuildConfig: RelWithDebInfo
39-
# ReleaseName: release
40-
# Architecture: x86_64
41-
# - BuildReleases: Release-arm64
42-
# image: macos-14
43-
# BuildConfig: RelWithDebInfo
44-
# ReleaseName: release
45-
# Architecture: arm64
46-
# env:
47-
# OS_TAG: "osx"
48-
# steps:
49-
# - name: 'Checkout'
50-
# uses: actions/checkout@v3
51-
# with:
52-
# submodules: 'recursive'
53-
# - name: Get the version
54-
# id: get_version
55-
# run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
56-
# shell: bash
57-
# - name: Install Node.js
58-
# uses: actions/setup-node@v3
59-
# with:
60-
# node-version: '18.x'
61-
# - name: Install dependencies
62-
# shell: bash
63-
# run: './ci/install-dependencies-osx.sh'
64-
# - name: 'Configure obs-studio-node'
65-
# shell: bash
66-
# run: './ci/configure-osn-osx.sh'
67-
# env:
68-
# BUILD_CONFIG: ${{matrix.BuildConfig}}
69-
# RELEASE_NAME: ${{matrix.ReleaseName}}
70-
# ARCHITECTURE: ${{matrix.Architecture}}
71-
# tagartifact: ${{ steps.get_version.outputs.VERSION }}
72-
# - name: 'Build obs-studio-node'
73-
# run: ./ci/build-osn-osx.sh
74-
# shell: bash
75-
# env:
76-
# BUILD_CONFIG: ${{matrix.BuildConfig}}
77-
# SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
78-
# - name: Put version into package.json
79-
# if: startsWith(github.ref, 'refs/tags/')
80-
# run: node ci/bump-version.js "${{ steps.get_version.outputs.VERSION }}" "${{env.PACKAGE_PATH}}"
81-
# env:
82-
# PACKAGE_PATH: "${{env.SLFullDistributePath}}/${{env.InstallPath}}"
83-
# - name: 'Run tests'
84-
# continue-on-error: true
85-
# run: 'yarn run test'
86-
# env:
87-
# SLOBS_BE_STREAMKEY: ${{secrets.testsStreamKey}}
88-
# SLOBS_TEST_USER_POOL_TOKEN: ${{secrets.testsUserPoolToken}}
29+
macos64:
30+
name: 'macOS'
31+
runs-on: ${{ matrix.image }}
32+
strategy:
33+
matrix:
34+
BuildReleases: [Release-x86_64, Release-arm64]
35+
include:
36+
- BuildReleases: Release-x86_64
37+
image: macos-13
38+
BuildConfig: RelWithDebInfo
39+
ReleaseName: release
40+
Architecture: x86_64
41+
- BuildReleases: Release-arm64
42+
image: macos-14
43+
BuildConfig: RelWithDebInfo
44+
ReleaseName: release
45+
Architecture: arm64
46+
env:
47+
OS_TAG: "osx"
48+
steps:
49+
- name: 'Checkout'
50+
uses: actions/checkout@v3
51+
with:
52+
submodules: 'recursive'
53+
- name: Get the version
54+
id: get_version
55+
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
56+
shell: bash
57+
- name: Install Node.js
58+
uses: actions/setup-node@v3
59+
with:
60+
node-version: '18.x'
61+
- name: Install dependencies
62+
shell: bash
63+
run: './ci/install-dependencies-osx.sh'
64+
- name: 'Configure obs-studio-node'
65+
shell: bash
66+
run: './ci/configure-osn-osx.sh'
67+
env:
68+
BUILD_CONFIG: ${{matrix.BuildConfig}}
69+
RELEASE_NAME: ${{matrix.ReleaseName}}
70+
ARCHITECTURE: ${{matrix.Architecture}}
71+
tagartifact: ${{ steps.get_version.outputs.VERSION }}
72+
- name: 'Build obs-studio-node'
73+
run: ./ci/build-osn-osx.sh
74+
shell: bash
75+
env:
76+
BUILD_CONFIG: ${{matrix.BuildConfig}}
77+
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
78+
- name: Put version into package.json
79+
if: startsWith(github.ref, 'refs/tags/')
80+
run: node ci/bump-version.js "${{ steps.get_version.outputs.VERSION }}" "${{env.PACKAGE_PATH}}"
81+
env:
82+
PACKAGE_PATH: "${{env.SLFullDistributePath}}/${{env.InstallPath}}"
83+
- name: 'Run tests'
84+
continue-on-error: true
85+
run: 'yarn run test'
86+
env:
87+
SLOBS_BE_STREAMKEY: ${{secrets.testsStreamKey}}
88+
SLOBS_TEST_USER_POOL_TOKEN: ${{secrets.testsUserPoolToken}}
8989

90-
# OSN_ACCESS_KEY_ID: ${{secrets.AWS_RELEASE_ACCESS_KEY_ID}}
91-
# OSN_SECRET_ACCESS_KEY: ${{secrets.AWS_RELEASE_SECRET_ACCESS_KEY}}
92-
# RELEASE_NAME: ${{matrix.ReleaseName}}
90+
OSN_ACCESS_KEY_ID: ${{secrets.AWS_RELEASE_ACCESS_KEY_ID}}
91+
OSN_SECRET_ACCESS_KEY: ${{secrets.AWS_RELEASE_SECRET_ACCESS_KEY}}
92+
RELEASE_NAME: ${{matrix.ReleaseName}}
9393

94-
# - name: Tar artifact for deployment
95-
# if: startsWith(github.ref, 'refs/tags/')
96-
# run: tar -cvzf ${{env.TARGET_ARTIFACT}}.tar.gz -C ${{env.SLFullDistributePath}} ${{env.InstallPath}}
97-
# env:
98-
# TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-${{matrix.ReleaseName}}-${{env.OS_TAG}}-${{matrix.Architecture}}
99-
# - name: Configure AWS credentials
100-
# if: startsWith(github.ref, 'refs/tags/')
101-
# uses: aws-actions/configure-aws-credentials@v1
102-
# with:
103-
# aws-access-key-id: ${{secrets.AWS_RELEASE_ACCESS_KEY_ID}}
104-
# aws-secret-access-key: ${{secrets.AWS_RELEASE_SECRET_ACCESS_KEY}}
105-
# aws-region: us-west-2
106-
# - name: Deploy
107-
# if: startsWith(github.ref, 'refs/tags/')
108-
# run: aws s3 cp ${{env.TARGET_ARTIFACT}}.tar.gz s3://${{env.RELEASE_BUCKET}} --acl public-read
109-
# env:
110-
# TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-${{matrix.ReleaseName}}-${{env.OS_TAG}}-${{matrix.Architecture}}
111-
# - name: 'Upload debug files to Sentry'
112-
# if: startsWith(github.ref, 'refs/tags/')
113-
# run: 'python ./ci/sentry-osx.py'
114-
# env:
115-
# SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
116-
# BUILDCONFIG: ${{matrix.BuildConfig}}
94+
- name: Tar artifact for deployment
95+
if: startsWith(github.ref, 'refs/tags/')
96+
run: tar -cvzf ${{env.TARGET_ARTIFACT}}.tar.gz -C ${{env.SLFullDistributePath}} ${{env.InstallPath}}
97+
env:
98+
TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-${{matrix.ReleaseName}}-${{env.OS_TAG}}-${{matrix.Architecture}}
99+
- name: Configure AWS credentials
100+
if: startsWith(github.ref, 'refs/tags/')
101+
uses: aws-actions/configure-aws-credentials@v1
102+
with:
103+
aws-access-key-id: ${{secrets.AWS_RELEASE_ACCESS_KEY_ID}}
104+
aws-secret-access-key: ${{secrets.AWS_RELEASE_SECRET_ACCESS_KEY}}
105+
aws-region: us-west-2
106+
- name: Deploy
107+
if: startsWith(github.ref, 'refs/tags/')
108+
run: aws s3 cp ${{env.TARGET_ARTIFACT}}.tar.gz s3://${{env.RELEASE_BUCKET}} --acl public-read
109+
env:
110+
TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-${{matrix.ReleaseName}}-${{env.OS_TAG}}-${{matrix.Architecture}}
111+
- name: 'Upload debug files to Sentry'
112+
if: startsWith(github.ref, 'refs/tags/')
113+
run: 'python ./ci/sentry-osx.py'
114+
env:
115+
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
116+
BUILDCONFIG: ${{matrix.BuildConfig}}
117117

118118
win64:
119119
name: 'Windows 64-bit'

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ test-results.xml
1717
*.vcxproj
1818
*.opendb
1919
docs/
20-
.vscode
2120
/*.log
22-
/streamlabs-build
21+
streamlabs-build.app
2322

2423
tests/osn-tests/*-cache-local.zip

.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Debug Electron-Mocha Tests",
8+
"program": "${workspaceFolder}/node_modules/electron-mocha/bin/electron-mocha",
9+
"args": [
10+
"-r",
11+
"ts-node/register",
12+
"${workspaceFolder}/tests/osn-tests/src/*.ts"
13+
],
14+
"cwd": "${workspaceFolder}",
15+
"outputCapture": "std", // Enables capturing test output directly
16+
"internalConsoleOptions": "openOnSessionStart",
17+
"skipFiles": ["<node_internals>/**"] // Avoid stepping into Electron internals
18+
}
19+
]
20+
}

CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ FetchContent_Declare(
125125

126126
FetchContent_GetProperties(libcurl)
127127
if(NOT libcurl_POPULATED)
128+
set(CURL_USE_OPENSSL OFF CACHE BOOL "")
129+
set(SSH2CURL_USE_LIB OFF CACHE BOOL "")
130+
set(CURL_USE_LIBSSH2 OFF CACHE BOOL "")
128131
FetchContent_Populate(libcurl)
129132
add_subdirectory(${libcurl_SOURCE_DIR} ${libcurl_BINARY_DIR} EXCLUDE_FROM_ALL)
130133
endif()
@@ -133,4 +136,14 @@ add_subdirectory(lib-streamlabs-ipc)
133136
add_subdirectory(obs-studio-client)
134137
add_subdirectory(obs-studio-server)
135138

136-
include(CPack)
139+
include(CPack)
140+
141+
if(APPLE)
142+
# Copies ALL libcurl.dylib files for obs64 after the install process completes.
143+
install(CODE "
144+
file(GLOB_RECURSE DYLIB_FILES \"${libcurl_BINARY_DIR}/lib/*.dylib\")
145+
foreach(file \${DYLIB_FILES})
146+
file(COPY \${file} DESTINATION \"${CMAKE_INSTALL_PREFIX}/bin\")
147+
endforeach()
148+
")
149+
endif()

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,30 @@ Some tests interact with Twitch and we use a user pool service to get users but
128128
* To run all the tests do `yarn run test`
129129
* To run only run one test do `yarn run test --grep describe_name_value` where `describe_name_value` is the name of the test passed to the describe call in each test file. Examples: `yarn run test --grep nodeobs_api` or `yarn run test -g "Start streaming"`
130130

131+
#### Debugging tests
132+
If you wish to debug a specific test change the wildcard character to the name of your test (for ex, change `*.ts` into `test_nodeobs_api.ts`) in your launch.json:
133+
```
134+
{
135+
"version": "0.2.0",
136+
"configurations": [
137+
{
138+
"type": "node",
139+
"request": "launch",
140+
"name": "Debug Electron-Mocha Tests",
141+
"program": "${workspaceFolder}/node_modules/electron-mocha/bin/electron-mocha",
142+
"args": [
143+
"-r",
144+
"ts-node/register",
145+
"${workspaceFolder}/tests/osn-tests/src/*.ts"
146+
],
147+
"cwd": "${workspaceFolder}",
148+
"env": {
149+
"ELECTRON_ENABLE_LOGGING": "true"
150+
},
151+
"outputCapture": "std", // Enables capturing test output directly
152+
"internalConsoleOptions": "openOnSessionStart",
153+
"skipFiles": ["<node_internals>/**"] // Avoid stepping into Electron internals
154+
}
155+
]
156+
}
157+
```

ci/configure-osn-osx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cd ..
88
[ -n "${ARCHITECTURE}" ] && CMAKE_OSX_ARCHITECTURES_PARAM="-DCMAKE_OSX_ARCHITECTURES=${ARCHITECTURE}" || CMAKE_OSX_ARCHITECTURES_PARAM=""
99

1010
cmake .. \
11-
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 \
11+
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
1212
-DCMAKE_INSTALL_PREFIX=$PWD/../${SLFullDistributePath}/${InstallPath} \
1313
-DSTREAMLABS_BUILD=OFF \
1414
-DNODEJS_NAME=${RuntimeName} \

0 commit comments

Comments
 (0)