1 | project (OSCam C)
|
---|
2 |
|
---|
3 | #----------------------- minimum version of cmake to use ------------
|
---|
4 |
|
---|
5 | # if you want to switch to 2.6 min, please look at the escaped definitions
|
---|
6 | # later in this file (the add_definitions in 2.6 don't need to be escaped),
|
---|
7 | # and remove the CMP0005 policy.
|
---|
8 | # the CMP0003 could also be removed for cmake 2.6
|
---|
9 | cmake_minimum_required (VERSION 2.4)
|
---|
10 | if(COMMAND cmake_policy)
|
---|
11 | cmake_policy(SET CMP0005 OLD)
|
---|
12 | cmake_policy(SET CMP0003 NEW)
|
---|
13 | endif(COMMAND cmake_policy)
|
---|
14 |
|
---|
15 | #----------------------- detect system ------------------------------
|
---|
16 |
|
---|
17 | if (CMAKE_CROSSCOMPILING)
|
---|
18 | if (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
|
---|
19 | set (OSCamOperatingSystem "Tuxbox")
|
---|
20 | set (CS_OS_HW "tuxbox")
|
---|
21 | set (CS_OS_SYS "linux")
|
---|
22 | elseif (OSCAM_SYSTEM_NAME MATCHES "TripleDragon")
|
---|
23 | set (OSCamOperatingSystem "TripleDragon")
|
---|
24 | set (CS_OS_HW "tuxbox")
|
---|
25 | set (CS_OS_SYS "linux")
|
---|
26 | elseif (OSCAM_SYSTEM_NAME MATCHES "Coolstream")
|
---|
27 | set (OSCamOperatingSystem "NeutrinoHD")
|
---|
28 | set (CS_OS_HW "coolstream")
|
---|
29 | set (CS_OS_SYS "linux")
|
---|
30 | elseif (OSCAM_SYSTEM_NAME MATCHES "NSLU2")
|
---|
31 | set (OSCamOperatingSystem "SlugOS")
|
---|
32 | set (CS_OS_HW "nslu2")
|
---|
33 | set (CS_OS_SYS "linux")
|
---|
34 | elseif (OSCAM_SYSTEM_NAME MATCHES "Fonera2")
|
---|
35 | set (OSCamOperatingSystem "Fonera2")
|
---|
36 | set (CS_OS_HW "fonera2")
|
---|
37 | set (CS_OS_SYS "linux")
|
---|
38 | elseif (OSCAM_SYSTEM_NAME MATCHES "agv2+w")
|
---|
39 | set (OSCamOperatingSystem "agv2+w")
|
---|
40 | set (CS_OS_HW "agv2+w")
|
---|
41 | set (CS_OS_SYS "linux")
|
---|
42 | elseif (OSCAM_SYSTEM_NAME MATCHES "WRT54G")
|
---|
43 | set (OSCamOperatingSystem "WRT54G")
|
---|
44 | set (CS_OS_HW "wrt54g")
|
---|
45 | set (CS_OS_SYS "linux")
|
---|
46 | elseif (OSCAM_SYSTEM_NAME MATCHES "Amino")
|
---|
47 | set (OSCamOperatingSystem "Amino")
|
---|
48 | set (CS_OS_HW "amino")
|
---|
49 | set (CS_OS_SYS "linux")
|
---|
50 | elseif (OSCAM_SYSTEM_NAME MATCHES "QboxHD")
|
---|
51 | set (OSCamOperatingSystem "QboxHD")
|
---|
52 | set (CS_OS_HW "qboxhd")
|
---|
53 | set (CS_OS_SYS "linux")
|
---|
54 | else (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
|
---|
55 | message (STATUS "Unknown cross system name: <${CMAKE_SYSTEM_NAME}>")
|
---|
56 | set (OSCamOperatingSystem "Unknown")
|
---|
57 | set (CS_OS_HW "unknown")
|
---|
58 | set (CS_OS_SYS "unknown")
|
---|
59 | endif (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
|
---|
60 | else (CMAKE_CROSSCOMPILING)
|
---|
61 | if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
---|
62 | set (OSCamOperatingSystem "Linux")
|
---|
63 | set (CS_OS_HW "pc")
|
---|
64 | set (CS_OS_SYS "linux")
|
---|
65 | elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
---|
66 | set (OSCamOperatingSystem "FreeBSD")
|
---|
67 | set (CS_OS_HW "pc")
|
---|
68 | set (CS_OS_SYS "freebsd")
|
---|
69 | elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
---|
70 | set (OSCamOperatingSystem "Mac OS X")
|
---|
71 | set (CS_OS_HW "mac")
|
---|
72 | set (CS_OS_SYS "macosx")
|
---|
73 | SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" )
|
---|
74 | SET( CMAKE_CFLAGS "${CMAKE_CFLAGS} -m32" )
|
---|
75 | elseif (${CYGWIN})
|
---|
76 | set (OSCamOperatingSystem "Windows/Cygwin")
|
---|
77 | set (CS_OS_HW "pc")
|
---|
78 | set (CS_OS_SYS "cygwin")
|
---|
79 | set (CMAKE_SYSTEM_PROCESSOR "i386")
|
---|
80 | else (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
---|
81 | message (STATUS "Unknown system name: <${CMAKE_SYSTEM_NAME}>")
|
---|
82 | set (OSCamOperatingSystem "Unknown")
|
---|
83 | set (CS_OS_HW "unknown")
|
---|
84 | set (CS_OS_SYS "unknown")
|
---|
85 | endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
---|
86 | endif (CMAKE_CROSSCOMPILING)
|
---|
87 |
|
---|
88 | #----------------------- some paths ------------------------------
|
---|
89 |
|
---|
90 | set (OPTIONAL_LINK_DIR "" CACHE STRING "Some optional link directories")
|
---|
91 | set (OPTIONAL_INCLUDE_DIR "" CACHE STRING "Some optional include directories")
|
---|
92 |
|
---|
93 | include_directories (
|
---|
94 | ${CMAKE_CURRENT_SOURCE_DIR}/csctapi
|
---|
95 | ${CMAKE_CURRENT_SOURCE_DIR}/cscrypt
|
---|
96 | if[CS_WITH_GBOX]
|
---|
97 | ${CMAKE_CURRENT_SOURCE_DIR}/csgbox
|
---|
98 | endif[CS_WITH_GBOX]
|
---|
99 | ${OPTIONAL_INCLUDE_DIR}
|
---|
100 | )
|
---|
101 | link_directories (${OPTIONAL_LINK_DIR})
|
---|
102 |
|
---|
103 | #----------------------- global options ------------------------------
|
---|
104 |
|
---|
105 | if (OSCamOperatingSystem MATCHES "Linux")
|
---|
106 | add_definitions ("-DOS_LINUX")
|
---|
107 | set (DEFAULT_CS_CONFDIR "/usr/local/etc")
|
---|
108 | elseif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
109 | add_definitions ("-DOS_MACOSX -DHAVE_PCSC -DNEED_DAEMON -DCS_NOSHM")
|
---|
110 | set (DEFAULT_CS_CONFDIR "/usr/local/etc")
|
---|
111 | elseif (OSCamOperatingSystem MATCHES "Tuxbox")
|
---|
112 | set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
|
---|
113 | if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "mips")
|
---|
114 | add_definitions ("-DOS_LINUX -DTUXBOX -DMIPSEL")
|
---|
115 | else (${CMAKE_SYSTEM_PROCESSOR} MATCHES "mips")
|
---|
116 | add_definitions ("-DOS_LINUX -DTUXBOX -DPPC")
|
---|
117 | endif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "mips")
|
---|
118 | elseif (OSCamOperatingSystem MATCHES "TripleDragon")
|
---|
119 | add_definitions ("-DOS_LINUX -DTRIPLEDRAGON -DSTB04SCI -DTUXBOX -DPPC")
|
---|
120 | set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
|
---|
121 | elseif (OSCamOperatingSystem MATCHES "NeutrinoHD")
|
---|
122 | add_definitions ("-DOS_LINUX -DTUXBOX -DCOOL")
|
---|
123 | set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
|
---|
124 | elseif (OSCamOperatingSystem MATCHES "SlugOS")
|
---|
125 | add_definitions ("-DOS_LINUX -DARM")
|
---|
126 | set (DEFAULT_CS_CONFDIR "/var/etc")
|
---|
127 | elseif (OSCamOperatingSystem MATCHES "Fonera2")
|
---|
128 | add_definitions ("-DOS_LINUX -DMIPSEL -DUCLIBC")
|
---|
129 | set (DEFAULT_CS_CONFDIR "/var/etc")
|
---|
130 | elseif (OSCamOperatingSystem MATCHES "agv2+w")
|
---|
131 | add_definitions ("-DOS_LINUX -DUCLIBC")
|
---|
132 | set (DEFAULT_CS_CONFDIR "/etc")
|
---|
133 | elseif (OSCamOperatingSystem MATCHES "WRT54G")
|
---|
134 | add_definitions ("-DOS_LINUX -DMIPSEL -DUCLIBC -DUSE_GPIO")
|
---|
135 | set (DEFAULT_CS_CONFDIR "/jffs/etc/config/oscam")
|
---|
136 | elseif (OSCamOperatingSystem MATCHES "Amino")
|
---|
137 | add_definitions ("-DOS_LINUX -DSH4 -DTUXBOX")
|
---|
138 | set (DEFAULT_CS_CONFDIR "/usr/local/etc")
|
---|
139 | elseif (OSCamOperatingSystem MATCHES "QboxHD")
|
---|
140 | add_definitions ("-DOS_LINUX -DSH4 -DQBOXHD -DTUXBOX")
|
---|
141 | set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
|
---|
142 | elseif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
143 | add_definitions ("-DOS_CYGWIN32 -static")
|
---|
144 | set (DEFAULT_CS_CONFDIR ".")
|
---|
145 | elseif (OSCamOperatingSystem MATCHES "FreeBSD")
|
---|
146 | add_definitions ("-DOS_FREEBSD")
|
---|
147 | set (DEFAULT_CS_CONFDIR ".")
|
---|
148 | endif (OSCamOperatingSystem MATCHES "Linux")
|
---|
149 |
|
---|
150 | set (CS_CONFDIR ${DEFAULT_CS_CONFDIR} CACHE STRING "Default path for the config files")
|
---|
151 | add_definitions ("-DCS_CONFDIR=\\\"${CS_CONFDIR}\\\"")
|
---|
152 |
|
---|
153 | set (CS_OS_CPU ${CMAKE_SYSTEM_PROCESSOR})
|
---|
154 | set (CS_OSTYPE ${CS_OS_CPU}-${CS_OS_HW}-${CS_OS_SYS})
|
---|
155 |
|
---|
156 | add_definitions ("-DUSE_CMAKE")
|
---|
157 | add_definitions ("-DCS_OSTYPE=\\\"${CS_OSTYPE}\\\"")
|
---|
158 | add_definitions ("-DCS_OS_CPU=\\\"${CS_OS_CPU}\\\"")
|
---|
159 | add_definitions ("-DCS_OS_HW=\\\"${CS_OS_HW}\\\"")
|
---|
160 | add_definitions ("-DCS_OS_SYS=\\\"${CS_OS_SYS}\\\"")
|
---|
161 |
|
---|
162 | #----------------------- subdirectories ------------------------------
|
---|
163 |
|
---|
164 | include (CheckIncludeFile)
|
---|
165 | if(CS_ANTICASC)
|
---|
166 | add_definitions ("-DCS_ANTICASC")
|
---|
167 | endif(CS_ANTICASC)
|
---|
168 |
|
---|
169 | if(CS_LOGHISTORY)
|
---|
170 | add_definitions ("-DCS_LOGHISTORY")
|
---|
171 | endif(CS_LOGHISTORY)
|
---|
172 |
|
---|
173 | if(CS_WITH_GBOX)
|
---|
174 | add_definitions ("-DCS_WITH_GBOX")
|
---|
175 | endif(CS_WITH_GBOX)
|
---|
176 |
|
---|
177 | if(CS_LED)
|
---|
178 | add_definitions ("-DCS_LED")
|
---|
179 | endif (CS_LED)
|
---|
180 |
|
---|
181 | if (WEBIF)
|
---|
182 | add_definitions ("-DWEBIF")
|
---|
183 | endif (WEBIF)
|
---|
184 |
|
---|
185 | if(IRDETO_GUESSING)
|
---|
186 | add_definitions ("-DIRDETO_GUESSING")
|
---|
187 | endif (IRDETO_GUESSING)
|
---|
188 |
|
---|
189 | check_include_file ("pthread.h" HAVE_PTHREAD)
|
---|
190 | if (HAVE_PTHREAD)
|
---|
191 | message(STATUS " pthread found. Adding pthread support ")
|
---|
192 | add_definitions ("-DHAVE_PTHREAD_H")
|
---|
193 | elseif (HAVE_PTHREAD)
|
---|
194 | message(STATUS " no pthread found. No smartreader ")
|
---|
195 | endif (HAVE_PTHREAD)
|
---|
196 |
|
---|
197 | check_include_file ("openssl/aes.h" HAVE_AES)
|
---|
198 | if (HAVE_AES)
|
---|
199 | add_definitions ("-DHAVE_AES")
|
---|
200 | endif (HAVE_AES)
|
---|
201 |
|
---|
202 | check_include_file ("openssl/sha.h" HAVE_SHA)
|
---|
203 | if (HAVE_SHA)
|
---|
204 | add_definitions ("-DHAVE_SHA")
|
---|
205 | endif (HAVE_SHA)
|
---|
206 |
|
---|
207 |
|
---|
208 | if (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
209 | if (LIBRTDIR)
|
---|
210 | check_include_file ("${LIBRTDIR}/include/time.h" HAVE_LIBRT_STATIC)
|
---|
211 | if (HAVE_LIBRT_STATIC)
|
---|
212 | if (EXISTS ${LIBRTDIR}/lib/librt.a)
|
---|
213 | message(STATUS " static librt found : ${LIBRTDIR}/lib/librt.a (needed by libusb).")
|
---|
214 | add_definitions ("-I${LIBRTDIR}/include/")
|
---|
215 | add_library(imp_librt STATIC IMPORTED)
|
---|
216 | set_property(TARGET imp_librt PROPERTY IMPORTED_LOCATION ${LIBRTDIR}/lib/librt.a)
|
---|
217 | else (EXISTS ${LIBRTDIR}/lib/librt.a)
|
---|
218 | message(STATUS " ${LIBRTDIR}/lib/librt.a not found (needed by libusb). No smartreader support)")
|
---|
219 | unset (HAVE_LIBRT_STATIC)
|
---|
220 | endif (EXISTS ${LIBRTDIR}/lib/librt.a)
|
---|
221 | else (HAVE_LIBRT_STATIC)
|
---|
222 | message(STATUS " no librt found (needed by libusb). No smartreader support")
|
---|
223 | endif (HAVE_LIBRT_STATIC)
|
---|
224 | else (LIBRTDIR)
|
---|
225 | check_include_file ("time.h" HAVE_LIBRT)
|
---|
226 | if (HAVE_LIBRT)
|
---|
227 | message(STATUS " librt found (needed by libusb).")
|
---|
228 | else (HAVE_LIBRT)
|
---|
229 | message(STATUS " no librt found (needed by libusb. No smartreader support")
|
---|
230 | endif (HAVE_LIBRT)
|
---|
231 | endif (LIBRTDIR)
|
---|
232 | else (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
233 | set (HAVE_LIBRT True)
|
---|
234 | endif (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
235 |
|
---|
236 |
|
---|
237 | if( HAVE_LIBRT OR HAVE_LIBRT_STATIC)
|
---|
238 | if (LIBUSBDIR)
|
---|
239 | check_include_file ("${LIBUSBDIR}/include/libusb-1.0/libusb.h" HAVE_LIBUSB)
|
---|
240 | if (HAVE_LIBUSB AND HAVE_PTHREAD)
|
---|
241 | if (EXISTS ${LIBUSBDIR}/lib/libusb-1.0.a)
|
---|
242 | message(STATUS " static libusb 1.0 found (${LIBUSBDIR}/lib/libusb-1.0.a). Adding smartreader support ")
|
---|
243 | add_definitions ("-DLIBUSB")
|
---|
244 | add_definitions ("-I${LIBUSBDIR}/include/")
|
---|
245 | add_library(imp_libusb STATIC IMPORTED)
|
---|
246 | set_property(TARGET imp_libusb PROPERTY IMPORTED_LOCATION ${LIBUSBDIR}/lib/libusb-1.0.a)
|
---|
247 | else (EXISTS ${LIBUSBDIR}/lib/libusb-1.0.a)
|
---|
248 | message(STATUS " static libusb 1.0 not found (${LIBUSBDIR}/lib/libusb-1.0.a). No smartreader support ")
|
---|
249 | unset(HAVE_LIBUSB)
|
---|
250 | unset(HAVE_LIBRT)
|
---|
251 | unset(HAVE_LIBRT_STATIC)
|
---|
252 | endif (EXISTS ${LIBUSBDIR}/lib/libusb-1.0.a)
|
---|
253 | else (HAVE_LIBUSB AND HAVE_PTHREAD)
|
---|
254 | message(STATUS " no libusb 1.0 found. No smartreader support")
|
---|
255 | endif (HAVE_LIBUSB AND HAVE_PTHREAD)
|
---|
256 | else (LIBUSBDIR)
|
---|
257 | check_include_file ("libusb-1.0/libusb.h" HAVE_LIBUSB)
|
---|
258 | if (HAVE_LIBUSB AND HAVE_PTHREAD)
|
---|
259 | if (EXISTS /usr/local/lib/libusb-1.0.a)
|
---|
260 | message(STATUS " static libusb 1.0 found : /usr/local/lib/libusb-1.0.a . Adding smartreader support ")
|
---|
261 | add_definitions ("-DLIBUSB")
|
---|
262 | add_definitions ("-I/usr/local/include")
|
---|
263 | add_library(imp_libusb STATIC IMPORTED)
|
---|
264 | set_property(TARGET imp_libusb PROPERTY IMPORTED_LOCATION /usr/local/lib/libusb-1.0.a)
|
---|
265 | elseif (EXISTS /usr/lib/libusb-1.0.a)
|
---|
266 | message(STATUS " static libusb 1.0 found : /usr/lib/libusb-1.0.a . Adding smartreader support ")
|
---|
267 | add_definitions ("-DLIBUSB")
|
---|
268 | add_library(imp_libusb STATIC IMPORTED)
|
---|
269 | set_property(TARGET imp_libusb PROPERTY IMPORTED_LOCATION /usr/lib/libusb-1.0.a)
|
---|
270 | else (EXISTS /usr/local/lib/libusb-1.0.a)
|
---|
271 | message(STATUS " static libusb 1.0 not found (not in /usr/local/lib/ or /usr/lib/) . No smartreader support ")
|
---|
272 | unset(HAVE_LIBUSB)
|
---|
273 | unset(HAVE_LIBRT)
|
---|
274 | unset(HAVE_LIBRT_STATIC)
|
---|
275 | endif (EXISTS /usr/local/lib/libusb-1.0.a)
|
---|
276 | else (HAVE_LIBUSB AND HAVE_PTHREAD)
|
---|
277 | message(STATUS " no libusb 1.0 found. No smartreader support")
|
---|
278 | endif (HAVE_LIBUSB AND HAVE_PTHREAD)
|
---|
279 | endif (LIBUSBDIR)
|
---|
280 | endif( HAVE_LIBRT OR HAVE_LIBRT_STATIC)
|
---|
281 |
|
---|
282 |
|
---|
283 | check_include_file ("PCSC/wintypes.h" HAVE_PCSC)
|
---|
284 | if (HAVE_PCSC)
|
---|
285 | add_definitions ("-DHAVE_PCSC")
|
---|
286 | if (OSCamOperatingSystem MATCHES "Linux")
|
---|
287 | add_definitions ("-I/usr/include/PCSC")
|
---|
288 | endif (OSCamOperatingSystem MATCHES "Linux")
|
---|
289 | endif (HAVE_PCSC)
|
---|
290 |
|
---|
291 | #----------------------- subdirectories ------------------------------
|
---|
292 |
|
---|
293 | add_subdirectory (csctapi)
|
---|
294 | add_subdirectory (cscrypt)
|
---|
295 | if(CS_WITH_GBOX)
|
---|
296 | add_subdirectory (csgbox)
|
---|
297 | endif(CS_WITH_GBOX)
|
---|
298 | if( HAVE_LIBRT OR HAVE_LIBRT_STATIC)
|
---|
299 | if (HAVE_LIBUSB)
|
---|
300 | add_subdirectory (utils)
|
---|
301 | endif (HAVE_LIBUSB)
|
---|
302 | endif( HAVE_LIBRT OR HAVE_LIBRT_STATIC)
|
---|
303 |
|
---|
304 | #----------------------- file groups ------------------------------
|
---|
305 |
|
---|
306 | file (GLOB csmodules_srcs "module-*.c")
|
---|
307 | file (GLOB csmodules_hdrs "module-*.h")
|
---|
308 | file (GLOB csreaders_srcs "reader-*.c")
|
---|
309 | file (GLOB csreaders_hdrs "reader-*.h")
|
---|
310 | file (GLOB csoscam_srcs "oscam-*.c")
|
---|
311 | file (GLOB csoscam_hdrs "oscam-*.h")
|
---|
312 | file (GLOB exe_srcs "oscam.c")
|
---|
313 | file (GLOB exe_hdrs "globals.h")
|
---|
314 | file (GLOB all_srcs ${csmodules_srcs} ${csreaders_srcs} ${csoscam_srcs} ${exe_srcs})
|
---|
315 |
|
---|
316 | #----------------------- modules ------------------------------
|
---|
317 |
|
---|
318 | set (csmodules "csmodules")
|
---|
319 | add_library (${csmodules} STATIC ${csmodules_srcs} ${csmodules_hdrs})
|
---|
320 |
|
---|
321 | #----------------------- readers ------------------------------
|
---|
322 |
|
---|
323 | set (csreaders "csreaders")
|
---|
324 | add_library (${csreaders} STATIC ${csreaders_srcs} ${csreaders_hdrs})
|
---|
325 |
|
---|
326 | #----------------------- other oscam files ------------------------------
|
---|
327 |
|
---|
328 | set (csoscam "csoscam")
|
---|
329 | add_library (${csoscam} STATIC ${csoscam_srcs} ${csoscam_hdrs})
|
---|
330 |
|
---|
331 | #----------------------- the executable ------------------------------
|
---|
332 |
|
---|
333 | set (exe_name "oscam")
|
---|
334 | add_executable (${exe_name} ${exe_srcs} ${exe_hdrs})
|
---|
335 | if(CS_WITH_GBOX)
|
---|
336 | target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt csgbox)
|
---|
337 | else(CS_WITHGBOX)
|
---|
338 | target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt)
|
---|
339 | endif(CS_WITH_GBOX)
|
---|
340 | if(HAVE_LIBRT AND HAVE_LIBUSB)
|
---|
341 | target_link_libraries (${exe_name} imp_libusb)
|
---|
342 | if (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
343 | target_link_libraries (${exe_name} rt)
|
---|
344 | endif (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
345 | if (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
346 | target_link_libraries (${exe_name} SetupAPI)
|
---|
347 | target_link_libraries (${exe_name} Ole32)
|
---|
348 | target_link_libraries (${exe_name} shell32)
|
---|
349 | endif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
350 | endif(HAVE_LIBRT AND HAVE_LIBUSB)
|
---|
351 |
|
---|
352 | if (HAVE_LIBRT_STATIC AND HAVE_LIBUSB)
|
---|
353 | target_link_libraries (${exe_name} imp_libusb)
|
---|
354 | if (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
355 | target_link_libraries (${exe_name} imp_librt)
|
---|
356 | endif (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
357 | if (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
358 | target_link_libraries (${exe_name} SetupAPI)
|
---|
359 | target_link_libraries (${exe_name} Ole32)
|
---|
360 | target_link_libraries (${exe_name} shell32)
|
---|
361 | endif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
362 | endif (HAVE_LIBRT_STATIC AND HAVE_LIBUSB)
|
---|
363 |
|
---|
364 | if (HAVE_PTHREAD)
|
---|
365 | target_link_libraries (${exe_name} pthread)
|
---|
366 | endif (HAVE_PTHREAD)
|
---|
367 |
|
---|
368 | if (HAVE_AES)
|
---|
369 | target_link_libraries (${exe_name} crypto)
|
---|
370 | endif (HAVE_AES)
|
---|
371 | if (HAVE_PCSC)
|
---|
372 | if (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
373 | target_link_libraries (${exe_name} pcsclite)
|
---|
374 | endif (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
375 | endif (HAVE_PCSC)
|
---|
376 |
|
---|
377 |
|
---|
378 | add_dependencies (${exe_name} ${csoscam} ${csreaders} ${csmodules})
|
---|
379 |
|
---|
380 | #----------------------- specific options ------------------------------
|
---|
381 |
|
---|
382 | if (OSCamOperatingSystem MATCHES "Linux")
|
---|
383 | elseif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
384 | FIND_LIBRARY (PCSC_LIBRARY PCSC)
|
---|
385 | message (STATUS "OS X system PCSC : ${PCSC_LIBRARY}")
|
---|
386 | target_link_libraries ( ${exe_name} ${PCSC_LIBRARY})
|
---|
387 | set (HAVE_PCSC "1")
|
---|
388 | FIND_LIBRARY (IOKit_LIBRARY IOKit)
|
---|
389 | target_link_libraries ( ${exe_name} ${IOKit_LIBRARY})
|
---|
390 | FIND_LIBRARY (CoreFoundation_LIBRARY CoreFoundation)
|
---|
391 | target_link_libraries ( ${exe_name} ${CoreFoundation_LIBRARY})
|
---|
392 | elseif (OSCamOperatingSystem MATCHES "Tuxbox")
|
---|
393 | target_link_libraries ( ${exe_name} dl)
|
---|
394 | elseif (OSCamOperatingSystem MATCHES "TripleDragon")
|
---|
395 | target_link_libraries ( ${exe_name} dl)
|
---|
396 | elseif (OSCamOperatingSystem MATCHES "SlugOS")
|
---|
397 | elseif (OSCamOperatingSystem MATCHES "Fonera2")
|
---|
398 | elseif (OSCamOperatingSystem MATCHES "agv2+w")
|
---|
399 | elseif (OSCamOperatingSystem MATCHES "WRT54G")
|
---|
400 | elseif (OSCamOperatingSystem MATCHES "Amino")
|
---|
401 | elseif (OSCamOperatingSystem MATCHES "QboxHD")
|
---|
402 | elseif (OSCamOperatingSystem MATCHES "Windows/cygwin")
|
---|
403 | elseif (OSCamOperatingSystem MATCHES "NeutrinoHD")
|
---|
404 | target_link_libraries ( ${exe_name} rt nxp )
|
---|
405 | endif (OSCamOperatingSystem MATCHES "Linux")
|
---|
406 |
|
---|
407 | #----------------------- put svnversion in the build ------------------------------
|
---|
408 | # at every target rebuild, we re-build the oscam.c compilation...
|
---|
409 |
|
---|
410 | # add the needed dependency
|
---|
411 | add_dependencies (${exe_name} svnversion)
|
---|
412 | add_dependencies (${csoscam} svnversion-log)
|
---|
413 |
|
---|
414 | # how to re-build the files which printout the version
|
---|
415 | add_custom_target (
|
---|
416 | svnversion
|
---|
417 | ALL
|
---|
418 | touch ${CMAKE_CURRENT_SOURCE_DIR}/oscam.c
|
---|
419 | )
|
---|
420 | add_custom_target (
|
---|
421 | svnversion-log
|
---|
422 | ALL
|
---|
423 | touch ${CMAKE_CURRENT_SOURCE_DIR}/oscam-log.c
|
---|
424 | )
|
---|
425 |
|
---|
426 | #if the svnversion program is absent, this will leave the SVN_REVISION string empty,
|
---|
427 | #but won't stop CMake.
|
---|
428 | execute_process (COMMAND "svnversion" "-n" "${CMAKE_CURRENT_SOURCE_DIR}" OUTPUT_VARIABLE OSCAM_SVN_REVISION)
|
---|
429 |
|
---|
430 | if (OSCAM_SVN_REVISION)
|
---|
431 | string (REGEX REPLACE "[0-9]+:" "" OSCAM_SVN_REVISION "${OSCAM_SVN_REVISION}")
|
---|
432 | string (REPLACE "M" "" OSCAM_SVN_REVISION "${OSCAM_SVN_REVISION}")
|
---|
433 | string (REPLACE "exported" "0" OSCAM_SVN_REVISION "${OSCAM_SVN_REVISION}")
|
---|
434 | else (OSCAM_SVN_REVISION)
|
---|
435 | set (OSCAM_SVN_REVISION "0")
|
---|
436 | endif (OSCAM_SVN_REVISION)
|
---|
437 |
|
---|
438 | # pass the version to the compilations as a define
|
---|
439 | add_definitions ("-D'CS_SVN_VERSION=\"${OSCAM_SVN_REVISION}\"'")
|
---|
440 |
|
---|
441 | #----------------------- global compile and link options ------------------------------
|
---|
442 |
|
---|
443 | # some optimisations
|
---|
444 | if (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
445 | add_definitions ("-O2 -Winline -Wall -Wextra -finline-functions -fomit-frame-pointer -m32 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk")
|
---|
446 | elseif (OSCAM_SYSTEM_NAME MATCHES "NSLU2")
|
---|
447 | add_definitions ("-O2 -Winline -Wall -finline-functions -fomit-frame-pointer")
|
---|
448 | else (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
449 | add_definitions ("-Winline -Wall -Wextra")
|
---|
450 | set (CMAKE_C_FLAGS "-O2 -finline-functions -fomit-frame-pointer")
|
---|
451 | set (CMAKE_C_FLAGS_DEBUG "-O0 -g")
|
---|
452 | endif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
453 |
|
---|
454 | # we don't want the '-rdynamic' in the link command
|
---|
455 | set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
---|
456 |
|
---|
457 | # we want to strip if not Debug build
|
---|
458 | if (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
459 | set (CMAKE_EXE_LINKER_FLAGS "-s -m32 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk")
|
---|
460 | else (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
461 | if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
462 | set (CMAKE_EXE_LINKER_FLAGS "-s")
|
---|
463 | endif (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
464 | endif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
465 | #----------------------- installation -----------------------------
|
---|
466 |
|
---|
467 | file (GLOB config_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/oscam.*")
|
---|
468 | file (GLOB doc_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/txt/*.txt")
|
---|
469 | file (GLOB man1_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/man/*.1")
|
---|
470 | file (GLOB man5_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/man/*.5")
|
---|
471 | file (GLOB example_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.ac"
|
---|
472 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.cert"
|
---|
473 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.conf"
|
---|
474 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.guess"
|
---|
475 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.ird"
|
---|
476 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.server"
|
---|
477 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.services"
|
---|
478 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.srvid"
|
---|
479 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.user")
|
---|
480 | file (GLOB monitor_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/monitor/mpcs*.sh"
|
---|
481 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/monitor/mpcs*.tar")
|
---|
482 |
|
---|
483 | install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${exe_name}${CMAKE_EXECUTABLE_SUFFIX} DESTINATION bin COMPONENT bin)
|
---|
484 | install (FILES ${config_files} DESTINATION etc COMPONENT config)
|
---|
485 | install (FILES ${doc_files} DESTINATION share/doc/oscam COMPONENT doc)
|
---|
486 | install (FILES ${man1_files} DESTINATION share/man/man1 COMPONENT doc)
|
---|
487 | install (FILES ${man5_files} DESTINATION share/man/man5 COMPONENT doc)
|
---|
488 | install (FILES ${example_files} DESTINATION share/doc/oscam/example COMPONENT doc)
|
---|
489 | install (FILES ${monitor_files} DESTINATION share/doc/oscam/monitor COMPONENT doc)
|
---|
490 |
|
---|
491 | #----------------------- we can use CPack to build pacakges --------------------------
|
---|
492 |
|
---|
493 | # get version from source file
|
---|
494 | execute_process (COMMAND grep CS_VERSION ${CMAKE_CURRENT_SOURCE_DIR}/globals.h
|
---|
495 | OUTPUT_VARIABLE CS_VERSION)
|
---|
496 | string (REGEX REPLACE ".*\"\(.*\)\".*" "\\1" CS_VERSION ${CS_VERSION})
|
---|
497 | string (REGEX REPLACE "\(.*\)\\..*\\..*" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${CS_VERSION})
|
---|
498 | string (REGEX REPLACE ".*\\.\(.*\)\\..*" "\\1" CPACK_PACKAGE_VERSION_MINOR ${CS_VERSION})
|
---|
499 | string (REGEX REPLACE ".*\\..*\\.\(.*\)" "\\1" CPACK_PACKAGE_VERSION_PATCH ${CS_VERSION})
|
---|
500 | set (CPACK_PACKAGE_VERSION
|
---|
501 | "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
---|
502 |
|
---|
503 | # compute my filename
|
---|
504 | set (CPACK_PACKAGE_FILE_NAME
|
---|
505 | "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${CS_OSTYPE}")
|
---|
506 |
|
---|
507 | # wich archive we want to generate
|
---|
508 | set (CPACK_GENERATOR "TGZ")
|
---|
509 |
|
---|
510 | # what to put in the archive
|
---|
511 | set (CPACK_STRIP_FILES TRUE)
|
---|
512 | set (CPACK_COMPONENTS_ALL bin)# config doc)
|
---|
513 |
|
---|
514 | # ok, we can now use CPack
|
---|
515 | include (CPack)
|
---|
516 |
|
---|
517 | #----------------------- printout resume -----------------------------
|
---|
518 |
|
---|
519 | message (STATUS "")
|
---|
520 | message (STATUS " operating system: ${OSCamOperatingSystem}")
|
---|
521 | message (STATUS " system type: ${CS_OSTYPE}")
|
---|
522 | message (STATUS " system: ${CS_OS_SYS}")
|
---|
523 | message (STATUS " cpu: ${CS_OS_CPU}")
|
---|
524 | message (STATUS " hw: ${CS_OS_HW}")
|
---|
525 | if (HAVE_AES)
|
---|
526 | message (STATUS " use system aes functions")
|
---|
527 | else (HAVE_AES)
|
---|
528 | message (STATUS " use built-in aes functions")
|
---|
529 | endif (HAVE_AES)
|
---|
530 | if (HAVE_SHA)
|
---|
531 | message (STATUS " use system sha functions")
|
---|
532 | else (HAVE_SHA)
|
---|
533 | message (STATUS " use built-in sha functions")
|
---|
534 | endif (HAVE_SHA)
|
---|
535 | if (HAVE_PCSC)
|
---|
536 | message (STATUS " use system pcsc functions")
|
---|
537 | endif (HAVE_PCSC)
|
---|
538 | if (HAVE_PTHREAD)
|
---|
539 | message (STATUS " use system pthread functions")
|
---|
540 | endif (HAVE_PTHREAD)
|
---|
541 | if (HAVE_LIBUSB)
|
---|
542 | message (STATUS " use system libusb functions")
|
---|
543 | endif (HAVE_LIBUSB)
|
---|
544 | if (WEBIF)
|
---|
545 | message (STATUS " web interface enabled")
|
---|
546 | endif (WEBIF)
|
---|
547 | if (IRDETO_GUESSING)
|
---|
548 | message (STATUS " irdeto guessing enabled")
|
---|
549 | endif (IRDETO_GUESSING)
|
---|
550 | if(CS_WITH_GBOX)
|
---|
551 | message (STATUS " gbox protocol enabled")
|
---|
552 | endif(CS_WITH_GBOX)
|
---|
553 | if(CS_LED)
|
---|
554 | message (STATUS " led trigger support enabled")
|
---|
555 | endif(CS_LED)
|
---|
556 | message (STATUS "")
|
---|