mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from libpng-1.2.15beta5.tar
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
# CMakeLists.txt, for use with cmake. See www.cmake.org
|
||||
|
||||
project(libpng)
|
||||
|
||||
SET(PNG_VER_MAJOR 1)
|
||||
@@ -11,8 +9,8 @@ find_package(ZLIB REQUIRED)
|
||||
|
||||
|
||||
# command line options
|
||||
OPTION(PNG_SHARED "Build shared lib" YES)
|
||||
OPTION(PNG_TESTS "Build pngtest" YES)
|
||||
option(PNG_SHARED "Build shared lib" YES)
|
||||
option(PNG_TESTS "Build pngtest" YES)
|
||||
#TODO:
|
||||
# PNG_NO_CONSOLE_IO
|
||||
# PNG_NO_STDIO
|
||||
@@ -20,6 +18,21 @@ OPTION(PNG_TESTS "Build pngtest" YES)
|
||||
# PNGARG
|
||||
# some others :)
|
||||
|
||||
set(png_asm_tmp "OFF")
|
||||
if(NOT WIN32)
|
||||
find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin)
|
||||
if(uname_executable)
|
||||
EXEC_PROGRAM(${uname_executable} ARGS --machine OUTPUT_VARIABLE uname_output)
|
||||
if("uname_output" MATCHES "^.*i[1-9]86.*$")
|
||||
set(png_asm_tmp "ON")
|
||||
else("uname_output" MATCHES "^.*i[1-9]86.*$")
|
||||
set(png_asm_tmp "OFF")
|
||||
endif("uname_output" MATCHES "^.*i[1-9]86.*$")
|
||||
endif(uname_executable)
|
||||
endif(NOT WIN32)
|
||||
|
||||
option(PNG_MMX "Use MMX assembler code (x86 only)" ${png_asm_tmp})
|
||||
|
||||
|
||||
# msvc does not append 'lib' - do it here to have consistent name
|
||||
if(MSVC)
|
||||
@@ -77,6 +90,16 @@ else(MSVC)
|
||||
)
|
||||
endif(MSVC)
|
||||
|
||||
if(NOT PNG_MMX)
|
||||
add_definitions(-DPNG_NO_MMX_CODE)
|
||||
endif(NOT PNG_MMX)
|
||||
|
||||
if(NOT WIN32)
|
||||
find_library(M_LIBRARY
|
||||
NAMES m
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
)
|
||||
endif(NOT WIN32)
|
||||
|
||||
# now build our target
|
||||
include_directories(${CMAKE_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||
@@ -87,10 +110,10 @@ else(PNG_SHARED)
|
||||
add_library(STATIC ${libpng_sources})
|
||||
endif(PNG_SHARED)
|
||||
|
||||
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY})
|
||||
if(PNG_SHARED)
|
||||
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
|
||||
if(PNG_SHARED AND WIN32)
|
||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
|
||||
endif(PNG_SHARED)
|
||||
endif(PNG_SHARED AND WIN32)
|
||||
|
||||
if(PNG_TESTS)
|
||||
# does not work with msvc due to png_lib_ver issue
|
||||
@@ -102,7 +125,7 @@ endif(PNG_TESTS)
|
||||
|
||||
# install
|
||||
install_targets(/bin ${PNG_LIB_NAME})
|
||||
install(FILES png.h pngconf.h DESTINATION include)
|
||||
install(FILES libpng.so libpng.a DESTINATION lib)
|
||||
install(FILES png.h pngconf.h DESTINATION include)
|
||||
install(FILES libpng.3 libpngpf.3 DESTINATION man/man3)
|
||||
# what's with libpng.txt and all the extra files?
|
||||
@@ -120,3 +143,5 @@ install(FILES libpng.3 libpngpf.3 DESTINATION man/man3)
|
||||
# lib /def:libpng.def /machine:x86
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user