]> Creatis software - gdcm.git/blob - src/gdcmjasper/src/libjasper/include/jasper/CMakeLists.txt
7a79978a39d4ae778cd182eb4bdd71637e58c974
[gdcm.git] / src / gdcmjasper / src / libjasper / include / jasper / CMakeLists.txt
1 #INCLUDE_REGULAR_EXPRESSION("^(jas).*$")
2
3
4 #libjasperinclude_HEADERS = \
5 #  jasper.h \
6 #  jas_config.h \
7 #  jas_config2.h \
8 #  jas_cm.h \
9 #  jas_fix.h \
10 #  jas_debug.h \
11 #  jas_getopt.h \
12 #  jas_icc.h \
13 #  jas_image.h \
14 #  jas_init.h \
15 #  jas_malloc.h \
16 #  jas_math.h \
17 #  jas_seq.h \
18 #  jas_stream.h \
19 #  jas_string.h \
20 #  jas_tvp.h \
21 #  jas_types.h \
22 #  jas_version.h
23 #
24 #libjasperincludedir = $(includedir)/jasper
25
26 SET(JAS_VERSION "1.701.0")
27
28 CHECK_INCLUDE_FILE("dlfcn.h"       HAVE_DLFCN_H)
29 CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
30 CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
31 CHECK_INCLUDE_FILE("io.h" HAVE_IO_H)
32 #/* Define to 1 if you have the `m' library (-lm). */
33 ##define HAVE_LIBM 1
34
35 CHECK_INCLUDE_FILE("limits.h" HAVE_LIMITS_H)
36 CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
37 CHECK_INCLUDE_FILE("stdbool.h" HAVE_STDBOOL_H)
38 CHECK_INCLUDE_FILE("stddef.h" HAVE_STDDEF_H)
39 CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
40 CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
41 CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
42 CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
43 CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
44 CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
45 CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
46
47 #/* Have variable length arrays */
48 ##define HAVE_VLA 1
49
50 #/* Define to 1 if you have the `vprintf' function. */
51 ##define HAVE_VPRINTF 1
52
53 CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
54 # Big endian thing:
55 INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
56 TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
57
58 # let's have some fun with long long and __int64...I don't even know why this lib need those types anyway...
59 INCLUDE(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
60 CHECK_TYPE_SIZE("char"   GDCM_SIZEOF_CHAR)
61 CHECK_TYPE_SIZE("short"  GDCM_SIZEOF_SHORT)
62 CHECK_TYPE_SIZE("int"    GDCM_SIZEOF_INT)
63 CHECK_TYPE_SIZE("long"   GDCM_SIZEOF_LONG)
64 CHECK_TYPE_SIZE("float"  GDCM_SIZEOF_FLOAT)
65 CHECK_TYPE_SIZE("double" GDCM_SIZEOF_DOUBLE)
66
67 CHECK_TYPE_SIZE("long long" GDCM_SIZEOF_LONG_LONG)
68 CHECK_TYPE_SIZE("__int64"   GDCM_SIZEOF___INT64)
69
70 IF(GDCM_SIZEOF___INT64)
71   IF("GDCM_TYPE_SAME_LONG_AND___INT64" MATCHES "^GDCM_TYPE_SAME_LONG_AND___INT64$")
72     MESSAGE(STATUS "Checking whether long and __int64 are the same type")
73     TRY_COMPILE(GDCM_TYPE_SAME_LONG_AND___INT64
74       ${GDCM_BINARY_DIR}/CMakeTmp
75       ${GDCM_SOURCE_DIR}/CMake/vtkTestCompareTypes.cxx
76       COMPILE_DEFINITIONS
77       -DGDCM_TEST_COMPARE_TYPE_1=long
78       -DGDCM_TEST_COMPARE_TYPE_2=__int64
79       OUTPUT_VARIABLE OUTPUT)
80     IF(GDCM_TYPE_SAME_LONG_AND___INT64)
81       MESSAGE(STATUS "Checking whether long and __int64 are the same type -- yes")
82       SET(GDCM_TYPE_SAME_LONG_AND___INT64 1 CACHE INTERNAL "Whether long and __int64 are the same type")
83       WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeOutput.log
84         "Determining whether long and __int64 are the same type "
85         "passed with the following output:\n"
86         "${OUTPUT}\n" APPEND)
87     ELSE(GDCM_TYPE_SAME_LONG_AND___INT64)
88       MESSAGE(STATUS "Checking whether long and __int64 are the same type -- no")
89       SET(GDCM_TYPE_SAME_LONG_AND___INT64 0 CACHE INTERNAL "Whether long and __int64 are the same type")
90       WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
91         "Determining whether long and __int64 are the same type "
92         "failed with the following output:\n"
93         "${OUTPUT}\n" APPEND)
94     ENDIF(GDCM_TYPE_SAME_LONG_AND___INT64)
95   ENDIF("GDCM_TYPE_SAME_LONG_AND___INT64" MATCHES "^GDCM_TYPE_SAME_LONG_AND___INT64$")
96   IF(GDCM_SIZEOF_LONG_LONG)
97     IF("GDCM_TYPE_SAME_LONG_LONG_AND___INT64" MATCHES "^GDCM_TYPE_SAME_LONG_LONG_AND___INT64$")
98       MESSAGE(STATUS "Checking whether long long and __int64 are the same type")
99       TRY_COMPILE(GDCM_TYPE_SAME_LONG_LONG_AND___INT64
100         ${GDCM_BINARY_DIR}/CMakeTmp
101         ${GDCM_SOURCE_DIR}/CMake/vtkTestCompareTypes.cxx
102         COMPILE_DEFINITIONS
103         -DGDCM_TEST_COMPARE_TYPE_1=TYPE_LONG_LONG
104         -DGDCM_TEST_COMPARE_TYPE_2=__int64
105         OUTPUT_VARIABLE OUTPUT)
106       IF(GDCM_TYPE_SAME_LONG_LONG_AND___INT64)
107         MESSAGE(STATUS "Checking whether long long and __int64 are the same type -- yes")
108         SET(GDCM_TYPE_SAME_LONG_LONG_AND___INT64 1 CACHE INTERNAL "Whether long long and __int64 are the same type")
109         WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeOutput.log
110           "Determining whether long long and __int64 are the same type "
111           "passed with the following output:\n"
112           "${OUTPUT}\n" APPEND)
113       ELSE(GDCM_TYPE_SAME_LONG_LONG_AND___INT64)
114         MESSAGE(STATUS "Checking whether long long and __int64 are the same type -- no")
115         SET(GDCM_TYPE_SAME_LONG_LONG_AND___INT64 0 CACHE INTERNAL "Whether long long and __int64 are the same type")
116         WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
117           "Determining whether long long and __int64 are the same type "
118           "failed with the following output:\n"
119           "${OUTPUT}\n" APPEND)
120       ENDIF(GDCM_TYPE_SAME_LONG_LONG_AND___INT64)
121     ENDIF("GDCM_TYPE_SAME_LONG_LONG_AND___INT64" MATCHES "^GDCM_TYPE_SAME_LONG_LONG_AND___INT64$")
122   ENDIF(GDCM_SIZEOF_LONG_LONG)
123   IF(NOT GDCM_TYPE_SAME_LONG_AND___INT64)
124     IF(NOT GDCM_TYPE_SAME_LONG_LONG_AND___INT64)
125       #  VS 6 cannot convert unsigned __int64 to double unless the
126       # "Visual C++ Processor Pack" is installed.
127       IF("GDCM_TYPE_CONVERT_UI64_TO_DOUBLE" MATCHES "^GDCM_TYPE_CONVERT_UI64_TO_DOUBLE$")
128         MESSAGE(STATUS "Checking whether unsigned __int64 can convert to double")
129         TRY_COMPILE(GDCM_TYPE_CONVERT_UI64_TO_DOUBLE
130           ${GDCM_BINARY_DIR}/CMakeTmp
131           ${GDCM_SOURCE_DIR}/CMake/vtkTestConvertTypes.cxx
132           COMPILE_DEFINITIONS
133           -DGDCM_TEST_CONVERT_TYPE_FROM=TYPE_UNSIGNED___INT64
134           -DGDCM_TEST_CONVERT_TYPE_TO=double
135           OUTPUT_VARIABLE OUTPUT)
136         IF(GDCM_TYPE_CONVERT_UI64_TO_DOUBLE)
137           MESSAGE(STATUS "Checking whether unsigned __int64 can convert to double -- yes")
138           SET(GDCM_TYPE_CONVERT_UI64_TO_DOUBLE 1 CACHE INTERNAL "Whether unsigned __int64 can convert to double")
139           WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeOutput.log
140             "Determining whether unsigned __int64 can convert to double "
141             "passed with the following output:\n"
142             "${OUTPUT}\n" APPEND)
143         ELSE(GDCM_TYPE_CONVERT_UI64_TO_DOUBLE)
144           MESSAGE(STATUS "Checking whether unsigned __int64 can convert to double -- no")
145           SET(GDCM_TYPE_CONVERT_UI64_TO_DOUBLE 0 CACHE INTERNAL "Whether unsigned __int64 can convert to double")
146           WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log
147             "Determining whether unsigned __int64 can convert to double "
148             "failed with the following output:\n"
149             "${OUTPUT}\n" APPEND)
150         ENDIF(GDCM_TYPE_CONVERT_UI64_TO_DOUBLE)
151       ENDIF("GDCM_TYPE_CONVERT_UI64_TO_DOUBLE" MATCHES "^GDCM_TYPE_CONVERT_UI64_TO_DOUBLE$")
152     ENDIF(NOT GDCM_TYPE_SAME_LONG_LONG_AND___INT64)
153   ENDIF(NOT GDCM_TYPE_SAME_LONG_AND___INT64)
154 ENDIF(GDCM_SIZEOF___INT64)
155
156 # Enable the "long long" type if it is available.  It is standard in
157 # C99 and C++03 but not in earlier standards.
158 SET(GDCM_TYPE_USE_LONG_LONG)
159 IF(GDCM_SIZEOF_LONG_LONG)
160   SET(GDCM_TYPE_USE_LONG_LONG 1)
161 ENDIF(GDCM_SIZEOF_LONG_LONG)
162
163 # Enable the "__int64" type if it is available and unique.  It is not
164 # standard.
165 SET(GDCM_TYPE_USE___INT64)
166 IF(GDCM_SIZEOF___INT64)
167   IF(NOT GDCM_TYPE_SAME_LONG_AND___INT64)
168     IF(NOT GDCM_TYPE_SAME_LONG_LONG_AND___INT64)
169       SET(GDCM_TYPE_USE___INT64 1)
170     ENDIF(NOT GDCM_TYPE_SAME_LONG_LONG_AND___INT64)
171   ENDIF(NOT GDCM_TYPE_SAME_LONG_AND___INT64)
172 ENDIF(GDCM_SIZEOF___INT64)
173
174 CONFIGURE_FILE(
175   ${JASPER_SOURCE_DIR}/src/libjasper/include/jasper/jas_config.h.in
176   ${JASPER_BINARY_DIR}/src/libjasper/include/jasper/jas_config.h
177   @ONLY IMMEDIATE)