Skip to content

Commit

Permalink
Merge pull request #315 from YellowLabrador/master
Browse files Browse the repository at this point in the history
Added Android support to rtmidi
  • Loading branch information
garyscavone committed Jul 4, 2023
2 parents e6e24db + cbb0297 commit 6c5953b
Show file tree
Hide file tree
Showing 8 changed files with 556 additions and 13 deletions.
26 changes: 17 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# CopyPolicy: RtMidi license.

# Set minimum CMake required version for this project.
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)

# Define a C++ project.
project(RtMidi LANGUAGES CXX C)
Expand Down Expand Up @@ -40,11 +40,10 @@ set(RTMIDI_TARGETNAME_UNINSTALL "uninstall" CACHE STRING "Name of 'uninstall' bu

# API Options
option(RTMIDI_API_JACK "Compile with JACK support." ${HAVE_JACK})
if(UNIX AND NOT APPLE)
option(RTMIDI_API_ALSA "Compile with ALSA support." ON)
endif()
option(RTMIDI_API_WINMM "Compile with WINMM support." ${WIN32})
option(RTMIDI_API_CORE "Compile with CoreMIDI support." ${APPLE})
option(RTMIDI_API_ALSA "Compile with ALSA support." ${ALSA})
option(RTMIDI_API_AMIDI "Compile with Android support." ${ANDROID})

# Add -Wall if possible
if (CMAKE_COMPILER_IS_GNUCXX)
Expand Down Expand Up @@ -119,12 +118,9 @@ if(RTMIDI_API_JACK)
endif()

# ALSA
if(RTMIDI_API_ALSA)
find_package(ALSA)
if(ALSA_FOUND OR ALSA)
set(NEED_PTHREAD ON)
find_package(ALSA)
if (NOT ALSA_FOUND)
message(FATAL_ERROR "ALSA API requested but no ALSA dev libraries found")
endif()
list(APPEND INCDIRS ${ALSA_INCLUDE_DIR})
list(APPEND LINKLIBS ALSA::ALSA)
list(APPEND PKGCONFIG_REQUIRES "alsa")
Expand Down Expand Up @@ -153,6 +149,18 @@ if(RTMIDI_API_CORE)
list(APPEND LINKFLAGS "-Wl,-F/Library/Frameworks")
endif()

# Android AMIDI
if(ANDROID)
set(NEED_PTHREAD ON)
set(JAVA_INCLUDE_PATH2 NotNeeded)
set(JAVA_AWT_INCLUDE_PATH NotNeeded)
find_package(JNI)
# find_library(ALOG_LIB log android)
list(APPEND API_DEFS "-D__AMIDI__")
list(APPEND API_LIST "amidi")
list(APPEND LINKLIBS log ${JNI_LIBRARIES} amidi)
endif()

# pthread
if (NEED_PTHREAD)
find_package(Threads REQUIRED
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![Build Status](https://github.com/thestk/rtmidi/actions/workflows/ci.yml/badge.svg)
[![Conan Center](https://shields.io/conan/v/rtmidi)](https://conan.io/center/rtmidi)

A set of C++ classes that provide a common API for realtime MIDI input/output across Linux (ALSA & JACK), Macintosh OS X (CoreMIDI & JACK) and Windows (Multimedia).
A set of C++ classes that provide a common API for realtime MIDI input/output across Linux (ALSA & JACK), Macintosh OS X (CoreMIDI & JACK), Windows (Multimedia) and Android.

By Gary P. Scavone, 2003-2021.

Expand Down

0 comments on commit 6c5953b

Please sign in to comment.