patch to use system's zlib when enabled by the CMake option USE_SYSTEM_ZLIB

This commit is contained in:
Tobias Frost 2014-11-01 14:13:16 +01:00
parent cc41f1a1fe
commit cbbf473d59
4 changed files with 28 additions and 5 deletions

View file

@ -21,6 +21,9 @@ option(FFMPEG
option(ONATIVE
"Optimize for the host CPU" OFF)
option(USE_SYSTEM_ZLIB
"Use the system zlib instead of the bundled one" OFF)
if(UNIX)
set(OPENAL TRUE)
endif()
@ -179,6 +182,18 @@ endif()
# add_definitions(-DSTANDALONE)
#endif()
if (USE_SYSTEM_ZLIB)
find_package(ZLIB REQUIRED)
endif(USE_SYSTEM_ZLIB)
if (ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
set(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
else (ZLIB_FOUND)
include_directories("libs/zlib")
set(ZLIB_LIBRARY "" )
endif (ZLIB_FOUND)
add_subdirectory(idlib)
file(GLOB AAS_INCLUDES aas/*.h)
@ -379,8 +394,14 @@ set(JPEG_SOURCES
file(GLOB PNG_INCLUDES libs/png/*.h)
file(GLOB PNG_SOURCES libs/png/*.c)
if (NOT ZLIB_FOUND)
file(GLOB ZLIB_INCLUDES libs/zlib/*.h)
file(GLOB ZLIB_SOURCES libs/zlib/*.c)
else (NOT ZLIB_FOUND)
set(ZLIB_INCLUDES "")
set(ZLIB_SOURCES "")
endif (NOT ZLIB_FOUND)
file(GLOB MINIZIP_INCLUDES libs/zlib/minizip/*.h)
file(GLOB MINIZIP_SOURCES libs/zlib/minizip/*.c libs/zlib/minizip/*.cpp)
@ -1134,7 +1155,7 @@ include_directories(
#libs/openal/include
libs/glew/include
#libs/freetype/include
libs/zlib)
)
#link_directories(
# ${CMAKE_CURRENT_SOURCE_DIR}/libs/curl/lib
@ -1312,6 +1333,7 @@ if(MSVC)
wsock32.lib
${OpenAL_LIBRARIES}
${FFmpeg_LIBRARIES}
${ZLIB_LIBRARY}
)
#CMAKE_BINARY_DIR
@ -1473,6 +1495,7 @@ else()
${SDLx_LIBRARY}
${OPENAL_LIBRARY}
${FFMPEG_LIBRARIES}
${ZLIB_LIBRARY}
)
endif()

View file

@ -28,7 +28,7 @@ If you have questions concerning this license or the applicable additional terms
#ifndef __FILE_SAVEGAME_H__
#define __FILE_SAVEGAME_H__
#include "../libs/zlib/zlib.h"
#include <zlib.h>
// Listing of the types of files within a savegame package
enum saveGameType_t

View file

@ -28,10 +28,10 @@ If you have questions concerning this license or the applicable additional terms
#ifndef __ZIP_H__
#define __ZIP_H__
#include "../libs/zlib/zlib.h"
#include <zlib.h>
// DG: all the zip access stuff from minizip is now in minizip/zip.h
#include "minizip/zip.h"
#include "libs/zlib/minizip/zip.h"
/*

View file

@ -27,7 +27,7 @@ If you have questions concerning this license or the applicable additional terms
*/
#pragma hdrstop
#include "precompiled.h"
#include "../libs/zlib/zlib.h"
#include <zlib.h>
/*
========================