This repository was archived by the owner on Aug 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Cmake: Fixes Windows cmake install path config #45
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
76a25aa
- fixes Windows cmake install path config
danrossi 152a1cc
- add Windows build readme
danrossi 3087800
- Update readme for macOS build
danrossi f563969
- Adding windows console debugger in debug mode
danrossi 050a3ad
Link Windows system libraries required by Rust libmoq
kixcord c69aa0a
Address PR #45 review feedback
kixcord b673c20
Fix Windows debug console so Rust logs are actually visible
kixcord 489f29f
Default relay to cdn.moq.dev and randomize broadcast name
kixcord File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| ## Windows Build Instructions | ||
|
|
||
| ### Build Setup | ||
|
|
||
| ```powershell | ||
| Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | ||
| choco install -y git | ||
| choco install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' | ||
| choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended" | ||
| choco install rustup | ||
| ``` | ||
|
|
||
| During the rustup installation choose the `nightly` variant. | ||
|
|
||
| Locate "Visual Studio Installer". Click "Modify". Choose "Desktop Development with C++". Check C++ ATL For x64 | ||
|
|
||
| ### Build the OBS fork | ||
|
|
||
| ```powershell | ||
| cd obs-studio | ||
| cmake --preset windows-x64 | ||
| cmake --build --preset windows-x64 | ||
| ``` | ||
|
|
||
| ### Build the obs-moq plugin and install | ||
|
|
||
| ```powershell | ||
| cd obs | ||
| cmake --preset windows-x64 -DMOQ_LOCAL="../moq" | ||
| cmake --build --preset windows-x64 --target install | ||
| ``` | ||
|
|
||
| ## Debugging Moq Plugin | ||
|
|
||
| ```powershell | ||
| $env:RUST_LOG="debug"; $env:RUST_BACKTRACE=1; $env:OBS_LOG_LEVEL="debug"; Set-Location "build_x64\rundir\RelWithDebInfo\bin\64bit"; & .\obs64.exe --verbose | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,6 +30,13 @@ extern "C" { | |||||||||||||||||||||
| #include "moq.h" | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #ifdef _WIN64 | ||||||||||||||||||||||
| #include <windows.h> | ||||||||||||||||||||||
| #include <cstdio> | ||||||||||||||||||||||
| #include <cstdlib> | ||||||||||||||||||||||
| #include <cstring> | ||||||||||||||||||||||
| #endif | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| OBS_DECLARE_MODULE() | ||||||||||||||||||||||
| OBS_MODULE_USE_DEFAULT_LOCALE("obs-moq", "en-US") | ||||||||||||||||||||||
| MODULE_EXPORT const char *obs_module_description(void) | ||||||||||||||||||||||
|
|
@@ -39,6 +46,19 @@ MODULE_EXPORT const char *obs_module_description(void) | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| bool obs_module_load(void) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| // On Windows, allocate a console when RUST_LOG=debug *before* initializing | ||||||||||||||||||||||
| // the Rust logger below, so its output binds to a valid stderr. AllocConsole | ||||||||||||||||||||||
| // sets the process std handles, but the C runtime streams must be reopened | ||||||||||||||||||||||
| // onto the console device for that output to be visible. | ||||||||||||||||||||||
| #ifdef _WIN64 | ||||||||||||||||||||||
| const char *logLevel = std::getenv("RUST_LOG"); | ||||||||||||||||||||||
| if (logLevel && strcmp(logLevel, "debug") == 0) { | ||||||||||||||||||||||
| AllocConsole(); | ||||||||||||||||||||||
| freopen("CONOUT$", "w", stdout); | ||||||||||||||||||||||
| freopen("CONOUT$", "w", stderr); | ||||||||||||||||||||||
|
Comment on lines
+56
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Guard the Lines 56-58 rewrite process-wide Suggested fix `#ifdef` _WIN64
const char *logLevel = std::getenv("RUST_LOG");
if (logLevel && strcmp(logLevel, "debug") == 0) {
- AllocConsole();
- freopen("CONOUT$", "w", stdout);
- freopen("CONOUT$", "w", stderr);
+ if (AllocConsole() || GetLastError() == ERROR_ACCESS_DENIED) {
+ FILE *out = freopen("CONOUT$", "w", stdout);
+ FILE *err = freopen("CONOUT$", "w", stderr);
+ if (!out || !err) {
+ // Leave the module loaded; console logging just stays unavailable.
+ }
+ }
}
`#endif`📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| } | ||||||||||||||||||||||
| #endif | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Use RUST_LOG env var for more verbose output | ||||||||||||||||||||||
| // The second argument is the string length of the first argument. | ||||||||||||||||||||||
| moq_log_level("info", 4); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.