1INCLUDE_REGULAR_EXPRESSION("^.*$")
2# Defines the source code for the library
3SET(OPENJPEG_SRCS
4  ${CMAKE_CURRENT_SOURCE_DIR}/bio.c
5  ${CMAKE_CURRENT_SOURCE_DIR}/cio.c
6  ${CMAKE_CURRENT_SOURCE_DIR}/dwt.c
7  ${CMAKE_CURRENT_SOURCE_DIR}/event.c
8  ${CMAKE_CURRENT_SOURCE_DIR}/image.c
9  ${CMAKE_CURRENT_SOURCE_DIR}/j2k.c
10  ${CMAKE_CURRENT_SOURCE_DIR}/j2k_lib.c
11  ${CMAKE_CURRENT_SOURCE_DIR}/jp2.c
12  ${CMAKE_CURRENT_SOURCE_DIR}/jpt.c
13  ${CMAKE_CURRENT_SOURCE_DIR}/mct.c
14  ${CMAKE_CURRENT_SOURCE_DIR}/mqc.c
15  ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.c
16  ${CMAKE_CURRENT_SOURCE_DIR}/pi.c
17  ${CMAKE_CURRENT_SOURCE_DIR}/raw.c
18  ${CMAKE_CURRENT_SOURCE_DIR}/t1.c
19  ${CMAKE_CURRENT_SOURCE_DIR}/t2.c
20  ${CMAKE_CURRENT_SOURCE_DIR}/tcd.c
21  ${CMAKE_CURRENT_SOURCE_DIR}/tgt.c
22  ${CMAKE_CURRENT_SOURCE_DIR}/cidx_manager.c
23  ${CMAKE_CURRENT_SOURCE_DIR}/phix_manager.c
24  ${CMAKE_CURRENT_SOURCE_DIR}/ppix_manager.c
25  ${CMAKE_CURRENT_SOURCE_DIR}/thix_manager.c
26  ${CMAKE_CURRENT_SOURCE_DIR}/tpix_manager.c
27)
28
29# Build the library
30IF(WIN32)
31  IF(BUILD_SHARED_LIBS)
32    ADD_DEFINITIONS(-DOPJ_EXPORTS)
33  ELSE(BUILD_SHARED_LIBS)
34    ADD_DEFINITIONS(-DOPJ_STATIC)
35  ENDIF(BUILD_SHARED_LIBS)
36ENDIF(WIN32)
37ADD_LIBRARY(${OPENJPEG_LIBRARY_NAME} ${OPENJPEG_SRCS})
38IF(UNIX)
39  TARGET_LINK_LIBRARIES(${OPENJPEG_LIBRARY_NAME} m)
40ENDIF(UNIX)
41SET_TARGET_PROPERTIES(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
42
43# Build the JPWL library ?
44IF(BUILD_JPWL)
45 ADD_SUBDIRECTORY(jpwl)
46ENDIF(BUILD_JPWL)
47
48# Install library
49INSTALL(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
57INSTALL(FILES openjpeg.h
58  DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers
59)
60
61# install man page of the library
62INSTALL(
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
67# no need to install:
68ADD_EXECUTABLE(t1_generate_luts t1_generate_luts.c)
69IF(UNIX)
70  TARGET_LINK_LIBRARIES(t1_generate_luts m)
71ENDIF()
72