Open3
Yuniframe: Android移植 (ビルド編)

これはマジで超クッソ激烈に面倒。。
Androidは他のプラットフォーム(iOSやUWP、HTML5)と違ってCMakeではパッケージングを完結させることができず、必ずJavaのビルドシステム(Gradle)を経由する必要がある。
ただ、(内部的には)テストだけでも何パターンも存在するyuniframeのビルドファイルを個別の build.gradle
としてリポジトリに用意するのは現実的ではないので、CMake側から build.gradle
やその他のAndroid固有ファイルを生成することにする。
実はGoogle謹製のVisual Studio拡張(AGDE)は同じアプローチを取っている。というわけで参考に使おうかと思ったけど現状のCMakeではうまくプロジェクトを生成できなかったので一旦ボツに。

なんかクラッシュする
art_sigsegv_fault 0x00000000ee09b990
art::FaultManager::HandleFault(int, siginfo*, void*) 0x00000000ee09bf34
art::art_fault_handler(int, siginfo*, void*) (.llvm.5830201453147425094) 0x00000000ee09bc5b
art::SignalChain::Handler(int, siginfo*, void*) 0x0000000056f54fe1
__restore_rt 0x00000000efc55180
get_host_u64_VkBufferView 0x00000000c75ebac0
goldfish_vk::UnwrapMapping::mapHandles_VkBufferView_u64(unsigned long long const*, unsigned long long*, unsigned int) 0x00000000c7609c7f
goldfish_vk::marshal_VkWriteDescriptorSet(goldfish_vk::VulkanStreamGuest*, VkWriteDescriptorSet const*) 0x00000000c7674727
goldfish_vk::VkEncoder::vkUpdateDescriptorSets(VkDevice_T*, unsigned int, VkWriteDescriptorSet const*, unsigned int, VkCopyDescriptorSet const*) 0x00000000c76374fd
goldfish_vk::ResourceTracker::Impl::on_vkUpdateDescriptorSets(void*, VkDevice_T*, unsigned int, VkWriteDescriptorSet const*, unsigned int, VkCopyDescriptorSet const*) 0x00000000c75ffb58
goldfish_vk::ResourceTracker::on_vkUpdateDescriptorSets(void*, VkDevice_T*, unsigned int, VkWriteDescriptorSet const*, unsigned int, VkCopyDescriptorSet const*) 0x00000000c75ff9b6
goldfish_vk::entry_vkUpdateDescriptorSets(VkDevice_T*, unsigned int, VkWriteDescriptorSet const*, unsigned int, VkCopyDescriptorSet const*) 0x00000000c2d9d00f
vulkan::api::(anonymous namespace)::UpdateDescriptorSets(VkDevice_T*, unsigned int, VkWriteDescriptorSet const*, unsigned int, VkCopyDescriptorSet const*) 0x00000000f18deed1
cwgl_backend_linkProgram cwgl-vk-shader.c:336
cwgl_linkProgram cwgl-tracker-s2.c:563
ImGui_ImplCwgl_Init(cwgl_ctx_s *) imgui_impl_cwgl.cpp:67
YFRM_ENTRYPOINT(int, char **) testimgui.cpp:39
SDL_main yfrm-main-sdl2.c:7
Java_org_libsdl_app_SDLActivity_nativeRunMain SDL_android.c:781
art_quick_generic_jni_trampoline 0x00000000edfcdf68
art_quick_invoke_static_stub 0x00000000edfc79a3
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x00000000edfd2a7b
art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*) 0x00000000ee1bb493
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00000000ee1b512d
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00000000ee1c3b91
ExecuteSwitchImplAsm 0x00000000edfceb53
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16846384386394761462) 0x00000000ee181f23
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00000000ee188daa
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00000000ee1b510f
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00000000ee1c7dd6
ExecuteSwitchImplAsm 0x00000000edfceb53
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16846384386394761462) 0x00000000ee181f23
art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*) 0x00000000ee188c56
artQuickToInterpreterBridge 0x00000000ee4f8cca
art_quick_to_interpreter_bridge 0x00000000edfce03e
art_quick_invoke_stub 0x00000000edfc77d3
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x00000000edfd2a6a
art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*) 0x00000000ee3e3604
art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*) 0x00000000ee3e4a0b
art::Thread::CreateCallback(void*) 0x00000000ee433b42
__pthread_start(void*) 0x00000000efcdd8e6
__start_thread 0x00000000efc726a8
__bionic_clone 0x00000000efc55147
goldfish_vk::marshal_VkWriteDescriptorSet
の実装 https://android.googlesource.com/device/generic/goldfish-opengl/+/8364ce8^!/ を見るに、どうも不要なポインタを無視する実装になっていないようだ。
もっとも、コレを入れても正常にレンダリングされない。

とりあえずテンプレを準備
これリソースの扱いが難しいな。。
そもそもAndroidのリソースってLauncher以外にも当然使われるので不要なものが割と多い。。