add support for building without RtMidi

This commit is contained in:
tildearrow 2022-02-21 13:47:49 -05:00
parent db553ba91c
commit fd28d1aef0
2 changed files with 27 additions and 14 deletions

View file

@ -18,9 +18,11 @@ set(CMAKE_PROJECT_VERSION_PATCH 7)
if (ANDROID) if (ANDROID)
set(BUILD_GUI_DEFAULT OFF) set(BUILD_GUI_DEFAULT OFF)
set(USE_RTMIDI_DEFAULT OFF)
set(SYSTEM_SDL2_DEFAULT ON) set(SYSTEM_SDL2_DEFAULT ON)
else() else()
set(BUILD_GUI_DEFAULT ON) set(BUILD_GUI_DEFAULT ON)
set(USE_RTMIDI_DEFAULT ON)
set(SYSTEM_SDL2_DEFAULT OFF) set(SYSTEM_SDL2_DEFAULT OFF)
endif() endif()
@ -33,6 +35,7 @@ else()
endif() endif()
option(BUILD_GUI "Build the tracker (disable to build only a headless player)" ${BUILD_GUI_DEFAULT}) option(BUILD_GUI "Build the tracker (disable to build only a headless player)" ${BUILD_GUI_DEFAULT})
option(USE_RTMIDI "Build with MIDI support using RtMidi. Currently unfinished." ${USE_RTMIDI_DEFAULT})
option(WITH_JACK "Whether to build with JACK support. Auto-detects if JACK is available" ${WITH_JACK_DEFAULT}) option(WITH_JACK "Whether to build with JACK support. Auto-detects if JACK is available" ${WITH_JACK_DEFAULT})
option(SYSTEM_FMT "Use a system-installed version of fmt instead of the vendored one" OFF) option(SYSTEM_FMT "Use a system-installed version of fmt instead of the vendored one" OFF)
option(SYSTEM_LIBSNDFILE "Use a system-installed version of libsndfile instead of the vendored one" OFF) option(SYSTEM_LIBSNDFILE "Use a system-installed version of libsndfile instead of the vendored one" OFF)
@ -105,20 +108,22 @@ else()
message(STATUS "Using vendored libsndfile") message(STATUS "Using vendored libsndfile")
endif() endif()
if (SYSTEM_RTMIDI) if (USE_RTMIDI)
find_package(PkgConfig REQUIRED) if (SYSTEM_RTMIDI)
pkg_check_modules(RTMIDI REQUIRED rtmidi) find_package(PkgConfig REQUIRED)
list(APPEND DEPENDENCIES_INCLUDE_DIRS ${RTMIDI_INCLUDE_DIRS}) pkg_check_modules(RTMIDI REQUIRED rtmidi)
list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${RTMIDI_CFLAGS_OTHER}) list(APPEND DEPENDENCIES_INCLUDE_DIRS ${RTMIDI_INCLUDE_DIRS})
list(APPEND DEPENDENCIES_LIBRARIES ${RTMIDI_LIBRARIES}) list(APPEND DEPENDENCIES_COMPILE_OPTIONS ${RTMIDI_CFLAGS_OTHER})
list(APPEND DEPENDENCIES_LIBRARY_DIRS ${RTMIDI_LIBRARY_DIRS}) list(APPEND DEPENDENCIES_LIBRARIES ${RTMIDI_LIBRARIES})
list(APPEND DEPENDENCIES_LINK_OPTIONS ${RTMIDI_LDFLAGS_OTHER}) list(APPEND DEPENDENCIES_LIBRARY_DIRS ${RTMIDI_LIBRARY_DIRS})
list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${RTMIDI_LDFLAGS}) list(APPEND DEPENDENCIES_LINK_OPTIONS ${RTMIDI_LDFLAGS_OTHER})
message(STATUS "Using system-installed RtMidi") list(APPEND DEPENDENCIES_LEGACY_LDFLAGS ${RTMIDI_LDFLAGS})
else() message(STATUS "Using system-installed RtMidi")
add_subdirectory(extern/rtmidi EXCLUDE_FROM_ALL) else()
list(APPEND DEPENDENCIES_LIBRARIES rtmidi) add_subdirectory(extern/rtmidi EXCLUDE_FROM_ALL)
message(STATUS "Using vendored RtMidi") list(APPEND DEPENDENCIES_LIBRARIES rtmidi)
message(STATUS "Using vendored RtMidi")
endif()
endif() endif()
if (SYSTEM_ZLIB) if (SYSTEM_ZLIB)
@ -210,6 +215,13 @@ else()
message(STATUS "Building without JACK support") message(STATUS "Building without JACK support")
endif() endif()
if (USE_RTMIDI)
list(APPEND AUDIO_SOURCES src/audio/rtmidi.cpp)
message(STATUS "Building with RtMidi")
else()
message(STATUS "Building without RtMidi")
endif()
set(ENGINE_SOURCES set(ENGINE_SOURCES
src/log.cpp src/log.cpp
src/fileutils.cpp src/fileutils.cpp

1
src/audio/rtmidi.cpp Normal file
View file

@ -0,0 +1 @@
#include "rtmidi.h"