Commit 69c7abfc authored by Rashad Kanavath's avatar Rashad Kanavath

SuperBuild: fixup libpng build

parent d545f81b
......@@ -22,24 +22,14 @@ ExternalProject_Add(PNG
-DPNG_STATIC:BOOL=OFF
-DPNG_SHARED:BOOL=ON
-DPNG_TESTS:BOOL=OFF
-DVERSIONED_OUTPUT_LIB:BOOL=ON
-DSKIP_INSTALL_FILES:BOOL=ON
-DSKIP_INSTALL_EXECUTABLES:BOOL=OFF
${PNG_SB_CONFIG}
CMAKE_COMMAND ${SB_CMAKE_COMMAND}
)
#having -DPNGLIB_NAME:STRING=libpng in CMAKE_CACHE_ARGS doesnt work
#libpng library built in the name libpng16.lib and other libs (Qt4)
#reports libpng.lib is not found As Qt is strict on the name of libpng
#below we copy the libpng16.lib to libpng.lib.
#modifying CMakeLists.txt in libpng is another way but then whole
#CMakeLists.txt must be kept in superbuild repository.
if(MSVC)
ExternalProject_Add_Step(PNG duplicate_pnglib
COMMAND ${CMAKE_COMMAND} -E copy
${SB_INSTALL_PREFIX}/lib/libpng16.lib ${SB_INSTALL_PREFIX}/lib/libpng.lib
DEPENDEES install
)
endif()
set(_SB_PNG_PNG_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include)
SUPERBUILD_PATCH_SOURCE(PNG)
SUPERBUILD_UPDATE_CMAKE_VARIABLES(PNG TRUE)
......@@ -22,7 +22,7 @@ JPEG_LIB = @CMAKE_WIN_INSTALL_PREFIX@\lib\jpeg.lib
#if using an external png library uncomment the follwing lines
PNG_EXTERNAL_LIB = 1
PNGDIR = @CMAKE_WIN_INSTALL_PREFIX@\include
PNG_LIB = @CMAKE_WIN_INSTALL_PREFIX@\lib\libpng16.lib
PNG_LIB = @CMAKE_WIN_INSTALL_PREFIX@\lib\libpng.lib
# if using an external libtiff library
TIFF_INC = -I@CMAKE_WIN_INSTALL_PREFIX@\include
......
diff -burN libjpeg-turbo-1.4.1.orig/CMakeLists.txt libjpeg-turbo-1.4.1/CMakeLists.txt
--- libjpeg-turbo-1.4.1.orig/CMakeLists.txt 2016-09-06 09:37:12.107984277 +0200
+++ libjpeg-turbo-1.4.1/CMakeLists.txt 2016-09-06 09:47:16.479979552 +0200
@@ -167,8 +167,14 @@
message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}")
-configure_file(win/jconfig.h.in jconfig.h)
-configure_file(win/jconfigint.h.in jconfigint.h)
+if(WIN32)
+ set(BUILD "04/02/2016")
+ configure_file(win/jconfig.h.in jconfig.h)
+ configure_file(win/jconfigint.h.in jconfigint.h)
+else()
+ configure_file(jconfig.h.in jconfig.h)
+ configure_file(jconfigint.h.in jconfigint.h)
+endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
diff -burN lpng1616.orig/CMakeLists.txt lpng1616/CMakeLists.txt
--- lpng1616.orig/CMakeLists.txt 2016-09-06 09:49:13.951978634 +0200
+++ lpng1616/CMakeLists.txt 2016-09-06 10:41:01.911954335 +0200
@@ -17,7 +17,16 @@
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 6)
set(PNGLIB_RELEASE 16)
-set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
+
+option(VERSIONED_OUTPUT_LIB "create output library with major.minor suffix" OFF)
+
+set(PNGLIB_NAME libpng)
+set(PNG_LIB_NAME png)
+if(VERSIONED_OUTPUT_LIB)
+ set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
+ set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
+endif()
+
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
# needed packages
@@ -56,11 +65,9 @@
option(PNG_DEBUG "Build with debug output" NO)
option(PNGARG "Disable ANSI-C prototypes" NO)
-# SET LIBNAME
-set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
# to distinguish between debug and release lib
-set(CMAKE_DEBUG_POSTFIX "d")
+#set(CMAKE_DEBUG_POSTFIX "d")
# Use the prebuilt pnglibconf.h file from the scripts folder
# TODO: fix this by building with awk; without this no cmake build can be
@@ -121,7 +128,6 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
unset(PNG_LIB_TARGETS)
-
if(PNG_SHARED)
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
set(PNG_LIB_TARGETS ${PNG_LIB_NAME})
@@ -286,18 +292,18 @@
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ if(VERSIONED_OUTPUT_LIB)
if(PNG_SHARED)
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
if(CYGWIN OR MINGW)
- get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
- CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
+ #get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
+ CREATE_SYMLINK( $<TARGET_FILE:${PNG_LIB_NAME}> libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(CYGWIN OR MINGW)
if(NOT WIN32)
- get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
- CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
+ CREATE_SYMLINK($<TARGET_FILE:${PNG_LIB_NAME}> libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(NOT WIN32)
@@ -305,12 +311,12 @@
if(PNG_STATIC)
if(NOT WIN32 OR CYGWIN OR MINGW)
- get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
- CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
+ CREATE_SYMLINK($<TARGET_FILE:${PNG_LIB_NAME}> libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(NOT WIN32 OR CYGWIN OR MINGW)
- endif()
+ endif(PNG_STATIC)
+ endif(VERSIONED_OUTPUT_LIB)
endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
@@ -362,4 +368,3 @@
# to create msvc import lib for mingw compiled shared lib
# pexports libpng.dll > libpng.def
# lib /def:libpng.def /machine:x86
-
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment