obs-ptz icon indicating copy to clipboard operation
obs-ptz copied to clipboard

Add initial support for Windows ARM64

Open anthony-linaro opened this issue 8 months ago • 4 comments

This PR adds support for building the plugin natively for Windows ARM64.

Had to switch buildspec to use my own fork, as the cmake in the main OBS tree blocks newer python. I suspect this is an oversight by OBS, as they have removed the limit elsewhere. For continuity, I would recommend pushing my changes to your own fork so that your code is not dependent on mine.

No CI as of yet, the scripts need a little bit of tweaking for the new GHA runners (lots of assumptions of Windows == x64).

Steps to test this is working:

  1. Open an x64 VS tools window, and run an x64 configure from in there: cmake --preset windows-x64
  2. Open an ARM64 VS tools window, and run an ARM64 configure from in there: cmake --preset windows-arm64
  3. Build the plugin: cmake --build --preset windows-arm64
  4. Install the plugin: cmake --install build_arm64 --prefix ./install --config RelWithDebInfo
  5. Copy to obs plugins directory

anthony-linaro avatar May 13 '25 19:05 anthony-linaro

Not entirely sure what's going on with macOS there, and I don't have a machine set up for it. It appears an empty list is being passed to add_dependencies somehow here: https://github.com/obsproject/obs-studio/blob/235be8ca3f8abcb99c4f44e9d9cea8ce9c736b99/cmake/macos/helpers.cmake#L89

anthony-linaro avatar May 13 '25 21:05 anthony-linaro

I found the problem. Cmake option ENABLE_UI was renamed to ENABLE_FRONTEND in upstream obs-studio https://github.com/obsproject/obs-studio/commit/7db4a75913fb627c1d1c169dc51e5468ebb7a148, meaning that the frontend isn't getting disabled in the deps build. That seems to be fine on Windows and Linux, but it appears to break the macos build. I suspect macos is broken with ENABLE_FRONTEND=TRUE and ENABLE_PLUGINS=FALSE. Here is the fix:

diff --git a/cmake/common/buildspec_common.cmake b/cmake/common/buildspec_common.cmake
index e4a688b..b22504a 100644
--- a/cmake/common/buildspec_common.cmake
+++ b/cmake/common/buildspec_common.cmake
@@ -158,7 +158,7 @@ function(_setup_obs_studio)
     COMMAND
       "${CMAKE_COMMAND}" -S "${dependencies_dir}/${_obs_destination}" -B
       "${dependencies_dir}/${_obs_destination}/build_${arch}" -G ${_cmake_generator} "${_cmake_arch}"
-      -DOBS_CMAKE_VERSION:STRING=3.0.0 -DENABLE_PLUGINS:BOOL=OFF -DENABLE_UI:BOOL=OFF
+      -DOBS_CMAKE_VERSION:STRING=3.0.0 -DENABLE_PLUGINS:BOOL=OFF -DENABLE_FRONTEND:BOOL=OFF
       -DOBS_VERSION_OVERRIDE:STRING=${_obs_version} "-DCMAKE_PREFIX_PATH='${CMAKE_PREFIX_PATH}'" ${_is_fresh}
       ${_cmake_extra}
     RESULT_VARIABLE _process_result

glikely avatar May 17 '25 12:05 glikely

I have reworked the commits and added your patch - hopefully the CI passes now!

anthony-linaro avatar May 19 '25 17:05 anthony-linaro

Thanks Anthony. I’ll take a look at the changes tomorrow.

You can squash the ENABLE_FRONTEND patch into the dependencies update patch. If it is kept separate then the series won’t build cleanly when bisecting

glikely avatar May 19 '25 17:05 glikely