[hatari-devel] PortMidi mingw dev headers/libraries for linux cross compile |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: [hatari-devel] PortMidi mingw dev headers/libraries for linux cross compile
- From: Chang Chong <codemonkey2x@xxxxxxxxx>
- Date: Mon, 29 Mar 2021 15:18:36 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:subject:message-id:date:to :mime-version; bh=8EWSa0DtWTJxIAWHB8DRf69Q2ZLRAV1O3AJhr9TnWm8=; b=pmVYr6O8M/Leyrt1xIBtEwLh3bJV4pcNjTXtNEBYX0LXPtMZfeg5B91NIG6klDOmrs U1+PfOy5KVp46QtbWybbdW6UDOI06GYgUh4lJSuT9/i9on1XQlo0QDkn9xndZUviuEC0 YuHA3JNpGVISIAVEXOcDFzD7jKLPoLIz0M/rPNZbo2zqyodKcOILElZIfR+vFaUH8wL6 sA6r6MPSpWoWapNxFpXPRqSEFAXi3/WK4gVN3yewaDhn0oPP4PRsJtcuDmY9JiBjsjI/ bWPyqReO/gZFAGUdH+E2s3X8Hl8qga4FAEWlojjqBSYPvFkVZyHp0AaBh/hU9cLQYWX0 Zkyg==
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:
if(PortMidi_FOUND)
include_directories(${PORT_MIDI_INCLUDE_DIR})
endif(PortMidi_FOUND)
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.