Skip to content

Commit

Permalink
Windows ARM64: initial support
Browse files Browse the repository at this point in the history
CI: Add GitHub Action Windows ARM64 CI

This mega commit also includes the changes from the following PR:

cmake: Add DISABLE_QSV11 option to disable QSV encoder #4748

libobs: Restrict emmintrin.h to x86(_64) platform #4746

Resolve potential symbol clash on MSVC #4743

obs-filters: Add preprocessor guard to method #4730
  • Loading branch information
tommyvct committed Aug 4, 2021
1 parent a935298 commit d764086
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 5 deletions.
66 changes: 64 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ on:
paths-ignore:
- '**.md'
branches:
- master
- '**'
- '*'
tags:
- '*'
pull_request:
paths-ignore:
- '**.md'
branches:
- master
- '**'
- '*'

env:
MACOS_CEF_BUILD_VERSION: '4183'
Expand Down Expand Up @@ -694,3 +696,63 @@ jobs:
with:
name: '${{ env.FILE_NAME }}'
path: '*-win32.zip'
winarm64:
name: 'Windows on ARM64'
runs-on: [windows-latest]
env:
QT_VERSION: '5.15.2'
CMAKE_GENERATOR: "Visual Studio 16 2019"
CMAKE_SYSTEM_VERSION: "10.0.18363.657"
VIRTUALCAM-GUID: "A3FCE0F5-3493-419F-958A-ABA1250EC20B"
steps:
- name: 'Add msbuild to PATH'
uses: microsoft/[email protected]
- name: 'Checkout'
uses: actions/[email protected]
with:
submodules: 'recursive'
- name: 'Fetch Git Tags'
shell: bash
run: |
git fetch --prune --unshallow
echo "OBS_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
echo "OBS_GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "OBS_GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: 'Check for Github Labels'
if: github.event_name == 'pull_request'
shell: bash
run: |
LABELS_URL="$(echo ${{ github.event.pull_request.url }} | sed s'/pulls/issues/')"
LABEL_FOUND="$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "${LABELS_URL}/labels" | sed -n 's/.*"name": "\(.*\)",/\1/p' | grep 'Seeking Testers' || true)"
if [ "${LABEL_FOUND}" = "Seeking Testers" ]; then
echo "SEEKING_TESTERS=1" >> $GITHUB_ENV
else
echo "SEEKING_TESTERS=0" >> $GITHUB_ENV
fi
- name: 'Install prerequisite: Pre-built dependencies'
run: |
curl -kL https://github.com/tommyvct/obs-deps/releases/latest/download/DepsARM64.zip -f --retry 5 -o DepsARM64.zip
7z x DepsARM64.zip -o"${{ github.workspace }}/cmbuild/"
- name: "Configure"
run: |
mkdir ./build64
cd ./build64
cmake -G"${{ env.CMAKE_GENERATOR }}" -A"ARM64" -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DBUILD_BROWSER=true -DCOMPILE_D3D12_HOOK=true -DDepsPath="${{ github.workspace }}/cmbuild/DepsARM64" -DQTDIR="${{ github.workspace }}/cmbuild/DepsARM64/qt/" -DCEF_ROOT_DIR="${{ github.workspace }}/cmbuild/DepsARM64/cef" -DPYTHON_LIB="${{ github.workspace }}/cmbuild/DepsARM64/bin/python39.lib" -DTWITCH_CLIENTID='${{ env.TWITCH_CLIENTID }}' -DTWITCH_HASH='${{ env.TWITCH_HASH }}' -DRESTREAM_CLIENTID='${{ env.RESTREAM_CLIENTID }}' -DRESTREAM_HASH='${{ env.RESTREAM_HASH }}' -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE -DVIRTUALCAM_GUID=${{ env.VIRTUALCAM-GUID }} -DBUILD_AMD_ENCODER=OFF -DENABLE_SCRIPTING=ON -DCOMPILE_PYTHON=ON -DDISABLE_QSV11=ON -DVULKAN_INCLUDE_DIR="${{ github.workspace }}/cmbuild/DepsARM64/VulkanSDK/include" -DVULKAN_LIB="${{ github.workspace }}/cmbuild/DepsARM64/VulkanSDK/vulkan-1.lib" ..
- name: 'Build'
run: msbuild /m /p:Configuration=RelWithDebInfo .\build64\obs-studio.sln
- name: 'Package'
if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
run: |
$env:FILE_DATE=(Get-Date -UFormat "%F")
$env:FILE_NAME="${env:FILE_DATE}-${{ env.OBS_GIT_HASH }}-${{ env.OBS_GIT_TAG }}-windows_arm64.zip"
echo "FILE_NAME=${env:FILE_NAME}" >> ${env:GITHUB_ENV}
robocopy .\build64\rundir\RelWithDebInfo .\build\ /E /XF .gitignore
7z a ${env:FILE_NAME} .\build\*
- name: 'Publish'
if: success() && (github.event_name != 'pull_request' || env.SEEKING_TESTERS == '1')
uses: actions/[email protected]
with:
name: '${{ env.FILE_NAME }}'
path: '*-windows_arm64.zip'


