forked from Kitware/fletch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for some graphics formats
- Loading branch information
Showing
10 changed files
with
806 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# PNG External project | ||
|
||
# ZLIB | ||
add_package_dependency( | ||
PACKAGE PNG | ||
PACKAGE_DEPENDENCY ZLib | ||
PACKAGE_DEPENDENCY_ALIAS ZLIB | ||
) | ||
if(NOT ZLIB_FOUND) | ||
set(ZLIB_INCLUDE_DIRS ${fletch_BUILD_INSTALL_PREFIX}/include) | ||
get_system_library_name(zlib zlib_lib) | ||
set(ZLIB_LIBRARIES ${fletch_BUILD_INSTALL_PREFIX}/lib/${zlib_lib}) | ||
endif() | ||
set(png_cmake_args ${png_cmake_args} | ||
-DZLIB_INCLUDE_DIR:PATH=${ZLIB_INCLUDE_DIRS} | ||
-DZLIB_LIBRARY:PATH=${ZLIB_LIBRARIES} | ||
) | ||
|
||
|
||
ExternalProject_Add(PNG | ||
DEPENDS ${PNG_DEPENDS} | ||
URL ${PNG_url} | ||
URL_MD5 ${PNG_md5} | ||
PREFIX ${fletch_BUILD_PREFIX} | ||
DOWNLOAD_DIR ${fletch_DOWNLOAD_DIR} | ||
INSTALL_DIR ${fletch_BUILD_INSTALL_PREFIX} | ||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy | ||
${fletch_SOURCE_DIR}/Patches/PNG/CMakeLists.txt | ||
${fletch_BUILD_PREFIX}/src/PNG/CMakeLists.txt | ||
CMAKE_GENERATOR ${gen} | ||
CMAKE_ARGS | ||
-DCMAKE_INSTALL_PREFIX:PATH=${fletch_BUILD_INSTALL_PREFIX} | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | ||
${png_cmake_args} | ||
) | ||
|
||
set(PNG_ROOT "${fletch_BUILD_INSTALL_PREFIX}" CACHE PATH "" FORCE) | ||
file(APPEND ${fletch_CONFIG_INPUT} " | ||
################################ | ||
# PNG | ||
################################ | ||
set(PNG_ROOT @PNG_ROOT@) | ||
") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# The ZLib external project for fletch | ||
|
||
ExternalProject_Add(ZLib | ||
URL ${ZLib_file} | ||
URL_MD5 ${zlib_md5} | ||
DOWNLOAD_NAME ${zlib_dlname} | ||
PREFIX ${fletch_BUILD_PREFIX} | ||
DOWNLOAD_DIR ${fletch_DOWNLOAD_DIR} | ||
INSTALL_DIR ${fletch_BUILD_INSTALL_PREFIX} | ||
CMAKE_GENERATOR ${gen} | ||
CMAKE_ARGS | ||
-DCMAKE_INSTALL_PREFIX:PATH=${fletch_BUILD_INSTALL_PREFIX} | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
-DBUILD_SHARED_LIBS:BOOL=ON | ||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | ||
) | ||
|
||
if(WIN32) | ||
# Copy zlib to zdll for Qt | ||
ExternalProject_Add_Step(ZLib fixup-install | ||
COMMAND ${CMAKE_COMMAND} -E copy | ||
${fletch_BUILD_INSTALL_PREFIX}/lib/zlib.lib | ||
${fletch_BUILD_INSTALL_PREFIX}/lib/zdll.lib | ||
DEPENDEES install | ||
) | ||
elseif(NOT APPLE) | ||
# For Linux machines | ||
ExternalProject_Add_Step(ZLib fixup-install | ||
COMMAND ${CMAKE_COMMAND} -E copy | ||
${fletch_BUILD_INSTALL_PREFIX}/lib/libzlib.so | ||
${fletch_BUILD_INSTALL_PREFIX}/lib/libz.so | ||
DEPENDEES install | ||
) | ||
endif() | ||
|
||
set(ZLIB_ROOT ${fletch_BUILD_INSTALL_PREFIX} CACHE PATH "" FORCE) | ||
file(APPEND ${fletch_CONFIG_INPUT} " | ||
######################################## | ||
# ZLib | ||
######################################## | ||
set(ZLIB_ROOT @ZLIB_ROOT@) | ||
") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# libjpeg-turbo External project | ||
|
||
include(External_yasm) | ||
list(APPEND libjpeg-turbo_DEPENDS yasm) | ||
|
||
if(WIN32) | ||
ExternalProject_Add(libjpeg-turbo | ||
URL ${libjpeg-turbo_url} | ||
URL_MD5 ${libjpeg-turbo_md5} | ||
DEPENDS ${libjpeg-turbo_DEPENDS} | ||
PREFIX ${fletch_BUILD_PREFIX} | ||
DOWNLOAD_DIR ${fletch_DOWNLOAD_DIR} | ||
PATCH_COMMAND ${CMAKE_COMMAND} | ||
-Dlibjpeg-turbo_patch:PATH=${fletch_SOURCE_DIR}/Patches/libjpeg-turbo | ||
-Dlibjpeg-turbo_source:PATH=${fletch_BUILD_PREFIX}/src/libjpeg-turbo | ||
-P ${fletch_SOURCE_DIR}/Patches/libjpeg-turbo/Patch.cmake | ||
INSTALL_DIR ${fletch_BUILD_INSTALL_PREFIX} | ||
|
||
CMAKE_GENERATOR ${gen} | ||
CMAKE_ARGS | ||
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} | ||
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} | ||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} | ||
-DCMAKE_INSTALL_PREFIX:PATH=${fletch_BUILD_INSTALL_PREFIX} | ||
-DNASM:FILEPATH=${fletch_YASM} -g vc8 | ||
) | ||
|
||
ExternalProject_Add_Step(libjpeg-turbo fixup-install | ||
COMMAND ${CMAKE_COMMAND} -E copy | ||
${fletch_BUILD_INSTALL_PREFIX}/lib/jpeg.lib | ||
${fletch_BUILD_INSTALL_PREFIX}/lib/libjpeg.lib | ||
DEPENDEES install | ||
) | ||
else() | ||
# We need some special Apple treatment | ||
if(APPLE) | ||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set(_libjpeg-turbo_ARGS_APPLE --host x86_64-apple-darwin ) | ||
endif() | ||
if(CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
# Need to investigate/apply the following command-line options for 32-bit when required. | ||
# Configure commandline comes from the BUILDING.txt file in libjpeg-turbo source | ||
# "--host i686-apple-darwin CFLAGS='-isysroot /Developer/SDKs/MacOSX10.5.sdk | ||
# -mmacosx-version-min=10.5 -O3 -m32' LDFLAGS='-isysroot | ||
# /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -m32'") | ||
|
||
endif() | ||
endif() | ||
|
||
Fletch_Require_Make() | ||
ExternalProject_Add(libjpeg-turbo | ||
URL ${libjpeg-turbo_url} | ||
URL_MD5 ${libjpeg-turbo_md5} | ||
DEPENDS ${libjpeg-turbo_DEPENDS} | ||
PREFIX ${fletch_BUILD_PREFIX} | ||
DOWNLOAD_DIR ${fletch_DOWNLOAD_DIR} | ||
INSTALL_DIR ${fletch_BUILD_INSTALL_PREFIX} | ||
BUILD_IN_SOURCE 1 | ||
CONFIGURE_COMMAND ./configure | ||
--prefix=${fletch_BUILD_INSTALL_PREFIX} | ||
${_libjpeg-turbo_ARGS_APPLE} | ||
NASM=${fletch_YASM} | ||
BUILD_COMMAND ${MAKE_EXECUTABLE} | ||
INSTALL_COMMAND ${MAKE_EXECUTABLE} install | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# libtiff External project | ||
|
||
# We need -fPIC when building statically | ||
if( UNIX AND NOT BUILD_SHARED_LIBS) | ||
set (CMAKE_POSITION_INDEPENDENT_CODE TRUE) | ||
endif() | ||
|
||
# JPEG | ||
add_package_dependency( | ||
PACKAGE libtiff | ||
PACKAGE_DEPENDENCY libjpeg-turbo | ||
PACKAGE_DEPENDENCY_ALIAS JPEG | ||
) | ||
|
||
# ZLIB | ||
add_package_dependency( | ||
PACKAGE libtiff | ||
PACKAGE_DEPENDENCY ZLib | ||
PACKAGE_DEPENDENCY_ALIAS ZLIB | ||
) | ||
|
||
if(WIN32) | ||
set(libtiff_nmake_args | ||
JPEG_SUPPORT=1 | ||
ZIP_SUPPORT=1 | ||
) | ||
|
||
if(NOT JPEG_FOUND) | ||
set(JPEG_INCLUDE_DIR ${fletch_BUILD_INSTALL_PREFIX}/include) | ||
set(JPEG_LIBRARY ${fletch_BUILD_INSTALL_PREFIX}/lib/jpeg.lib) | ||
endif() | ||
set(libtiff_nmake_args | ||
JPEG_INCLUDE=-I${JPEG_INCLUDE_DIR} | ||
JPEG_LIB=${JPEG_LIBRARY} | ||
${libtiff_nmake_args} | ||
) | ||
|
||
if(NOT ZLIB_FOUND) | ||
set(ZLIB_INCLUDE_DIRS ${fletch_BUILD_INSTALL_PREFIX}/include) | ||
set(ZLIB_LIBRARIES ${fletch_BUILD_INSTALL_PREFIX}/lib/zlib.lib) | ||
endif() | ||
set(libtiff_nmake_args | ||
ZLIB_INCLUDE=-I${ZLIB_INCLUDE_DIRS} | ||
ZLIB_LIB=${ZLIB_LIBRARIES} | ||
${libtiff_nmake_args} | ||
) | ||
|
||
ExternalProject_Add(libtiff | ||
DEPENDS ${libtiff_DEPENDS} | ||
URL ${libtiff_url} | ||
URL_MD5 ${libtiff_md5} | ||
PREFIX ${fletch_BUILD_PREFIX} | ||
DOWNLOAD_DIR ${fletch_DOWNLOAD_DIR} | ||
DOWNLOAD_COMMAND ${libtiff_download_command} | ||
BUILD_IN_SOURCE 1 | ||
CONFIGURE_COMMAND "" | ||
# Build with nmake | ||
BUILD_COMMAND nmake -f Makefile.vc clean | ||
COMMAND nmake -f Makefile.vc ${libtiff_nmake_args} | ||
# Custom install | ||
INSTALL_COMMAND ${CMAKE_COMMAND} | ||
-DBUILD_DIR:PATH=${fletch_BUILD_PREFIX}/src/libtiff | ||
-DINSTALL_DIR:PATH=${fletch_BUILD_INSTALL_PREFIX} | ||
-P ${fletch_SOURCE_DIR}/Patches/libtiff/Install.cmake | ||
) | ||
|
||
else() | ||
# variables to configure libtiff | ||
set(libtiff_configure_args) | ||
|
||
# JPEG | ||
if (fletch_ENABLE_libjpeg-turbo) | ||
set(JPEG_INCLUDE_DIR ${fletch_BUILD_INSTALL_PREFIX}/include) | ||
set(JPEG_LIBRARY_PATH ${fletch_BUILD_INSTALL_PREFIX}/lib) | ||
else() | ||
get_filename_component(JPEG_LIBRARY_PATH JPEG_LIBRARY PATH) | ||
endif() | ||
set(libtiff_configure_args ${libtiff_configure_args} | ||
"--with-jpeg-include-dir=${JPEG_INCLUDE_DIR}" | ||
"--with-jpeg-lib-dir=${JPEG_LIBRARY_PATH}" | ||
) | ||
|
||
if (fletch_ENABLE_ZLib) | ||
set(ZLIB_INCLUDE_DIRS ${fletch_BUILD_INSTALL_PREFIX}/include) | ||
set(ZLIB_LIBRARY_PATH ${fletch_BUILD_INSTALL_PREFIX}/lib) | ||
else() | ||
get_filename_component(ZLIB_LIBRARY_PATH ZLIB_LIBRARY PATH) | ||
endif() | ||
set(libtiff_configure_args ${libtiff_configure_args} | ||
"--with-zlib-include-dir=${ZLIB_INCLUDE_DIRS}" | ||
"--with-zlib-lib-dir=${ZLIB_LIBRARY_PATH}" | ||
) | ||
|
||
Fletch_Require_Make() | ||
ExternalProject_Add(libtiff | ||
DEPENDS ${libtiff_DEPENDS} | ||
URL ${libtiff_url} | ||
URL_MD5 ${libtiff_md5} | ||
PREFIX ${fletch_BUILD_PREFIX} | ||
DOWNLOAD_DIR ${fletch_DOWNLOAD_DIR} | ||
INSTALL_DIR ${fletch_BUILD_INSTALL_PREFIX} | ||
BUILD_IN_SOURCE 1 | ||
CONFIGURE_COMMAND ./configure | ||
--prefix=${fletch_BUILD_INSTALL_PREFIX} | ||
${libtiff_configure_args} | ||
|
||
BUILD_COMMAND ${MAKE_EXECUTABLE} | ||
INSTALL_COMMAND ${MAKE_EXECUTABLE} install | ||
) | ||
endif() | ||
|
||
set(libtiff_ROOT "${fletch_BUILD_INSTALL_PREFIX}" CACHE PATH "" FORCE) | ||
file(APPEND ${fletch_CONFIG_INPUT} " | ||
################################ | ||
# libtiff | ||
################################ | ||
set(libtiff_ROOT @libtiff_ROOT@) | ||
") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# The yasm external project for fletch. | ||
# This external project does not follow the normal pattern for | ||
# fletch. It is only used by the jpeg-turbo project and only when | ||
# NASM or YASM can't be found. So, the usual enable flags and infrastructure | ||
# for a fletch. Instead this file is directly included | ||
# in External_libjpegturbo.cmake. | ||
|
||
if (NOT _external_yasm_include) | ||
set(_external_yasm_include TRUE) | ||
ExternalProject_Add(yasm | ||
URL ${yasm_url} | ||
URL_MD5 ${yasm_md5} | ||
PREFIX ${fletch_BUILD_PREFIX} | ||
DOWNLOAD_DIR ${fletch_DOWNLOAD_DIR} | ||
CMAKE_GENERATOR ${gen} | ||
INSTALL_COMMAND "" | ||
CMAKE_ARGS | ||
-DCMAKE_BUILD_TYPE=Release | ||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} | ||
-DBUILD_SHARED_LIBS=OFF | ||
) | ||
|
||
if (WIN32) | ||
set(fletch_YASM ${fletch_BUILD_PREFIX}/src/yasm-build/${CMAKE_CFG_INTDIR}/yasm.exe) | ||
else() | ||
set(fletch_YASM ${fletch_BUILD_PREFIX}/src/yasm-build/yasm) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.