mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-15 07:00:58 +00:00
patch to use system's libpng when enabled by the CMake option USE_SYSTEM_LIBPNG
This commit is contained in:
parent
d3a9fa14ae
commit
a8d9c2b489
2 changed files with 25 additions and 3 deletions
|
@ -24,6 +24,9 @@ option(ONATIVE
|
|||
option(USE_SYSTEM_ZLIB
|
||||
"Use the system zlib instead of the bundled one" OFF)
|
||||
|
||||
option(USE_SYSTEM_LIBPNG
|
||||
"Use the system libpng instead of the bundled one" OFF)
|
||||
|
||||
if(UNIX)
|
||||
set(OPENAL TRUE)
|
||||
endif()
|
||||
|
@ -194,6 +197,18 @@ else (ZLIB_FOUND)
|
|||
set(ZLIB_LIBRARY "" )
|
||||
endif (ZLIB_FOUND)
|
||||
|
||||
if(USE_SYSTEM_LIBPNG)
|
||||
find_package(PNG REQUIRED)
|
||||
endif (USE_SYSTEM_LIBPNG)
|
||||
|
||||
if (PNG_FOUND)
|
||||
include_directories(${PNG_INCLUDE_DIRS})
|
||||
set(PNG_LIBRARY ${PNG_LIBRARIES})
|
||||
else (PNG_FOUND)
|
||||
include_directories("libs/png")
|
||||
set(PNG_LIBRARY "" )
|
||||
endif (PNG_FOUND)
|
||||
|
||||
add_subdirectory(idlib)
|
||||
|
||||
file(GLOB AAS_INCLUDES aas/*.h)
|
||||
|
@ -391,8 +406,13 @@ set(JPEG_SOURCES
|
|||
libs/jpeg-6/jquant2.cpp
|
||||
libs/jpeg-6/jutils.cpp)
|
||||
|
||||
file(GLOB PNG_INCLUDES libs/png/*.h)
|
||||
file(GLOB PNG_SOURCES libs/png/*.c)
|
||||
if (NOT PNG_FOUND)
|
||||
file(GLOB PNG_INCLUDES libs/png/*.h)
|
||||
file(GLOB PNG_SOURCES libs/png/*.c)
|
||||
else (NOT PNG_FOUND)
|
||||
set(PNG_INCLUDES "")
|
||||
set(PNG_SOURCES "")
|
||||
endif (NOT PNG_FOUND)
|
||||
|
||||
if (NOT ZLIB_FOUND)
|
||||
file(GLOB ZLIB_INCLUDES libs/zlib/*.h)
|
||||
|
@ -1334,6 +1354,7 @@ if(MSVC)
|
|||
${OpenAL_LIBRARIES}
|
||||
${FFmpeg_LIBRARIES}
|
||||
${ZLIB_LIBRARY}
|
||||
${PNG_LIBRARY}
|
||||
)
|
||||
|
||||
#CMAKE_BINARY_DIR
|
||||
|
@ -1496,6 +1517,7 @@ else()
|
|||
${OPENAL_LIBRARY}
|
||||
${FFMPEG_LIBRARIES}
|
||||
${ZLIB_LIBRARY}
|
||||
${PNG_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -617,7 +617,7 @@ PNG LOADING
|
|||
|
||||
extern "C"
|
||||
{
|
||||
#include "../libs/png/png.h"
|
||||
#include <png.h>
|
||||
|
||||
|
||||
static void png_Error( png_structp pngPtr, png_const_charp msg )
|
||||
|
|
Loading…
Reference in a new issue