2 changes: 2 additions & 0 deletions UI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ include_directories(${LIBCURL_INCLUDE_DIRS})
add_definitions(${LIBCURL_DEFINITIONS})

if(WIN32)
add_definitions(-DNOMINMAX)

include_directories(${BLAKE2_INCLUDE_DIR})

set(obs_PLATFORM_SOURCES
Expand Down
1 change: 1 addition & 0 deletions UI/frontend-plugins/decklink-output-ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ set(decklink-ouput-ui_UI
)

if(WIN32)
add_definitions(-DNOMINMAX)
set(MODULE_DESCRIPTION "OBS DeckLink Output UI")
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in decklink-ouput-ui.rc)
list(APPEND decklink-ouput-ui_SOURCES
Expand Down
1 change: 1 addition & 0 deletions UI/frontend-plugins/frontend-tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ if(SCRIPTING_ENABLED)
endif()

if(WIN32)
add_definitions(-DNOMINMAX)
set(MODULE_DESCRIPTION "OBS Frontend Tools")
configure_file(${CMAKE_SOURCE_DIR}/cmake/winrc/obs-module.rc.in frontend-tools.rc)
set(frontend-tools_PLATFORM_SOURCES
Expand Down
4 changes: 4 additions & 0 deletions cmake/Modules/CopyMSVCBins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ file(GLOB FFMPEG_BIN_FILES
"${FFMPEG_avfilter_INCLUDE_DIR}/../bin/avfilter-*.dll"
"${FFMPEG_avfilter_INCLUDE_DIR}/../bin${_bin_suffix}/avfilter-*.dll"
"${FFMPEG_avfilter_INCLUDE_DIR}/bin${_bin_suffix}/avfilter-*.dll"
"${FFMPEG_avfilter_INCLUDE_DIR}/../bin/avresample-*.dll"
"${FFMPEG_avfilter_INCLUDE_DIR}/../bin${_bin_suffix}/avresample-*.dll"
"${FFMPEG_avfilter_INCLUDE_DIR}/bin${_bin_suffix}/avresample-*.dll"


"${FFMPEG_postproc_INCLUDE_DIR}/../bin/postproc-*.dll"
"${FFMPEG_postproc_INCLUDE_DIR}/../bin${_bin_suffix}/postproc-*.dll"
Expand Down
2 changes: 1 addition & 1 deletion deps/w32-pthreads/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
#define PTW32_PROGCTR(Context) ((Context).Rip)
#endif

#if defined(_ARM_) || defined(ARM)
#if defined(_ARM_) || defined(ARM) || defined(_M_ARM) || defined(_M_ARM64)
#define PTW32_PROGCTR(Context) ((Context).Pc)
#endif

Expand Down
5 changes: 5 additions & 0 deletions libobs/graphics/graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
#include "effect-parser.h"
#include "effect.h"

#ifdef _MSC_VER
#undef near
#undef far
#endif

static THREAD_LOCAL graphics_t *thread_graphics = NULL;

static inline bool gs_obj_valid(const void *obj, const char *f,
Expand Down
4 changes: 4 additions & 0 deletions libobs/obs-hotkey-name-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

#ifdef _MSC_VER
#define WIN32_LEAN_AND_MEAN
#endif

#include <string.h>
#include <assert.h>

Expand Down
8 changes: 7 additions & 1 deletion libobs/obs-win-crash-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ static inline bool get_dbghelp_imports(struct exception_handler_data *data)

static inline void init_instruction_data(struct stack_trace *trace)
{
#ifdef _WIN64
#if defined(_M_ARM64)
trace->instruction_ptr = trace->context.Pc;
trace->frame.AddrPC.Offset = trace->instruction_ptr;
trace->frame.AddrFrame.Offset = trace->context.Fp;
trace->frame.AddrStack.Offset = trace->context.Sp;
trace->image_type = IMAGE_FILE_MACHINE_ARM64;
#elif defined(_WIN64)
trace->instruction_ptr = trace->context.Rip;
trace->frame.AddrPC.Offset = trace->instruction_ptr;
trace->frame.AddrFrame.Offset = trace->context.Rbp;
Expand Down
4 changes: 3 additions & 1 deletion libobs/util/sse-intrin.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

#pragma once

#if defined(_MSC_VER)
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) && \
!(defined(_M_ARM64) || defined(_M_ARM64EC))

#include <emmintrin.h>
#else
#define SIMDE_ENABLE_NATIVE_ALIASES
Expand Down
2 changes: 2 additions & 0 deletions plugins/obs-filters/noise-suppress-filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,9 +1008,11 @@ static obs_properties_t *noise_suppress_properties(void *data)
TEXT_NVAFX_INTENSITY, 0.0f, 1.0f,
0.01f);

#if defined(LIBRNNOISE_ENABLED) && defined(LIBSPEEXDSP_ENABLED)
if (!nvafx_loaded) {
obs_property_list_item_disable(method, 2, true);
}
#endif

#endif
return ppts;
Expand Down
4 changes: 4 additions & 0 deletions plugins/obs-outputs/flv-mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

#ifdef _MSC_VER
#define WIN32_LEAN_AND_MEAN
#endif

#include <obs.h>
#include <stdio.h>
#include <util/dstr.h>
Expand Down
4 changes: 4 additions & 0 deletions plugins/obs-outputs/ftl-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

#ifdef _MSC_VER
#define WIN32_LEAN_AND_MEAN
#endif

#include <obs-module.h>
#include <obs-avc.h>
#include <util/platform.h>
Expand Down
4 changes: 4 additions & 0 deletions plugins/obs-outputs/obs-outputs.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifdef _MSC_VER
#define WIN32_LEAN_AND_MEAN
#endif

#include <obs-module.h>

#include "obs-outputs-config.h"
Expand Down
4 changes: 4 additions & 0 deletions plugins/obs-outputs/rtmp-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

#ifdef _MSC_VER
#define WIN32_LEAN_AND_MEAN
#endif

#include "rtmp-stream.h"

#ifndef SEC_TO_NSEC
Expand Down
4 changes: 4 additions & 0 deletions plugins/obs-outputs/rtmp-windows.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#ifdef _MSC_VER
#define WIN32_LEAN_AND_MEAN
#endif

#ifdef _WIN32
#include "rtmp-stream.h"
#include <winsock2.h>
Expand Down
5 changes: 5 additions & 0 deletions plugins/obs-qsv11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
if(DISABLE_QSV11)
message(STATUS "NOT building Intel QSV Encoder.")
return()
endif()

project(obs-qsv11)

include_directories(libmfx/include/msdk/include)
Expand Down

0 comments on commit d764086

Please sign in to comment.