Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build for Windows on Windows using MSYS2 #1847

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,57 +71,68 @@ jobs:

build:
needs: [calc_ver]

defaults:
run:
shell: '${{ matrix.shell }} {0}'
strategy:
matrix:
include:
- run_on: ubuntu-20.04
for: linux
prepare: "debian-based"
build_on: linux
shell: /bin/bash

- run_on: ubuntu-20.04
for: linux
prepare: "debian-based"
build_on: linux
pkg_suffix: wx32
shell: /bin/bash

- run_on: ubuntu-20.04
for: appimage-x86_64
prepare: "debian-based"
build_on: linux
shell: /bin/bash

- run_on: ubuntu-20.04
for: linux-armhf
prepare: "debian-based"
build_on: linux
shell: /bin/bash

- run_on: ubuntu-20.04
for: linux-armhf
prepare: "debian-based"
build_on: linux
pkg_suffix: wx32
shell: /bin/bash

- run_on: ubuntu-20.04
for: linux-aarch64
prepare: "debian-based"
build_on: linux
shell: /bin/bash

- run_on: ubuntu-20.04
for: linux-aarch64
prepare: "debian-based"
build_on: linux
pkg_suffix: wx32
shell: /bin/bash

- run_on: macos-12
for: osx
prepare: osx
build_on: osx

- run_on: ubuntu-latest
shell: /bin/bash

- run_on: windows-latest
for: win64
prepare: "debian-based"
build_on: linux
prepare: msys2
build_on: msys2
shell: 'c:\msys64\msys2_shell.cmd -mingw64 -here -no-start -defterm'

runs-on: ${{ matrix.run_on }}
steps:
Expand All @@ -130,11 +141,13 @@ jobs:
submodules: true

- name: Install Dependencies
run: ${{github.workspace}}/build-scripts/for-${{ matrix.for }}/prepare-${{ matrix.prepare }}.sh "${{ matrix.pkg_suffix }}"
run: |
"${{github.workspace}}/build-scripts/for-${{ matrix.for }}/prepare-${{ matrix.prepare }}.sh" "${{ matrix.pkg_suffix }}"

- name: Build
working-directory: ${{github.workspace}}
run: ${{github.workspace}}/build-scripts/for-${{ matrix.for }}/build-on-${{ matrix.build_on }}.sh ${{needs.calc_ver.outputs.project_ver}} ${{needs.calc_ver.outputs.build_ver}} ${{github.workspace}} "${{ matrix.pkg_suffix }}"
run: |
"${{github.workspace}}/build-scripts/for-${{ matrix.for }}/build-on-${{ matrix.build_on }}.sh" ${{needs.calc_ver.outputs.project_ver}} ${{needs.calc_ver.outputs.build_ver}} "${{github.workspace}}" "${{ matrix.pkg_suffix }}"

- name: Upload result
uses: nanoufo/action-upload-artifacts-and-release-assets@v2
Expand Down
43 changes: 43 additions & 0 deletions build-scripts/for-win64/build-on-msys2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# $1 - Version
# $2 - Build version
# $3 - Go source Dir. If not set then relative to the script dir

set -e

source $(dirname $0)/../set-ver-prms.sh "$1" "$2"

if [[ -n "$3" ]]; then
SRC_DIR=$3
else
SRC_DIR=$(readlink -f $(dirname $0)/../..)
fi

PARALLEL_PRMS="-j$(nproc)"

# Find VC (needed for CV2PDB)
VCTOOLS_COMPONENT="Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
VCTOOLS_DIR=$(vswhere -latest -requires "$VCTOOLS_COMPONENT" -find '**\bin\Hostx86\x64' | head -n 1)
if [ -z "${VCTOOLS_DIR}" ]; then
echo "Could not find $VCTOOLS_COMPONENT Visual Studio component"
exit 1
fi

# Prepare build directory
mkdir -p build/win64
pushd build/win64
rm -rf *
export LANG=C

