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

fix: android build #639

Merged
merged 6 commits into from
Nov 28, 2023
Merged
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
16 changes: 16 additions & 0 deletions cmake/FindZLIB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Try to find the ZLIB library
# ZLIB_FOUND - system has ZLIB
# ZLIB_INCLUDE_DIR - the ZLIB include directory
# ZLIB_LIBRARY - the ZLIB library

FIND_PATH(ZLIB_INCLUDE_DIR NAMES zlib.h)
SET(_ZLIB_STATIC_LIBS libz.a libzlib.a zlib1.a)
SET(_ZLIB_SHARED_LIBS libz.dll.a zdll zlib zlib1 z)
IF(USE_STATIC_LIBS)
FIND_LIBRARY(ZLIB_LIBRARY NAMES ${_ZLIB_STATIC_LIBS} ${_ZLIB_SHARED_LIBS})
ELSE()
FIND_LIBRARY(ZLIB_LIBRARY NAMES ${_ZLIB_SHARED_LIBS} ${_ZLIB_STATIC_LIBS})
ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ add_definitions(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"")
# *****************************************************************************
find_package(OpenSSL QUIET)
find_package(PhysFS REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Protobuf REQUIRED)
find_package(LibLZMA REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(asio REQUIRED)
find_package(Threads REQUIRED)
find_package(STDUUID CONFIG REQUIRED)
find_package(pugixml CONFIG REQUIRED)
find_package(ZLIB REQUIRED)
if(APPLE)
# Required for Physfs
find_library(FOUNDATION Foundation REQUIRED)
Expand Down Expand Up @@ -464,7 +464,6 @@ if(MSVC)
LibLZMA::LibLZMA
winmm.lib
pugixml::pugixml
ZLIB::ZLIB
)
elseif(ANDROID)
target_include_directories(${PROJECT_NAME}
Expand All @@ -486,6 +485,7 @@ elseif(ANDROID)
${LUA_LIBRARY}
${LUAJIT_LIBRARY}
${PHYSFS_LIBRARY}
${ZLIB_LIBRARY}
${PROTOBUF_LIBRARY}
${NLOHMANN_JSON_LIBRARY}
${EGL_LIBRARY}
Expand Down Expand Up @@ -526,6 +526,7 @@ else()
PRIVATE
${LUAJIT_LIBRARY}
${PHYSFS_LIBRARY}
${ZLIB_LIBRARY}
${PROTOBUF_LIBRARY}
${NLOHMANN_JSON_LIBRARY}
${GLEW_LIBRARY}
Expand All @@ -547,7 +548,6 @@ else()
Vorbis::vorbisfile
LibLZMA::LibLZMA
pugixml::pugixml
ZLIB::ZLIB
)
endif()

Expand Down
4 changes: 2 additions & 2 deletions src/client/uimap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void UIMap::updateMapSize()
void UIMap::addTile(const TilePtr& tile) {
std::scoped_lock l(g_drawPool.get(DrawPoolType::FOREGROUND)->getMutex());

if (std::ranges::find(m_tiles, tile) == m_tiles.end())
if (std::find(m_tiles.begin(), m_tiles.end(), tile) == m_tiles.end())
m_tiles.emplace_back(tile);
}
void UIMap::removeTile(const TilePtr& tile) {
Expand All @@ -227,4 +227,4 @@ void UIMap::removeTile(const TilePtr& tile) {
m_tiles.erase(it);
}

/* vim: set ts=4 sw=4 et: */
/* vim: set ts=4 sw=4 et: */
7 changes: 7 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include <framework/net/protocolhttp.h>
#endif

#ifdef ANDROID
extern "C" {
#endif

int main(int argc, const char* argv[])
{
std::vector<std::string> args(argv, argv + argc);
Expand Down Expand Up @@ -101,3 +105,6 @@ int main(int argc, const char* argv[])
#endif
return 0;
}
#ifdef ANDROID
}
#endif
Loading