Fix cross-compilation from Win32 to ARM using vcpkg (#630)

For some reason, the configure command must be specified explicitly in the `gentables` build step. Otherwise, the ARM target compiler will be used to build `make_tables` rather than the host compiler. 

Now that microsoft/vcpkg#10485 has been completed, an ARM CI build can be added to AppVeyor. Also, the build status table in the README has been updated.
This commit is contained in:
Tom M 2020-04-08 11:13:42 +02:00 committed by GitHub
parent d9ad6a0725
commit 85237e4fc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 20 deletions

View file

@ -1,5 +1,5 @@
image:
- Visual Studio 2017
- Visual Studio 2019
build:
parallel: true
@ -13,8 +13,8 @@ environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
matrix:
- platform: ARM
- platform: x86
- platform: x64
cache:
@ -22,25 +22,33 @@ cache:
init:
- set TARGET_PLATFORM=
- if "%platform%"=="x64" ( set TARGET_PLATFORM= Win64)
- if "%platform%"=="ARM" ( set TARGET_PLATFORM= ARM)
- if "%platform%"=="x86" ( set TARGET_PLATFORM=Win32)
- if "%platform%"=="x64" ( set TARGET_PLATFORM=x64)
- if "%platform%"=="ARM" ( set TARGET_PLATFORM=ARM)
- echo %TARGET_PLATFORM%
- echo %APPVEYOR_BUILD_WORKER_IMAGE%
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set "generator=Visual Studio 15 2017%TARGET_PLATFORM%" && set "toolset=v141_xp" )
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" ( set "generator=Visual Studio 16 2019" && set "toolset=v142" )
- echo %generator%
- echo %toolset%
install:
# make sure the latest version of git is installed
- choco upgrade git -y
- vcpkg install glib:%platform%-windows
- choco upgrade git ninja -y
- ninja --version
- cmake --version
# manually update vcpkg
- cd "C:\Tools\vcpkg"
- git pull
- .\bootstrap-vcpkg.bat
- cd %appveyor_build_folder%
- vcpkg install glib:%platform%-windows || type C:\Tools\vcpkg\buildtrees\libffi\config-arm-windows-out.log
build_script:
- mkdir build
- cd build
- cmake -Werror=dev -G "%generator%" -T "%toolset%" -Denable-pkgconfig=0 -DCMAKE_TOOLCHAIN_FILE=c:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DNO_GUI=1 ..
- cmake -Werror=dev -G "%generator%" -A %TARGET_PLATFORM% -T "%toolset%" -Denable-pkgconfig=0 -DCMAKE_TOOLCHAIN_FILE=c:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 ..
- cmake --build . --config Release # build libfluidsynth and fluidsynth exec
- cmake --build . --config Release --target check # build and exec unittests
- if not "%platform%"=="ARM" ( cmake --build . --config Release --target check ) # build and exec unittests, unless when cross-compiling
after_build:
- 7z a fluidsynth-vcpkg-%platform%.zip %APPVEYOR_BUILD_FOLDER%\build\src\Release\*

View file

