1include_regular_expression("^.*$") 2 3# 4install( FILES ${CMAKE_CURRENT_BINARY_DIR}/opj_config.h 5 DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers) 6 7include_directories( 8 ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h 9) 10# Defines the source code for the library 11set(OPENJPEG_SRCS 12 ${CMAKE_CURRENT_SOURCE_DIR}/bio.c 13 ${CMAKE_CURRENT_SOURCE_DIR}/cio.c 14 ${CMAKE_CURRENT_SOURCE_DIR}/dwt.c 15 ${CMAKE_CURRENT_SOURCE_DIR}/event.c 16 ${CMAKE_CURRENT_SOURCE_DIR}/function_list.c 17 ${CMAKE_CURRENT_SOURCE_DIR}/image.c 18 ${CMAKE_CURRENT_SOURCE_DIR}/invert.c 19 ${CMAKE_CURRENT_SOURCE_DIR}/j2k.c 20 ${CMAKE_CURRENT_SOURCE_DIR}/jp2.c 21 ${CMAKE_CURRENT_SOURCE_DIR}/mct.c 22 ${CMAKE_CURRENT_SOURCE_DIR}/mqc.c 23 ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.c 24 ${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.c 25 ${CMAKE_CURRENT_SOURCE_DIR}/pi.c 26 ${CMAKE_CURRENT_SOURCE_DIR}/raw.c 27 ${CMAKE_CURRENT_SOURCE_DIR}/sparse_array.c 28 ${CMAKE_CURRENT_SOURCE_DIR}/t1.c 29 ${CMAKE_CURRENT_SOURCE_DIR}/t2.c 30 ${CMAKE_CURRENT_SOURCE_DIR}/tcd.c 31 ${CMAKE_CURRENT_SOURCE_DIR}/tgt.c 32) 33if(BUILD_JPIP) 34 add_definitions(-DUSE_JPIP) 35 set(OPENJPEG_SRCS 36 ${OPENJPEG_SRCS} 37 ${CMAKE_CURRENT_SOURCE_DIR}/cidx_manager.c 38 ${CMAKE_CURRENT_SOURCE_DIR}/phix_manager.c 39 ${CMAKE_CURRENT_SOURCE_DIR}/ppix_manager.c 40 ${CMAKE_CURRENT_SOURCE_DIR}/thix_manager.c 41 ${CMAKE_CURRENT_SOURCE_DIR}/tpix_manager.c 42 ) 43endif() 44 45# Build the library 46if(WIN32) 47 if(BUILD_SHARED_LIBS) 48 add_definitions(-DOPJ_EXPORTS) 49 else() 50 add_definitions(-DOPJ_STATIC) 51 endif() 52endif() 53add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS}) 54if(UNIX) 55 target_link_libraries(${OPENJPEG_LIBRARY_NAME} m) 56endif() 57set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES}) 58 59# Install library 60install(TARGETS ${OPENJPEG_LIBRARY_NAME} 61 EXPORT OpenJPEGTargets 62 RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications 63 LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries 64 ARCHIVE DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries 65) 66 67# Install includes files 68install(FILES openjpeg.h opj_stdint.h 69 DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers 70) 71 72if(BUILD_DOC) 73# install man page of the library 74install( 75 FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man3/libopenjp2.3 76 DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man3) 77endif() 78 79# internal utilities to generate t1_luts.h (part of the jp2 lib) 80# no need to install: 81add_executable(t1_generate_luts t1_generate_luts.c) 82if(UNIX) 83 target_link_libraries(t1_generate_luts m) 84endif() 85 86# Experimental option; let's how cppcheck performs 87# Implementation details: 88# I could not figure out how to easily upload a file to CDash. Instead simply 89# pretend cppcheck is part of the Build step. Technically cppcheck can even 90# output gcc formatted error/warning report 91# Another implementation detail: I could not redirect error to the error 92# catching mechanism something is busted in cmake 2.8.5, I had to use the 93# warning regex to catch them. 94if(OPENJPEG_CPPCHECK) 95 find_package(CPPCHECK REQUIRED) 96 foreach(f ${OPENJPEG_SRCS}) 97 # cppcheck complains about too many configuration, pretend to be WIN32: 98 add_custom_command(TARGET ${OPENJPEG_LIBRARY_NAME} 99 COMMAND ${CPPCHECK_EXECUTABLE} -DWIN32 ${f}) 100 endforeach() 101endif() 102 103if(OPJ_USE_DSYMUTIL) 104 if(BUILD_SHARED_LIBS) 105 GET_TARGET_PROPERTY(OPENJPEG_LIBRARY_LOCATION ${OPENJPEG_LIBRARY_NAME} LOCATION) 106 add_custom_command(TARGET ${OPENJPEG_LIBRARY_NAME} POST_BUILD 107 COMMAND "dsymutil" "${OPENJPEG_LIBRARY_LOCATION}" 108 COMMENT "dsymutil ${OPENJPEG_LIBRARY_LOCATION}" 109 DEPENDS ${OPENJPEG_LIBRARY_NAME}) 110 endif() 111endif() 112