Skip to content

Instantly share code, notes, and snippets.

@coldtobi
Created October 20, 2014 21:34
Show Gist options
  • Save coldtobi/b50daef2cbea8cb77e62 to your computer and use it in GitHub Desktop.
Save coldtobi/b50daef2cbea8cb77e62 to your computer and use it in GitHub Desktop.
Description: Use system/packaged libpng
Author: Tobias Frost <tobi@debian.org>
Forwarded: no
Last-Update: 2014-10-18
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/neo/CMakeLists.txt
+++ b/neo/CMakeLists.txt
@@ -191,6 +191,17 @@
set(ZLIB_LIBRARY "" )
endif (ZLIB_FOUND)
+
+# coldtobi: use system libpng if available (same logic as for the zlib)
+find_package(PNG)
+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)
@@ -388,8 +399,13 @@
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)
@@ -1332,6 +1348,7 @@
${OpenAL_LIBRARIES}
${FFmpeg_LIBRARIES}
${ZLIB_LIBRARY}
+ ${PNG_LIBRARY}
)
#CMAKE_BINARY_DIR
@@ -1494,6 +1511,7 @@
${OPENAL_LIBRARY}
${FFMPEG_LIBRARIES}
${ZLIB_LIBRARY}
+ ${PNG_LIBRARY}
)
endif()
--- a/neo/renderer/Image_files.cpp
+++ b/neo/renderer/Image_files.cpp
@@ -617,7 +617,7 @@
extern "C"
{
-#include "../libs/png/png.h"
+#include <png.h>
static void png_Error( png_structp pngPtr, png_const_charp msg )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment