-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
157 lines (136 loc) · 3.28 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
cmake_minimum_required(VERSION 3.2...3.5)
project(libjpeg)
include(CheckIncludeFile)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
# to distinguish between debug and release lib
if(NOT DISABLE_FORCE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
check_include_file(stddef.h HAVE_STDDEF_H)
check_include_file(stdlib.h HAVE_STDLIB_H)
check_include_file(string.h HAVE_STRING_H)
check_symbol_exists(size_t stddef.h stdlib.h stdio.h HAVE_ANSI_SIZE_T)
check_symbol_exists(setmode io.h USE_SETMODE)
check_c_source_compiles(
"
void f()
{
char x[ (char)0xff ]; /* x[-1] if signed */
}
"
CHAR_IS_UNSIGNED)
check_c_source_compiles(
"
void f()
{
char x[ ((signed char)0xff) >> 1 ]; /* x[-1] if signed */
}
"
RIGHT_SHIFT_IS_UNSIGNED)
if(NOT HAVE_STRING_H)
set(NEED_BSD_STRINGS TRUE)
else()
set(NEED_BSD_STRINGS FALSE)
endif()
if(NOT HAVE_ANSI_SIZE_T)
set(NEED_SYS_TYPES_H TRUE)
else()
set(NEED_SYS_TYPES_H FALSE)
endif()
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/jconfig.h.in" "${CMAKE_CURRENT_BINARY_DIR}/include/jconfig.h")
add_library(libjpeg
jaricom.c
jcapimin.c
jcapistd.c
jcarith.c
jccoefct.c
jccolor.c
jcdctmgr.c
jchuff.c
jcinit.c
jcmainct.c
jcmarker.c
jcmaster.c
jcomapi.c
jcparam.c
jcprepct.c
jcsample.c
jctrans.c
jdapimin.c
jdapistd.c
jdarith.c
jdatadst.c
jdatasrc.c
jdcoefct.c
jdcolor.c
jddctmgr.c
jdhuff.c
jdinput.c
jdmainct.c
jdmarker.c
jdmaster.c
jdmerge.c
jdpostct.c
jdsample.c
jdtrans.c
jerror.c
jfdctflt.c
jfdctfst.c
jfdctint.c
jidctflt.c
jidctfst.c
jidctint.c
jquant1.c
jquant2.c
jutils.c
jmemmgr.c
jmemnobs.c
)
if(NOT MSVC)
set_target_properties(libjpeg PROPERTIES
OUTPUT_NAME "jpeg"
CLEAN_DIRECT_OUTPUT 1)
else()
set_target_properties(libjpeg PROPERTIES
OUTPUT_NAME "jpeg_static"
CLEAN_DIRECT_OUTPUT 1)
endif()
target_include_directories(libjpeg PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/include/")
option(JPEG_BUILD_EXECUTABLES "Also compiule executables" ON)
if(JPEG_BUILD_EXECUTABLES)
add_executable(cjpeg cjpeg.c rdppm.c rdgif.c rdtarga.c rdrle.c rdbmp.c rdswitch.c cdjpeg.c)
target_link_libraries(cjpeg libjpeg)
add_executable(djpeg djpeg.c wrppm.c wrgif.c wrtarga.c wrrle.c wrbmp.c rdcolmap.c cdjpeg.c)
target_link_libraries(djpeg libjpeg)
add_executable(jpegtran jpegtran.c rdswitch.c cdjpeg.c transupp.c)
target_link_libraries(jpegtran libjpeg)
add_executable(rdjpgcom rdjpgcom.c)
add_executable(wrjpgcom wrjpgcom.c)
install(
TARGETS cjpeg djpeg jpegtran rdjpgcom wrjpgcom
EXPORT "libjpegTargets"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
RUNTIME DESTINATION "bin"
INCLUDES DESTINATION "include"
)
endif()
install(
TARGETS libjpeg
EXPORT "libjpegTargets"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
RUNTIME DESTINATION "bin"
INCLUDES DESTINATION "include"
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/include/jconfig.h" jerror.h jmorecfg.h jpeglib.h
DESTINATION "include"
)
install(
EXPORT "libjpegTargets"
DESTINATION "lib/cmake/libjpeg"
)