Skip to content

Commit

Permalink
[ci] Try to put the windows store build in GH actions and add a MinGW…
Browse files Browse the repository at this point in the history
… action
  • Loading branch information
jcelerier committed Jul 31, 2022
1 parent d2aab23 commit 66a7ad0
Show file tree
Hide file tree
Showing 64 changed files with 208 additions and 73 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/win-builds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Windows build
on: push

jobs:
winstore:
name: Windows (store)
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Dependencies
shell: bash
run: |
./ci/win32.deps.sh
- name: Build
shell: cmd
run: |
call "%cd%\ci\win32store.build.cmd"
- name: Create certificate
shell: pwsh
env:
OSSIA_WIN32_CERT_SUBJECT: ${{ secrets.OSSIA_WIN32_CERT_SUBJECT }}
OSSIA_WIN32_CERT_PASSWORD: ${{ secrets.OSSIA_WIN32_CERT_PASSWORD }}
run: |
.\ci\win32store.cert.ps1
- name: Deploy
shell: cmd
env:
OSSIA_WIN32_CERT_SUBJECT: ${{ secrets.OSSIA_WIN32_CERT_SUBJECT }}
OSSIA_WIN32_CERT_PASSWORD: ${{ secrets.OSSIA_WIN32_CERT_PASSWORD }}
run: |
call "%cd%\ci\win32store.deploy.cmd"
- name: Upload build
uses: actions/upload-artifact@v2
with:
name: windows-store
path: |
output/*.appxbundle
mingw:
runs-on: windows-latest
strategy:
matrix:
include:
- { sys: mingw64, env: x86_64 }
- { sys: mingw32, env: i686 }
- { sys: ucrt64, env: ucrt-x86_64 }
- { sys: clang64, env: clang-x86_64 }
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Setup msys2 and mingw-w64
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
update: true
pacboy: >-
cmake:p
ninja:p
toolchain:p
qt6-base:p
qt6-declarative:p
qt6-websockets:p
qt6-serialport:p
qt6-shadertools:p
qt6-5compat:p
qt6-scxml:p
qt6-tools:p
boost:p
portaudio:p
fftw:p
ffmpeg:p
SDL2:p
- name: Dependencies
shell: msys2 {0}
run: |
./ci/mingw.deps.sh
- name: Build
shell: msys2 {0}
run: |
./ci/mingw.build.sh
30 changes: 1 addition & 29 deletions 3rdparty/Spout/SpoutUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,35 +742,7 @@ namespace spoututils {
// Get the default log file path
std::string _getLogPath()
{
char logpath[MAX_PATH];
logpath[0] = 0;

// Retrieve user %appdata% environment variable
char *appdatapath = nullptr;
size_t len;
bool bSuccess = true;
errno_t err = _dupenv_s(&appdatapath, &len, "APPDATA");
if (err == 0 && appdatapath) {
strcpy_s(logpath, MAX_PATH, appdatapath);
strcat_s(logpath, MAX_PATH, "\\Spout");
if (_access(logpath, 0) == -1) {
if (!CreateDirectoryA(logpath, NULL)) {
bSuccess = false;
}
}
}
else {
bSuccess = false;
}

if (!bSuccess) {
// _dupenv_s or CreateDirectory failed
// Find the path of the executable
GetModuleFileNameA(NULL, (LPSTR)logpath, sizeof(logpath));
PathRemoveFileSpecA((LPSTR)logpath);
}

return logpath;
return {};
}

// Get the name for the current log level
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/Spout/SpoutUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
// a Visual studio 2017 compiler. "#include <chrono>" will then fail.
// If this is a problem, remove _MSC_VER_ and manually enable/disable the USE_CHRONO define.
//
#if _MSC_VER >= 1900 || defined (__clang__)
#if _MSC_VER >= 1900 || defined (__clang__) || (__cplusplus >= 201703L)
#define USE_CHRONO
#endif

Expand Down
16 changes: 12 additions & 4 deletions ci/mingw.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@

export SCORE_DIR=$PWD

mkdir -p /build || true
cd /build
mkdir -p build || true
cd build

# FIXME vst3 error in sdk hosting...
# FIXME windres error.. https://gitlab.kitware.com/cmake/cmake/-/merge_requests/24


cmake $SCORE_DIR \
-GNinja \
-G"MinGW Makefiles" \
-DQT_VERSION="Qt6;6.2" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=install \
-DSCORE_DISABLED_PLUGINS=score-plugin-vst3 \
-DCMAKE_CXX_FLAGS="-Wa,-mbig-obj" \
-DSCORE_DYNAMIC_PLUGINS=1 \
-DCMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS=1 \
-DCMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS=1 \
-DCMAKE_NINJA_FORCE_RESPONSE_FILE=1 \
-DSCORE_PCH=1

cmake --build .
Expand Down
27 changes: 11 additions & 16 deletions ci/mingw.deps.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
#!/bin/bash -eux

sudo pacman -S --needed --noconfirm \
mingw-w64-qt5-base mingw-w64-qt5-declarative mingw-w64-qt5-serialport mingw-w64-qt5-websockets \
mingw-w64-portaudio \
mingw-w64-fftw \
mingw-w64-ffmpeg \
ninja \
mingw-w64-gcc
# Done in the GH action for caching:
# pacboy -S --needed --noconfirm \
# cmake:p ninja:p toolchain:p \
# qt6-base:p qt6-declarative:p qt6-websockets:p qt6-serialport:p \
# qt6-shadertools:p qt6-5compat:p qt6-scxml:p qt6-tools:p \
# boost:p portaudio:p fftw:p ffmpeg:p \
# SDL2:p

# sudo pacman -S --needed --noconfirm \
# mingw-w64-x86_64-qt5 \
# mingw-w64-x86_64-portaudio \
# mingw-w64-x86_64-fftw \
# mingw-w64-x86_64-ffmpeg \
# mingw-w64-x86_64-cmake \
# mingw-w64-x86_64-ninja \
# mingw-w64-x86_64-gcc
# TODO:
# jack2:p not available on clang?
# lv2 suil lilv

source ci/common.deps.sh
# source ci/common.deps.sh
19 changes: 15 additions & 4 deletions ci/win32store.build.cmd
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
set SCORE_DIR=%cd%
mkdir build
cd build

mkdir install

set PATH=%PATH%;c:\ossia-sdk\llvm\bin
cmake -GNinja %BUILD_SOURCESDIRECTORY% ^
cmake -GNinja %SCORE_DIR% ^
-DCMAKE_C_COMPILER=c:/ossia-sdk/llvm/bin/clang.exe ^
-DCMAKE_CXX_COMPILER=c:/ossia-sdk/llvm/bin/clang++.exe ^
-DCMAKE_C_FLAGS=" -flto -fno-stack-protector -Ofast -fno-finite-math-only -D_WIN32_WINNT_=0x0A00 -DWINVER=0x0A00 " ^
-DCMAKE_CXX_FLAGS=" -flto -fno-stack-protector -Ofast -fno-finite-math-only -D_WIN32_WINNT_=0x0A00 -DWINVER=0x0A00 " ^
-DOSSIA_SDK=c:\ossia-sdk ^
-DCMAKE_INSTALL_PREFIX=install ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_UNITY_BUILD=1 ^
-DOSSIA_STATIC_EXPORT=0 ^
-DSCORE_INSTALL_HEADERS=0 ^
-DSCORE_DISABLED_PLUGINS="score-plugin-faust;score-plugin-jit;score-plugin-pd" ^
-DSCORE_DISABLED_PLUGINS="score-plugin-faust;score-plugin-jit" ^
-DSCORE_DEPLOYMENT_BUILD=1 ^
-DSCORE_MSSTORE_DEPLOYMENT=1
-DSCORE_MSSTORE_DEPLOYMENT=1 ^
-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=1

cmake --build .
cmake --build . --target install
cmake --build . --target install/strip
REM
REM llvm-strip install/score.exe
REM llvm-strip install/ossia-score-vstpuppet.exe
REM llvm-strip install/ossia-score-vst3puppet.exe
REM
14 changes: 14 additions & 0 deletions ci/win32store.cert.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$cert = New-SelfSignedCertificate `
-Type Custom `
-Subject $Env:OSSIA_WIN32_CERT_SUBJECT `
-KeyUsage DigitalSignature `
-FriendlyName "ossia.io" `
-CertStoreLocation "Cert:\CurrentUser\My" `
-TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")

$password = ConvertTo-SecureString -String $Env:OSSIA_WIN32_CERT_PASSWORD -Force -AsPlainText

Export-PfxCertificate `
-cert "Cert:\CurrentUser\My\$($cert.Thumbprint)" `
-FilePath ossia-selfsigned.pfx `
-Password $password
53 changes: 39 additions & 14 deletions ci/win32store.deploy.cmd
Original file line number Diff line number Diff line change
@@ -1,22 +1,47 @@
set SCORE_PATH=%CD%
cd build
cd install

REM makepri createconfig /cf priconfig.xml /dq en-US
REM makepri.exe new /pr %cd% /cf %cd%\priconfig.xml
@echo off
set SCORE_PATH=%cd%
set BUILD_PATH=%cd%\build
set OSSIA_WIN32_CERTIFICATE=%SCORE_PATH%\ossia-selfsigned.pfx

cd %BUILD_PATH%
rmdir output /s

cd install

REM Cleanup unused things
rmdir faust\docs /s

del /s /q *.eot
del /s /q *.ttf
del /s /q *.woff
del /s /q *.md
del /s /q *.css
del /s /q *.html
del /s /q *.gz
del /s /q *.jpg
del /s /q *.jpeg
del /s /q *.xml
del /s /q *.pri

REM Create resource files
REM (Necessary for multi-scale images, etc.)
makepri.exe createconfig /cf priconfig.xml /dq en-US
makepri.exe new /pr %cd% /cf %cd%\priconfig.xml /mn %cd%\manifests\Package.appxmanifest

REM Embed manifest inside score.exe
mt.exe -nologo -manifest score.exe.manifest -outputresource:"score.exe;#1"

signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERTIFICATE_PASSWORD% /debug score.exe
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERTIFICATE_PASSWORD% /debug libc++.dll
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERTIFICATE_PASSWORD% /debug libunwind.dll
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERTIFICATE_PASSWORD% /debug libwinpthread-1.dll
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERTIFICATE_PASSWORD% /debug ossia-score-vstpuppet.exe
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERTIFICATE_PASSWORD% /debug ossia-score-vst3puppet.exe
REM Sign every binary file
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERT_PASSWORD% score.exe
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERT_PASSWORD% ossia-score-vstpuppet.exe
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERT_PASSWORD% ossia-score-vst3puppet.exe
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERT_PASSWORD% libc++.dll
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERT_PASSWORD% libunwind.dll
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERT_PASSWORD% libwinpthread-1.dll

makeappx build /v /f %SCORE_PATH%\cmake\Deployment\Windows\store\PackagingLayout.xml /op ..\output /bv %GITTAGNOV%.0 /pv %GITTAGNOV%.0 /ca
REM Create the appxbundle
makeappx build /v /f %SCORE_PATH%\cmake\Deployment\Windows\store\PackagingLayout.xml /op %SCORE_PATH%\output /bv %GITTAGNOV%.0 /pv %GITTAGNOV%.0 /ca

signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERTIFICATE_PASSWORD% /debug %SCORE_PATH%\build\output\ossia-score.appxbundle
REM Sign the appxbundle
signtool sign /fd sha256 /a /f %OSSIA_WIN32_CERTIFICATE% /p %OSSIA_WIN32_CERT_PASSWORD% %SCORE_PATH%\output\ossia-score.appxbundle

4 changes: 4 additions & 0 deletions cmake/Deployment/Windows/store/PackagingLayout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
<Package ID="x64" ProcessorArchitecture="x64">
<Files>
<File DestinationPath="score.exe" SourcePath="score.exe"/>
<File DestinationPath="ossia-score-vstpuppet.exe" SourcePath="ossia-score-vstpuppet.exe"/>
<File DestinationPath="ossia-score-vst3puppet.exe" SourcePath="ossia-score-vst3puppet.exe"/>
<File DestinationPath="*.manifest" SourcePath="*.manifest"/>
<File DestinationPath="*.dll" SourcePath="*.dll"/>
<File DestinationPath="*.conf" SourcePath="*.conf"/>
<File DestinationPath="*.png" SourcePath="*.png"/>
<File DestinationPath="images\*.png" SourcePath="images\*.png"/>
<File DestinationPath="*.ico" SourcePath="*.ico"/>
<File DestinationPath="*.pri" SourcePath="*.pri"/>
<File DestinationPath="*.xml" SourcePath="*.xml"/>
<!-- <File DestinationPath="faust\\**" SourcePath="faust\**"/> -->
</Files>
</Package>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<Properties>
<DisplayName>ossia score</DisplayName>
<PublisherDisplayName>ossia.io</PublisherDisplayName>
<Logo>images/ossia-50x50.png</Logo>
<Logo>images/StoreLogo.png</Logo>
</Properties>

<Dependencies>
Expand All @@ -30,10 +30,11 @@
<uap:VisualElements
DisplayName="ossia score"
Description="an interactive and intermedia sequencer"
Square150x150Logo="images/ossia-150x150.png"
Square44x44Logo="images/ossia-44x44.png"
Square150x150Logo="images/Square150x150Logo.png"
Square44x44Logo="images/Square44x44Logo.png"
BackgroundColor="transparent">
<uap:SplashScreen Image="images/banner-620x300.png" />
<uap:DefaultTile Wide310x150Logo="images/Wide310x150Logo.png" Square71x71Logo="images/SmallTile.png" Square310x310Logo="images/LargeTile.png"/>
<uap:SplashScreen Image="images/SplashScreen.png" />
</uap:VisualElements>

<Extensions>
Expand Down
14 changes: 13 additions & 1 deletion src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,19 @@ if(MSVC)
endif()

if(WIN32)
target_sources(${APPNAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../lib/resources/score.rc")
if(MSVC OR ("${CMAKE_RC_COMPILER}" MATCHES ".*llvm.*"))
target_sources(${APPNAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../lib/resources/score.rc")
else()
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/score-icon.obj"
COMMAND "${CMAKE_RC_COMPILER}"
-D GCC_WINDRES
-I "${CMAKE_CURRENT_SOURCE_DIR}"
-I "${CMAKE_CURRENT_BINARY_DIR}"
-o "${CMAKE_CURRENT_BINARY_DIR}/score-icon.obj"
-i "${CMAKE_CURRENT_SOURCE_DIR}/../lib/resources/score.rc"
VERBATIM)
target_sources(${APPNAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/score-icon.obj")
endif()
endif()

if(UNIX AND NOT APPLE)
Expand Down

0 comments on commit 66a7ad0

Please sign in to comment.