diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml new file mode 100644 index 00000000..e8cc5b6e --- /dev/null +++ b/.github/workflows/mingw.yml @@ -0,0 +1,73 @@ +name: MSYS2 build + +on: push + +jobs: + mingw: + runs-on: windows-latest + strategy: + matrix: + sys: + - mingw64 + - ucrt64 + - clang64 +# - clangarm64 + + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Setup msys2 and mingw-w64 + uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + pacboy: >- + cmake:p + ninja:p + toolchain:p + cppwinrt:p + boost:p + + - name: Build debug + shell: msys2 {0} + run: | + cmake -S . -B build-debug \ + -DCMAKE_BUILD_TYPE=Debug \ + -DBUILD_TESTING=1 \ + -DLIBREMIDI_EXAMPLES=1 \ + -DLIBREMIDI_TESTS=1 \ + -DLIBREMIDI_CI=1 \ + -DCMAKE_CTEST_ARGUMENTS="--rerun-failed;--output-on-failure" \ + -DCMAKE_INSTALL_PREFIX=install + + cmake --build build-debug + cmake --build build-debug --target install + + - name: Test debug + shell: msys2 {0} + run: | + cmake --build build-debug --target test + + - name: Build release + shell: msys2 {0} + run: | + cmake -S . -B build-release \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=1 \ + -DLIBREMIDI_EXAMPLES=1 \ + -DLIBREMIDI_TESTS=1 \ + -DLIBREMIDI_CI=1 \ + -DCMAKE_CTEST_ARGUMENTS="--rerun-failed;--output-on-failure" \ + -DCMAKE_INSTALL_PREFIX=install + + cmake --build build-release + cmake --build build-release --target install + + - name: Test release + shell: msys2 {0} + run: | + cmake --build build-release --target test + diff --git a/cmake/libremidi.deps.cmake b/cmake/libremidi.deps.cmake index fe488e79..13c878ca 100644 --- a/cmake/libremidi.deps.cmake +++ b/cmake/libremidi.deps.cmake @@ -44,11 +44,11 @@ if(LIBREMIDI_NEEDS_READERWRITERQUEUE AND NOT TARGET readerwriterqueue) if(NOT readerwriterqueue_FOUND) FetchContent_Declare( - readerwriterqueue + rwq GIT_REPOSITORY https://github.com/cameron314/readerwriterqueue GIT_TAG master ) - FetchContent_MakeAvailable(readerwriterqueue) + FetchContent_MakeAvailable(rwq) endif() endif() diff --git a/cmake/libremidi.tests.cmake b/cmake/libremidi.tests.cmake index 511b1ffb..505381fb 100644 --- a/cmake/libremidi.tests.cmake +++ b/cmake/libremidi.tests.cmake @@ -1,7 +1,12 @@ +if(CMAKE_VERSION VERSION_GREATER 3.25) + set(CMAKE_FETCHCONTENT_SYSTEM_KEYWORD "SYSTEM") +endif() + FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.4.0 + ${CMAKE_FETCHCONTENT_SYSTEM_KEYWORD} ) FetchContent_MakeAvailable(Catch2) diff --git a/include/libremidi/backends/winmidi/observer.hpp b/include/libremidi/backends/winmidi/observer.hpp index 304179e2..3380de44 100644 --- a/include/libremidi/backends/winmidi/observer.hpp +++ b/include/libremidi/backends/winmidi/observer.hpp @@ -167,7 +167,7 @@ class observer_impl final } void on_device_updated( - const MidiEndpointDeviceWatcher& e, + const MidiEndpointDeviceWatcher&, const MidiEndpointDeviceInformationUpdatedEventArgs& result) { // OPTIMIZEME diff --git a/include/libremidi/backends/winuwp/midi_in.hpp b/include/libremidi/backends/winuwp/midi_in.hpp index 0ccfbc50..2cd6eeda 100644 --- a/include/libremidi/backends/winuwp/midi_in.hpp +++ b/include/libremidi/backends/winuwp/midi_in.hpp @@ -47,7 +47,8 @@ class midi_in_winuwp final midi_start_timestamp = std::chrono::steady_clock::now(); port_.MessageReceived( - [=](const winrt::Windows::Devices::Midi::IMidiInPort& inputPort, + [this]( + const winrt::Windows::Devices::Midi::IMidiInPort&, const winrt::Windows::Devices::Midi::MidiMessageReceivedEventArgs& args) { this->process_message(args.Message()); }); diff --git a/include/libremidi/backends/winuwp/observer.hpp b/include/libremidi/backends/winuwp/observer.hpp index 7b5d2430..83e7a97f 100644 --- a/include/libremidi/backends/winuwp/observer.hpp +++ b/include/libremidi/backends/winuwp/observer.hpp @@ -1,5 +1,6 @@ #pragma once #include +#include #include namespace libremidi @@ -33,11 +34,11 @@ class observer_winuwp_internal cbs.emplace_back(tk, f); return tk; } + void remove(int tk) { auto it = std::remove_if( cbs.begin(), cbs.end(), [tk](const callback& c) { return c.token == tk; }); - auto r = std::distance(it, cbs.end()); cbs.erase(it, cbs.end()); } }; @@ -122,7 +123,7 @@ class observer_winuwp_internal deviceWatcher_.Added(evTokenOnDeviceAdded_); } - void on_device_added(DeviceWatcher sender, DeviceInformation deviceInfo) + void on_device_added(const DeviceWatcher&, const DeviceInformation& deviceInfo) { port_info p; { @@ -133,7 +134,7 @@ class observer_winuwp_internal portAddedEvent_(p); } - void on_device_removed(DeviceWatcher sender, DeviceInformationUpdate deviceUpdate) + void on_device_removed(const DeviceWatcher&, const DeviceInformationUpdate& deviceUpdate) { const auto id = deviceUpdate.Id(); auto pred = [&id](const port_info& portInfo) { return portInfo.id == id; }; @@ -152,9 +153,9 @@ class observer_winuwp_internal portRemovedEvent_(*p); } - void on_device_updated(DeviceWatcher sender, DeviceInformationUpdate deviceUpdate) { } + void on_device_updated(const DeviceWatcher&, const DeviceInformationUpdate&) { } - void on_device_enumeration_completed(DeviceWatcher sender, IInspectable const&) { } + void on_device_enumeration_completed(const DeviceWatcher&, const IInspectable&) { } private: std::vector portList_;