[trunk] fixed BMP reading for 8bpp when width & 3 == 1
[openjpeg.git] / src / bin / jp2 / CMakeLists.txt
1 # Build the demo app, small examples
2
3 # First thing define the common source:
4 set(common_SRCS
5   convert.c
6   convertbmp.c
7   index.c
8   ${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c
9   ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
10   )
11
12 # Headers file are located here:
13 include_directories(
14   ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
15   ${OPENJPEG_BINARY_DIR}/src/bin/common # opj_apps_config.h
16   ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
17   ${OPENJPEG_SOURCE_DIR}/src/bin/common
18   ${LCMS_INCLUDE_DIRNAME}
19   ${Z_INCLUDE_DIRNAME}
20   ${PNG_INCLUDE_DIRNAME}
21   ${TIFF_INCLUDE_DIRNAME}
22   )
23
24 if(WIN32)
25   if(BUILD_SHARED_LIBS)
26     add_definitions(-DOPJ_EXPORTS)
27   else()
28     add_definitions(-DOPJ_STATIC)
29   endif()
30 endif()
31
32 # Loop over all executables:
33 foreach(exe opj_decompress opj_compress opj_dump)
34   add_executable(${exe} ${exe}.c ${common_SRCS})
35   target_link_libraries(${exe} ${OPENJPEG_LIBRARY_NAME}
36     ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME}
37     )
38   # To support universal exe:
39   if(ZLIB_FOUND AND APPLE)
40     target_link_libraries(${exe} z)
41   else(ZLIB_FOUND AND APPLE)
42     target_link_libraries(${exe} ${Z_LIBNAME})
43   endif()
44
45   # On unix you need to link to the math library:
46   if(UNIX)
47     target_link_libraries(${exe} m)
48   endif()
49   # Install exe
50   install(TARGETS ${exe}
51     EXPORT OpenJPEGTargets
52     DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
53   )
54   if(OPJ_USE_DSYMUTIL)
55     add_custom_command(TARGET ${exe} POST_BUILD 
56     COMMAND "dsymutil" "$<TARGET_FILE:${exe}>"
57     COMMENT "dsymutil $<TARGET_FILE:${exe}>"
58     DEPENDS ${exe})
59   endif()
60 endforeach()
61
62 if(BUILD_DOC)
63 # Install man pages
64 install(
65   FILES       ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_compress.1
66               ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_decompress.1
67               ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_dump.1
68   DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
69 #
70 endif()