#-------------------------------------------------------------------------------
MACRO (EXTERNAL_JPEG_LIBRARY compress_type libtype jpeg_pic)
# May need to build JPEG with PIC on x64 machines with gcc
# Need to use CMAKE_ANSI_CFLAGS define so that compiler test works
if (${compress_type} MATCHES "SVN")
EXTERNALPROJECT_ADD (JPEG
SVN_REPOSITORY ${JPEG_URL}
# [SVN_REVISION rev]
INSTALL_COMMAND ""
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
-DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
)
elseif (${compress_type} MATCHES "GIT")
EXTERNALPROJECT_ADD (JPEG
GIT_REPOSITORY ${JPEG_URL}
INSTALL_COMMAND ""
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
-DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
)
elseif (${compress_type} MATCHES "TGZ")
EXTERNALPROJECT_ADD (JPEG
URL ${JPEG_URL}
URL_MD5 ""
INSTALL_COMMAND ""
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
-DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
)
endif (${compress_type} MATCHES "SVN")
externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR)
# Create imported target szip
add_library (jpeg ${libtype} IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (jpeg "jpeg" ${libtype} "")
add_dependencies (JPEG jpeg)
# include (${BINARY_DIR}/JPEG-targets.cmake)
set (JPEG_LIBRARY "jpeg")
set (JPEG_INCLUDE_DIR_GEN "${BINARY_DIR}")
set (JPEG_INCLUDE_DIR "${SOURCE_DIR}/src")
set (JPEG_FOUND 1)
set (JPEG_LIBRARIES ${JPEG_LIBRARY})
set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR_GEN} ${JPEG_INCLUDE_DIR})
ENDMACRO (EXTERNAL_JPEG_LIBRARY)
#-------------------------------------------------------------------------------
MACRO (PACKAGE_JPEG_LIBRARY compress_type)
add_custom_target (JPEG-GenHeader-Copy ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${JPEG_INCLUDE_DIR_GEN}/jconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
COMMENT "Copying ${JPEG_INCLUDE_DIR_GEN}/jconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jconfig.h)
if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
add_dependencies (JPEG-GenHeader-Copy JPEG)
endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
ENDMACRO (PACKAGE_JPEG_LIBRARY)
#-------------------------------------------------------------------------------
MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding)
if (${compress_type} MATCHES "SVN")
EXTERNALPROJECT_ADD (SZIP
SVN_REPOSITORY ${SZIP_URL}
# [SVN_REVISION rev]
INSTALL_COMMAND ""
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
-DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DSZIP_ENABLE_ENCODING:BOOL=${encoding}
)
elseif (${compress_type} MATCHES "GIT")
EXTERNALPROJECT_ADD (SZIP
GIT_REPOSITORY ${SZIP_URL}
# [SVN_REVISION rev]
INSTALL_COMMAND ""
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
-DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DSZIP_ENABLE_ENCODING:BOOL=${encoding}
)
elseif (${compress_type} MATCHES "TGZ")
EXTERNALPROJECT_ADD (SZIP
URL ${SZIP_URL}
URL_MD5 ""
INSTALL_COMMAND ""
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
-DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-DSZIP_ENABLE_ENCODING:BOOL=${encoding}
)
endif (${compress_type} MATCHES "SVN")
externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR)
# Create imported target szip
add_library (szip ${libtype} IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (szip "szip" ${libtype} "")
add_dependencies (SZIP szip)
# include (${BINARY_DIR}/SZIP-targets.cmake)
set (SZIP_LIBRARY "szip")
set (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}")
set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src")
set (SZIP_FOUND 1)
set (SZIP_LIBRARIES ${SZIP_LIBRARY})
set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR})
ENDMACRO (EXTERNAL_SZIP_LIBRARY)
#-------------------------------------------------------------------------------
MACRO (PACKAGE_SZIP_LIBRARY compress_type)
add_custom_target (SZIP-GenHeader-Copy ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h)
if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
add_dependencies (SZIP-GenHeader-Copy SZIP)
endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
ENDMACRO (PACKAGE_SZIP_LIBRARY)
#-------------------------------------------------------------------------------
MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype)
if (${compress_type} MATCHES "SVN")
EXTERNALPROJECT_ADD (ZLIB
SVN_REPOSITORY ${ZLIB_URL}
# [SVN_REVISION rev]
INSTALL_COMMAND ""
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
-DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
)
elseif (${compress_type} MATCHES "GIT")
EXTERNALPROJECT_ADD (ZLIB
GIT_REPOSITORY ${ZLIB_URL}
# [SVN_REVISION rev]
INSTALL_COMMAND ""
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
-DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
)
elseif (${compress_type} MATCHES "TGZ")
EXTERNALPROJECT_ADD (ZLIB
URL ${ZLIB_URL}
URL_MD5 ""
INSTALL_COMMAND ""
CMAKE_ARGS
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
-DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
-DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
)
endif (${compress_type} MATCHES "SVN")
externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR)
# Create imported target zlib
add_library (zlib ${libtype} IMPORTED)
if (WIN32)
set (ZLIB_LIB_NAME "zlib")
else (WIN32)
set (ZLIB_LIB_NAME "z")
endif (WIN32)
HDF_IMPORT_SET_LIB_OPTIONS (zlib ${ZLIB_LIB_NAME} ${libtype} "")
add_dependencies (ZLIB zlib)
# include (${BINARY_DIR}/ZLIB-targets.cmake)
set (ZLIB_LIBRARY "zlib")
set (ZLIB_INCLUDE_DIR_GEN "${BINARY_DIR}")
set (ZLIB_INCLUDE_DIR "${SOURCE_DIR}")
set (ZLIB_FOUND 1)
set (ZLIB_LIBRARIES ${ZLIB_LIBRARY})
set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR})
ENDMACRO (EXTERNAL_ZLIB_LIBRARY)
#-------------------------------------------------------------------------------
MACRO (PACKAGE_ZLIB_LIBRARY compress_type)
add_custom_target (ZLIB-GenHeader-Copy ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
)
set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h)
if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
add_dependencies (ZLIB-GenHeader-Copy ZLIB)
endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
ENDMACRO (PACKAGE_ZLIB_LIBRARY)