fix CMake error when ENABLE_WEBP

master
Wangkun 2015-05-07 15:35:03 +08:00
parent 7ec030c4f1
commit 917fa11bfb
7 changed files with 47 additions and 49 deletions

View File

@ -95,7 +95,7 @@ else (USE_EXT_GD)
FIND_PACKAGE(ZLIB)
IF (ENABLE_WEBP)
FIND_PACKAGE(VPX)
FIND_PACKAGE(WEBP)
ENDIF (ENABLE_WEBP)
IF (ENABLE_LIQ)
@ -137,10 +137,10 @@ else (USE_EXT_GD)
SET(HAVE_LIBZ 1)
ENDIF(ZLIB_FOUND)
IF(VPX_FOUND)
INCLUDE_DIRECTORIES(${VPX_INCLUDE_DIR})
SET(HAVE_LIBVPX 1)
ENDIF(VPX_FOUND)
IF(WEBP_FOUND)
INCLUDE_DIRECTORIES(${WEBP_INCLUDE_DIR})
SET(HAVE_LIBWEBP 1)
ENDIF(WEBP_FOUND)
IF(PNG_FOUND)
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
@ -223,7 +223,6 @@ endif (USE_EXT_GD)
add_subdirectory(tests)
add_subdirectory(examples)
add_subdirectory(docs)
SET(CPACK_PACKAGE_NAME "libgd")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libGD, powerful and easy to use graphic library")

View File

