• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1include_regular_expression("^.*$")
2
3#
4install( FILES  ${CMAKE_CURRENT_BINARY_DIR}/opj_config.h
5 DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers)
6
7include_directories(
8  ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h
9)
10# Defines the source code for the library
11set(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)
32if(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  )
42endif()
43
44# Build the library
45if(WIN32)
46  if(BUILD_SHARED_LIBS)
47    add_definitions(-DOPJ_EXPORTS)
48  else()
49    add_definitions(-DOPJ_STATIC)
50  endif()
51endif()
52add_library(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
53if(UNIX)
54  target_link_libraries(${OPENJPEG_LIBRARY_NAME} m)
55endif()
56set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
57
58# Install library
59install(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
67install(FILES openjpeg.h opj_stdint.h
68  DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers
69)
70
71if(BUILD_DOC)
72# install man page of the library
73install(
74  FILES       ${OPENJPEG_SOURCE_DIR}/doc/man/man3/libopenjp2.3
75  DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man3)
76endif()
77
78# internal utilities to generate t1_luts.h (part of the jp2 lib)
79# no need to install:
80add_executable(t1_generate_luts t1_generate_luts.c)
81if(UNIX)
82  target_link_libraries(t1_generate_luts m)
83endif()
84
85# Experimental option; let's how cppcheck performs
86# Implementation details:
87# I could not figure out how to easily upload a file to CDash. Instead simply
88# pretend cppcheck is part of the Build step. Technically cppcheck can even
89# output gcc formatted error/warning report
90# Another implementation detail: I could not redirect error to the error
91# catching mechanism something is busted in cmake 2.8.5, I had to use the
92# warning regex to catch them.
93if(OPENJPEG_CPPCHECK)
94  find_package(CPPCHECK REQUIRED)
95  foreach(f ${OPENJPEG_SRCS})
96    # cppcheck complains about too many configuration, pretend to be WIN32:
97    add_custom_command(TARGET ${OPENJPEG_LIBRARY_NAME}
98      COMMAND ${CPPCHECK_EXECUTABLE} -DWIN32 ${f})
99  endforeach()
100endif()
101
102if(OPJ_USE_DSYMUTIL)
103  if(BUILD_SHARED_LIBS)
104    GET_TARGET_PROPERTY(OPENJPEG_LIBRARY_LOCATION ${OPENJPEG_LIBRARY_NAME} LOCATION)
105    add_custom_command(TARGET ${OPENJPEG_LIBRARY_NAME} POST_BUILD
106    COMMAND "dsymutil" "${OPENJPEG_LIBRARY_LOCATION}"
107    COMMENT "dsymutil ${OPENJPEG_LIBRARY_LOCATION}"
108    DEPENDS ${OPENJPEG_LIBRARY_NAME})
109  endif()
110endif()
111