@ -1,12 +1,13 @@
# FluidSynth
| Build Status | glib < 2.30 | glib >= 2.30 |
|---|---|---|
| <img src="https://www.kernel.org/theme/images/logos/tux.png" height="30" alt=""> **Linux** | n.a. | [![Build Status Travis](https://travis-ci.org/FluidSynth/fluidsynth.svg?branch=master)](https://travis-ci.org/FluidSynth/fluidsynth/branches) |
| <img src="https://cdn.pling.com/img//hive/content-pre1/112422-1.png" height="25" alt=""> **FreeBSD** | n.a. | [![Build Status](https://api.cirrus-ci.com/github/FluidSynth/fluidsynth.svg?branch=master)](https://cirrus-ci.com/github/FluidSynth/fluidsynth) |
| <img src="https://www.microsoft.com/windows/favicon.ico" height="25" alt=""> **Windows** | [![Build Status](https://dev.azure.com/tommbrt/tommbrt/_apis/build/status/FluidSynth.fluidsynth.Win?branchName=master)](https://dev.azure.com/tommbrt/tommbrt/_build/latest?definitionId=3&branchName=master) | [![Build status](https://ci.appveyor.com/api/projects/status/anbmtebt5uk4q1it/branch/master?svg=true)](https://ci.appveyor.com/project/derselbst/fluidsynth-g2ouw/branch/master) |
| <img src="https://www.apple.com/favicon.ico" height="30" alt=""> **MacOSX** | n.a. | [![Build Status](https://dev.azure.com/tommbrt/tommbrt/_apis/build/status/FluidSynth.fluidsynth.macOS?branchName=master)](https://dev.azure.com/tommbrt/tommbrt/_build/latest?definitionId=5&branchName=master) |
| <img src="https://www.android.com/favicon.ico" height="30" alt=""> **Android** | n.a. | [![CircleCI](https://circleci.com/gh/FluidSynth/fluidsynth/tree/master.svg?style=shield)](https://circleci.com/gh/FluidSynth/fluidsynth) |
| | Build Status |
|---|---|
| <img src="https://www.kernel.org/theme/images/logos/tux.png" height="30" alt=""> **Linux** | [![Build Status Travis](https://travis-ci.org/FluidSynth/fluidsynth.svg?branch=master)](https://travis-ci.org/FluidSynth/fluidsynth/branches) |
| <img src="https://cdn.pling.com/img//hive/content-pre1/112422-1.png" height="25" alt=""> **FreeBSD** | [![Build Status](https://api.cirrus-ci.com/github/FluidSynth/fluidsynth.svg?branch=master)](https://cirrus-ci.com/github/FluidSynth/fluidsynth) |
| <img src="https://www.microsoft.com/windows/favicon.ico" height="25" alt=""> **Windows** | [![Build Status](https://dev.azure.com/tommbrt/tommbrt/_apis/build/status/FluidSynth.fluidsynth.Win?branchName=master)](https://dev.azure.com/tommbrt/tommbrt/_build/latest?definitionId=3&branchName=master) |
| <img src="https://www.microsoft.com/windows/favicon.ico" height="25" alt=""> **Windows (vcpkg)** | [![Build status](https://ci.appveyor.com/api/projects/status/anbmtebt5uk4q1it/branch/master?svg=true)](https://ci.appveyor.com/project/derselbst/fluidsynth-g2ouw/branch/master) |
| <img src="https://www.apple.com/favicon.ico" height="30" alt=""> **MacOSX** | [![Build Status](https://dev.azure.com/tommbrt/tommbrt/_apis/build/status/FluidSynth.fluidsynth.macOS?branchName=master)](https://dev.azure.com/tommbrt/tommbrt/_build/latest?definitionId=5&branchName=master) |
| <img src="https://www.android.com/favicon.ico" height="30" alt=""> **Android** | [![CircleCI](https://circleci.com/gh/FluidSynth/fluidsynth/tree/master.svg?style=shield)](https://circleci.com/gh/FluidSynth/fluidsynth) |
@ -20,7 +21,7 @@ FluidSynth generates audio by reading and handling MIDI events from MIDI input d
The central place for documentation and further links is our **wiki** here at GitHub:
**https://github.com/FluidSynth/fluidsynth/wiki**
#### https://github.com/FluidSynth/fluidsynth/wiki
If you are missing parts of the documentation, let us know by writing to our mailing list.
Of course, you are welcome to edit and improve the wiki yourself. All you need is an account at GitHub. Alternatively, you may send an EMail to our mailing list along with your suggested changes. Further information about the mailing list is available in the wiki as well.

View file

@ -402,10 +402,22 @@ endif ( MACOSX_FRAMEWORK )
# ******* Auto Generated Lookup Tables ******
include(ExternalProject)
set (GENTAB_SDIR ${CMAKE_CURRENT_SOURCE_DIR}/gentables)
set (GENTAB_BDIR ${CMAKE_CURRENT_BINARY_DIR}/gentables)
# Use external project to ensure that cmake uses the host compiler when building make_tables.exe
# To fix cross-compiling fluidsynth from Win32 to ARM (using vcpkg), we need to pass the current generator
# on to the external project, otherwise (for some unknown reason) the target compiler will be used rather
# than the host compiler.
ExternalProject_Add(gentables
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gentables
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/gentables
INSTALL_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/gentables/make_tables.exe "${CMAKE_BINARY_DIR}/"
SOURCE_DIR ${GENTAB_SDIR}
BINARY_DIR ${GENTAB_BDIR}
CONFIGURE_COMMAND
"${CMAKE_COMMAND}" -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE} -G "${CMAKE_GENERATOR}" -B "${GENTAB_BDIR}" "${GENTAB_SDIR}"
BUILD_COMMAND
"${CMAKE_COMMAND}" --build "${GENTAB_BDIR}"
INSTALL_COMMAND ${GENTAB_BDIR}/make_tables.exe "${CMAKE_BINARY_DIR}/"
)
add_dependencies(libfluidsynth-OBJ gentables)