-
Notifications
You must be signed in to change notification settings - Fork 17
Cmake: Fixes Windows cmake install path config #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
76a25aa
152a1cc
3087800
f563969
050a3ad
c69aa0a
b673c20
489f29f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| ``` |
| 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); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.