@ -1,13 +1,13 @@
# - Find the native VPX includes and library
# - Find the native WEBP includes and library
#
# This module defines
# VPX_INCLUDE_DIR, where to find png.h, etc.
# VPX_LIBRARIES, the libraries to link against to use VPX.
# VPX_DEFINITIONS - You should ADD_DEFINITONS(${VPX_DEFINITIONS}) before compiling code that includes png library files.
# VPX_FOUND, If false, do not try to use VPX.
# WEBP_INCLUDE_DIR, where to find png.h, etc.
# WEBP_LIBRARIES, the libraries to link against to use WEBP.
# WEBP_DEFINITIONS - You should ADD_DEFINITONS(${WEBP_DEFINITIONS}) before compiling code that includes png library files.
# WEBP_FOUND, If false, do not try to use WEBP.
# also defined, but not for general use are
# VPX_LIBRARY, where to find the VPX library.
# WEBP_LIBRARY, where to find the WEBP library.
#
# Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
#
@ -38,38 +38,35 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
INCLUDE(FindZLIB)
include(FindZLIB)
SET(VPX_FOUND "NO")
SET(VPX_LIBRARY "")
FIND_PATH(VPX_INCLUDE_DIR vp8cx.h
/usr/local/include/vpx
/usr/include/vpx
find_path(WEBP_INCLUDE_DIR decode.h
/usr/local/include/webp
/usr/include/webp
)
SET(VPX_NAMES ${VPX_NAMES} "vpxmt" "libvpx")
FIND_LIBRARY(VPX_LIBRARY
NAMES ${VPX_NAMES}
PATHS "${PROJECT_SOURCE_DIR}/../deps/lib" /usr/lib64 /usr/lib /usr/local/lib
)
set(WEBP_NAMES ${WEBP_NAMES} webp)
find_library(WEBP_LIBRARY
NAMES ${WEBP_NAMES}
PATHS "${PROJECT_SOURCE_DIR}/../deps/lib" /usr/lib64 /usr/lib /usr/local/lib
)
IF (VPX_LIBRARY AND VPX_INCLUDE_DIR)
SET(VPX_INCLUDE_DIR ${VPX_INCLUDE_DIR})
SET(VPX_LIBRARIES ${VPX_LIBRARY})
SET(VPX_FOUND "YES")
if (WEBP_LIBRARY AND WEBP_INCLUDE_DIR)
set(WEBP_INCLUDE_DIR ${WEBP_INCLUDE_DIR})
set(WEBP_LIBRARIES ${WEBP_LIBRARY})
set(WEBP_FOUND "YES")
ENDIF (VPX_LIBRARY AND VPX_INCLUDE_DIR)
endif (WEBP_LIBRARY AND WEBP_INCLUDE_DIR)
IF (VPX_FOUND)
IF (NOT VPX_FIND_QUIETLY)
MESSAGE(STATUS "Found VPX: ${VPX_LIBRARY}")
ENDIF (NOT VPX_FIND_QUIETLY)
ELSE (VPX_FOUND)
IF (VPX_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find VPX library")
ENDIF (VPX_FIND_REQUIRED)
ENDIF (VPX_FOUND)
if (WEBP_FOUND)
if (NOT WEBP_FIND_QUIETLY)
message(STATUS "Found WEBP: ${WEBP_LIBRARY}")
endif (NOT WEBP_FIND_QUIETLY)
else (WEBP_FOUND)
if (WEBP_FIND_REQUIRED)
message(FATAL_ERROR "Could not find WEBP library")
endif (WEBP_FIND_REQUIRED)
endif (WEBP_FOUND)
MARK_AS_ADVANCED(VPX_INCLUDE_DIR VPX_LIBRARY )
SET(VPX_LIBRARIES ${VPX_LIBRARY})
mark_as_advanced(WEBP_INCLUDE_DIR WEBP_LIBRARY )
set(WEBP_LIBRARIES ${WEBP_LIBRARY})

View File

@ -15,6 +15,7 @@ ENABLE_TIFF=1
ENABLE_FREETYPE=1
ENABLE_FONTCONFIG=1
ENABLE_XPM=1
ENABLE_WEBP=1
You can optionnally run our tests suite using:
$ ctest .

View File

@ -66,6 +66,7 @@ SET (LIBGD_SRC_FILES
gd_version.c
)
include(GNUInstallDirs)
add_library(${GD_LIB} ${LIBGD_SRC_FILES})
add_library(${GD_LIB_STATIC} STATIC ${LIBGD_SRC_FILES})
@ -85,8 +86,8 @@ endif (MINGW OR MSYS)
INCLUDE_DIRECTORIES(BEFORE "${PROJECT_BINARY_DIR}" "${CMAKE_BINARY_DIR}" "${GD_SOURCE_DIR}/src")
target_link_libraries(${GD_LIB} ${ZLIB_LIBRARIES} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${ICONV_LIBRARIES} ${LIQ_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARY} ${VPX_LIBRARIES})
target_link_libraries(${GD_LIB_STATIC} ${ZLIB_LIBRARIES} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${ICONV_LIBRARIES} ${LIQ_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARY} ${VPX_LIBRARIES} )
target_link_libraries(${GD_LIB} ${ZLIB_LIBRARIES} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${ICONV_LIBRARIES} ${LIQ_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARY} ${WEBP_LIBRARIES})
target_link_libraries(${GD_LIB_STATIC} ${ZLIB_LIBRARIES} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${ICONV_LIBRARIES} ${LIQ_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARY} ${WEBP_LIBRARIES} )
set(GD_PROGRAMS annotate gdparttopng gdtopng gd2copypal gd2topng pngtogd pngtogd2 webpng gd2togif gdcmpgif giftogd2)
foreach(program ${GD_PROGRAMS})
@ -96,7 +97,7 @@ endforeach(program)
install(TARGETS ${GD_LIB} ${GD_LIB_STATIC} ${GD_PROGRAMS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(PROGRAMS bdftogd DESTINATION bin)
install(FILES gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h gd_color_map.h gd_errors.h DESTINATION include)

View File

@ -39,8 +39,8 @@
/* Define if you have the png library. */
#cmakedefine HAVE_LIBPNG
/* Define if you have the VPX library. */
#cmakedefine HAVE_LIBVPX
/* Define if you have the WEBP library. */
#cmakedefine HAVE_LIBWEBP
/* Define to 1 if you have the <libimagequant.h> header file. */
#cmakedefine HAVE_LIBIMAGEQUANT_H

View File

@ -70,7 +70,7 @@ static struct FileType {
{".gd2", gdImageCreateFromGd2, writegd2, NULL},
#endif
#ifdef HAVE_LIBVPX
#ifdef HAVE_LIBWEBP
{".webp", gdImageCreateFromWebp, gdImageWebp, NULL},
#endif

View File

@ -71,9 +71,9 @@ if (BUILD_TEST)
LIST(APPEND TESTS_DIRS xpm)
ENDIF(XPM_FOUND)
IF(VPX_FOUND)
IF(WEBP_FOUND)
LIST(APPEND TESTS_DIRS webp)
ENDIF(XPM_FOUND)
ENDIF(WEBP_FOUND)
FOREACH(test_dir ${TESTS_DIRS})
add_subdirectory (${test_dir})