# Run cmake & make
CMAKE_WIN_PRMS=(-DINSTALL_DEPEND=ON -DSTATIC=1 -DASIO_SDK_DIR=/usr/local/asio-sdk -DRTAUDIO_USE_ASIO=ON -G "MSYS Makefiles"
-DCV2PDB_EXE=/usr/local/share/cv2pdb/cv2pdb.exe "-DVC_PATH=$VCTOOLS_DIR")
CMAKE_APP_PRMS=(-DGO_USE_JACK=ON $CMAKE_VERSION_PRMS)
CMAKE_PRMS=("${CMAKE_WIN_PRMS[@]}" "${CMAKE_APP_PRMS[@]}" "$SRC_DIR")

echo "> Running CMake with parameters:" "${CMAKE_PRMS[@]}"
cmake "${CMAKE_PRMS[@]}"
make $PARALLEL_PRMS VERBOSE=1 package

popd
39 changes: 39 additions & 0 deletions build-scripts/for-win64/prepare-msys2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

set -eu

# Install build dependencies
pacman -S --needed --noconfirm \
base-devel wget unzip \
mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-fftw mingw-w64-x86_64-imagemagick \
mingw-w64-x86_64-inkscape mingw-w64-x86_64-jack2 mingw-w64-x86_64-librsvg mingw-w64-x86_64-nsis \
mingw-w64-x86_64-pkgconf mingw-w64-x86_64-rtmidi mingw-w64-x86_64-wavpack \
mingw-w64-x86_64-wxwidgets3.2-msw mingw-w64-x86_64-yaml-cpp

# Download and install ASIO sdk
if [ ! -d /usr/local/asio-sdk ]; then
DL_DIR=`mktemp -d -t asio.XXX`
wget -O $DL_DIR/asiosdk.zip https://www.steinberg.net/asiosdk
mkdir -p /usr/local
unzip -o $DL_DIR/asiosdk.zip -d /usr/local/
rm -rf $DL_DIR
SDK_DIR=`ls -1d /usr/local/asiosdk* | tail -1`
ln -sf `basename $SDK_DIR` /usr/local/asio-sdk
fi

# download vswhere to find MSVC
if [ ! -d /usr/local/bin/vswhere ]; then
mkdir -p /usr/local/bin
wget -O /usr/local/bin/vswhere https://github.com/microsoft/vswhere/releases/latest/download/vswhere.exe
fi

