Skip to content

Commit 6c5953b

Browse files
authored
Merge pull request #315 from YellowLabrador/master
Added Android support to rtmidi
2 parents e6e24db + cbb0297 commit 6c5953b

File tree

8 files changed

+556
-13
lines changed

8 files changed

+556
-13
lines changed

CMakeLists.txt

+17-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# CopyPolicy: RtMidi license.
33

44
# Set minimum CMake required version for this project.
5-
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
5+
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
66

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

4141
# API Options
4242
option(RTMIDI_API_JACK "Compile with JACK support." ${HAVE_JACK})
43-
if(UNIX AND NOT APPLE)
44-
option(RTMIDI_API_ALSA "Compile with ALSA support." ON)
45-
endif()
4643
option(RTMIDI_API_WINMM "Compile with WINMM support." ${WIN32})
4744
option(RTMIDI_API_CORE "Compile with CoreMIDI support." ${APPLE})
45+
option(RTMIDI_API_ALSA "Compile with ALSA support." ${ALSA})
46+
option(RTMIDI_API_AMIDI "Compile with Android support." ${ANDROID})
4847

4948
# Add -Wall if possible
5049
if (CMAKE_COMPILER_IS_GNUCXX)
@@ -119,12 +118,9 @@ if(RTMIDI_API_JACK)
119118
endif()
120119

121120
# ALSA
122-
if(RTMIDI_API_ALSA)
121+
find_package(ALSA)
122+
if(ALSA_FOUND OR ALSA)
123123
set(NEED_PTHREAD ON)
124-
find_package(ALSA)
125-
if (NOT ALSA_FOUND)
126-
message(FATAL_ERROR "ALSA API requested but no ALSA dev libraries found")
127-
endif()
128124
list(APPEND INCDIRS ${ALSA_INCLUDE_DIR})
129125
list(APPEND LINKLIBS ALSA::ALSA)
130126
list(APPEND PKGCONFIG_REQUIRES "alsa")
@@ -153,6 +149,18 @@ if(RTMIDI_API_CORE)
153149
list(APPEND LINKFLAGS "-Wl,-F/Library/Frameworks")
154150
endif()
155151

152+
# Android AMIDI
153+
if(ANDROID)
154+
set(NEED_PTHREAD ON)
155+
set(JAVA_INCLUDE_PATH2 NotNeeded)
156+
set(JAVA_AWT_INCLUDE_PATH NotNeeded)
157+
find_package(JNI)
158+
# find_library(ALOG_LIB log android)
159+
list(APPEND API_DEFS "-D__AMIDI__")
160+
list(APPEND API_LIST "amidi")
161+
list(APPEND LINKLIBS log ${JNI_LIBRARIES} amidi)
162+
endif()
163+
156164
# pthread
157165
if (NEED_PTHREAD)
158166
find_package(Threads REQUIRED

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![Build Status](https://github.com/thestk/rtmidi/actions/workflows/ci.yml/badge.svg)
44
[![Conan Center](https://shields.io/conan/v/rtmidi)](https://conan.io/center/rtmidi)
55

6-
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).
6+
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.
77

88
By Gary P. Scavone, 2003-2021.
99

0 commit comments

Comments
 (0)