Skip to content

Commit f602d94

Browse files
committed
fixup! WIP: Android
1 parent e38ab31 commit f602d94

File tree

7 files changed

+99
-20
lines changed

7 files changed

+99
-20
lines changed

CMakeLists.txt

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3579,15 +3579,6 @@ target_link_libraries(
35793579
# PortAudio
35803580
find_package(PortAudio REQUIRED)
35813581
target_link_libraries(mixxx-lib PUBLIC PortAudio::PortAudio)
3582-
# FIXME move to PortAudio pkgconfig
3583-
target_link_libraries(mixxx-lib PUBLIC OpenSLES)
3584-
target_compile_definitions(mixxx-lib PUBLIC PA_USE_OPENSLES)
3585-
target_link_libraries(
3586-
mixxx-lib
3587-
PUBLIC
3588-
/workspaces/mixxx/buildenv/mixxx-deps-2.6-arm64-android-rel-da4c207/installed/arm64-android-release/lib/liboboe.a
3589-
)
3590-
target_compile_definitions(mixxx-lib PUBLIC PA_USE_OBOE)
35913582

35923583
# PortAudio Ring Buffer
35933584
add_library(
@@ -4989,8 +4980,6 @@ if(HID)
49894980
target_sources(
49904981
mixxx-lib
49914982
PRIVATE
4992-
src/controllers/controllerhidreporttabsmanager.cpp
4993-
src/controllers/android.cpp
49944983
src/controllers/hid/hidcontroller.cpp
49954984
src/controllers/hid/hidiothread.cpp
49964985
src/controllers/hid/hidioglobaloutputreportfifo.cpp
@@ -5002,6 +4991,16 @@ if(HID)
50024991
src/controllers/hid/legacyhidcontrollermapping.cpp
50034992
src/controllers/hid/legacyhidcontrollermappingfilehandler.cpp
50044993
)
4994+
4995+
if(CMAKE_SYSTEM_NAME STREQUAL Android)
4996+
target_sources(mixxx-lib PRIVATE src/controllers/android.cpp)
4997+
else()
4998+
# Android doesn't support QWidget and is not able to compile this manager due to compiler lacking support for structure binding (error: capturing a structured binding is not yet supported)
4999+
target_sources(
5000+
mixxx-lib
5001+
PRIVATE src/controllers/controllerhidreporttabsmanager.cpp
5002+
)
5003+
endif()
50055004
target_compile_definitions(mixxx-lib PUBLIC __HID__)
50065005
endif()
50075006

cmake/modules/FindOboe.cmake

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#[=======================================================================[.rst:
2+
FindOboe
3+
--------
4+
5+
Finds the Oboe library.
6+
7+
Imported Targets
8+
^^^^^^^^^^^^^^^^
9+
10+
This module provides the following imported targets, if found:
11+
12+
``Oboe::Oboe``
13+
The Oboe library
14+
15+
#]=======================================================================]
16+
17+
# Prefer finding the libraries from pkgconfig rather than find_library. This is
18+
# required to build with PipeWire's reimplementation of the Oboe library.
19+
#
20+
# This also enables using PortAudio with the Oboe port in vcpkg. That only
21+
# builds OboeWeakAPI (not the Oboe server) which dynamically loads the real
22+
# Oboe library and forwards API calls to it. OboeWeakAPI requires linking `dl`
23+
# in addition to Oboe, as specified in the pkgconfig file in vcpkg.
24+
find_package(PkgConfig QUIET)
25+
if(PkgConfig_FOUND)
26+
pkg_check_modules(Oboe Oboe)
27+
endif()
28+
29+
find_path(
30+
Oboe_INCLUDE_DIR
31+
NAMES oboe/Oboe.h
32+
HINTS ${PC_Oboe_INCLUDE_DIRS}
33+
DOC "Oboe include directory"
34+
)
35+
mark_as_advanced(Oboe_INCLUDE_DIR)
36+
37+
find_library(
38+
Oboe_LIBRARY
39+
NAMES oboe
40+
HINTS ${PC_Oboe_LIBRARY_DIRS}
41+
DOC "Oboe library"
42+
)
43+
mark_as_advanced(Oboe_LIBRARY)
44+
45+
if(DEFINED PC_Oboe_VERSION AND NOT PC_Oboe_VERSION STREQUAL "")
46+
set(Oboe_VERSION "${PC_Oboe_VERSION}")
47+
endif()
48+
49+
include(FindPackageHandleStandardArgs)
50+
find_package_handle_standard_args(
51+
Oboe
52+
REQUIRED_VARS Oboe_LIBRARY Oboe_INCLUDE_DIR
53+
VERSION_VAR Oboe_VERSION
54+
)
55+
56+
if(Oboe_FOUND)
57+
set(Oboe_LIBRARIES "${Oboe_LIBRARY}")
58+
set(Oboe_INCLUDE_DIRS "${Oboe_INCLUDE_DIR}")
59+
set(Oboe_DEFINITIONS ${PC_Oboe_CFLAGS_OTHER})
60+
61+
if(NOT TARGET Oboe::Oboe)
62+
add_library(Oboe::Oboe UNKNOWN IMPORTED)
63+
set_target_properties(
64+
Oboe::Oboe
65+
PROPERTIES
66+
IMPORTED_LOCATION "${Oboe_LIBRARY}"
67+
INTERFACE_COMPILE_OPTIONS "${PC_Oboe_CFLAGS_OTHER}"
68+
INTERFACE_INCLUDE_DIRECTORIES "${Oboe_INCLUDE_DIR}"
69+
)
70+
endif()
71+
endif()

cmake/modules/FindPortAudio.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ if(PortAudio_FOUND)
110110
PROPERTY INTERFACE_LINK_LIBRARIES JACK::jack
111111
)
112112
endif()
113+
if(CMAKE_SYSTEM_NAME STREQUAL Android)
114+
target_link_libraries(mixxx-lib PUBLIC OpenSLES)
115+
target_compile_definitions(mixxx-lib PUBLIC PA_USE_OPENSLES)
116+
find_package(Oboe)
117+
if(NOT (OBOE_FOUND))
118+
message(FATAL_ERROR "Oboe: not found")
119+
endif()
120+
set_property(
121+
TARGET PortAudio::PortAudio
122+
APPEND
123+
PROPERTY INTERFACE_LINK_LIBRARIES Oboe::Oboe
124+
)
125+
endif()
113126
endif()
114127
if(PortAudio_ALSA_H)
115128
target_compile_definitions(PortAudio::PortAudio INTERFACE PA_USE_ALSA)

src/controllers/controllerhidreporttabsmanager.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ void ControllerHidReportTabsManager::createHidReportTab(QTabWidget* pParentRepor
127127

128128
populateHidReportTable(pTable, report, reportType);
129129
}
130-
131130
if (reportType != hid::reportDescriptor::HidReportType::Output) {
132131
connect(pReadButton,
133132
&QPushButton::clicked,
@@ -146,7 +145,6 @@ void ControllerHidReportTabsManager::createHidReportTab(QTabWidget* pParentRepor
146145
slotSendReport(pTable, reportId, reportType);
147146
});
148147
}
149-
150148
pParentReportTypeTab->addTab(pTabWidget, tabName);
151149

152150
if (reportType == hid::reportDescriptor::HidReportType::Input) {

src/controllers/dlgprefcontroller.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#endif
1919
#include "controllers/defs_controllers.h"
2020
#include "controllers/dlgcontrollerlearning.h"
21-
#ifdef __HID__
21+
#if defined(__HID__) && !defined(Q_OS_ANDROID)
2222
#include "controllers/hid/hidcontroller.h"
2323
#endif
2424
#include "controllers/midi/legacymidicontrollermapping.h"
@@ -91,7 +91,7 @@ DlgPrefController::DlgPrefController(
9191
m_outputMappingsTabIndex(-1),
9292
m_settingsTabIndex(-1),
9393
m_screensTabIndex(-1)
94-
#ifdef __HID__
94+
#if defined(__HID__) && !defined(Q_OS_ANDROID)
9595
,
9696
m_hidReportTabsManager(nullptr) {
9797
qRegisterMetaType<const hid::reportDescriptor::Control*>();
@@ -188,7 +188,7 @@ DlgPrefController::DlgPrefController(
188188
m_ui.labelUsbInterfaceNumberValue->setVisible(false);
189189
}
190190

191-
#ifdef __HID__
191+
#if defined(__HID__) && !defined(Q_OS_ANDROID)
192192
// Display HID UsagePage and Usage if the controller is an HidController
193193
if (auto* hidController = qobject_cast<HidController*>(m_pController)) {
194194
m_ui.labelHidUsagePageValue->setText(QStringLiteral("%1 (%2)")

src/controllers/dlgprefcontroller.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <memory>
44

5-
#ifdef __HID__
5+
#if defined(__HID__) && !defined(Q_OS_ANDROID)
66
#include "controllers/controllerhidreporttabsmanager.h"
77
#endif
88
#include "controllers/controllermappinginfo.h"
@@ -151,7 +151,7 @@ class DlgPrefController : public DlgPreferencePage {
151151
int m_screensTabIndex; // Index of the screens tab
152152
QHash<QString, bool> m_settingsCollapsedStates;
153153

154-
#ifdef __HID__
154+
#if defined(__HID__) && !defined(Q_OS_ANDROID)
155155
std::unique_ptr<ControllerHidReportTabsManager> m_hidReportTabsManager;
156156
#endif
157157
};

tools/android_buildenv.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ case "$1" in
111111
export BUILDENV_URL
112112
export BUILDENV_SHA256
113113
export MIXXX_VCPKG_ROOT="${BUILDENV_PATH}"
114-
export CMAKE_GENERATOR=Ninja
115114
export VCPKG_TARGET_TRIPLET="${VCPKG_TARGET_TRIPLET}"
116115

117116
echo_exported_variables() {
@@ -122,7 +121,6 @@ case "$1" in
122121
echo "BUILDENV_URL=${BUILDENV_URL}"
123122
echo "BUILDENV_SHA256=${BUILDENV_SHA256}"
124123
echo "MIXXX_VCPKG_ROOT=${MIXXX_VCPKG_ROOT}"
125-
echo "CMAKE_GENERATOR=${CMAKE_GENERATOR}"
126124
echo "VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}"
127125
}
128126

0 commit comments

Comments
 (0)