# download cv2pdb
if [ ! -d /usr/local/share/cv2pdb ]; then
DL_DIR=`mktemp -d -t cv2pdb.XXX`
wget -O $DL_DIR/cv2pdb-0.51.zip https://github.com/rainers/cv2pdb/releases/download/v0.51/cv2pdb-0.51.zip
mkdir -p /usr/local/share/cv2pdb.tmp
rm -rf /usr/local/share/cv2pdb.tmp/*
unzip -d /usr/local/share/cv2pdb.tmp $DL_DIR/cv2pdb-0.51.zip
rm -rf $DL_DIR
mv /usr/local/share/cv2pdb.tmp /usr/local/share/cv2pdb
fi
8 changes: 4 additions & 4 deletions cmake/BuildExecutable.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# GrandOrgue - free pipe organ simulator
#
# Copyright 2006 Milan Digital Audio LLC
# Copyright 2009-2019 GrandOrgue contributors (see AUTHORS)
# Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -34,9 +34,9 @@ function(BUILD_EXECUTABLE TARGET)
OUTPUT "${BINDIR}/${TARGET}.pdb"
DEPENDS ${TARGET}
COMMAND
${CMAKE_COMMAND}
-E env "WINEPATH=Z:${VC_PATH}"
wine "${CV2PDB_EXE}"
${CMAKE_COMMAND}
-E env "PATH=${VC_PATH}"
"${CV2PDB_EXE}"
"$<TARGET_FILE:${TARGET}>"
"${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_FILE_PREFIX:${TARGET}>$<TARGET_FILE_BASE_NAME:${TARGET}>-tmp$<TARGET_FILE_SUFFIX:${TARGET}>"
"${BINDIR}/${TARGET}.pdb"
Expand Down
6 changes: 3 additions & 3 deletions cmake/BuildLibrary.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# GrandOrgue - free pipe organ simulator
#
# Copyright 2006 Milan Digital Audio LLC
# Copyright 2009-2019 GrandOrgue contributors (see AUTHORS)
# Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -46,8 +46,8 @@ function(BUILD_LIBRARY TARGET)
DEPENDS ${TARGET}
COMMAND
${CMAKE_COMMAND}
-E env "WINEPATH=Z:${VC_PATH}"
wine "${CV2PDB_EXE}"
-E env "PATH=${VC_PATH}"
"${CV2PDB_EXE}"
"$<TARGET_FILE:${TARGET}>"
"${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_FILE_PREFIX:${TARGET}>$<TARGET_FILE_BASE_NAME:${TARGET}>-tmp$<TARGET_FILE_SUFFIX:${TARGET}>"
"${LIBDIR}/lib${TARGET}.pdb"
Expand Down
7 changes: 5 additions & 2 deletions cmake/CopyDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Copyright 2006 Milan Digital Audio LLC
# Copyright 2006 Milan Digital Audio LLC
# Copyright 2009-2023 GrandOrgue contributors (see AUTHORS)
# Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
# License GPL-2.0 or later
# (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).

Expand All @@ -22,5 +22,8 @@ function(CopyDependencies app instpath)
COMMAND ${CMAKE_COMMAND} -Dstatusfile="${statusfile}" -Dbundledtarget="${targetfile}" -Dsearchdirs="${cmd_searchdirs}" -P "${CMAKE_SOURCE_DIR}/cmake/FixupBundle.cmake"
DEPENDS ${targetfile} "${CMAKE_SOURCE_DIR}/cmake/FixupBundle.cmake" "${statusfile}")

install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" \"-Dstatusfile=${statusfile}\" \"-Dbundledtarget=\$ENV{DESTDIR}/\${CMAKE_INSTALL_PREFIX}/${instpath}\" \"-Dsearchdirs=${searchdirs}\" -P \"${CMAKE_SOURCE_DIR}/cmake/FixupBundle.cmake\")")
install(CODE "
cmake_path(APPEND BUNDLEDTARGET \$ENV{DESTDIR} \${CMAKE_INSTALL_PREFIX} ${instpath})
execute_process(COMMAND \"${CMAKE_COMMAND}\" \"-Dstatusfile=${statusfile}\" \"-Dbundledtarget=\${BUNDLEDTARGET}\" \"-Dsearchdirs=${searchdirs}\" -P \"${CMAKE_SOURCE_DIR}/cmake/FixupBundle.cmake\")
")
endfunction()
7 changes: 5 additions & 2 deletions resources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2006 Milan Digital Audio LLC
# Copyright 2009-2023 GrandOrgue contributors (see AUTHORS)
# Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
# License GPL-2.0 or later
# (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).

Expand All @@ -10,7 +10,10 @@ set(DEPLIST)
# ========================

# Find ImageMagick
find_program(ImageMagick_convert_EXECUTABLE convert)
LIST(APPEND CMAKE_IGNORE_PATH "C:\\Windows\\System32") # ignore convert.exe here
find_program(ImageMagick_convert_EXECUTABLE convert REQUIRED)
MESSAGE("Found ImageMagick convert at ${ImageMagick_convert_EXECUTABLE}")
LIST(POP_BACK CMAKE_IGNORE_PATH)

# Setup command to generate GOIcon.ico.
# That icon is used for two purposes:
Expand Down
8 changes: 1 addition & 7 deletions src/portaudio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright 2006 Milan Digital Audio LLC
# Copyright 2009-2023 GrandOrgue contributors (see AUTHORS)
# Copyright 2009-2024 GrandOrgue contributors (see AUTHORS)
# License GPL-2.0 or later (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).

message(STATUS "PortAudio build Configuration")
Expand Down Expand Up @@ -76,12 +76,6 @@ if (WIN32)
endif ()

check_include_file_cxx(rpcsal.h HAVE_RPCSAL_H)
check_cxx_source_compiles("#include <ksmedia.h>
KSRTAUDIO_HWREGISTER_PROPERTY x;" HAVE_KSRT)
if (${HAVE_KSRT})
else()
include_directories(${CMAKE_SOURCE_DIR}/submodules/PortAudio/src/hostapi/wasapi/mingw-include)
endif ()

if (RTAUDIO_USE_WDMKS)
add_definitions(-DPA_USE_WDMKS)
Expand Down
Loading