libremidi icon indicating copy to clipboard operation
libremidi copied to clipboard

add libremidi to vcpkg?

Open ericfont opened this issue 4 years ago • 4 comments

vcpkg seems to be a good way for including C/C++ libraries in a cross-platform manner and have them downloadable and work well with github-ci and such. RtMidi and PortMidi are in vcpkg:

https://github.com/microsoft/vcpkg/tree/master/ports/rtmidi https://github.com/microsoft/vcpkg/tree/master/ports/portmidi

I notice you already have support for conan according to https://github.com/jcelerier/libremidi/issues/45, but I think it would be good to also add to vcpkg cause then more users could easily include if they are using vcpkg for library management.

ericfont avatar Oct 08 '21 04:10 ericfont

hi ! yep, that sound a good idea but I have no experience with vcpkg ^^'

What is the process to get a lib added there ?

jcelerier avatar Oct 09 '21 15:10 jcelerier

https://github.com/Microsoft/vcpkg/blob/master/CONTRIBUTING.md#new-package-guidelines

ericfont avatar Oct 09 '21 17:10 ericfont

I added a "New port request" at https://github.com/microsoft/vcpkg/issues/20623

ericfont avatar Oct 09 '21 18:10 ericfont

What is the process to get a lib added there ?

It's very easy for a typical well behaved CMake build system. It generally takes about 15 lines of CMake script and 15 lines of JSON and that's about it. Thereafter updating the package would generally be a simple matter of updating the version in the vcpkg.json file and the download hash in the portfile.cmake file. Here is a simple example.

Be-ing avatar Oct 18 '21 19:10 Be-ing

the cmake part has been done for quite a while

jcelerier avatar Jul 27 '23 23:07 jcelerier

I've created a draft pull request for vcpkg implementing the libremidi library. Currently the automated testing is failing because the UWP builds fail. It seems like the UWP build is trying to link against WinMM... but there may be something I'm missing! Here is the pull request on the vcpkg repo: https://github.com/microsoft/vcpkg/pull/33848

Also, if anyone wants to test the library in vcpkg, my branch is here: https://github.com/marinedalek/vcpkg/tree/libremidi Clone it using git clone https://github.com/marinedalek/vcpkg.git --branch libremidi and run bootstrap-vcpkg.bat to download the vcpkg binary.

There are further instructions here: https://learn.microsoft.com/en-us/vcpkg/examples/manifest-mode-cmake or to build just the UWP version, you can run vcpkg install libremidi:x64-uwp

marinedalek avatar Sep 19 '23 02:09 marinedalek

heya, I'm going through all the steps - it seems to work on already most of the OSes, super nice and thanks for doing this!

First build error

https://dev.azure.com/vcpkg/public/_build/results?buildId=94328&view=logs&j=878666d5-db33-5b27-9e7d-b0c7ee352005&t=3980505e-92f5-53ef-75a8-4f2e70b97516

##[error]Found the following errors:
##[error]versions/l-/libremidi.json(2,): error : while parsing versions for libremidi from version/l-/libremidi.json
4.0 is declared with 596c1313e051acf0d6af025900facc7174c8d12b, but the local port has a different SHA b11db5e2edfeb6789c91b45c19f2b9fb3f60a35e.

I guess some SHA has to be updated somewhere.. weird that it does not cause any issue on the other builds though, maybe a spurious failure.

Second and third error

https://dev.azure.com/vcpkg/public/_build/results?buildId=94328&view=logs&j=afe306fb-88a0-5d5e-2934-71aa01507316&t=5029ab74-fefd-5c62-0657-5855530a064d

https://dev.azure.com/vcpkg/public/_build/results?buildId=94328&view=logs&j=f3185963-cf64-542d-738a-b43a7110d124&t=2c19ce80-94f8-552d-2342-a0796f515613

CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: D:/downloads/tools/cmake-3.27.1-windows/cmake-3.27.1-windows-i386/bin/cmake.exe --build . --config Debug --target install -- -v -j33
    Working Directory: D:/buildtrees/libremidi/x64-uwp-dbg
    See logs for more information:
      D:\buildtrees\libremidi\install-x64-uwp-dbg-out.log

Call Stack (most recent call first):
  D:/installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  D:/installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/libremidi/portfile.cmake:13 (vcpkg_cmake_install)
  scripts/ports.cmake:147 (include)

to check this I'd really need to see the D:\buildtrees\libremidi\install-x64-uwp-dbg-out.log log file... error can be anywhere. gonna try a build against UWP platform locally to see...

jcelerier avatar Sep 24 '23 18:09 jcelerier

okay, I could reproduce an error locally.. it seems that just setting LIBREMIDI_NO_WINMM in the offending cases is enough. i'll add acheck for if we're targeting windows store.

jcelerier avatar Sep 24 '23 18:09 jcelerier

if you can try with git master..

jcelerier avatar Sep 24 '23 18:09 jcelerier

Hi, thanks for looking at this! The first build error is just an internal check for something that needs to be set once all modifications to the port are complete - I'll fix that just before marking the pull request as ready.

Sounds like you found the source of the error I was seeing, so I'll test building from head later after I finish work.

Thanks again!

marinedalek avatar Sep 24 '23 19:09 marinedalek

I tagged a new version with the fixes if it makes it easier (but if it does not just set -DLIBREMIDI_NO_WINMM=1 to cmake in the uwp vcpkg configurations and it should be good)

jcelerier avatar Sep 24 '23 23:09 jcelerier

That's great! I've updated the port to point to the new tag, and all checks now pass. I've marked the pull request as ready and requested a re-review with the new changes, so hopefully (assuming there are no further review comments) it should be accepted and merged soon :)

marinedalek avatar Sep 25 '23 02:09 marinedalek

super thank you so much!

jcelerier avatar Sep 26 '23 01:09 jcelerier

seems to have been merged to vcpkg, yay!

jcelerier avatar Sep 26 '23 18:09 jcelerier