Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Android #17

Open
wants to merge 3 commits into
base: soh-macready
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion ZAPD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,30 @@ endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(CMAKE_FIND_FRAMEWORK LAST)
endif()
find_package(PNG REQUIRED)

if (NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(PNG REQUIRED)
endif()

################################################################################
# Find/download PNG for Android
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(PNG QUIET)
if (NOT ${PNG_FOUND})
include(FetchContent)
FetchContent_Declare(
png
GIT_REPOSITORY https://github.com/glennrp/libpng.git
GIT_TAG v1.6.37
)
message("PNG not found. Downloading now...")
FetchContent_MakeAvailable(png)
message("PNG downloaded to " ${FETCHCONTENT_BASE_DIR}/png-src)
set (PNG_PNG_INCLUDE_DIR ${png_BINARY_DIR} ${png_SOURCE_DIR})
endif()
endif()


target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../libultraship/extern/ZAPDUtils
Expand Down Expand Up @@ -476,6 +499,17 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
"libultraship;"
PNG::PNG
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"ZAPDUtils;"
-Wl,--whole-archive $<TARGET_LINKER_FILE_DIR:OTRExporter>/$<TARGET_LINKER_FILE_NAME:OTRExporter> -Wl,--no-whole-archive
"libultraship;"
png
${CMAKE_DL_LIBS}
Threads::Threads
)
else()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
Expand Down
4 changes: 3 additions & 1 deletion ZAPD/CrashHandler.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "CrashHandler.h"
#include "Utils/StringHelper.h"

#if __has_include(<unistd.h>)
#if __has_include(<unistd.h>) && !defined(__ANDROID__)
#define HAS_POSIX 1
#else
#define HAS_POSIX 0
Expand All @@ -25,6 +25,8 @@
#include <inttypes.h>

#pragma comment(lib, "Dbghelp.lib")
#else
#include "WarningHandler.h"
#endif

// Feel free to add more crash messages.
Expand Down