diff --git a/cmake/FindZLIB.cmake b/cmake/FindZLIB.cmake new file mode 100644 index 0000000000..b12f75efad --- /dev/null +++ b/cmake/FindZLIB.cmake @@ -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) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0f601ceab7..f9154a93cb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -182,6 +182,7 @@ 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) @@ -189,7 +190,6 @@ 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) @@ -464,7 +464,6 @@ if(MSVC) LibLZMA::LibLZMA winmm.lib pugixml::pugixml - ZLIB::ZLIB ) elseif(ANDROID) target_include_directories(${PROJECT_NAME} @@ -486,6 +485,7 @@ elseif(ANDROID) ${LUA_LIBRARY} ${LUAJIT_LIBRARY} ${PHYSFS_LIBRARY} + ${ZLIB_LIBRARY} ${PROTOBUF_LIBRARY} ${NLOHMANN_JSON_LIBRARY} ${EGL_LIBRARY} @@ -526,6 +526,7 @@ else() PRIVATE ${LUAJIT_LIBRARY} ${PHYSFS_LIBRARY} + ${ZLIB_LIBRARY} ${PROTOBUF_LIBRARY} ${NLOHMANN_JSON_LIBRARY} ${GLEW_LIBRARY} @@ -547,7 +548,6 @@ else() Vorbis::vorbisfile LibLZMA::LibLZMA pugixml::pugixml - ZLIB::ZLIB ) endif() diff --git a/src/client/uimap.cpp b/src/client/uimap.cpp index e1ce9cc723..140e4bdeaa 100644 --- a/src/client/uimap.cpp +++ b/src/client/uimap.cpp @@ -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) { @@ -227,4 +227,4 @@ void UIMap::removeTile(const TilePtr& tile) { m_tiles.erase(it); } -/* vim: set ts=4 sw=4 et: */ \ No newline at end of file +/* vim: set ts=4 sw=4 et: */ diff --git a/src/main.cpp b/src/main.cpp index 5577fdb654..296185d3d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,6 +35,10 @@ #include #endif +#ifdef ANDROID +extern "C" { +#endif + int main(int argc, const char* argv[]) { std::vector args(argv, argv + argc); @@ -101,3 +105,6 @@ int main(int argc, const char* argv[]) #endif return 0; } +#ifdef ANDROID +} +#endif