[trunk]update the copyright, the authors and thanks to respect the license
[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 # Defines the source code for the library
11 set(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}/image.c
17   ${CMAKE_CURRENT_SOURCE_DIR}/invert.c
18   ${CMAKE_CURRENT_SOURCE_DIR}/j2k.c
19   ${CMAKE_CURRENT_SOURCE_DIR}/jp2.c
20   ${CMAKE_CURRENT_SOURCE_DIR}/mct.c
21   ${CMAKE_CURRENT_SOURCE_DIR}/mqc.c
22   ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.c
23   ${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.c
24   ${CMAKE_CURRENT_SOURCE_DIR}/pi.c
25   ${CMAKE_CURRENT_SOURCE_DIR}/raw.c
26   ${CMAKE_CURRENT_SOURCE_DIR}/t1.c
27   ${CMAKE_CURRENT_SOURCE_DIR}/t2.c
28   ${CMAKE_CURRENT_SOURCE_DIR}/tcd.c
29   ${CMAKE_CURRENT_SOURCE_DIR}/tgt.c
30   ${CMAKE_CURRENT_SOURCE_DIR}/function_list.c
31 )
32 if(BUILD_JPIP)
33   add_definitions(-DUSE_JPIP)
34   set(OPENJPEG_SRCS
35     ${OPENJPEG_SRCS}
36     ${CMAKE_CURRENT_SOURCE_DIR}/cidx_manager.c
37     ${CMAKE_CURRENT_SOURCE_DIR}/phix_manager.c
38     ${CMAKE_CURRENT_SOURCE_DIR}/ppix_manager.c
39     ${CMAKE_CURRENT_SOURCE_DIR}/thix_manager.c
40     ${CMAKE_CURRENT_SOURCE_DIR}/tpix_manager.c
41   )
42 endif()
43
44 # Build the library
45 if(WIN32)
46   if(BUILD_SHARED_LIBS)
47     add_definitions(-DOPJ_EXPORTS)
48   else()
49     add_definitions(-DOPJ_STATIC)
50   endif()
51 endif()
52 add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
53 if(UNIX)
54   target_link_libraries(${OPENJPEG_LIBRARY_NAME} m)
55 endif()
56 set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
57
58 # Install library
59 install(TARGETS ${OPENJPEG_LIBRARY_NAME}
60   EXPORT OpenJPEGTargets
61   RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
62   LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
63   ARCHIVE DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
64 )
65
66 # Install includes files
67 install(FILES openjpeg.h opj_stdint.h
68   DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers
69 )
70
71 # install man page of the library
72 install(
73   FILES       ${OPENJPEG_SOURCE_DIR}/doc/man/man3/libopenjp2.3
74   DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man3)
75
76 # internal utilities to generate t1_luts.h (part of the jp2 lib)
77 # no need to install:
78 add_executable(t1_generate_luts t1_generate_luts.c)
79 if(UNIX)
80   target_link_libraries(t1_generate_luts m)
81 endif()
82
83 # Experimental option; let's how cppcheck performs
84 # Implementation details:
85 # I could not figure out how to easily upload a file to CDash. Instead simply
86 # pretend cppcheck is part of the Build step. Technically cppcheck can even
87 # output gcc formatted error/warning report
88 # Another implementation detail: I could not redirect error to the error
89 # catching mechanism something is busted in cmake 2.8.5, I had to use the
90 # warning regex to catch them.
91 if(OPENJPEG_CPPCHECK)
92   find_package(CPPCHECK REQUIRED)
93   foreach(f ${OPENJPEG_SRCS})
94     # cppcheck complains about too many configuration, pretend to be WIN32:
95     add_custom_command(TARGET ${OPENJPEG_LIBRARY_NAME}
96       COMMAND ${CPPCHECK_EXECUTABLE} -DWIN32 ${f})
97   endforeach()
98 endif()