From 01287cb7da3f74064701311fe787542092b35728 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 7 Jul 2020 20:27:06 +1000 Subject: [PATCH] build: Support building libretro core for Android --- CMakeLists.txt | 4 ++-- src/common/CMakeLists.txt | 2 +- src/common/gl/context.cpp | 4 +++- src/duckstation-libretro/CMakeLists.txt | 4 ++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c98a72fa..19693ea93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ if(BUILD_LIBRETRO_CORE) if(USE_X11) set(USE_X11 OFF) endif() - if(USE_EGL) + if(BUILD_LIBRETRO_CORE AND USE_EGL) set(USE_EGL OFF) endif() @@ -187,6 +187,6 @@ enable_testing() add_subdirectory(dep) add_subdirectory(src) -if(ANDROID) +if(ANDROID AND NOT BUILD_LIBRETRO_CORE) add_subdirectory(android/app/src/cpp) endif() diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 74d73722b..5ca16a2f2 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -141,7 +141,7 @@ if(USE_EGL) gl/context_egl_x11.h ) endif() - if(ANDROID) + if(ANDROID AND USE_EGL) target_sources(common PRIVATE gl/context_egl_android.cpp gl/context_egl_android.h diff --git a/src/common/gl/context.cpp b/src/common/gl/context.cpp index 20c65b760..1c6fdbd1a 100644 --- a/src/common/gl/context.cpp +++ b/src/common/gl/context.cpp @@ -75,8 +75,10 @@ std::unique_ptr Context::Create(const WindowInfo& wi, const Version #elif defined(__APPLE__) context = ContextAGL::Create(wi, versions_to_try, num_versions_to_try); #elif defined(ANDROID) +#ifdef USE_EGL context = ContextEGLAndroid::Create(wi, versions_to_try, num_versions_to_try); -#else +#endif +#elif defined(USE_X11) if (wi.type == WindowInfo::Type::X11) { #ifdef USE_EGL diff --git a/src/duckstation-libretro/CMakeLists.txt b/src/duckstation-libretro/CMakeLists.txt index 7b6c34e3a..ebb1ff3a7 100644 --- a/src/duckstation-libretro/CMakeLists.txt +++ b/src/duckstation-libretro/CMakeLists.txt @@ -30,3 +30,7 @@ set_target_properties(duckstation_libretro PROPERTIES PREFIX "") set_target_properties(duckstation_libretro PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set_target_properties(duckstation_libretro PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") +# for android, suffix _android +if(ANDROID) + set_target_properties(duckstation_libretro PROPERTIES OUTPUT_NAME "duckstation_libretro_android") +endif()