diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml new file mode 100644 index 0000000..a90cf2e --- /dev/null +++ b/.github/workflows/ccpp.yml @@ -0,0 +1,109 @@ +--- +name: Build CI +on: [push] # yamllint disable-line rule:truthy +jobs: + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - { + name: "Windows MSVC", + enabled: 1, + os: windows-latest, + deps: "", + config: "cmake + -B build + -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake + -DWERROR=1 + -DCMAKE_BUILD_TYPE=Debug + ", + build: "cmake --build build --config Debug", + # all tests work except "performance" (liblo bug?) + # this weird regex lets all those tests run, except performance + test: "ctest --output-on-failure --test-dir build -R '(i|s|t|g)'" + } + - { + name: "Ubuntu gcc", + enabled: 1, + os: ubuntu-latest, + deps: "sudo apt-get install liblo-dev", + config: "cd build && cmake -DWERROR=1 ..", + build: "cd build && make", + test: "cd build && ctest --output-on-failure" + } + - { + name: "Ubuntu clang+lld", + enabled: 1, + os: ubuntu-latest, + deps: "sudo apt-get install liblo-dev", + config: "cd build && + cmake + -DWERROR=1 + -DCMAKE_C_COMPILER=clang + -DCMAKE_CXX_COMPILER=clang++ + -DCMAKE_SHARED_LINKER_FLAGS='-fuse-ld=lld' + -DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=lld' + ..", + build: "cd build && make", + test: "cd build && ctest --output-on-failure" + } + - { + name: "Ubuntu mingw32", + enabled: 1, + os: ubuntu-latest, + deps: "sudo apt-get install liblo-dev mingw-w64", + config: "cd build && + cmake + -DWERROR=1 + CC=i686-w64-mingw32-gcc-win32 + CXX=i686-w64-mingw32-g++-win32 + ..", + build: "cd build && make", + test: "cd build && ctest --output-on-failure" + } + - { + name: "Ubuntu mingw64", + enabled: 1, + os: ubuntu-latest, + deps: "sudo apt-get install liblo-dev mingw-w64", + config: "cd build && + cmake + -DWERROR=1 + CC=x86_64-w64-mingw32-gcc-win32 + CXX=x86_64-w64-mingw32-g++-win32 + ..", + build: "cd build && make", + test: "cd build && ctest --output-on-failure" + } + - { + name: "macOS clang", + enabled: 1, + os: macos-latest, + deps: "brew install liblo", + config: "cd build && cmake -DWERROR=1 ..", + build: "cd build && make", + test: "cd build && ctest --output-on-failure" + } + steps: + - name: check out + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: install deps + if: ${{ matrix.config.enabled == 1 }} + run: ${{ matrix.config.deps }} + - name: create build directory + if: ${{ matrix.config.enabled == 1 }} + run: mkdir build + - name: configure + if: ${{ matrix.config.enabled == 1 }} + run: ${{ matrix.config.config }} + - name: make + if: ${{ matrix.config.enabled == 1 }} + run: ${{ matrix.config.build }} + - name: make test + if: ${{ matrix.config.enabled == 1 }} + run: ${{ matrix.config.test }} diff --git a/.github/workflows/yaml.yml b/.github/workflows/yaml.yml new file mode 100644 index 0000000..c884178 --- /dev/null +++ b/.github/workflows/yaml.yml @@ -0,0 +1,13 @@ +--- +name: Build CI +on: [push] # yamllint disable-line rule:truthy +jobs: + yamllint: + name: yamllint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: yamllint-this + run: yamllint -s .github/workflows/yaml.yml + - name: yamllint-ccpp + run: yamllint -s .github/workflows/ccpp.yml diff --git a/CMakeLists.txt b/CMakeLists.txt index 33d80ac..e0cdfa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ set(VERSION_MAJOR 0) set(VERSION_MINOR 3) set(VERSION_PATCH 1) +SET(CMAKE_CXX_STANDARD 17) + #Find Packages find_package(Doxygen) @@ -25,11 +27,18 @@ else() set(GUI_FOUND FALSE) endif(FLTK_FOUND) -if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")) +if(MSVC) + find_package(liblo) + if(liblo_FOUND) + set(LIBLO_FOUND TRUE) + endif() +else() find_package(PkgConfig) if(PKG_CONFIG_FOUND) - pkg_check_modules(JACK jack) pkg_check_modules(LIBLO liblo>=0.28) + if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")) + pkg_check_modules(JACK jack) + endif() endif() endif() @@ -167,6 +176,11 @@ macro(maketestcpp fname) target_link_libraries(${fname} PRIVATE rtosc-cpp rtosc) #add_test(memcheck_${fname} valgrind --leak-check=full --show-reachable=yes --error-exitcode=1 ./${fname}) endmacro(maketestcpp) +if(PKG_CONFIG_FOUND) + set(RTOSC_LIBLO_LIBRARIES "${LIBLO_LIBRARIES}") +else() + set(RTOSC_LIBLO_LIBRARIES "liblo::liblo") +endif() maketest(rtosc-time) maketest(osc-spec) @@ -182,7 +196,8 @@ maketest(test-arg-iter) if(LIBLO_FOUND) maketest(liblo) target_include_directories(liblo PRIVATE ${LIBLO_INCLUDE_DIRS}) - target_link_libraries(liblo PRIVATE ${LIBLO_LDFLAGS}) + target_link_libraries(liblo PRIVATE ${RTOSC_LIBLO_LIBRARIES}) + target_link_directories(liblo PRIVATE ${LIBLO_LIBRARY_DIRS}) endif() maketestcpp(version) @@ -202,8 +217,10 @@ maketestcpp(path-search) maketestcpp(performance) if(LIBLO_FOUND) - target_link_libraries(performance PRIVATE ${LIBLO_LDFLAGS}) + target_include_directories(performance PRIVATE ${LIBLO_INCLUDE_DIRS}) target_compile_definitions(performance PRIVATE HAVE_LIBLO) + target_link_libraries(performance PRIVATE ${RTOSC_LIBLO_LIBRARIES}) + target_link_directories(performance PRIVATE ${LIBLO_LIBRARY_DIRS}) endif() maketestcpp(undo-test) @@ -219,18 +236,26 @@ maketestcpp(test-automation) if(LIBLO_FOUND) add_library(lo-server test/liblo-server.cpp) - target_include_directories(lo-server PRIVATE ${LIBLO_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include) - target_link_libraries(lo-server PRIVATE ${LIBLO_LDFLAGS} rtosc-cpp rtosc) + target_include_directories(lo-server PRIVATE ${LIBLO_INCLUDE_DIRS}) + target_include_directories(lo-server PRIVATE ${CMAKE_SOURCE_DIR}/include) + target_link_libraries(lo-server PRIVATE ${RTOSC_LIBLO_LIBRARIES}) + target_link_directories(performance PRIVATE ${LIBLO_LIBRARY_DIRS}) set(RTOSC_TEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test CACHE INTERNAL "") set(RTOSC_TEST_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") endif() if(LIBLO_FOUND AND RUBY_FOUND) add_executable(port-checker test/port-checker-main.cpp) - target_link_libraries(port-checker PRIVATE lo-server rtosc-cpp rtosc ${LIBLO_LDFLAGS}) + target_include_directories(port-checker PRIVATE ${LIBLO_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include) + target_link_libraries(port-checker PRIVATE lo-server rtosc-cpp rtosc ${RTOSC_LIBLO_LIBRARIES}) + target_link_directories(port-checker PRIVATE ${LIBLO_LIBRARY_DIRS}) add_executable(port-checker-tester test/port-checker-tester.cpp) - target_link_libraries(port-checker-tester PRIVATE lo-server rtosc-cpp rtosc ${LIBLO_LDFLAGS}) + target_include_directories(port-checker-tester PRIVATE ${LIBLO_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include) + target_link_libraries(port-checker-tester PRIVATE lo-server rtosc-cpp rtosc ${RTOSC_LIBLO_LIBRARIES}) + target_link_directories(port-checker-tester PRIVATE ${LIBLO_LIBRARY_DIRS}) add_executable(port-checker-testapp test/port-checker-testapp.cpp) - target_link_libraries(port-checker-testapp PRIVATE rtosc-cpp rtosc ${LIBLO_LDFLAGS}) + target_include_directories(port-checker-testapp PRIVATE ${LIBLO_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include) + target_link_libraries(port-checker-testapp PRIVATE rtosc-cpp rtosc ${RTOSC_LIBLO_LIBRARIES}) + target_link_directories(port-checker-testapp PRIVATE ${LIBLO_LIBRARY_DIRS}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/test-port-checker.rb ${CMAKE_CURRENT_BINARY_DIR}/test-port-checker.rb COPYONLY) add_test(test-port-checker test-port-checker.rb) diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..7a7a6ff --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,6 @@ +{ + "dependencies": [ + "liblo" + ] +} +