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