mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 23:21:19 +02:00
CMake:use external zlib if present
This commit is contained in:
@@ -231,15 +231,30 @@ IF(BUILD_MODEL_VIEWER OR BUILD_MAP_EDITOR OR BUILD_ZETAGLEST)
|
||||
#########################################################################################
|
||||
# zetaglest lib
|
||||
|
||||
include(FindZLIB)
|
||||
IF (FORCE_EMBEDDED_LIBS)
|
||||
SET(DIRS_WITH_SRC
|
||||
${DIRS_WITH_SRC}
|
||||
miniz)
|
||||
ELSE()
|
||||
message(STATUS "Searching for zlib")
|
||||
if (ZLIB_FOUND)
|
||||
message(STATUS "Using external zlib")
|
||||
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${ZLIB_LIBRARIES})
|
||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
|
||||
add_definitions("-DHAVE_ZLIB")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(DIRS_WITH_SRC
|
||||
compression
|
||||
${DIRS_WITH_SRC}
|
||||
compression
|
||||
feathery_ftp
|
||||
glew
|
||||
graphics
|
||||
graphics/gl
|
||||
lua
|
||||
map
|
||||
miniz
|
||||
platform/common
|
||||
sound
|
||||
sound/openal
|
||||
|
@@ -17,7 +17,6 @@
|
||||
// is not a limitation of miniz.c.
|
||||
|
||||
#include "compression_utils.h"
|
||||
#include "miniz/miniz.h"
|
||||
#include <limits.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -25,6 +24,12 @@
|
||||
#include "platform_util.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include <zlib.h>
|
||||
#else
|
||||
#include "miniz/miniz.h"
|
||||
#endif
|
||||
|
||||
using namespace Shared::Util;
|
||||
|
||||
namespace Shared {
|
||||
@@ -53,7 +58,13 @@ namespace Shared {
|
||||
const char *pDst_filename = NULL;
|
||||
long file_loc = 0;
|
||||
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("miniz.c version: %s\n", MZ_VERSION);
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED) {
|
||||
#ifdef HAVE_ZLIB
|
||||
printf("zlib version: " ZLIB_VERSION "\n");
|
||||
#else
|
||||
printf("miniz.c version: " MZ_VERSION "\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (argc < 4) {
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED) {
|
||||
@@ -294,8 +305,19 @@ namespace Shared {
|
||||
}
|
||||
|
||||
if (SystemFlags::VERBOSE_MODE_ENABLED) {
|
||||
#ifdef HAVE_ZLIB
|
||||
printf("Total input bytes: %u\n", stream.total_in);
|
||||
printf("Total output bytes: %u\n", stream.total_out);
|
||||
#else
|
||||
/*
|
||||
* I don't know why this typecasting (mz_unit32) is used for
|
||||
* miniz, but it was there when I found the code, so leaving it
|
||||
* here for now.
|
||||
* -andy5995, 2018-09-25
|
||||
*/
|
||||
printf("Total input bytes: %u\n", (mz_uint32) stream.total_in);
|
||||
printf("Total output bytes: %u\n", (mz_uint32) stream.total_out);
|
||||
#endif
|
||||
printf("Success.\n");
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
|
Reference in New Issue
Block a user