]> Creatis software - gdcm.git/blob - CMakeLists.txt
667bfc5b1e683d3a4f66718b79d9002b236c8894
[gdcm.git] / CMakeLists.txt
1 SUBDIRS(
2   libijg12 
3   libijg8
4   ljpg
5 )
6
7 # memmgr back ends: compile only one of these into a working library
8 # (For now, let's use the mode that requires the image fit into memory.
9 # This is the recommended mode for Win32 anyway.)
10 SET(systemdependent_SRCS jmemnobs.c)
11
12 # library object files common to compression and decompression
13 SET(common_SRCS
14 jcomapi.c jutils.c jerror.c jmemmgr.c
15 )
16
17 # compression library object files
18 SET(compression_SRCS
19 jcapimin.c jcapistd.c jctrans.c jcparam.c jdatadst.c jcinit.c
20 jcmaster.c jcmarker.c jcmainct.c jcprepct.c jccoefct.c jccolor.c
21 jcsample.c jchuff.c jcphuff.c jcdctmgr.c jfdctfst.c jfdctflt.c
22 jfdctint.c
23 )
24
25 # decompression library object files
26 SET(decompression_SRCS
27 jdapimin.c jdapistd.c jdtrans.c jdatasrc.c jdmaster.c
28 jdinput.c jdmarker.c jdhuff.c jdphuff.c jdmainct.c jdcoefct.c
29 jdpostct.c jddctmgr.c jidctfst.c jidctflt.c jidctint.c jidctred.c
30 jdsample.c jdcolor.c jquant1.c jquant2.c jdmerge.c
31 )
32
33 SET(JPEG_HEADER_FILES
34   jchuff.h  
35   jdct.h  
36   jdhuff.h  
37   jerror.h  
38   jinclude.h  
39   jmemsys.h  
40 #  jmorecfg.h     #no this one need to be configured
41   jpegint.h  
42   jpeglib.h  
43   jversion.h
44   )
45
46 SET(JPEG_SOURCES
47   ${systemdependent_SRCS}
48   ${common_SRCS}
49   ${compression_SRCS}
50   ${decompression_SRCS}
51   )
52
53 IF (WIN32)
54   IF (BUILD_SHARED_LIBS)
55     ADD_DEFINITIONS(-DJPEGDLL)
56   ELSE (BUILD_SHARED_LIBS)
57     ADD_DEFINITIONS(-DJPEGSTATIC)
58   ENDIF (BUILD_SHARED_LIBS)
59 ENDIF (WIN32)
60
61 # Attempt to generate two libraries: jpeg 8bits and 12 bits using only one
62 # source directory
63
64 SET(JPEG8_SOURCES)
65 SET(JPEG12_SOURCES)
66 FOREACH(file ${JPEG_SOURCES})
67   # Duplicate jpeg source in subdir libijg8
68   CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/libijg/${file}"
69     "${CMAKE_CURRENT_BINARY_DIR}/libijg8/${file}"
70     )
71   SET(JPEG8_SOURCES ${JPEG8_SOURCES} "${CMAKE_CURRENT_BINARY_DIR}/libijg8/${file}")
72
73   SET(BITS_TYPE_JPEG_MANGLE_NAME gdcm_mangle_8bits.h)
74   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libijg/jconfig.h.in
75                  ${CMAKE_CURRENT_BINARY_DIR}/libijg8/jconfig.h @ONLY IMMEDIATE)
76   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libijg/gdcm_mangle_8bits.h
77                  ${CMAKE_CURRENT_BINARY_DIR}/libijg8/gdcm_mangle_8bits.h @ONLY IMMEDIATE)
78
79   # Duplicate jpeg source in subdir libijg12
80   CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/libijg/${file}"
81     "${CMAKE_CURRENT_BINARY_DIR}/libijg12/${file}"
82     )
83   SET(JPEG12_SOURCES ${JPEG12_SOURCES} "${CMAKE_CURRENT_BINARY_DIR}/libijg12/${file}")
84
85   SET(BITS_TYPE_JPEG_MANGLE_NAME gdcm_mangle_12bits.h)
86   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libijg/jconfig.h.in
87                  ${CMAKE_CURRENT_BINARY_DIR}/libijg12/jconfig.h @ONLY IMMEDIATE)
88   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libijg/gdcm_mangle_12bits.h
89                  ${CMAKE_CURRENT_BINARY_DIR}/libijg12/gdcm_mangle_12bits.h @ONLY IMMEDIATE)
90 ENDFOREACH(file)
91
92 # Now copy the header file
93 FOREACH(file ${JPEG_HEADER_FILES})
94   CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/libijg/${file}"
95     "${CMAKE_CURRENT_BINARY_DIR}/libijg8/${file}"
96     )
97   CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/libijg/${file}"
98     "${CMAKE_CURRENT_BINARY_DIR}/libijg12/${file}"
99     )
100 ENDFOREACH(file)
101 # Particular case jmorecfg.h needs to be specified either 8 or 12 bits:
102 SET(GDCM_BITS_IN_JSAMPLE 8)
103 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libijg/jmorecfg.h
104                ${CMAKE_CURRENT_BINARY_DIR}/libijg8/jmorecfg.h @ONLY IMMEDIATE)
105
106 SET(GDCM_BITS_IN_JSAMPLE 12)
107 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libijg/jmorecfg.h
108                ${CMAKE_CURRENT_BINARY_DIR}/libijg12/jmorecfg.h @ONLY IMMEDIATE)
109