Fix Android build

This commit is contained in:
Wunkolo 2024-03-10 14:13:58 -07:00
parent b147df6094
commit 3b57275776
No known key found for this signature in database

View file

@ -197,7 +197,6 @@ set(AUDIO_SOURCE_FILES src/core/audio/dsp_core.cpp src/core/audio/null_core.cpp
set(RENDERER_SW_SOURCE_FILES src/core/renderer_sw/renderer_sw.cpp) set(RENDERER_SW_SOURCE_FILES src/core/renderer_sw/renderer_sw.cpp)
# Frontend source files # Frontend source files
if(NOT ANDROID)
if(ENABLE_QT_GUI) if(ENABLE_QT_GUI)
set(FRONTEND_SOURCE_FILES src/panda_qt/main.cpp src/panda_qt/screen.cpp src/panda_qt/main_window.cpp src/panda_qt/about_window.cpp set(FRONTEND_SOURCE_FILES src/panda_qt/main.cpp src/panda_qt/screen.cpp src/panda_qt/main_window.cpp src/panda_qt/about_window.cpp
src/panda_qt/config_window.cpp src/panda_qt/zep.cpp src/panda_qt/text_editor.cpp src/panda_qt/cheats_window.cpp src/panda_qt/config_window.cpp src/panda_qt/zep.cpp src/panda_qt/text_editor.cpp src/panda_qt/cheats_window.cpp
@ -217,7 +216,6 @@ if(NOT ANDROID)
set(FRONTEND_SOURCE_FILES src/panda_sdl/main.cpp src/panda_sdl/frontend_sdl.cpp) set(FRONTEND_SOURCE_FILES src/panda_sdl/main.cpp src/panda_sdl/frontend_sdl.cpp)
set(FRONTEND_HEADER_FILES "") set(FRONTEND_HEADER_FILES "")
endif() endif()
endif()
set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/termcolor.hpp set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/termcolor.hpp
include/cpu.hpp include/cpu_dynarmic.hpp include/memory.hpp include/renderer.hpp include/kernel/kernel.hpp include/cpu.hpp include/cpu_dynarmic.hpp include/memory.hpp include/renderer.hpp include/kernel/kernel.hpp
@ -406,6 +404,10 @@ set(ALL_SOURCES ${SOURCE_FILES} ${FS_SOURCE_FILES} ${CRYPTO_SOURCE_FILES} ${KERN
${LOADER_SOURCE_FILES} ${SERVICE_SOURCE_FILES} ${APPLET_SOURCE_FILES} ${RENDERER_SW_SOURCE_FILES} ${PICA_SOURCE_FILES} ${THIRD_PARTY_SOURCE_FILES} ${LOADER_SOURCE_FILES} ${SERVICE_SOURCE_FILES} ${APPLET_SOURCE_FILES} ${RENDERER_SW_SOURCE_FILES} ${PICA_SOURCE_FILES} ${THIRD_PARTY_SOURCE_FILES}
${AUDIO_SOURCE_FILES} ${HEADER_FILES} ${FRONTEND_HEADER_FILES}) ${AUDIO_SOURCE_FILES} ${HEADER_FILES} ${FRONTEND_HEADER_FILES})
if(ANDROID)
set(ALL_SOURCES ${ALL_SOURCES} src/jni_driver.cpp)
endif()
if(ENABLE_OPENGL) if(ENABLE_OPENGL)
# Add the OpenGL source files to ALL_SOURCES # Add the OpenGL source files to ALL_SOURCES
set(ALL_SOURCES ${ALL_SOURCES} ${RENDERER_GL_SOURCE_FILES}) set(ALL_SOURCES ${ALL_SOURCES} ${RENDERER_GL_SOURCE_FILES})
@ -416,17 +418,7 @@ if(ENABLE_VULKAN)
set(ALL_SOURCES ${ALL_SOURCES} ${RENDERER_VK_SOURCE_FILES}) set(ALL_SOURCES ${ALL_SOURCES} ${RENDERER_VK_SOURCE_FILES})
endif() endif()
if(ANDROID)
set(ALL_SOURCES ${ALL_SOURCES} src/jni_driver.cpp)
endif()
if(BUILD_HYDRA_CORE)
add_library(AlberCore SHARED ${ALL_SOURCES} src/hydra_core.cpp)
target_compile_definitions(AlberCore PRIVATE PANDA3DS_HYDRA_CORE=1)
include_directories(third_party/hydra_core/include)
else()
add_library(AlberCore STATIC ${ALL_SOURCES}) add_library(AlberCore STATIC ${ALL_SOURCES})
endif()
if(ANDROID) if(ANDROID)
target_link_libraries(AlberCore PRIVATE EGL log) target_link_libraries(AlberCore PRIVATE EGL log)
@ -485,15 +477,20 @@ if(ENABLE_HTTP_SERVER)
endif() endif()
# Configure frontend # Configure frontend
if(ENABLE_QT_GUI)
target_compile_definitions(AlberCore PUBLIC "PANDA3DS_FRONTEND_QT=1")
else()
target_compile_definitions(AlberCore PUBLIC "PANDA3DS_FRONTEND_SDL=1")
endif()
if(NOT BUILD_HYDRA_CORE)
add_executable(Alber ${FRONTEND_SOURCE_FILES} ${FRONTEND_HEADER_FILES}) add_executable(Alber ${FRONTEND_SOURCE_FILES} ${FRONTEND_HEADER_FILES})
target_link_libraries(Alber PRIVATE AlberCore) target_link_libraries(Alber PRIVATE AlberCore)
if(ENABLE_QT_GUI) if(ENABLE_QT_GUI)
target_compile_definitions(AlberCore PUBLIC "PANDA3DS_FRONTEND_QT=1")
target_compile_definitions(Alber PUBLIC "ZEP_QT=1") target_compile_definitions(Alber PUBLIC "ZEP_QT=1")
target_compile_definitions(Alber PUBLIC "ZEP_FEATURE_CPP_FILE_SYSTEM=1") target_compile_definitions(Alber PUBLIC "ZEP_FEATURE_CPP_FILE_SYSTEM=1")
target_link_libraries(Alber PRIVATE Qt6::Widgets) target_link_libraries(Alber PRIVATE Qt6::Widgets)
# We can't use qt_standard_project_setup since it's Qt 6.3+ and we don't need to set the minimum that high # We can't use qt_standard_project_setup since it's Qt 6.3+ and we don't need to set the minimum that high
@ -517,5 +514,11 @@ if(ENABLE_QT_GUI)
docs/img/rsob_icon.png docs/img/rstarstruck_icon.png docs/img/rsob_icon.png docs/img/rstarstruck_icon.png
) )
else() else()
target_compile_definitions(AlberCore PUBLIC "PANDA3DS_FRONTEND_SDL=1") endif()
elseif(BUILD_HYDRA_CORE)
target_compile_definitions(AlberCore PRIVATE PANDA3DS_HYDRA_CORE=1)
include_directories(third_party/hydra_core/include)
add_library(Alber SHARED src/hydra_core.cpp)
target_link_libraries(Alber PUBLIC AlberCore)
else()
endif() endif()