mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-30 18:38:32 +00:00
targets: Add service-lib stub for Android
This commit is contained in:
parent
cb767c7705
commit
0ea7cf8009
src/xrt/targets
|
@ -19,6 +19,13 @@ if(XRT_HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(XRT_FEATURE_SERVICE)
|
if(XRT_FEATURE_SERVICE)
|
||||||
add_subdirectory(ctl)
|
add_subdirectory(ctl)
|
||||||
add_subdirectory(service)
|
endif()
|
||||||
|
|
||||||
|
if(XRT_FEATURE_SERVICE AND XRT_FEATURE_OPENXR)
|
||||||
|
if(ANDROID)
|
||||||
|
add_subdirectory(service-lib)
|
||||||
|
else()
|
||||||
|
add_subdirectory(service)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
22
src/xrt/targets/service-lib/CMakeLists.txt
Normal file
22
src/xrt/targets/service-lib/CMakeLists.txt
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Copyright 2020, Collabora, Ltd.
|
||||||
|
# SPDX-License-Identifier: BSL-1.0
|
||||||
|
|
||||||
|
|
||||||
|
add_library(monado-service MODULE
|
||||||
|
lib.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(monado-service PRIVATE
|
||||||
|
aux_util
|
||||||
|
st_prober
|
||||||
|
ipc_server
|
||||||
|
comp_main
|
||||||
|
target_lists
|
||||||
|
target_instance
|
||||||
|
xrt-external-jni-wrap
|
||||||
|
)
|
||||||
|
|
||||||
|
set_target_properties(monado-service
|
||||||
|
PROPERTIES
|
||||||
|
CXX_STANDARD 17
|
||||||
|
CXX_STANDARD_REQUIRED ON)
|
48
src/xrt/targets/service-lib/lib.cpp
Normal file
48
src/xrt/targets/service-lib/lib.cpp
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright 2020, Collabora, Ltd.
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
/*!
|
||||||
|
* @file
|
||||||
|
* @brief Library exposing IPC server.
|
||||||
|
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
* @ingroup ipc_android
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "target_lists.h"
|
||||||
|
|
||||||
|
#include "jnipp.h"
|
||||||
|
#include "jni.h"
|
||||||
|
|
||||||
|
#include "wrap/android.os.h"
|
||||||
|
#include "wrap/android.view.h"
|
||||||
|
|
||||||
|
#include <android/native_window.h>
|
||||||
|
#include <android/native_window_jni.h>
|
||||||
|
|
||||||
|
using wrap::android::os::ParcelFileDescriptor;
|
||||||
|
using wrap::android::view::Surface;
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
Java_org_freedesktop_monado_ipc_MonadoImpl_nativeAddClient(
|
||||||
|
JNIEnv *env, jobject thiz, jobject parcel_file_descriptor)
|
||||||
|
{
|
||||||
|
jni::init(env);
|
||||||
|
//! @todo do something!
|
||||||
|
// This may be the "entry point" of the native code, or we could already
|
||||||
|
// have another client running, etc.
|
||||||
|
|
||||||
|
ParcelFileDescriptor pfd(parcel_file_descriptor);
|
||||||
|
jni::Object monadoImpl(thiz);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
Java_org_freedesktop_monado_ipc_MonadoImpl_nativeAppSurface(JNIEnv *env,
|
||||||
|
jobject thiz,
|
||||||
|
jobject surface)
|
||||||
|
{
|
||||||
|
jni::init(env);
|
||||||
|
Surface surf(surface);
|
||||||
|
jni::Object monadoImpl(thiz);
|
||||||
|
ANativeWindow *nativeWindow = ANativeWindow_fromSurface(env, surface);
|
||||||
|
|
||||||
|
//! @todo do something!
|
||||||
|
}
|
Loading…
Reference in a new issue