Synchronize branch and trunk cmakelists files

This commit is contained in:
Mathieu Malaterre 2010-06-29 19:08:58 +00:00
parent 8bb5a19905
commit 89eafad589
3 changed files with 96 additions and 19 deletions

View File

@ -9,9 +9,9 @@
# SET(OPENJPEG_NAMESPACE "GDCMOPENJPEG") # SET(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
if(COMMAND cmake_policy) IF(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0003 NEW) CMAKE_POLICY(SET CMP0003 NEW)
endif(COMMAND cmake_policy) ENDIF(COMMAND CMAKE_POLICY)
IF(NOT OPENJPEG_NAMESPACE) IF(NOT OPENJPEG_NAMESPACE)
SET(OPENJPEG_NAMESPACE "OPENJPEG") SET(OPENJPEG_NAMESPACE "OPENJPEG")
@ -39,6 +39,54 @@ SET(OPENJPEG_LIBRARY_PROPERTIES
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}" VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
SOVERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}" SOVERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}"
) )
# You will also need to define a value for the following variables:
# OPENJPEG_INSTALL_BIN_DIR - binary dir (executables)
# OPENJPEG_INSTALL_LIB_DIR - library dir (libs)
# OPENJPEG_INSTALL_DATA_DIR - share dir (say, examples, data, etc)
# OPENJPEG_INSTALL_INCLUDE_DIR - include dir (headers)
# --------------------------------------------------------------------------
# Install directories
STRING(TOLOWER ${PROJECT_NAME} projectname)
SET(subdir "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
IF(NOT OPENJPEG_INSTALL_BIN_DIR)
SET(OPENJPEG_INSTALL_BIN_DIR "bin")
ENDIF(NOT OPENJPEG_INSTALL_BIN_DIR)
IF(NOT OPENJPEG_INSTALL_LIB_DIR)
SET(OPENJPEG_INSTALL_LIB_DIR "lib")
ENDIF(NOT OPENJPEG_INSTALL_LIB_DIR)
IF(NOT OPENJPEG_INSTALL_DATA_DIR)
SET(OPENJPEG_INSTALL_DATA_DIR "share/${subdir}")
ENDIF(NOT OPENJPEG_INSTALL_DATA_DIR)
IF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
SET(OPENJPEG_INSTALL_INCLUDE_DIR "include/${subdir}")
ENDIF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
IF(NOT OPENJPEG_INSTALL_DOC_DIR)
SET(OPENJPEG_INSTALL_DOC_DIR "share/doc/${subdir}")
ENDIF(NOT OPENJPEG_INSTALL_DOC_DIR)
IF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
SET(OPENJPEG_INSTALL_PACKAGE_DIR ${OPENJPEG_INSTALL_LIB_DIR}/${subdir}
CACHE INTERNAL "")
ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
#-----------------------------------------------------------------------------
# Test for some required system information.
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
#-----------------------------------------------------------------------------
# Setup file for setting custom ctest vars
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/CMake/CTestCustom.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake
@ONLY
)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# OpenJPEG build configuration options. # OpenJPEG build configuration options.
@ -49,13 +97,6 @@ SET (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output
SET (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.") SET (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH) MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
#-----------------------------------------------------------------------------
# Setup file for setting custom ctest vars
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake
@ONLY
)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# For the codec... # For the codec...
@ -125,8 +166,18 @@ FIND_PATH(JPEG2000_CONFORMANCE_DATA_ROOT testimages.html
# Compiler specific flags: # Compiler specific flags:
IF(CMAKE_COMPILER_IS_GNUCC) IF(CMAKE_COMPILER_IS_GNUCC)
# For all builds, make sure openjpeg is std99 compliant: # For all builds, make sure openjpeg is std99 compliant:
SET(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # 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: # Do not use ffast-math for all build, it would produce incorrect results, only set for release:
SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}") SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
ENDIF(CMAKE_COMPILER_IS_GNUCC) ENDIF(CMAKE_COMPILER_IS_GNUCC)
# install all targets referenced as OPENJPEGTargets
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
CONFIGURE_FILE( ${OPENJPEG_SOURCE_DIR}/CMake/OpenJPEGConfig.cmake.in
${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
@ONLY
)
INSTALL( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
)

View File

@ -52,9 +52,13 @@ FOREACH(exe j2k_to_image image_to_j2k j2k_dump)
TARGET_LINK_LIBRARIES(${exe} m) TARGET_LINK_LIBRARIES(${exe} m)
ENDIF(UNIX) ENDIF(UNIX)
# Install exe # Install exe
INSTALL_TARGETS(/bin/ ${exe}) INSTALL(TARGETS ${exe}
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
ENDFOREACH(exe) ENDFOREACH(exe)
if(BUILD_TESTING)
# Do testing here, once we know the examples are being built: # Do testing here, once we know the examples are being built:
FILE(GLOB_RECURSE OPENJPEG_DATA_IMAGES_GLOB FILE(GLOB_RECURSE OPENJPEG_DATA_IMAGES_GLOB
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.j2k" "${JPEG2000_CONFORMANCE_DATA_ROOT}/*.j2k"
@ -62,8 +66,27 @@ FILE(GLOB_RECURSE OPENJPEG_DATA_IMAGES_GLOB
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.jp2" "${JPEG2000_CONFORMANCE_DATA_ROOT}/*.jp2"
) )
FOREACH(filename ${OPENJPEG_DATA_IMAGES_GLOB}) foreach(filename ${OPENJPEG_DATA_IMAGES_GLOB})
GET_FILENAME_COMPONENT(filename_temp ${filename} NAME) get_filename_component(filename_temp ${filename} NAME)
ADD_TEST(j2i-${filename_temp} ${EXECUTABLE_OUTPUT_PATH}/j2k_to_image -i ${filename} -o ${filename_temp}.tif) get_filename_component(filename_ext ${filename} EXT)
ENDFOREACH(filename) execute_process(COMMAND ${EXECUTABLE_OUTPUT_PATH}/j2k_dump -i ${filename}
OUTPUT_VARIABLE dump_success
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${filename_temp}.dump
ERROR_QUIET
)
if(dump_success)
file(READ ${CMAKE_CURRENT_BINARY_DIR}/${filename_temp}.dump numcomp_file)
string(REGEX REPLACE ".*numcomps=([0-9]+).*" "\\1"
numcomps "${numcomp_file}")
#message( "found:${output_variable} for ${filename_temp}" )
endif()
ADD_TEST(dump-${filename_temp} ${EXECUTABLE_OUTPUT_PATH}/j2k_dump -i ${filename})
foreach(codec_type ppm pgx bmp tif raw tga png)
ADD_TEST(j2i-${filename_temp}-${codec_type} ${EXECUTABLE_OUTPUT_PATH}/j2k_to_image -i ${filename} -o ${filename_temp}.${codec_type})
ADD_TEST(i2j-${filename_temp}-${codec_type} ${EXECUTABLE_OUTPUT_PATH}/image_to_j2k -i ${filename_temp}.${codec_type} -o ${filename_temp}.${codec_type}${filename_ext})
#if(UNIX)
# ADD_TEST(cmp-${filename_temp}-${codec_type} cmp ${filename} ${filename_temp}.${codec_type}${filename_ext})
#endif(UNIX)
endforeach(codec_type)
endforeach(filename)
endif(BUILD_TESTING)

View File

@ -37,8 +37,11 @@ SET_TARGET_PROPERTIES(${OPENJPEG_LIBRARY_NAME} PROPERTIES
# Install library # Install library
INSTALL(TARGETS ${OPENJPEG_LIBRARY_NAME} INSTALL(TARGETS ${OPENJPEG_LIBRARY_NAME}
DESTINATION lib) EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
# Install includes files # Install includes files
INSTALL(FILES openjpeg.h INSTALL(FILES openjpeg.h
DESTINATION ${INCLUDE_INSTALL_DIR}/openjpeg) DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers
)