build: Support building libretro core for Android

This commit is contained in:
Connor McLaughlin 2020-07-07 20:27:06 +10:00
parent c242d4707f
commit 01287cb7da
4 changed files with 10 additions and 4 deletions

View file

@ -50,7 +50,7 @@ if(BUILD_LIBRETRO_CORE)
if(USE_X11) if(USE_X11)
set(USE_X11 OFF) set(USE_X11 OFF)
endif() endif()
if(USE_EGL) if(BUILD_LIBRETRO_CORE AND USE_EGL)
set(USE_EGL OFF) set(USE_EGL OFF)
endif() endif()
@ -187,6 +187,6 @@ enable_testing()
add_subdirectory(dep) add_subdirectory(dep)
add_subdirectory(src) add_subdirectory(src)
if(ANDROID) if(ANDROID AND NOT BUILD_LIBRETRO_CORE)
add_subdirectory(android/app/src/cpp) add_subdirectory(android/app/src/cpp)
endif() endif()

View file

@ -141,7 +141,7 @@ if(USE_EGL)
gl/context_egl_x11.h gl/context_egl_x11.h
) )
endif() endif()
if(ANDROID) if(ANDROID AND USE_EGL)
target_sources(common PRIVATE target_sources(common PRIVATE
gl/context_egl_android.cpp gl/context_egl_android.cpp
gl/context_egl_android.h gl/context_egl_android.h

View file

@ -75,8 +75,10 @@ std::unique_ptr<GL::Context> Context::Create(const WindowInfo& wi, const Version
#elif defined(__APPLE__) #elif defined(__APPLE__)
context = ContextAGL::Create(wi, versions_to_try, num_versions_to_try); context = ContextAGL::Create(wi, versions_to_try, num_versions_to_try);
#elif defined(ANDROID) #elif defined(ANDROID)
#ifdef USE_EGL
context = ContextEGLAndroid::Create(wi, versions_to_try, num_versions_to_try); context = ContextEGLAndroid::Create(wi, versions_to_try, num_versions_to_try);
#else #endif
#elif defined(USE_X11)
if (wi.type == WindowInfo::Type::X11) if (wi.type == WindowInfo::Type::X11)
{ {
#ifdef USE_EGL #ifdef USE_EGL

View file

@ -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 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set_target_properties(duckstation_libretro PROPERTIES LIBRARY_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()