[hatari-devel] PortMidi mingw dev headers/libraries for linux cross compile

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]

Wanted to share a technique for getting the portmidi dev headers and libraries for those that want to cross compile windows binaries from linux.

On my debian machine, I wasn’t able to find a native mingw install for portmidi like I did for SDL2. But a workaround is to obtain these from the MSYS2 package.

At first I thought you had to install MSYS2 and use pacman to install the package from windows. But all you have to do is go to the MSYS2 package site and download the pkg file.

For example, to get the mingw64 x86_64 portmidi, download the file from the msys2 page https://packages.msys2.org/package/mingw-w64-x86_64-portmidi?repo=mingw64.

Then it’s a matter of unpacking this file into a location of your choice (e.g. ~/portmidi) on your linux box.

Before you run cmake, you’ll need to make some changes to the toolchain cmake file and src/CMakeLists.txt file.

1. add the following to the toolchain file (i’m using my example of ~/portmidi as my install root dir):

set(PORTMIDI_INCLUDE_DIR ~/portmidi/include)
set(PORTMIDI_LIBRARY ~/portmidi/lib/libportmidi.dll.a)

2. add this to the src/CMakeLists.txt file:


By the way, i’m not sure why there’s no check for this and PortAudio. This check is being done for zlib, png, x11 and caps image.

Once you have these cmake changes, you can run cmake with the toolchain cmake file and you’ll be all configured and ready to do your windows build.

I don’t believe it’s too outrageous as the mingw SDL2 appears to be nothing more than pre-built mingw based artifacts since the make cross puts these files in their correct location. Also, the msys2 package is for version 217 and that appears to be the most recent version with no revisions for many years.

You can always download the portmidi source and perform your cross compile. I was able to successfully build a mingw version from my debian box. But this was more involved than what I outlined below. More than happy to share how I was able to build portmidi from source.

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/