mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
and test.cmake.in
This commit is contained in:
parent
98c6fa2495
commit
74e481c743
11
ANNOUNCE
11
ANNOUNCE
@ -1,4 +1,4 @@
|
|||||||
Libpng 1.6.22beta02 - January 27, 2016
|
Libpng 1.6.22beta02 - January 28, 2016
|
||||||
|
|
||||||
This is not intended to be a public release. It will be replaced
|
This is not intended to be a public release. It will be replaced
|
||||||
within a few weeks by a public version or by another test version.
|
within a few weeks by a public version or by another test version.
|
||||||
@ -40,8 +40,13 @@ Version 1.6.22beta01 [January 23, 2016]
|
|||||||
less than 4GByte and image row size (stride) to less than 2GByte.
|
less than 4GByte and image row size (stride) to less than 2GByte.
|
||||||
Revised workaround for false-positive Coverity issue in pngvalid.c.
|
Revised workaround for false-positive Coverity issue in pngvalid.c.
|
||||||
|
|
||||||
Version 1.6.22beta02 [January 27, 2016]
|
Version 1.6.22beta02 [January 28, 2016]
|
||||||
Only use exit(77) in configure builds
|
Only use exit(77) in configure builds.
|
||||||
|
Corrected error in PNG_IMAGE_PNG_SIZE_MAX. This new macro underreported
|
||||||
|
the palette size because it failed to take into account that the memory
|
||||||
|
palette has to be expanded to full RGB when it is written to PNG.
|
||||||
|
Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
|
||||||
|
and test.cmake.in
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
9
CHANGES
9
CHANGES
@ -5499,8 +5499,13 @@ Version 1.6.22beta01 [January 23, 2016]
|
|||||||
less than 4GByte and image row size (stride) to less than 2GByte.
|
less than 4GByte and image row size (stride) to less than 2GByte.
|
||||||
Revised workaround for false-positive Coverity issue in pngvalid.c.
|
Revised workaround for false-positive Coverity issue in pngvalid.c.
|
||||||
|
|
||||||
Version 1.6.22beta02 [January 27, 2016]
|
Version 1.6.22beta02 [January 28, 2016]
|
||||||
Only use exit(77) in configure builds
|
Only use exit(77) in configure builds.
|
||||||
|
Corrected error in PNG_IMAGE_PNG_SIZE_MAX. This new macro underreported
|
||||||
|
the palette size because it failed to take into account that the memory
|
||||||
|
palette has to be expanded to full RGB when it is written to PNG.
|
||||||
|
Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
|
||||||
|
and test.cmake.in
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
581
CMakeLists.txt
581
CMakeLists.txt
@ -6,8 +6,23 @@
|
|||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
# and license in png.h
|
# and license in png.h
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.4.4)
|
cmake_minimum_required(VERSION 2.8.3)
|
||||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
cmake_policy(VERSION 2.8.3)
|
||||||
|
|
||||||
|
# Set MacOSX @rpath usage globally.
|
||||||
|
if (POLICY CMP0020)
|
||||||
|
cmake_policy(SET CMP0020 NEW)
|
||||||
|
endif(POLICY CMP0020)
|
||||||
|
if (POLICY CMP0042)
|
||||||
|
cmake_policy(SET CMP0042 NEW)
|
||||||
|
endif(POLICY CMP0042)
|
||||||
|
# Use new variable expansion policy.
|
||||||
|
if (POLICY CMP0053)
|
||||||
|
cmake_policy(SET CMP0053 NEW)
|
||||||
|
endif(POLICY CMP0053)
|
||||||
|
if (POLICY CMP0054)
|
||||||
|
cmake_policy(SET CMP0054 NEW)
|
||||||
|
endif(POLICY CMP0054)
|
||||||
|
|
||||||
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
|
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
|
||||||
|
|
||||||
@ -47,28 +62,284 @@ option(PNG_FRAMEWORK "Build OS X framework" OFF)
|
|||||||
option(PNG_DEBUG "Build with debug output" OFF)
|
option(PNG_DEBUG "Build with debug output" OFF)
|
||||||
option(PNGARG "Disable ANSI-C prototypes" OFF)
|
option(PNGARG "Disable ANSI-C prototypes" OFF)
|
||||||
|
|
||||||
|
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
|
||||||
|
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
|
||||||
|
|
||||||
# SET LIBNAME
|
# SET LIBNAME
|
||||||
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
|
|
||||||
# to distinguish between debug and release lib
|
# 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
|
include(CheckCSourceCompiles)
|
||||||
# TODO: fix this by building with awk; without this no cmake build can be
|
option(ld-version-script "Enable linker version script" ON)
|
||||||
# configured directly (to do so indirectly use your local awk to build a
|
if(ld-version-script AND NOT APPLE)
|
||||||
# pnglibconf.h in the build directory.)
|
# Check if LD supports linker scripts.
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
|
||||||
|
global: sym;
|
||||||
|
local: *;
|
||||||
|
};
|
||||||
|
|
||||||
|
VERS_2 {
|
||||||
|
global: sym2;
|
||||||
|
main;
|
||||||
|
} VERS_1;
|
||||||
|
")
|
||||||
|
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
|
||||||
|
check_c_source_compiles("void sym(void) {}
|
||||||
|
void sym2(void) {}
|
||||||
|
int main(void) {return 0;}
|
||||||
|
" HAVE_LD_VERSION_SCRIPT)
|
||||||
|
if(NOT HAVE_LD_VERSION_SCRIPT)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
||||||
|
check_c_source_compiles("void sym(void) {}
|
||||||
|
void sym2(void) {}
|
||||||
|
int main(void) {return 0;}
|
||||||
|
" HAVE_SOLARIS_LD_VERSION_SCRIPT)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
|
||||||
|
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find symbol prefix. Likely obsolete and unnecessary with recent
|
||||||
|
# toolchains (it's not done in many other projects).
|
||||||
|
function(symbol_prefix)
|
||||||
|
set(SYMBOL_PREFIX)
|
||||||
|
|
||||||
|
execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E" "-"
|
||||||
|
INPUT_FILE /dev/null
|
||||||
|
OUTPUT_VARIABLE OUT
|
||||||
|
RESULT_VARIABLE STATUS)
|
||||||
|
|
||||||
|
if(CPP_FAIL)
|
||||||
|
message(WARNING "Failed to run the C preprocessor")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REPLACE "\n" ";" OUT "${OUT}")
|
||||||
|
foreach(line ${OUT})
|
||||||
|
string(REGEX MATCH "^PREFIX=" found_match "${line}")
|
||||||
|
if(found_match)
|
||||||
|
STRING(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
|
||||||
|
string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}")
|
||||||
|
if(found_match)
|
||||||
|
STRING(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
|
||||||
|
endif()
|
||||||
|
set(SYMBOL_PREFIX "${prefix}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}")
|
||||||
|
set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
symbol_prefix()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(AWK NAMES gawk awk)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
if(NOT AWK)
|
||||||
|
# No awk available to generate sources; use pre-built pnglibconf.h
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
add_custom_target(genfiles) # Dummy
|
||||||
|
else()
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
# Generate .chk from .out with awk
|
||||||
|
# generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
||||||
|
function(generate_chk)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs INPUT OUTPUT)
|
||||||
|
set(multiValueArgs DEPENDS)
|
||||||
|
cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
if (NOT _GC_INPUT)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
|
||||||
|
endif()
|
||||||
|
if (NOT _GC_OUTPUT)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${_GC_OUTPUT}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DINPUT=${_GC_INPUT}"
|
||||||
|
"-DOUTPUT=${_GC_OUTPUT}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake"
|
||||||
|
DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Generate .out from .c with awk
|
||||||
|
# generate_out(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
||||||
|
function(generate_out)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs INPUT OUTPUT)
|
||||||
|
set(multiValueArgs DEPENDS)
|
||||||
|
cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
if (NOT _GO_INPUT)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
|
||||||
|
endif()
|
||||||
|
if (NOT _GO_OUTPUT)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${_GO_OUTPUT}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DINPUT=${_GO_INPUT}"
|
||||||
|
"-DOUTPUT=${_GO_OUTPUT}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake"
|
||||||
|
DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Generate specific source file with awk
|
||||||
|
# generate_source(OUTPUT outputfile [DEPENDS dep1 [dep2...]])
|
||||||
|
function(generate_source)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs OUTPUT)
|
||||||
|
set(multiValueArgs DEPENDS)
|
||||||
|
cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
if (NOT _GSO_OUTPUT)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. generate_source requires output.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DOUTPUT=${_GSO_OUTPUT}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
|
||||||
|
DEPENDS ${_GSO_DEPENDS}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Copy file
|
||||||
|
function(generate_copy source destination)
|
||||||
|
add_custom_command(OUTPUT "${destination}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E remove "${destination}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy "${source}"
|
||||||
|
"${destination}"
|
||||||
|
DEPENDS "${source}")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Generate scripts/pnglibconf.h
|
||||||
|
generate_source(OUTPUT "scripts/pnglibconf.c"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
|
||||||
|
|
||||||
|
# Generate pnglibconf.c
|
||||||
|
generate_source(OUTPUT "pnglibconf.c"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
|
||||||
|
|
||||||
|
if(PNG_PREFIX)
|
||||||
|
set(PNGLIBCONF_H_EXTRA_DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/macro.lst")
|
||||||
|
set(PNGPREFIX_H_EXTRA_DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
|
||||||
|
|
||||||
|
# Generate pnglibconf.h
|
||||||
|
generate_source(OUTPUT "pnglibconf.h"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
|
||||||
|
${PNGLIBCONF_H_EXTRA_DEPENDS})
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/intprefix.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/prefix.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
|
||||||
|
|
||||||
|
# Generate pngprefix.h
|
||||||
|
generate_source(OUTPUT "pngprefix.h"
|
||||||
|
DEPENDS ${PNGPREFIX_H_EXTRA_DEPENDS})
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt")
|
||||||
|
|
||||||
|
generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
|
||||||
|
|
||||||
|
generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.def")
|
||||||
|
|
||||||
|
add_custom_target(symbol-check DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk")
|
||||||
|
|
||||||
|
generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
|
||||||
|
generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
|
||||||
|
|
||||||
|
add_custom_target(genvers DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
|
||||||
|
add_custom_target(gensym DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
|
||||||
|
|
||||||
|
add_custom_target("genprebuilt"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DOUTPUT=scripts/pnglibconf.h.prebuilt"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
|
# A single target handles generation of all generated files. If
|
||||||
|
# they are dependend upon separately by multiple targets, this
|
||||||
|
# confuses parallel make (it would require a separate top-level
|
||||||
|
# target for each file to track the dependencies properly).
|
||||||
|
add_custom_target(genfiles DEPENDS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.sym"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/libpng.vers"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
|
||||||
|
endif(NOT AWK)
|
||||||
|
|
||||||
# OUR SOURCES
|
# OUR SOURCES
|
||||||
set(libpng_public_hdrs
|
set(libpng_public_hdrs
|
||||||
png.h
|
png.h
|
||||||
pngconf.h
|
pngconf.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
|
|
||||||
)
|
)
|
||||||
|
set(libpng_private_hdrs
|
||||||
|
pngpriv.h
|
||||||
|
pngdebug.h
|
||||||
|
pnginfo.h
|
||||||
|
pngstruct.h
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
|
||||||
|
)
|
||||||
|
if(AWK)
|
||||||
|
list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
|
||||||
|
endif()
|
||||||
set(libpng_sources
|
set(libpng_sources
|
||||||
${libpng_public_hdrs}
|
${libpng_public_hdrs}
|
||||||
|
${libpng_private_hdrs}
|
||||||
pngdebug.h
|
pngdebug.h
|
||||||
pnginfo.h
|
pnginfo.h
|
||||||
pngpriv.h
|
pngpriv.h
|
||||||
@ -98,7 +369,18 @@ set(pngvalid_sources
|
|||||||
set(pngstest_sources
|
set(pngstest_sources
|
||||||
contrib/libtests/pngstest.c
|
contrib/libtests/pngstest.c
|
||||||
)
|
)
|
||||||
# SOME NEEDED DEFINITIONS
|
set(pngunknown_sources
|
||||||
|
contrib/libtests/pngunknown.c
|
||||||
|
)
|
||||||
|
set(pngimage_sources
|
||||||
|
contrib/libtests/pngimage.c
|
||||||
|
)
|
||||||
|
set(pngfix_sources
|
||||||
|
contrib/tools/pngfix.c
|
||||||
|
)
|
||||||
|
set(png_fix_itxt_sources
|
||||||
|
contrib/tools/png-fix-itxt.c
|
||||||
|
)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
@ -114,33 +396,59 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
|||||||
unset(PNG_LIB_TARGETS)
|
unset(PNG_LIB_TARGETS)
|
||||||
|
|
||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
|
add_library(png SHARED ${libpng_sources})
|
||||||
set(PNG_LIB_TARGETS ${PNG_LIB_NAME})
|
set(PNG_LIB_TARGETS png)
|
||||||
|
set_target_properties(png PROPERTIES OUTPUT_NAME ${PNG_LIB_NAME})
|
||||||
|
add_dependencies(png genfiles)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# msvc does not append 'lib' - do it here to have consistent name
|
# msvc does not append 'lib' - do it here to have consistent name
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
|
set_target_properties(png PROPERTIES PREFIX "lib")
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
|
set_target_properties(png PROPERTIES IMPORT_PREFIX "lib")
|
||||||
|
endif()
|
||||||
|
target_link_libraries(png ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
|
|
||||||
|
if(UNIX AND AWK)
|
||||||
|
if(HAVE_LD_VERSION_SCRIPT)
|
||||||
|
set_target_properties(png PROPERTIES LINK_FLAGS
|
||||||
|
"-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
|
||||||
|
elseif(HAVE_SOLARIS_LD_VERSION_SCRIPT)
|
||||||
|
set_target_properties(png PROPERTIES LINK_FLAGS
|
||||||
|
"-Wl,-M -Wl,'${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PNG_STATIC)
|
if(PNG_STATIC)
|
||||||
# does not work without changing name
|
# does not work without changing name
|
||||||
set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
|
set(PNG_LIB_NAME_STATIC png_static)
|
||||||
add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
|
add_library(png_static STATIC ${libpng_sources})
|
||||||
list(APPEND PNG_LIB_TARGETS ${PNG_LIB_NAME_STATIC})
|
add_dependencies(png_static genfiles)
|
||||||
|
# MSVC doesn't use a different file extension for shared vs. static
|
||||||
|
# libs. We are able to change OUTPUT_NAME to remove the _static
|
||||||
|
# for all other platforms.
|
||||||
|
if(NOT MSVC)
|
||||||
|
set_target_properties(png_static PROPERTIES
|
||||||
|
OUTPUT_NAME "${PNG_LIB_NAME}"
|
||||||
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
else()
|
||||||
|
set_target_properties(png_static PROPERTIES
|
||||||
|
OUTPUT_NAME "${PNG_LIB_NAME}_static"
|
||||||
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
endif()
|
||||||
|
list(APPEND PNG_LIB_TARGETS png_static)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# msvc does not append 'lib' - do it here to have consistent name
|
# msvc does not append 'lib' - do it here to have consistent name
|
||||||
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
|
set_target_properties(png_static PROPERTIES PREFIX "lib")
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
target_link_libraries(png_static ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PNG_FRAMEWORK)
|
if(PNG_FRAMEWORK)
|
||||||
set(PNG_LIB_NAME_FRAMEWORK ${PNG_LIB_NAME}_framework)
|
set(PNG_LIB_NAME_FRAMEWORK png_framework)
|
||||||
add_library(${PNG_LIB_NAME_FRAMEWORK} SHARED ${libpng_sources})
|
add_library(png_framework SHARED ${libpng_sources})
|
||||||
list(APPEND PNG_LIB_TARGETS ${PNG_LIB_NAME_FRAMEWORK})
|
add_dependencies(png_framework genfiles)
|
||||||
set_target_properties(${PNG_LIB_NAME_FRAMEWORK} PROPERTIES
|
list(APPEND PNG_LIB_TARGETS png_framework)
|
||||||
|
set_target_properties(png_framework PROPERTIES
|
||||||
FRAMEWORK TRUE
|
FRAMEWORK TRUE
|
||||||
FRAMEWORK_VERSION ${PNGLIB_VERSION}
|
FRAMEWORK_VERSION ${PNGLIB_VERSION}
|
||||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PNGLIB_MAJOR}.${PNGLIB_MINOR}
|
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PNGLIB_MAJOR}.${PNGLIB_MINOR}
|
||||||
@ -149,7 +457,7 @@ if(PNG_FRAMEWORK)
|
|||||||
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
|
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
|
||||||
PUBLIC_HEADER "${libpng_public_hdrs}"
|
PUBLIC_HEADER "${libpng_public_hdrs}"
|
||||||
OUTPUT_NAME png)
|
OUTPUT_NAME png)
|
||||||
target_link_libraries(${PNG_LIB_NAME_FRAMEWORK} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
target_link_libraries(png_framework ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT PNG_LIB_TARGETS)
|
if(NOT PNG_LIB_TARGETS)
|
||||||
@ -160,52 +468,169 @@ if(NOT PNG_LIB_TARGETS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PNG_SHARED AND WIN32)
|
if(PNG_SHARED AND WIN32)
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
set_target_properties(png PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
function(png_add_test)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs NAME COMMAND)
|
||||||
|
set(multiValueArgs OPTIONS FILES)
|
||||||
|
cmake_parse_arguments(_PAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if (NOT _PAT_NAME)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. png_add_test requires name.")
|
||||||
|
endif()
|
||||||
|
if (NOT _PAT_COMMAND)
|
||||||
|
message(FATAL_ERROR "Invalid arguments. png_add_test requires command.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(TEST_OPTIONS "${_PAT_OPTIONS}")
|
||||||
|
set(TEST_FILES "${_PAT_FILES}")
|
||||||
|
|
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/test.cmake.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake" @ONLY)
|
||||||
|
if(CMAKE_MAJOR_VERSION GREATER 2) # have generator expressions
|
||||||
|
add_test(NAME "${_PAT_NAME}"
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
"-DLIBPNG=$<TARGET_FILE:png>"
|
||||||
|
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
|
||||||
|
else() # old 2.x add_test; limited and won't work well on Windows
|
||||||
|
# Note LIBPNG is a dummy value as there are no generator expressions
|
||||||
|
add_test("${_PAT_NAME}" "${CMAKE_COMMAND}"
|
||||||
|
"-DLIBPNG=${CMAKE_CURRENT_BINARY_DIR}/libpng.so"
|
||||||
|
"-DTEST_COMMAND=./${_PAT_COMMAND}"
|
||||||
|
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
if(PNG_TESTS AND PNG_SHARED)
|
if(PNG_TESTS AND PNG_SHARED)
|
||||||
|
file(GLOB PNGSUITE_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/*.png")
|
||||||
|
|
||||||
|
file(GLOB TEST_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/testpngs/*.png")
|
||||||
|
|
||||||
|
set(PNGTEST_PNG "${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png")
|
||||||
|
|
||||||
# does not work with msvc due to png_lib_ver issue
|
# does not work with msvc due to png_lib_ver issue
|
||||||
add_executable(pngtest ${pngtest_sources})
|
add_executable(pngtest ${pngtest_sources})
|
||||||
target_link_libraries(pngtest ${PNG_LIB_NAME})
|
target_link_libraries(pngtest png)
|
||||||
add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
|
|
||||||
|
png_add_test(NAME pngtest COMMAND pngtest FILES "${PNGTEST_PNG}")
|
||||||
|
|
||||||
#
|
#
|
||||||
add_executable(pngvalid ${pngvalid_sources})
|
add_executable(pngvalid ${pngvalid_sources})
|
||||||
target_link_libraries(pngvalid ${PNG_LIB_NAME})
|
target_link_libraries(pngvalid png)
|
||||||
add_test(pngvalid ./pngvalid)
|
|
||||||
|
png_add_test(NAME pngvalid COMMAND pngvalid)
|
||||||
|
png_add_test(NAME pngvalid-gamma-16-to-8
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-16-to-8)
|
||||||
|
png_add_test(NAME pngvalid-gamma-alpha-mode
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-alpha-mode)
|
||||||
|
png_add_test(NAME pngvalid-gamma-background
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-background)
|
||||||
|
png_add_test(NAME pngvalid-gamma-alpha-mode-expand16
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-alpha-mode --expand16)
|
||||||
|
png_add_test(NAME pngvalid-gamma-background-expand16
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-background --expand16)
|
||||||
|
png_add_test(NAME pngvalid-gamma-transform-expand16
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-transform --expand16)
|
||||||
|
png_add_test(NAME pngvalid-gamma-sbit
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-sbit)
|
||||||
|
png_add_test(NAME pngvalid-gamma-threshold
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-threshold)
|
||||||
|
png_add_test(NAME pngvalid-gamma-transform
|
||||||
|
COMMAND pngvalid OPTIONS --gamma-transform)
|
||||||
|
png_add_test(NAME pngvalid-standard-progressive-read-interlace
|
||||||
|
COMMAND pngvalid OPTIONS --standard --progressive-read --interlace)
|
||||||
|
png_add_test(NAME pngvalid-size-progressive-read
|
||||||
|
COMMAND pngvalid OPTIONS --size --progressive-read)
|
||||||
|
png_add_test(NAME pngvalid-standard-progressive-read
|
||||||
|
COMMAND pngvalid OPTIONS --standard --progressive-read)
|
||||||
|
png_add_test(NAME pngvalid-standard
|
||||||
|
COMMAND pngvalid OPTIONS --standard)
|
||||||
|
png_add_test(NAME pngvalid-transform
|
||||||
|
COMMAND pngvalid OPTIONS --transform)
|
||||||
|
|
||||||
add_executable(pngstest ${pngstest_sources})
|
add_executable(pngstest ${pngstest_sources})
|
||||||
target_link_libraries(pngstest ${PNG_LIB_NAME})
|
target_link_libraries(pngstest png)
|
||||||
add_test(pngstest ./pngstest
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g01.png
|
png_add_test(NAME pngstest-pngsuite COMMAND pngstest FILES ${PNGSUITE_PNGS})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g02.png
|
foreach(gamma_type 1.8 linear none sRGB)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g04.png
|
foreach(alpha_type none alpha)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g08.png
|
set(PNGSTEST_FILES)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g16.png
|
foreach(test_png ${TEST_PNGS})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c08.png
|
string(REGEX MATCH ".*-linear[-.].*" TEST_PNG_LINEAR "${test_png}")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c16.png
|
string(REGEX MATCH ".*-sRGB[-.].*" TEST_PNG_SRGB "${test_png}")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p01.png
|
string(REGEX MATCH ".*-1.8[-.].*" TEST_PNG_G18 "${test_png}")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p02.png
|
string(REGEX MATCH ".*-alpha-.*" TEST_PNG_ALPHA "${test_png}")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p04.png
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p08.png
|
set(TEST_PNG_VALID TRUE)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a08.png
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a16.png
|
if(TEST_PNG_ALPHA)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a08.png
|
if (NOT "${alpha_type}" STREQUAL "alpha")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a16.png
|
set(TEST_PNG_VALID FALSE)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g01.png
|
endif()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g02.png
|
else()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g04.png
|
if ("${alpha_type}" STREQUAL "alpha")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn2c16.png
|
set(TEST_PNG_VALID FALSE)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn3p08.png
|
endif()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn2c16.png
|
endif()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn3p08.png
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbrn2c08.png
|
if(TEST_PNG_LINEAR)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn0g16.png
|
if(NOT "${gamma_type}" STREQUAL "linear")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn3p08.png
|
set(TEST_PNG_VALID FALSE)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbyn3p08.png
|
endif()
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n0g08.png
|
elseif(TEST_PNG_SRGB)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n2c08.png
|
if(NOT "${gamma_type}" STREQUAL "sRGB")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n3p08.png
|
set(TEST_PNG_VALID FALSE)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp1n3p08.png
|
endif()
|
||||||
)
|
elseif(TEST_PNG_G18)
|
||||||
|
if(NOT "${gamma_type}" STREQUAL "1.8")
|
||||||
|
set(TEST_PNG_VALID FALSE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(NOT "${gamma_type}" STREQUAL "none")
|
||||||
|
set(TEST_PNG_VALID FALSE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TEST_PNG_VALID)
|
||||||
|
list(APPEND PNGSTEST_FILES "${test_png}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
png_add_test(NAME pngstest-${gamma_type}-${alpha_type}
|
||||||
|
COMMAND pngstest
|
||||||
|
OPTIONS --tmpfile "${gamma_type}-${alpha_type}-" --log
|
||||||
|
FILES ${PNGSTEST_FILES})
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
add_executable(pngunknown ${pngunknown_sources})
|
||||||
|
target_link_libraries(pngunknown png)
|
||||||
|
|
||||||
|
png_add_test(NAME pngunknown-discard COMMAND pngunknown OPTIONS --strict default=discard FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-IDAT COMMAND pngunknown OPTIONS --strict default=discard IDAT=save FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-if-safe COMMAND pngunknown OPTIONS --strict default=if-safe FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-sAPI COMMAND pngunknown OPTIONS --strict bKGD=save cHRM=save gAMA=save all=discard iCCP=save sBIT=save sRGB=save FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-save COMMAND pngunknown OPTIONS --strict default=save FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-sTER COMMAND pngunknown OPTIONS --strict sTER=if-safe FILES "${PNGTEST_PNG}")
|
||||||
|
png_add_test(NAME pngunknown-vpAg COMMAND pngunknown OPTIONS --strict vpAg=if-safe FILES "${PNGTEST_PNG}")
|
||||||
|
|
||||||
|
add_executable(pngimage ${pngimage_sources})
|
||||||
|
target_link_libraries(pngimage png)
|
||||||
|
|
||||||
|
png_add_test(NAME pngimage-quick COMMAND pngimage OPTIONS --list-combos --log FILES ${PNGSUITE_PNGS})
|
||||||
|
png_add_test(NAME pngimage-full COMMAND pngimage OPTIONS --exhaustive --list-combos --log FILES ${PNGSUITE_PNGS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PNG_SHARED)
|
||||||
|
add_executable(pngfix ${pngfix_sources})
|
||||||
|
target_link_libraries(pngfix png)
|
||||||
|
set(PNG_BIN_TARGETS pngfix)
|
||||||
|
|
||||||
|
add_executable(png-fix-itxt ${png_fix_itxt_sources})
|
||||||
|
target_link_libraries(png-fix-itxt ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||||
|
list(APPEND PNG_BIN_TARGETS png-fix-itxt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
|
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
|
||||||
@ -234,6 +659,15 @@ macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
|
|||||||
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# Create source generation scripts.
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake @ONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake @ONLY)
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY)
|
||||||
|
|
||||||
|
|
||||||
# libpng is a library so default to 'lib'
|
# libpng is a library so default to 'lib'
|
||||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||||
set(CMAKE_INSTALL_LIBDIR lib)
|
set(CMAKE_INSTALL_LIBDIR lib)
|
||||||
@ -260,22 +694,12 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
|
|||||||
|
|
||||||
# SET UP LINKS
|
# SET UP LINKS
|
||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
set_target_properties(png PROPERTIES
|
||||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.22beta02
|
# VERSION 16.${PNGLIB_RELEASE}.1.6.22beta02
|
||||||
VERSION 16.${PNGLIB_RELEASE}.0
|
VERSION 16.${PNGLIB_RELEASE}.0
|
||||||
SOVERSION 16
|
SOVERSION 16
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
endif()
|
endif()
|
||||||
if(PNG_STATIC)
|
|
||||||
# MSVC doesn't use a different file extension for shared vs. static
|
|
||||||
# libs. We are able to change OUTPUT_NAME to remove the _static
|
|
||||||
# for all other platforms.
|
|
||||||
if(NOT MSVC)
|
|
||||||
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
|
|
||||||
OUTPUT_NAME ${PNG_LIB_NAME}
|
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# If CMake > 2.4.x, we set a variable used below to export
|
# If CMake > 2.4.x, we set a variable used below to export
|
||||||
# targets to an export file.
|
# targets to an export file.
|
||||||
@ -298,14 +722,14 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
|||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
||||||
if(CYGWIN OR MINGW)
|
if(CYGWIN OR MINGW)
|
||||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
|
||||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif(CYGWIN OR MINGW)
|
endif(CYGWIN OR MINGW)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
|
get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
|
||||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
@ -314,7 +738,7 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
|||||||
|
|
||||||
if(PNG_STATIC)
|
if(PNG_STATIC)
|
||||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
|
get_target_property(BUILD_TARGET_LOCATION png_static LOCATION_${CMAKE_BUILD_TYPE})
|
||||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
@ -334,6 +758,11 @@ if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
|
|||||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL )
|
||||||
|
install(TARGETS ${PNG_BIN_TARGETS}
|
||||||
|
RUNTIME DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||||
# Install man pages
|
# Install man pages
|
||||||
if(NOT PNG_MAN_DIR)
|
if(NOT PNG_MAN_DIR)
|
||||||
|
29
scripts/genchk.cmake.in
Normal file
29
scripts/genchk.cmake.in
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Generate .chk from .out with awk (generic), based upon the automake logic.
|
||||||
|
|
||||||
|
# Variables substituted from CMakeLists.txt
|
||||||
|
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
|
||||||
|
|
||||||
|
set(AWK "@AWK@")
|
||||||
|
|
||||||
|
get_filename_component(INPUTEXT "${INPUT}" EXT)
|
||||||
|
get_filename_component(OUTPUTEXT "${OUTPUT}" EXT)
|
||||||
|
get_filename_component(INPUTBASE "${INPUT}" NAME_WE)
|
||||||
|
get_filename_component(OUTPUTBASE "${OUTPUT}" NAME_WE)
|
||||||
|
get_filename_component(INPUTDIR "${INPUT}" PATH)
|
||||||
|
get_filename_component(OUTPUTDIR "${OUTPUT}" PATH)
|
||||||
|
|
||||||
|
if("${INPUTEXT}" STREQUAL ".out" AND "${OUTPUTEXT}" STREQUAL ".chk")
|
||||||
|
# Generate .chk from .out with awk (generic)
|
||||||
|
file(REMOVE "${OUTPUT}" "${OUTPUTDIR}/${OUTPUTBASE}.new")
|
||||||
|
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/checksym.awk"
|
||||||
|
"${SRCDIR}/scripts/${INPUTBASE}.def"
|
||||||
|
"of=${OUTPUTDIR}/${OUTPUTBASE}.new"
|
||||||
|
"${INPUT}"
|
||||||
|
RESULT_VARIABLE AWK_FAIL)
|
||||||
|
if(AWK_FAIL)
|
||||||
|
message(FATAL_ERROR "Failed to generate ${OUTPUTDIR}/${OUTPUTBASE}.new")
|
||||||
|
endif()
|
||||||
|
file(RENAME "${OUTPUTDIR}/${OUTPUTBASE}.new" "${OUTPUT}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unsupported conversion: ${INPUTEXT} to ${OUTPUTEXT}")
|
||||||
|
endif()
|
69
scripts/genout.cmake.in
Normal file
69
scripts/genout.cmake.in
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# Generate .out from .c with awk (generic), based upon the automake logic.
|
||||||
|
|
||||||
|
# Variables substituted from CMakeLists.txt
|
||||||
|
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
|
||||||
|
set(BINDIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||||
|
|
||||||
|
set(AWK "@AWK@")
|
||||||
|
set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
|
||||||
|
set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@")
|
||||||
|
set(INCDIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||||
|
set(PNG_PREFIX "@PNG_PREFIX@")
|
||||||
|
set(PNGLIB_MAJOR "@PNGLIB_MAJOR@")
|
||||||
|
set(PNGLIB_MINOR "@PNGLIB_MINOR@")
|
||||||
|
set(PNGLIB_VERSION "@PNGLIB_VERSION@")
|
||||||
|
set(ZLIBINCDIR "@ZLIB_INCLUDE_DIR@")
|
||||||
|
|
||||||
|
get_filename_component(INPUTEXT "${INPUT}" EXT)
|
||||||
|
get_filename_component(OUTPUTEXT "${OUTPUT}" EXT)
|
||||||
|
get_filename_component(INPUTBASE "${INPUT}" NAME_WE)
|
||||||
|
get_filename_component(OUTPUTBASE "${OUTPUT}" NAME_WE)
|
||||||
|
get_filename_component(INPUTDIR "${INPUT}" PATH)
|
||||||
|
get_filename_component(OUTPUTDIR "${OUTPUT}" PATH)
|
||||||
|
|
||||||
|
if ("${INPUTEXT}" STREQUAL ".c" AND "${OUTPUTEXT}" STREQUAL ".out")
|
||||||
|
get_filename_component(GENDIR "${OUTPUT}" PATH)
|
||||||
|
file(MAKE_DIRECTORY "${GENDIR}")
|
||||||
|
|
||||||
|
file(REMOVE "${OUTPUT}.tf1" "${OUTPUT}.tf2")
|
||||||
|
|
||||||
|
set(INCLUDES "-I${INCDIR}")
|
||||||
|
if(ZLIBINCDIR)
|
||||||
|
list(APPEND INCLUDES "-I${ZLIBINCDIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PNG_PREFIX)
|
||||||
|
set(PNG_PREFIX_DEF "-DPNG_PREFIX=${PNG_PREFIX}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E"
|
||||||
|
${CMAKE_C_FLAGS}
|
||||||
|
"-I${SRCDIR}"
|
||||||
|
"-I${BINDIR}"
|
||||||
|
"-DPNGLIB_LIBNAME=PNG${PNGLIB_MAJOR}${PNGLIB_MINOR}_0"
|
||||||
|
"-DPNGLIB_VERSION=${PNGLIB_VERSION}"
|
||||||
|
"-DSYMBOL_PREFIX=${SYMBOL_PREFIX}"
|
||||||
|
"-DPNG_NO_USE_READ_MACROS"
|
||||||
|
"-DPNG_BUILDING_SYMBOL_TABLE"
|
||||||
|
${PNG_PREFIX_DEF}
|
||||||
|
"${INPUT}"
|
||||||
|
OUTPUT_FILE "${OUTPUT}.tf1"
|
||||||
|
WORKING_DIRECTORY "${BINDIR}"
|
||||||
|
RESULT_VARIABLE CPP_FAIL)
|
||||||
|
if(CPP_FAIL)
|
||||||
|
message(FATAL_ERROR "Failed to generate ${OUTPUT}.tf1")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/dfn.awk"
|
||||||
|
"out=${OUTPUT}.tf2" "${OUTPUT}.tf1"
|
||||||
|
WORKING_DIRECTORY "${BINDIR}"
|
||||||
|
RESULT_VARIABLE AWK_FAIL)
|
||||||
|
if(AWK_FAIL)
|
||||||
|
message(FATAL_ERROR "Failed to generate ${OUTPUT}.tf2")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(REMOVE "${OUTPUT}.tf1")
|
||||||
|
file(RENAME "${OUTPUT}.tf2" "${OUTPUT}")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unsupported conversion: ${INPUTEXT} to ${OUTPUTEXT}")
|
||||||
|
endif()
|
130
scripts/gensrc.cmake.in
Normal file
130
scripts/gensrc.cmake.in
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
# Generate source files with awk, based upon the automake logic.
|
||||||
|
|
||||||
|
# Variables substituted from CMakeLists.txt
|
||||||
|
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
|
||||||
|
set(BINDIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||||
|
|
||||||
|
set(AWK "@AWK@")
|
||||||
|
set(DFA_XTRA "@DFA_XTRA@")
|
||||||
|
set(PNG_PREFIX "@PNG_PREFIX@")
|
||||||
|
set(PNGLIB_VERSION "@PNGLIB_VERSION@")
|
||||||
|
|
||||||
|
if("${OUTPUT}" STREQUAL "scripts/pnglibconf.c")
|
||||||
|
# Generate scripts/pnglibconf.c
|
||||||
|
|
||||||
|
file(REMOVE "${BINDIR}/pnglibconf.tf6" "${BINDIR}/pnglibconf.tf7")
|
||||||
|
|
||||||
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "com ${PNGLIB_VERSION} STANDARD API DEFINITION"
|
||||||
|
COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
|
||||||
|
"out=pnglibconf.tf6" "logunsupported=1" "version=search"
|
||||||
|
"${SRCDIR}/pngconf.h" "-"
|
||||||
|
"${SRCDIR}/scripts/pnglibconf.dfa"
|
||||||
|
WORKING_DIRECTORY "${BINDIR}"
|
||||||
|
RESULT_VARIABLE AWK_FAIL)
|
||||||
|
if(AWK_FAIL)
|
||||||
|
message(FATAL_ERROR "Failed to generate pnglibconf.tf6")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
|
||||||
|
"out=pnglibconf.tf7" "pnglibconf.tf6"
|
||||||
|
WORKING_DIRECTORY "${BINDIR}"
|
||||||
|
RESULT_VARIABLE AWK_FAIL)
|
||||||
|
if(AWK_FAIL)
|
||||||
|
message(FATAL_ERROR "Failed to generate pnglibconf.tf7")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(REMOVE "pnglibconf.tf6")
|
||||||
|
file(MAKE_DIRECTORY "${BINDIR}/scripts")
|
||||||
|
file(RENAME "pnglibconf.tf7" "${BINDIR}/scripts/pnglibconf.c")
|
||||||
|
|
||||||
|
elseif ("${OUTPUT}" STREQUAL "pnglibconf.c")
|
||||||
|
# Generate pnglibconf.c
|
||||||
|
|
||||||
|
file(REMOVE "${BINDIR}/pnglibconf.tf4" "${BINDIR}/pnglibconf.tf5")
|
||||||
|
|
||||||
|
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
|
||||||
|
out=pnglibconf.tf4 version=search
|
||||||
|
${SRCDIR}/pngconf.h ${SRCDIR}/scripts/pnglibconf.dfa
|
||||||
|
${SRCDIR}/pngusr.dfa ${DFA_XTRA}
|
||||||
|
WORKING_DIRECTORY "${BINDIR}"
|
||||||
|
RESULT_VARIABLE AWK_FAIL)
|
||||||
|
if(AWK_FAIL)
|
||||||
|
message(FATAL_ERROR "Failed to generate pnglibconf.tf4")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
|
||||||
|
out=pnglibconf.tf5 pnglibconf.tf4
|
||||||
|
WORKING_DIRECTORY "${BINDIR}"
|
||||||
|
RESULT_VARIABLE AWK_FAIL)
|
||||||
|
if(AWK_FAIL)
|
||||||
|
message(FATAL_ERROR "Failed to generate pnglibconf.tf5")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(REMOVE "pnglibconf.tf4")
|
||||||
|
file(MAKE_DIRECTORY "${BINDIR}/scripts")
|
||||||
|
file(RENAME "pnglibconf.tf5" "${BINDIR}/pnglibconf.c")
|
||||||
|
|
||||||
|
elseif ("${OUTPUT}" STREQUAL "pnglibconf.h")
|
||||||
|
# Generate pnglibconf.h
|
||||||
|
|
||||||
|
file(REMOVE "${BINDIR}/${OUTPUT}")
|
||||||
|
if(PNG_PREFIX)
|
||||||
|
file(REMOVE "pnglibconf.tf8")
|
||||||
|
|
||||||
|
execute_process(COMMAND "${AWK}" "s==0 && NR>1{print prev}
|
||||||
|
s==0{prev=\$0}
|
||||||
|
s==1{print \"#define\", \$1, \"${PNG_PREFIX}\" \$1}
|
||||||
|
s==2{print \"#define ${PNG_PREFIX}png_\" \$1, \"PNG_\" \$1}
|
||||||
|
END{print prev}" s=0 pnglibconf.out s=1 "${BINDIR}/scripts/prefix.out"
|
||||||
|
s=2 "${SRCDIR}/scripts/macro.lst"
|
||||||
|
OUTPUT_FILE pnglibconf.tf8
|
||||||
|
RESULT_VARIABLE AWK_FAIL)
|
||||||
|
if(AWK_FAIL)
|
||||||
|
message(FATAL_ERROR "Failed to generate pnglibconf.tf8")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(RENAME "pnglibconf.tf8" "${BINDIR}/${OUTPUT}")
|
||||||
|
else()
|
||||||
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${BINDIR}/pnglibconf.out"
|
||||||
|
"${BINDIR}/${OUTPUT}"
|
||||||
|
RESULT_VARIABLE COPY_FAIL)
|
||||||
|
if(COPY_FAIL)
|
||||||
|
message(FATAL_ERROR "Failed to create pnglibconf.h")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
elseif ("${OUTPUT}" STREQUAL "pngprefix.h")
|
||||||
|
# Generate pngprefix.h
|
||||||
|
|
||||||
|
file(REMOVE "${BINDIR}/${OUTPUT}")
|
||||||
|
|
||||||
|
if(PNG_PREFIX)
|
||||||
|
file(REMOVE "pngprefix.tf1")
|
||||||
|
|
||||||
|
execute_process(COMMAND "${AWK}"
|
||||||
|
"{print \"#define\", \$1, \"${PNG_PREFIX}\" \$1}"
|
||||||
|
"${BINDIR}/scripts/intprefix.out"
|
||||||
|
OUTPUT_FILE "pngprefix.tf1"
|
||||||
|
RESULT_VARIABLE AWK_FAIL)
|
||||||
|
if(AWK_FAIL)
|
||||||
|
message(FATAL_ERROR "Failed to generate pngprefix.tf1")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(RENAME "pngprefix.tf1" "${BINDIR}/${OUTPUT}")
|
||||||
|
else()
|
||||||
|
file(WRITE "${BINDIR}/${OUTPUT}" "/* No libpng symbol prefix configured. */")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
elseif("${OUTPUT}" STREQUAL "scripts/pnglibconf.h.prebuilt")
|
||||||
|
# Generate scripts/pnglibconf.h.prebuilt (fails build)
|
||||||
|
|
||||||
|
message(STATUS "Attempting to build scripts/pnglibconf.h.prebuilt")
|
||||||
|
message(STATUS "This is a machine generated file, but if you want to make")
|
||||||
|
message(STATUS "a new one simply build the 'genfiles' target, and copy")
|
||||||
|
message(STATUS "scripts/pnglibconf.out to scripts/pnglibconf.h.prebuilt")
|
||||||
|
message(STATUS "AND set PNG_ZLIB_VERNUM to 0 (you MUST do this)")
|
||||||
|
message(FATAL_ERROR "Stopping build")
|
||||||
|
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unsupported output: ${OUTPUT}")
|
||||||
|
endif()
|
22
scripts/test.cmake.in
Normal file
22
scripts/test.cmake.in
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
set(TEST_OPTIONS "@TEST_OPTIONS@")
|
||||||
|
set(TEST_FILES "@TEST_FILES@")
|
||||||
|
|
||||||
|
foreach(file ${TEST_FILES})
|
||||||
|
file(TO_NATIVE_PATH "${file}" native_file)
|
||||||
|
list(APPEND NATIVE_TEST_FILES "${native_file}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Add the directory containing libpng to the PATH (Windows only)
|
||||||
|
if(WIN32)
|
||||||
|
get_filename_component(LIBPNG_DIR "${LIBPNG}" PATH)
|
||||||
|
file(TO_NATIVE_PATH "${LIBPNG_DIR}" LIBPNG_DIR)
|
||||||
|
set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "Running ${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES})
|
||||||
|
|
||||||
|
execute_process(COMMAND "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}
|
||||||
|
RESULT_VARIABLE TEST_STATUS)
|
||||||
|
if(TEST_STATUS)
|
||||||
|
message(FATAL_ERROR "Returned failed status ${TEST_STATUS}!")
|
||||||
|
endif()
|
Loading…
x
Reference in New Issue
Block a user