Skip to content

Commit

Permalink
build: Support building libretro core for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jul 7, 2020
1 parent c242d47 commit 01287cb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
2 changes: 1 addition & 1 deletion src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/common/gl/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ std::unique_ptr<GL::Context> 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
Expand Down
4 changes: 4 additions & 0 deletions src/duckstation-libretro/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 01287cb

Please sign in to comment.