Inspired from https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/Maintenance/HowToCreateTheCMakeCaseConversion.txt
This needs vim 7.3 and fails with vim 7.4
This also fixes a number of :
- missing empty line at end of files
- useless space at end of lines
# you can specify your own OPENJPEG_SOVERSION at cmake configuration time:
# cmake -DOPENJPEG_SOVERSION:STRING=42 /path/to/openjpeg
if(NOT OPENJPEG_SOVERSION)
- SET(OPENJPEG_SOVERSION 7)
+ set(OPENJPEG_SOVERSION 7)
endif(NOT OPENJPEG_SOVERSION)
set(OPENJPEG_LIBRARY_PROPERTIES
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
# For all builds, make sure openjpeg is std99 compliant:
# set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
- SET(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>")
+ set(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>")
endif()
#-----------------------------------------------------------------------------
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config.h
@ONLY
)
-
+
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config_private.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config_private.h
# Ensure that an include file is provided by the system
-# Add the check about the mandatory status to the check_include_file macro
+# Add the check about the mandatory status to the check_include_file macro
# provided by cmake
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
endif()
endif()
-endmacro()
\ No newline at end of file
+endmacro()
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
-HTML_TIMESTAMP = NO
+HTML_TIMESTAMP = NO
HTML_ALIGN_MEMBERS = YES
HTML_DYNAMIC_SECTIONS = NO
GENERATE_DOCSET = NO
#-----------------------------------------------------------------------------
-# opj_apps_config.h generation
+# opj_apps_config.h generation
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/opj_apps_config.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/opj_apps_config.h
@ONLY
- )
\ No newline at end of file
+ )
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.h
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_string.h
)
-
+
if(OPJ_HAVE_LIBTIFF)
list(APPEND common_SRCS converttif.c)
endif()
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
if(OPJ_USE_DSYMUTIL)
- add_custom_command(TARGET ${exe} POST_BUILD
+ add_custom_command(TARGET ${exe} POST_BUILD
COMMAND "dsymutil" "$<TARGET_FILE:${exe}>"
COMMENT "dsymutil $<TARGET_FILE:${exe}>"
DEPENDS ${exe})
# Build the demo app, small examples
# First thing define the common source:
-SET(common_SRCS
+set(common_SRCS
convert.c
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
)
endif()
# Loop over all executables:
-FOREACH(exe opj_jp3d_compress opj_jp3d_decompress)
- ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
- TARGET_LINK_LIBRARIES(${exe} openjp3d)
+foreach(exe opj_jp3d_compress opj_jp3d_decompress)
+ add_executable(${exe} ${exe}.c ${common_SRCS})
+ target_link_libraries(${exe} openjp3d)
# On unix you need to link to the math library:
- IF(UNIX)
- TARGET_LINK_LIBRARIES(${exe} m)
- ENDIF(UNIX)
+ if(UNIX)
+ target_link_libraries(${exe} m)
+ endif(UNIX)
# Install exe
- INSTALL(TARGETS ${exe}
+ install(TARGETS ${exe}
EXPORT OpenJP3DTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
find_package(Java 1.5 COMPONENTS Development) # javac, jar
# User can override this:
-if(NOT DEFINED JAVA_SOURCE_VERSION)
+if(NOT DEFINED JAVA_SOURCE_VERSION)
set(JAVA_SOURCE_VERSION 1.5)
endif()
if(NOT DEFINED JAVA_TARGET_VERSION)
APPEND PROPERTY COMPILE_DEFINITIONS USE_MJ2
)
target_link_libraries(${exe} ${LCMS_LIBNAME} openmj2)
-
+
if(UNIX)
target_link_libraries(${exe} m)
endif()
-
+
install(TARGETS ${exe}
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR})
endforeach()
if(OPJ_USE_DSYMUTIL)
if(BUILD_SHARED_LIBS)
- add_custom_command(TARGET ${OPENJPEG_LIBRARY_NAME} POST_BUILD
+ add_custom_command(TARGET ${OPENJPEG_LIBRARY_NAME} POST_BUILD
COMMAND "dsymutil" "$<TARGET_SONAME_FILE:${OPENJPEG_LIBRARY_NAME}>"
COMMENT "dsymutil $<TARGET_SONAME_FILE:${OPENJPEG_LIBRARY_NAME}>"
DEPENDS ${OPENJPEG_LIBRARY_NAME})
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
)
-SET(OPENJP3D_LIBRARY_NAME openjp3d)
+set(OPENJP3D_LIBRARY_NAME openjp3d)
# Defines the source code for the library
-SET(OPENJP3D_SRCS
+set(OPENJP3D_SRCS
bio.c cio.c dwt.c event.c jp3d.c jp3d_lib.c mct.c mqc.c openjp3d.c
pi.c raw.c t1.c t1_3d.c t2.c tcd.c tgt.c volume.c
)
# Install library
install(TARGETS ${OPENJP3D_LIBRARY_NAME}
EXPORT OpenJP3DTargets
- DESTINATION ${OPENJPEG_INSTALL_LIB_DIR}
+ DESTINATION ${OPENJPEG_INSTALL_LIB_DIR}
COMPONENT Libraries
)
# Install library
install(TARGETS ${OPENMJ2_LIBRARY_NAME}
EXPORT OpenMJ2Targets
- DESTINATION ${OPENJPEG_INSTALL_LIB_DIR}
+ DESTINATION ${OPENJPEG_INSTALL_LIB_DIR}
COMPONENT Libraries
)
# Install includes files
-#INSTALL(FILES mj2.h
-# DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR}/${subdir}
+#install(FILES mj2.h
+# DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR}/${subdir}
# COMPONENT Headers
#)
# Define a list of file which should be gracefully rejected:
set(BLACKLIST_JPEG2000
${BLACKLIST_JPEG2000_TMP}
- broken1.jp2
+ broken1.jp2
broken2.jp2
broken3.jp2
broken4.jp2
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref)
endif()
-
+
# Test the encoded file is a valid JP2 file
if (JPYLYZER_EXECUTABLE)
if (${OUTPUT_FILENAME} MATCHES "\\.jp2$")
COMMAND ${JPYLYZER_EXECUTABLE}
${OUTPUT_FILENAME}
)
- set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-jpylyser PROPERTIES
+ set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-jpylyser PROPERTIES
DEPENDS NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode
PASS_REGULAR_EXPRESSION "<isValidJP2>True</isValidJP2>"
)
endif()
endif(JPYLYZER_EXECUTABLE)
-
+
# If lossless compression (simple test is 4 arguments), decompress & compare
list(LENGTH CMD_ARG_LIST_2 ARG_COUNT)
if (ARG_COUNT EQUAL 4)
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-decode
COMMAND opj_decompress -i ${OUTPUT_FILENAME} -o ${OUTPUT_FILENAME}.lossless.tif
)
- set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-decode PROPERTIES
+ set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-decode PROPERTIES
DEPENDS NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode
)
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-compare
COMMAND compare_images -b ${INPUT_FILENAME} -t ${OUTPUT_FILENAME}.lossless.tif -n 1 -d
)
- set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-compare PROPERTIES
+ set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-compare PROPERTIES
DEPENDS NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-decode
)
endif()
-DOUTFILENAME:STRING=${OUTPUT_FILENAME}
-P ${CMAKE_CURRENT_SOURCE_DIR}/checkmd5refs.cmake)
- set_tests_properties(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode-md5
+ set_tests_properties(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode-md5
PROPERTIES DEPENDS NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode
)
foreach(pgxfullpath ${globfiles})
file(MD5 ${pgxfullpath} output)
get_filename_component(pgxfile ${pgxfullpath} NAME)
-
+
string(REGEX MATCH "[0-9a-f]+ ${pgxfile}" output_var "${variable}")
set(output "${output} ${pgxfile}")
-
+
if("${output_var}" STREQUAL "${output}")
message(STATUS "equal: [${output_var}] vs [${output}]")
else()
-# UNIT TESTS
+# UNIT TESTS
include_directories(
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
#------------
# Try to find lib Z
-IF(BUILD_THIRDPARTY)
+if(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build Z lib from thirdparty")
- ADD_SUBDIRECTORY(libz)
- SET(Z_LIBNAME z PARENT_SCOPE)
- SET(Z_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include PARENT_SCOPE)
- SET(ZLIB_FOUND 1)
-ELSE (BUILD_THIRDPARTY)
+ add_subdirectory(libz)
+ set(Z_LIBNAME z PARENT_SCOPE)
+ set(Z_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include PARENT_SCOPE)
+ set(ZLIB_FOUND 1)
+else(BUILD_THIRDPARTY)
# Try to find lib Z
- FIND_PACKAGE(ZLIB)
- IF(ZLIB_FOUND)
- SET(Z_LIBNAME ${ZLIB_LIBRARIES} PARENT_SCOPE)
- SET(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIRS} PARENT_SCOPE)
+ find_package(ZLIB)
+ if(ZLIB_FOUND)
+ set(Z_LIBNAME ${ZLIB_LIBRARIES} PARENT_SCOPE)
+ set(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIRS} PARENT_SCOPE)
message(STATUS "Your system seems to have a Z lib available, we will use it to generate PNG lib")
# message(STATUS "DEBUG: ${ZLIB_INCLUDE_DIRS} vs ${ZLIB_INCLUDE_DIR}")
- ELSE (ZLIB_FOUND) # not found
+ else(ZLIB_FOUND) # not found
message(STATUS "Z lib not found, activate BUILD_THIRDPARTY if you want build it (necessary to build libPNG)")
- ENDIF(ZLIB_FOUND)
-ENDIF(BUILD_THIRDPARTY)
+ endif(ZLIB_FOUND)
+endif(BUILD_THIRDPARTY)
#------------
# Try to find lib PNG (which depends on zlib)
-IF(BUILD_THIRDPARTY)
+if(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build PNG lib from thirdparty")
- ADD_SUBDIRECTORY(libpng)
- SET(OPJ_HAVE_PNG_H 1 PARENT_SCOPE)
- SET(OPJ_HAVE_LIBPNG 1 PARENT_SCOPE)
- SET(PNG_LIBNAME png PARENT_SCOPE)
- SET(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng PARENT_SCOPE)
-ELSE (BUILD_THIRDPARTY)
- IF (ZLIB_FOUND)
- FIND_PACKAGE(PNG)
- IF(PNG_FOUND)
+ add_subdirectory(libpng)
+ set(OPJ_HAVE_PNG_H 1 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBPNG 1 PARENT_SCOPE)
+ set(PNG_LIBNAME png PARENT_SCOPE)
+ set(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng PARENT_SCOPE)
+else(BUILD_THIRDPARTY)
+ if(ZLIB_FOUND)
+ find_package(PNG)
+ if(PNG_FOUND)
message(STATUS "Your system seems to have a PNG lib available, we will use it")
- SET(OPJ_HAVE_PNG_H 1 PARENT_SCOPE)
- SET(OPJ_HAVE_LIBPNG 1 PARENT_SCOPE)
- SET(PNG_LIBNAME ${PNG_LIBRARIES} PARENT_SCOPE)
- SET(PNG_INCLUDE_DIRNAME ${PNG_PNG_INCLUDE_DIR} PARENT_SCOPE)
- ELSE(PNG_FOUND) # not found
- SET(OPJ_HAVE_PNG_H 0 PARENT_SCOPE)
- SET(OPJ_HAVE_LIBPNG 0 PARENT_SCOPE)
+ set(OPJ_HAVE_PNG_H 1 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBPNG 1 PARENT_SCOPE)
+ set(PNG_LIBNAME ${PNG_LIBRARIES} PARENT_SCOPE)
+ set(PNG_INCLUDE_DIRNAME ${PNG_PNG_INCLUDE_DIR} PARENT_SCOPE)
+ else(PNG_FOUND) # not found
+ set(OPJ_HAVE_PNG_H 0 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBPNG 0 PARENT_SCOPE)
message(STATUS "PNG lib not found, activate BUILD_THIRDPARTY if you want build it")
- ENDIF(PNG_FOUND)
- ENDIF (ZLIB_FOUND)
-ENDIF(BUILD_THIRDPARTY)
+ endif(PNG_FOUND)
+ endif(ZLIB_FOUND)
+endif(BUILD_THIRDPARTY)
#------------
# Try to find lib TIFF
-IF(BUILD_THIRDPARTY)
+if(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build TIFF lib from thirdparty")
- ADD_SUBDIRECTORY(libtiff)
- SET(TIFF_LIBNAME tiff PARENT_SCOPE)
- SET(TIFF_INCLUDE_DIRNAME
+ add_subdirectory(libtiff)
+ set(TIFF_LIBNAME tiff PARENT_SCOPE)
+ set(TIFF_INCLUDE_DIRNAME
${OPENJPEG_SOURCE_DIR}/thirdparty/libtiff
${OPENJPEG_BINARY_DIR}/thirdparty/libtiff
PARENT_SCOPE)
- SET(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE)
- SET(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
-ELSE (BUILD_THIRDPARTY)
- FIND_PACKAGE(TIFF)
- IF(TIFF_FOUND)
+ set(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
+else(BUILD_THIRDPARTY)
+ find_package(TIFF)
+ if(TIFF_FOUND)
message(STATUS "Your system seems to have a TIFF lib available, we will use it")
- SET(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE)
- SET(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
- SET(TIFF_LIBNAME ${TIFF_LIBRARIES} PARENT_SCOPE)
- SET(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} PARENT_SCOPE)
- ELSE (TIFF_FOUND) # not found
- SET(OPJ_HAVE_TIFF_H 0 PARENT_SCOPE)
- SET(OPJ_HAVE_LIBTIFF 0 PARENT_SCOPE)
+ set(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
+ set(TIFF_LIBNAME ${TIFF_LIBRARIES} PARENT_SCOPE)
+ set(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} PARENT_SCOPE)
+ else(TIFF_FOUND) # not found
+ set(OPJ_HAVE_TIFF_H 0 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBTIFF 0 PARENT_SCOPE)
message(STATUS "TIFF lib not found, activate BUILD_THIRDPARTY if you want build it")
- ENDIF(TIFF_FOUND)
-ENDIF(BUILD_THIRDPARTY)
+ endif(TIFF_FOUND)
+endif(BUILD_THIRDPARTY)
#------------
# Try to find lib LCMS2 (or by default LCMS)
-SET(OPJ_HAVE_LCMS_H 0 PARENT_SCOPE)
-SET(OPJ_HAVE_LIBLCMS 0 PARENT_SCOPE)
+set(OPJ_HAVE_LCMS_H 0 PARENT_SCOPE)
+set(OPJ_HAVE_LIBLCMS 0 PARENT_SCOPE)
-IF( BUILD_THIRDPARTY)
+if( BUILD_THIRDPARTY)
# Try to build lcms2
message(STATUS "We will build LCMS2 lib from thirdparty")
- ADD_SUBDIRECTORY(liblcms2)
- SET(LCMS_LIBNAME lcms2 PARENT_SCOPE)
- SET(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include PARENT_SCOPE) #
- SET(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE)
- SET(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE)
-ELSE (BUILD_THIRDPARTY)
- FIND_PACKAGE(LCMS2)
- IF(LCMS2_FOUND)
+ add_subdirectory(liblcms2)
+ set(LCMS_LIBNAME lcms2 PARENT_SCOPE)
+ set(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include PARENT_SCOPE) #
+ set(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE)
+else(BUILD_THIRDPARTY)
+ find_package(LCMS2)
+ if(LCMS2_FOUND)
message(STATUS "Your system seems to have a LCMS2 lib available, we will use it")
- SET(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE)
- SET(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE)
- SET(LCMS_LIBNAME ${LCMS2_LIBRARIES} PARENT_SCOPE)
- SET(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIRS} PARENT_SCOPE)
- ELSE (LCMS2_FOUND) # not found lcms2
+ set(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE)
+ set(LCMS_LIBNAME ${LCMS2_LIBRARIES} PARENT_SCOPE)
+ set(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIRS} PARENT_SCOPE)
+ else(LCMS2_FOUND) # not found lcms2
# try to find LCMS
- FIND_PACKAGE(LCMS)
- IF(LCMS_FOUND)
+ find_package(LCMS)
+ if(LCMS_FOUND)
message(STATUS "Your system seems to have a LCMS lib available, we will use it")
- SET(OPJ_HAVE_LCMS_H 1 PARENT_SCOPE)
- SET(OPJ_HAVE_LIBLCMS 1 PARENT_SCOPE)
- SET(LCMS_LIBNAME ${LCMS_LIBRARIES} PARENT_SCOPE)
- SET(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIRS} PARENT_SCOPE)
- ELSE (LCMS_FOUND) # not found lcms
- SET(OPJ_HAVE_LCMS2_H 0 PARENT_SCOPE)
- SET(OPJ_HAVE_LIBLCMS2 0 PARENT_SCOPE)
+ set(OPJ_HAVE_LCMS_H 1 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBLCMS 1 PARENT_SCOPE)
+ set(LCMS_LIBNAME ${LCMS_LIBRARIES} PARENT_SCOPE)
+ set(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIRS} PARENT_SCOPE)
+ else(LCMS_FOUND) # not found lcms
+ set(OPJ_HAVE_LCMS2_H 0 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBLCMS2 0 PARENT_SCOPE)
message(STATUS "LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it")
- ENDIF (LCMS_FOUND)
- ENDIF(LCMS2_FOUND)
-ENDIF(BUILD_THIRDPARTY)
+ endif(LCMS_FOUND)
+ endif(LCMS2_FOUND)
+endif(BUILD_THIRDPARTY)
-PROJECT(liblcms2 C)
+project(liblcms2 C)
#
-INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/include")
+include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
#
-FILE(GLOB SRCS src/*.c)
-FILE(GLOB HDRS include/*.h)
+file(GLOB SRCS src/*.c)
+file(GLOB HDRS include/*.h)
#
-SET(LIBTARGET "lcms2")
+set(LIBTARGET "lcms2")
#
-ADD_LIBRARY(${LIBTARGET} STATIC ${SRCS} ${HDRS})
+add_library(${LIBTARGET} STATIC ${SRCS} ${HDRS})
#
-IF(MSVC)
- SET_TARGET_PROPERTIES(${LIBTARGET} PROPERTIES PREFIX "lib")
-ENDIF(MSVC)
+if(MSVC)
+ set_target_properties(${LIBTARGET} PROPERTIES PREFIX "lib")
+endif(MSVC)
#
-SET_TARGET_PROPERTIES(${LIBTARGET}
+set_target_properties(${LIBTARGET}
PROPERTIES
OUTPUT_NAME "${LIBTARGET}"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib)
-PROJECT(libpng C)
+project(libpng C)
-INCLUDE_DIRECTORIES(
+include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}"
${OPENJPEG_SOURCE_DIR}/thirdparty/include
)
-FILE(GLOB SRCS *.c)
-FILE(GLOB HDRS *.h)
-SET(EXT_HDRS
+file(GLOB SRCS *.c)
+file(GLOB HDRS *.h)
+set(EXT_HDRS
${OPENJPEG_SOURCE_DIR}/thirdparty/include/zlib.h
${OPENJPEG_SOURCE_DIR}/thirdparty/include/zconf.h
)
#
-SET(LIBTARGET "png")
+set(LIBTARGET "png")
#
-ADD_LIBRARY(${LIBTARGET} STATIC ${SRCS} ${HDRS} ${EXT_HDRS})
+add_library(${LIBTARGET} STATIC ${SRCS} ${HDRS} ${EXT_HDRS})
#
-IF(MSVC)
- SET_TARGET_PROPERTIES(${LIBTARGET} PROPERTIES PREFIX "lib")
-ENDIF(MSVC)
+if(MSVC)
+ set_target_properties(${LIBTARGET} PROPERTIES PREFIX "lib")
+endif(MSVC)
#
-TARGET_LINK_LIBRARIES(${LIBTARGET} ${Z_LIBNAME} ${M_LIBRARY})
+target_link_libraries(${LIBTARGET} ${Z_LIBNAME} ${M_LIBRARY})
#
-SET_TARGET_PROPERTIES(${LIBTARGET}
+set_target_properties(${LIBTARGET}
PROPERTIES
OUTPUT_NAME "${LIBTARGET}"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib)
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+cmake_minimum_required(VERSION 2.6)
project(libtiff C)
# This convenient copy of libtiff does not support encapsulated zlib or jpeg
# stream. see ZIP_SUPPORT and JPEG_SUPPORT values
-INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}")
-INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}")
+include_directories(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}")
+include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}")
-SET(TARGET_FILES
+set(TARGET_FILES
t4.h
tiffiop.h
tif_aux.c
uvcode.h
)
-IF(UNIX)
- SET(TARGET_FILES ${TARGET_FILES} tif_unix.c)
+if(UNIX)
+ set(TARGET_FILES ${TARGET_FILES} tif_unix.c)
# Large file support
# This might not catch every possibility catered for by
# AC_SYS_LARGEFILE.
add_definitions(-D_FILE_OFFSET_BITS=64)
set(_FILE_OFFSET_BITS 64)
-ELSE()
- SET(TARGET_FILES ${TARGET_FILES} tif_win32.c)
-ENDIF()
+else()
+ set(TARGET_FILES ${TARGET_FILES} tif_win32.c)
+endif()
include(${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
}" HAVE_SNPRINTF)
if(NOT HAVE_SNPRINTF)
- SET(TARGET_FILES ${TARGET_FILES} snprintf.c)
+ set(TARGET_FILES ${TARGET_FILES} snprintf.c)
endif()
include(CheckTypeSize)
CHECK_SYMBOL_EXISTS(setmod "io.h" HAVE_SETMODE)
# http://www.cmake.org/pipermail/cmake/2007-September/016285.html
-FOREACH(KEYWORD "inline" "__inline__" "__inline")
- IF(NOT DEFINED C_INLINE)
- TRY_COMPILE(C_HAS_${KEYWORD} "${CMAKE_CURRENT_BINARY_DIR}"
+foreach(KEYWORD "inline" "__inline__" "__inline")
+ if(NOT DEFINED C_INLINE)
+ try_compile(C_HAS_${KEYWORD} "${CMAKE_CURRENT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/test_inline.c"
COMPILE_DEFINITIONS "-Dinline=${KEYWORD}")
- IF(C_HAS_${KEYWORD})
- SET(C_INLINE TRUE)
- SET(INLINE_KEYWORD "${KEYWORD}")
- ENDIF(C_HAS_${KEYWORD})
- ENDIF(NOT DEFINED C_INLINE)
-ENDFOREACH(KEYWORD)
+ if(C_HAS_${KEYWORD})
+ set(C_INLINE TRUE)
+ set(INLINE_KEYWORD "${KEYWORD}")
+ endif(C_HAS_${KEYWORD})
+ endif(NOT DEFINED C_INLINE)
+endforeach(KEYWORD)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tiffconf.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/tiffconf.h @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tif_config.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/tif_config.h @ONLY)
-SET(LIBTARGET "tiff")
+set(LIBTARGET "tiff")
#
-ADD_LIBRARY(${LIBTARGET} STATIC ${TARGET_FILES})
+add_library(${LIBTARGET} STATIC ${TARGET_FILES})
#
-SET_TARGET_PROPERTIES(${LIBTARGET}
+set_target_properties(${LIBTARGET}
PROPERTIES
OUTPUT_NAME "${LIBTARGET}"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib
#based on zlib-1.2.5/CMakeLists.txt
#
cmake_minimum_required(VERSION 2.6)
-SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
+set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
-PROJECT(zlib C)
+project(zlib C)
-INCLUDE(CheckTypeSize)
-INCLUDE(CheckFunctionExists)
-INCLUDE(CheckIncludeFile)
-INCLUDE(CheckCSourceCompiles)
+include(CheckTypeSize)
+include(CheckFunctionExists)
+include(CheckIncludeFile)
+include(CheckCSourceCompiles)
CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
#
# Check to see if we have large file support
#
-SET(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
+set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
# We add these other definitions here because CheckTypeSize.cmake
# in CMake 2.4.x does not automatically do so and we want
# compatibility with CMake 2.4.x.
-IF(HAVE_SYS_TYPES_H)
- LIST(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
-ENDIF()
-IF(HAVE_STDINT_H)
- LIST(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
-ENDIF()
-IF(HAVE_STDDEF_H)
- LIST(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
-ENDIF()
+if(HAVE_SYS_TYPES_H)
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
+endif()
+if(HAVE_STDINT_H)
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
+endif()
+if(HAVE_STDDEF_H)
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
+endif()
CHECK_TYPE_SIZE(off64_t OFF64_T)
-IF(HAVE_OFF64_T)
- ADD_DEFINITIONS(-D_LARGEFILE64_SOURCE=1)
-ENDIF()
-SET(CMAKE_REQUIRED_DEFINITIONS) # clear variable
+if(HAVE_OFF64_T)
+ add_definitions(-D_LARGEFILE64_SOURCE=1)
+endif()
+set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
#
# Check for fseeko
#
CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO)
-IF(NOT HAVE_FSEEKO)
- ADD_DEFINITIONS(-DNO_FSEEKO)
-ENDIF()
+if(NOT HAVE_FSEEKO)
+ add_definitions(-DNO_FSEEKO)
+endif()
#
# Check for unistd.h
#
CHECK_INCLUDE_FILE(unistd.h Z_HAVE_UNISTD_H)
-INCLUDE_DIRECTORIES(
+include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${OPENJPEG_SOURCE_DIR}/thirdparty/include
)
#
-SET(EXT_HDRS
+set(EXT_HDRS
${OPENJPEG_SOURCE_DIR}/thirdparty/include/zlib.h
${OPENJPEG_SOURCE_DIR}/thirdparty/include/zconf.h
)
-SET(HDRS
+set(HDRS
crc32.h
deflate.h
gzguts.h
trees.h
zutil.h
)
-SET(SRCS
+set(SRCS
adler32.c
compress.c
crc32.c
zutil.c
)
-SET(LIBTARGET "z")
+set(LIBTARGET "z")
#
-ADD_LIBRARY(${LIBTARGET} STATIC ${SRCS} ${EXT_HDRS} ${HDRS})
+add_library(${LIBTARGET} STATIC ${SRCS} ${EXT_HDRS} ${HDRS})
#
-IF(MSVC)
- SET_TARGET_PROPERTIES(${LIBTARGET} PROPERTIES PREFIX "lib")
-ENDIF(MSVC)
+if(MSVC)
+ set_target_properties(${LIBTARGET} PROPERTIES PREFIX "lib")
+endif(MSVC)
-SET_TARGET_PROPERTIES(${LIBTARGET}
+set_target_properties(${LIBTARGET}
PROPERTIES
OUTPUT_NAME "${LIBTARGET}"
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/lib
endif()
if(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1")
- # To execute part of the encoding test suite, kakadu binaries are needed to decode encoded image and compare
- # it to the baseline. Kakadu binaries are freely available for non-commercial purposes
+ # To execute part of the encoding test suite, kakadu binaries are needed to decode encoded image and compare
+ # it to the baseline. Kakadu binaries are freely available for non-commercial purposes
# at http://www.kakadusoftware.com.
# Here's the copyright notice from kakadu:
# Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney.
set(BUILD_TESTING "FALSE")
endif(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1")
-# Options
+# Options
set( CACHE_CONTENTS "
# Build kind
# Use to activate the test suite
BUILD_TESTING:BOOL=${BUILD_TESTING}
-# Build Thirdparty, useful but not required for test suite
+# Build Thirdparty, useful but not required for test suite
BUILD_THIRDPARTY:BOOL=TRUE
# JPEG2000 test files are available with git clone https://github.com/uclouvain/openjpeg-data.git
OPJ_DATA_ROOT:PATH=$ENV{PWD}/data
-# jpylyzer is available with on GitHub: https://github.com/openpreserve/jpylyzer
+# jpylyzer is available with on GitHub: https://github.com/openpreserve/jpylyzer
JPYLYZER_EXECUTABLE=$ENV{PWD}/jpylyzer/jpylyzer.${JPYLYZER_EXT}
" )
#---------------------
-#1. openjpeg specific:
+#1. openjpeg specific:
set( CTEST_PROJECT_NAME "OPENJPEG" )
if(NOT EXISTS $ENV{OPJ_SOURCE_DIR})
message(FATAL_ERROR "OPJ_SOURCE_DIR not defined or does not exist:$ENV{OPJ_SOURCE_DIR}")
-#
+#
add_subdirectory(openjp2)