[trunk] Start FolderReorgProposal task
[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   index.c
7   ${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c
8   ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
9   )
10
11 # Headers file are located here:
12 include_directories(
13   ${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
14   ${LCMS_INCLUDE_DIRNAME}
15   ${OPENJPEG_SOURCE_DIR}/src/bin/common
16   ${Z_INCLUDE_DIRNAME}
17   ${PNG_INCLUDE_DIRNAME}
18   ${TIFF_INCLUDE_DIRNAME}
19   )
20
21 if(WIN32)
22   if(BUILD_SHARED_LIBS)
23     add_definitions(-DOPJ_EXPORTS)
24   else()
25     add_definitions(-DOPJ_STATIC)
26   endif()
27 endif()
28
29 # Loop over all executables:
30 foreach(exe j2k_to_image image_to_j2k j2k_dump)
31   add_executable(${exe} ${exe}.c ${common_SRCS})
32   target_link_libraries(${exe} ${OPENJPEG_LIBRARY_NAME}
33     ${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME}
34     )
35   # To support universal exe:
36   if(ZLIB_FOUND AND APPLE)
37     target_link_libraries(${exe} z)
38   ELSe(ZLIB_FOUND AND APPLE)
39     target_link_libraries(${exe} ${Z_LIBNAME})
40   endif()
41
42   # On unix you need to link to the math library:
43   if(UNIX)
44     target_link_libraries(${exe} m)
45   endif()
46   # Install exe
47   install(TARGETS ${exe}
48     EXPORT OpenJPEGTargets
49     DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
50   )
51 endforeach()
52
53 # Install man pages
54 install(
55   FILES       ${OPENJPEG_SOURCE_DIR}/doc/man/man1/image_to_j2k.1
56               ${OPENJPEG_SOURCE_DIR}/doc/man/man1/j2k_dump.1
57               ${OPENJPEG_SOURCE_DIR}/doc/man/man1/j2k_to_image.1
58   DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
59 #
60
61 if(BUILD_JPWL)
62   add_executable(JPWL_j2k_to_image
63   j2k_to_image.c
64   ${common_SRCS}
65   )
66
67   set_property(
68      TARGET JPWL_j2k_to_image
69      APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
70   )
71
72   target_link_libraries(JPWL_j2k_to_image ${OPENJPEG_LIBRARY_NAME}_JPWL
73     ${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
74
75   # To support universal exe:
76   if(ZLIB_FOUND AND APPLE)
77     target_link_libraries(JPWL_j2k_to_image z)
78   ELSe(ZLIB_FOUND AND APPLE)
79     target_link_libraries(JPWL_j2k_to_image ${Z_LIBNAME})
80   endif()
81
82   if(UNIX)
83     target_link_libraries(JPWL_j2k_to_image m)
84   endif()
85
86   add_executable(JPWL_image_to_j2k
87   image_to_j2k.c
88   ${common_SRCS}
89   )
90
91   set_property(
92      TARGET JPWL_image_to_j2k
93      APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
94   )
95
96   target_link_libraries(JPWL_image_to_j2k ${OPENJPEG_LIBRARY_NAME}_JPWL
97         ${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
98         
99   # To support universal exe:
100   if(ZLIB_FOUND AND APPLE)
101     target_link_libraries(JPWL_image_to_j2k z)
102   ELSe(ZLIB_FOUND AND APPLE)
103     target_link_libraries(JPWL_image_to_j2k ${Z_LIBNAME})
104   endif()
105
106   if(UNIX)
107     target_link_libraries(JPWL_image_to_j2k m)
108   endif()
109
110   install(TARGETS JPWL_image_to_j2k JPWL_j2k_to_image
111     DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
112   )
113 endif()