1# Build the demo app, small examples 2 3# First thing define the common source: 4SET(common_SRCS 5 convert.c 6 index.c 7 ${OPENJPEG_SOURCE_DIR}/applications/common/color.c 8 ) 9if(NOT USE_SYSTEM_GETOPT) 10 list(APPEND common_SRCS 11 ${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c 12 ) 13endif() 14 15# Headers file are located here: 16INCLUDE_DIRECTORIES( 17 ${OPENJPEG_SOURCE_DIR}/libopenjpeg 18 ${LCMS_INCLUDE_DIRNAME} 19 ${OPENJPEG_SOURCE_DIR}/applications/common 20 ${Z_INCLUDE_DIRNAME} 21 ${PNG_INCLUDE_DIRNAME} 22 ${TIFF_INCLUDE_DIRNAME} 23 ) 24 25IF(WIN32) 26 IF(BUILD_SHARED_LIBS) 27 ADD_DEFINITIONS(-DOPJ_EXPORTS) 28 ELSE(BUILD_SHARED_LIBS) 29 ADD_DEFINITIONS(-DOPJ_STATIC) 30 ENDIF(BUILD_SHARED_LIBS) 31ENDIF(WIN32) 32 33# Loop over all executables: 34FOREACH(exe j2k_to_image image_to_j2k j2k_dump) 35 ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS}) 36 TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME} 37 ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} 38 ) 39 # To support universal exe: 40 IF(ZLIB_FOUND AND APPLE) 41 TARGET_LINK_LIBRARIES(${exe} z) 42 ELSe(ZLIB_FOUND AND APPLE) 43 TARGET_LINK_LIBRARIES(${exe} ${Z_LIBNAME}) 44 ENDIF(ZLIB_FOUND AND APPLE) 45 46 # On unix you need to link to the math library: 47 IF(UNIX) 48 TARGET_LINK_LIBRARIES(${exe} m) 49 ENDIF(UNIX) 50 # Install exe 51 INSTALL(TARGETS ${exe} 52 EXPORT OpenJPEGTargets 53 DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications 54 ) 55ENDFOREACH(exe) 56 57# Install man pages 58INSTALL( 59 FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man1/image_to_j2k.1 60 ${OPENJPEG_SOURCE_DIR}/doc/man/man1/j2k_dump.1 61 ${OPENJPEG_SOURCE_DIR}/doc/man/man1/j2k_to_image.1 62 DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1) 63# 64 65IF(BUILD_JPWL) 66 ADD_EXECUTABLE(JPWL_j2k_to_image 67 j2k_to_image.c 68 ${common_SRCS} 69 ) 70 71 SET_PROPERTY( 72 TARGET JPWL_j2k_to_image 73 APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL 74 ) 75 76 TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${OPENJPEG_LIBRARY_NAME}_JPWL 77 ${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME}) 78 79 # To support universal exe: 80 IF(ZLIB_FOUND AND APPLE) 81 TARGET_LINK_LIBRARIES(JPWL_j2k_to_image z) 82 ELSe(ZLIB_FOUND AND APPLE) 83 TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${Z_LIBNAME}) 84 ENDIF(ZLIB_FOUND AND APPLE) 85 86 IF(UNIX) 87 TARGET_LINK_LIBRARIES(JPWL_j2k_to_image m) 88 ENDIF(UNIX) 89 90 ADD_EXECUTABLE(JPWL_image_to_j2k 91 image_to_j2k.c 92 ${common_SRCS} 93 ) 94 95 SET_PROPERTY( 96 TARGET JPWL_image_to_j2k 97 APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL 98 ) 99 100 TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${OPENJPEG_LIBRARY_NAME}_JPWL 101 ${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME}) 102 103 # To support universal exe: 104 IF(ZLIB_FOUND AND APPLE) 105 TARGET_LINK_LIBRARIES(JPWL_image_to_j2k z) 106 ELSe(ZLIB_FOUND AND APPLE) 107 TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${Z_LIBNAME}) 108 ENDIF(ZLIB_FOUND AND APPLE) 109 110 IF(UNIX) 111 TARGET_LINK_LIBRARIES(JPWL_image_to_j2k m) 112 ENDIF(UNIX) 113 114 INSTALL(TARGETS JPWL_image_to_j2k JPWL_j2k_to_image 115 DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications 116 ) 117ENDIF(BUILD_JPWL) 118