From 4ccbd91040635b092fe2623006596c3676b36ccd Mon Sep 17 00:00:00 2001 From: Tommy Vercetti <7903172+tommyvct@users.noreply.github.com> Date: Sat, 22 May 2021 15:34:41 -0500 Subject: [PATCH] Windows ARM64: initial support 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 --- .github/workflows/main.yml | 66 ++++++++++++++++++- UI/CMakeLists.txt | 2 + .../decklink-output-ui/CMakeLists.txt | 1 + .../frontend-tools/CMakeLists.txt | 1 + deps/w32-pthreads/context.h | 2 +- libobs/graphics/graphics.c | 5 ++ libobs/obs-hotkey-name-map.c | 4 ++ libobs/obs-win-crash-handler.c | 8 ++- libobs/util/sse-intrin.h | 3 +- plugins/obs-filters/noise-suppress-filter.c | 2 + plugins/obs-outputs/flv-mux.c | 4 ++ plugins/obs-outputs/ftl-stream.c | 4 ++ plugins/obs-outputs/obs-outputs.c | 4 ++ plugins/obs-outputs/rtmp-stream.c | 4 ++ plugins/obs-outputs/rtmp-windows.c | 4 ++ plugins/obs-qsv11/CMakeLists.txt | 5 ++ 16 files changed, 114 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b942ad33e78c58..dfe34826dd1449 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,14 +5,16 @@ on: paths-ignore: - '**.md' branches: - - master + - '**' + - '*' tags: - '*' pull_request: paths-ignore: - '**.md' branches: - - master + - '**' + - '*' env: MACOS_CEF_BUILD_VERSION: '4183' @@ -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/setup-msbuild@v1.0.2 + - name: 'Checkout' + uses: actions/checkout@v2.3.3 + 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/upload-artifact@v2.2.0 + with: + name: '${{ env.FILE_NAME }}' + path: '*-windows_arm64.zip' + + diff --git a/UI/CMakeLists.txt b/UI/CMakeLists.txt index 6cbad64b430fd4..b498892b6b0730 100644 --- a/UI/CMakeLists.txt +++ b/UI/CMakeLists.txt @@ -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 diff --git a/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt b/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt index 6acd8830c9d20e..8b1cd1cda121cc 100644 --- a/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt +++ b/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt @@ -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 diff --git a/UI/frontend-plugins/frontend-tools/CMakeLists.txt b/UI/frontend-plugins/frontend-tools/CMakeLists.txt index 46e6286067436a..40e5404d19097f 100644 --- a/UI/frontend-plugins/frontend-tools/CMakeLists.txt +++ b/UI/frontend-plugins/frontend-tools/CMakeLists.txt @@ -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 diff --git a/deps/w32-pthreads/context.h b/deps/w32-pthreads/context.h index f55dd73e944929..72e1c1812a9b14 100644 --- a/deps/w32-pthreads/context.h +++ b/deps/w32-pthreads/context.h @@ -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 diff --git a/libobs/graphics/graphics.c b/libobs/graphics/graphics.c index 9d59509102ad63..4f3ee89055d5ef 100644 --- a/libobs/graphics/graphics.c +++ b/libobs/graphics/graphics.c @@ -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, diff --git a/libobs/obs-hotkey-name-map.c b/libobs/obs-hotkey-name-map.c index a7e0683faf86b7..51a104fe617aa8 100644 --- a/libobs/obs-hotkey-name-map.c +++ b/libobs/obs-hotkey-name-map.c @@ -15,6 +15,10 @@ along with this program. If not, see . ******************************************************************************/ +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#endif + #include #include diff --git a/libobs/obs-win-crash-handler.c b/libobs/obs-win-crash-handler.c index d4551b56482139..9e27e3b9b93cd1 100644 --- a/libobs/obs-win-crash-handler.c +++ b/libobs/obs-win-crash-handler.c @@ -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; diff --git a/libobs/util/sse-intrin.h b/libobs/util/sse-intrin.h index 903139e60bc2e5..1989e5b306b4dc 100644 --- a/libobs/util/sse-intrin.h +++ b/libobs/util/sse-intrin.h @@ -17,7 +17,8 @@ #pragma once -#if defined(_MSC_VER) +#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) && \ + !defined(_M_ARM64) #include #else #define SIMDE_ENABLE_NATIVE_ALIASES diff --git a/plugins/obs-filters/noise-suppress-filter.c b/plugins/obs-filters/noise-suppress-filter.c index 600b2a0ce9824f..a2264390e06677 100644 --- a/plugins/obs-filters/noise-suppress-filter.c +++ b/plugins/obs-filters/noise-suppress-filter.c @@ -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; diff --git a/plugins/obs-outputs/flv-mux.c b/plugins/obs-outputs/flv-mux.c index 7b28512530e50d..f9eacbfdb972aa 100644 --- a/plugins/obs-outputs/flv-mux.c +++ b/plugins/obs-outputs/flv-mux.c @@ -15,6 +15,10 @@ along with this program. If not, see . ******************************************************************************/ +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#endif + #include #include #include diff --git a/plugins/obs-outputs/ftl-stream.c b/plugins/obs-outputs/ftl-stream.c index 99d6e95c491c2e..b4323c59d3e7cf 100644 --- a/plugins/obs-outputs/ftl-stream.c +++ b/plugins/obs-outputs/ftl-stream.c @@ -15,6 +15,10 @@ along with this program. If not, see . ******************************************************************************/ +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#endif + #include #include #include diff --git a/plugins/obs-outputs/obs-outputs.c b/plugins/obs-outputs/obs-outputs.c index 31534cbd3f04f4..72b848c4b82a6d 100644 --- a/plugins/obs-outputs/obs-outputs.c +++ b/plugins/obs-outputs/obs-outputs.c @@ -1,3 +1,7 @@ +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#endif + #include #include "obs-outputs-config.h" diff --git a/plugins/obs-outputs/rtmp-stream.c b/plugins/obs-outputs/rtmp-stream.c index 18cb18cd03a82b..7943f1ea59ae1a 100644 --- a/plugins/obs-outputs/rtmp-stream.c +++ b/plugins/obs-outputs/rtmp-stream.c @@ -15,6 +15,10 @@ along with this program. If not, see . ******************************************************************************/ +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#endif + #include "rtmp-stream.h" #ifndef SEC_TO_NSEC diff --git a/plugins/obs-outputs/rtmp-windows.c b/plugins/obs-outputs/rtmp-windows.c index 3b794fa099214a..30c0ed5e9068fe 100644 --- a/plugins/obs-outputs/rtmp-windows.c +++ b/plugins/obs-outputs/rtmp-windows.c @@ -1,3 +1,7 @@ +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#endif + #ifdef _WIN32 #include "rtmp-stream.h" #include diff --git a/plugins/obs-qsv11/CMakeLists.txt b/plugins/obs-qsv11/CMakeLists.txt index c1d2631081ffa5..c933d06a5c5f83 100644 --- a/plugins/obs-qsv11/CMakeLists.txt +++ b/plugins/obs-qsv11/CMakeLists.txt @@ -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)