Skip to content

Commit 841927a

Browse files
Merge pull request #18 from chrisgleissner/feature/improve-rendering
Optimize retry thread: eliminate 100ms polling and reduce mutex contention
2 parents 270b3e6 + 64beba0 commit 841927a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3892
-674
lines changed

.github/copilot-instructions.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,92 @@ When setting default user directories, use platform conventions:
411411
- Pay special attention to file I/O and networking code
412412
- Test default path behavior on each platform
413413

414+
## Local Compilation Verification (MANDATORY)
415+
416+
**Before announcing any change as completed, you MUST verify it builds locally on both Linux AND Windows platforms.**
417+
418+
### Linux Verification (Required)
419+
```bash
420+
# Clean build to ensure no cached artifacts
421+
rm -rf build_x86_64
422+
cmake --preset ubuntu-x86_64
423+
cmake --build build_x86_64
424+
425+
# Verify success
426+
if [ -f "build_x86_64/c64u-plugin-for-obs.so" ]; then
427+
echo "✅ Linux build successful"
428+
else
429+
echo "❌ Linux build failed - DO NOT proceed"
430+
fi
431+
```
432+
433+
### Windows Verification (Required)
434+
Choose ONE method to verify Windows compatibility:
435+
436+
**Method 1: Docker-based Windows simulation (Linux users)**
437+
```bash
438+
./test-windows-build.sh
439+
# Must show: "🎉 SUCCESS: Windows build simulation completed!"
440+
```
441+
442+
**Method 2: Native Windows build (Windows users)**
443+
```powershell
444+
# Clean build
445+
Remove-Item "build_x64" -Recurse -Force -ErrorAction SilentlyContinue
446+
cmake --preset windows-x64
447+
cmake --build build_x64 --config RelWithDebInfo
448+
449+
# Verify success
450+
if (Test-Path "build_x64\RelWithDebInfo\c64u-plugin-for-obs.dll") {
451+
Write-Host "✅ Windows build successful" -ForegroundColor Green
452+
} else {
453+
Write-Host "❌ Windows build failed - DO NOT proceed" -ForegroundColor Red
454+
}
455+
```
456+
457+
**Method 3: CI-compatible Windows build (Advanced)**
458+
```powershell
459+
$env:CI = "1"
460+
cmake --preset windows-ci-x64
461+
cmake --build build_x64 --config RelWithDebInfo --parallel
462+
# Must complete without errors or warnings
463+
```
464+
465+
### Validation Checklist
466+
467+
Before announcing completion, verify ALL of the following:
468+
469+
- [ ] **Linux build succeeds** without errors or warnings
470+
- [ ] **Windows build succeeds** using one of the above methods
471+
- [ ] **Code formatting passes**: `./build-aux/run-clang-format --check`
472+
- [ ] **CMake formatting passes**: `./build-aux/run-gersemi --check`
473+
- [ ] **No compilation warnings** in either platform
474+
- [ ] **Atomic types work correctly** (if atomic changes were made)
475+
- [ ] **Header inclusion order is correct** (if header changes were made)
476+
- [ ] **Cross-platform compatibility maintained** (no platform-specific assumptions)
477+
478+
### If Verification Fails
479+
480+
If either Linux or Windows build fails:
481+
1. **DO NOT announce the change as completed**
482+
2. **Investigate and fix the build failures**
483+
3. **Re-run both verifications**
484+
4. **Only proceed after both platforms build successfully**
485+
486+
### Documentation Requirements
487+
488+
When announcing completion of changes that affect build processes:
489+
- **Reference the appropriate build documentation**:
490+
- Linux/general: `doc/developer.md`
491+
- Windows-specific: `doc/windows-local-build.md`
492+
- Cross-platform: Cross-Platform Development Guidelines (above)
493+
- **Mention which verification method was used**
494+
- **Confirm both platforms were tested**
495+
414496
## Trust These Instructions
415497

416498
These instructions are comprehensive and tested. Only search for additional information if:
417499
1. Build fails with error not covered in "Common Build Issues"
418500
2. Instructions appear outdated (e.g., tool versions changed significantly)
419501
3. New platform support is needed beyond Windows/macOS/Linux
502+
4. The mandatory verification process fails and troubleshooting is needed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
!/cmake
88
!/data
99
!/doc
10+
!/docs
1011
!/src
1112
!/tests
1213
!/tools

CMakeLists.txt

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,30 @@ cmake_minimum_required(VERSION 3.28...3.30)
22

33
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)
44

5-
project(${_name} VERSION ${_version})
5+
# Determine authoritative version from git tag first
6+
execute_process(
7+
COMMAND git describe --tags --always --dirty
8+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
9+
OUTPUT_VARIABLE GIT_VERSION_TAG
10+
OUTPUT_STRIP_TRAILING_WHITESPACE
11+
ERROR_QUIET
12+
)
13+
14+
# Extract clean version number from git tag for project version
15+
if(GIT_VERSION_TAG AND GIT_VERSION_TAG MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)")
16+
# Extract version number from tag (e.g., "v1.2.3" -> "1.2.3", "1.2.3-dirty" -> "1.2.3")
17+
string(REGEX REPLACE "^v?([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" AUTHORITATIVE_VERSION "${GIT_VERSION_TAG}")
18+
message(STATUS "Using git tag version: ${AUTHORITATIVE_VERSION}")
19+
else()
20+
# Fallback to buildspec.json version if no proper git tag is available
21+
set(AUTHORITATIVE_VERSION "${_version}")
22+
message(STATUS "No git tag found, using buildspec.json version: ${AUTHORITATIVE_VERSION}")
23+
endif()
24+
25+
project(${_name} VERSION ${AUTHORITATIVE_VERSION})
26+
27+
# Set dummy VirtualCam GUID to prevent Windows build warning
28+
set(VIRTUALCAM_GUID "{00000000-0000-0000-0000-000000000000}")
629

730
option(ENABLE_FRONTEND_API "Use obs-frontend-api for UI functionality" OFF)
831
option(ENABLE_QT "Use Qt functionality" OFF)
@@ -14,6 +37,45 @@ include(helpers)
1437

1538
add_library(${CMAKE_PROJECT_NAME} MODULE)
1639

40+
# Update buildspec.json with authoritative version if it came from git tag
41+
if(GIT_VERSION_TAG AND GIT_VERSION_TAG MATCHES "^v?([0-9]+\\.[0-9]+\\.[0-9]+)")
42+
# Update buildspec.json with the git tag version to keep it in sync
43+
# Use sed to update only line 41 (the main project version, not dependency versions)
44+
execute_process(
45+
COMMAND sed -i "41s/\"version\": \"[^\"]*\"/\"version\": \"${AUTHORITATIVE_VERSION}\"/" "${CMAKE_SOURCE_DIR}/buildspec.json"
46+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
47+
RESULT_VARIABLE sed_result
48+
)
49+
50+
if(sed_result EQUAL 0)
51+
message(STATUS "Updated buildspec.json version to: ${AUTHORITATIVE_VERSION}")
52+
else()
53+
message(WARNING "Failed to update buildspec.json version")
54+
endif()
55+
endif()
56+
57+
# Use git tag for display version (includes dirty/commit info), authoritative version for project
58+
set(DISPLAY_VERSION "${GIT_VERSION_TAG}")
59+
60+
execute_process(
61+
COMMAND git rev-parse --short HEAD
62+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
63+
OUTPUT_VARIABLE GIT_HASH
64+
OUTPUT_STRIP_TRAILING_WHITESPACE
65+
ERROR_QUIET
66+
)
67+
if(NOT GIT_HASH)
68+
set(GIT_HASH "unknown")
69+
endif()
70+
71+
string(TIMESTAMP BUILD_TIME "%Y-%m-%d %H:%M:%S" UTC)
72+
73+
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
74+
C64U_VERSION_TAG="${DISPLAY_VERSION}"
75+
C64U_GIT_HASH="${GIT_HASH}"
76+
C64U_BUILD_TIME="${BUILD_TIME}"
77+
)
78+
1779
find_package(libobs REQUIRED)
1880
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE OBS::libobs)
1981

@@ -42,9 +104,12 @@ target_sources(
42104
src/c64u-network.c
43105
src/c64u-protocol.c
44106
src/c64u-video.c
107+
src/c64u-color.c
45108
src/c64u-audio.c
46109
src/c64u-source.c
47110
src/c64u-record.c
111+
src/c64u-version.c
112+
src/c64u-properties.c
48113
)
49114

50115
# Link resolver library for DNS functionality on Unix platforms

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ New-NetFirewallRule -DisplayName "C64U" -Direction Inbound -Protocol UDP -LocalP
5151
2. Install `c64u-plugin-for-obs-*-macos-universal.pkg` to `~/Library/Application Support/obs-studio/plugins`
5252
3. Restart OBS Studio
5353

54+
> [!NOTE]
55+
> macOS support is currently under active development and is not yet fully functional. We're working to resolve compatibility issues and will update this documentation when macOS builds are stable.
56+
5457
**Linux (Ubuntu/Debian):**
5558
1. Close OBS Studio
5659
2. Install `c64u-plugin-for-obs-*-x86_64-linux-gnu.deb` to `~/.config/obs-studio/plugins` by running:

0 commit comments

Comments
 (0)