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 | elseif (OSCAM_SYSTEM_NAME MATCHES "TripleDragon")
|
---|
21 | set (OSCamOperatingSystem "TripleDragon")
|
---|
22 | elseif (OSCAM_SYSTEM_NAME MATCHES "Coolstream")
|
---|
23 | set (OSCamOperatingSystem "NeutrinoHD")
|
---|
24 | elseif (OSCAM_SYSTEM_NAME MATCHES "NSLU2")
|
---|
25 | set (OSCamOperatingSystem "SlugOS")
|
---|
26 | elseif (OSCAM_SYSTEM_NAME MATCHES "WRT350NV2")
|
---|
27 | set (OSCamOperatingSystem "OpenWRT")
|
---|
28 | set (CS_OS_HW "wrt350nv2")
|
---|
29 | elseif (OSCAM_SYSTEM_NAME MATCHES "Dockstar")
|
---|
30 | set (OSCamOperatingSystem "OpenWRT")
|
---|
31 | set (CS_OS_HW "dockstar")
|
---|
32 | elseif (OSCAM_SYSTEM_NAME MATCHES "Fonera2")
|
---|
33 | set (OSCamOperatingSystem "Fonera2")
|
---|
34 | elseif (OSCAM_SYSTEM_NAME MATCHES "DIR-825")
|
---|
35 | set (OSCamOperatingSystem "DIR-825")
|
---|
36 | elseif (OSCAM_SYSTEM_NAME MATCHES "AZBox")
|
---|
37 | set (OSCamOperatingSystem "AZBox")
|
---|
38 | elseif (OSCAM_SYSTEM_NAME MATCHES "MCA")
|
---|
39 | set (OSCamOperatingSystem "MCA")
|
---|
40 | elseif (OSCAM_SYSTEM_NAME MATCHES "agv2+w")
|
---|
41 | set (OSCamOperatingSystem "agv2+w")
|
---|
42 | elseif (OSCAM_SYSTEM_NAME MATCHES "WRT54G")
|
---|
43 | set (OSCamOperatingSystem "WRT54G")
|
---|
44 | elseif (OSCAM_SYSTEM_NAME MATCHES "Amino")
|
---|
45 | set (OSCamOperatingSystem "Amino")
|
---|
46 | elseif (OSCAM_SYSTEM_NAME MATCHES "QboxHD")
|
---|
47 | set (OSCamOperatingSystem "QboxHD")
|
---|
48 | elseif (OSCAM_SYSTEM_NAME MATCHES "Padre")
|
---|
49 | set (OSCamOperatingSystem "Padre")
|
---|
50 | elseif (OSCAM_SYSTEM_NAME MATCHES "FriendlyARM")
|
---|
51 | set (OSCamOperatingSystem "FriendlyARM")
|
---|
52 | else (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
|
---|
53 | message (STATUS "Unknown cross system name: <${CMAKE_SYSTEM_NAME}>")
|
---|
54 | set (OSCamOperatingSystem "Unknown")
|
---|
55 | endif (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
|
---|
56 | else (CMAKE_CROSSCOMPILING)
|
---|
57 | if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
---|
58 | set (OSCamOperatingSystem "Linux")
|
---|
59 | elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
---|
60 | set (OSCamOperatingSystem "FreeBSD")
|
---|
61 | elseif (OSCamOperatingSystem MATCHES "Padre")
|
---|
62 | add_definitions ("-DPADRE -DSPARC")
|
---|
63 | set (DEFAULT_CS_CONFDIR "/etc/oscam")
|
---|
64 | elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
---|
65 | set (OSCamOperatingSystem "Mac OS X")
|
---|
66 | execute_process(COMMAND sw_vers -productVersion COMMAND cut -c 1-4 COMMAND tr -d '\n' OUTPUT_VARIABLE SWVER)
|
---|
67 | execute_process(COMMAND xcodebuild -version COMMAND grep Xcode COMMAND sed "s/Xcode\ //g" COMMAND tr -d '\n' OUTPUT_VARIABLE XCODEVER)
|
---|
68 | message (STATUS "mac sdk version is ${SWVER}")
|
---|
69 | message (STATUS "mac Xcode version is ${XCODEVER}")
|
---|
70 | add_definitions ("-w")
|
---|
71 | set (CMAKE_OSX_DEPLOYMENT_TARGET "${SWVER}")
|
---|
72 | if (SWVER GREATER 10.5)
|
---|
73 | set (CMAKE_OSX_ARCHITECTURES "x86_64")
|
---|
74 | endif (SWVER GREATER 10.5)
|
---|
75 | if (SWVER EQUAL 10.7 AND XCODEVER LESS 4.3)
|
---|
76 | message (STATUS "Compiling with xcode less then 4.3 on 10.7 If You have time update You're Xcode")
|
---|
77 | endif (SWVER EQUAL 10.7 AND XCODEVER LESS 4.3)
|
---|
78 | set (STATIC_LIBUSB True)
|
---|
79 | elseif (${CYGWIN})
|
---|
80 | set (OSCamOperatingSystem "Windows/Cygwin")
|
---|
81 | set (CMAKE_SYSTEM_PROCESSOR "i386")
|
---|
82 | else (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
---|
83 | message (STATUS "Unknown system name: <${CMAKE_SYSTEM_NAME}>")
|
---|
84 | set (OSCamOperatingSystem "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 | if (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
94 | include_directories (
|
---|
95 | ${CMAKE_CURRENT_SOURCE_DIR}/csctapi
|
---|
96 | ${CMAKE_CURRENT_SOURCE_DIR}/cscrypt
|
---|
97 | ${CMAKE_CURRENT_SOURCE_DIR}/algo
|
---|
98 | ${CMAKE_CURRENT_SOURCE_DIR}/extapi/cygwin
|
---|
99 | /usr/include/w32api
|
---|
100 | ${OPTIONAL_INCLUDE_DIR}
|
---|
101 | )
|
---|
102 | else (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
103 | include_directories (
|
---|
104 | ${CMAKE_CURRENT_SOURCE_DIR}/csctapi
|
---|
105 | ${CMAKE_CURRENT_SOURCE_DIR}/cscrypt
|
---|
106 | ${CMAKE_CURRENT_SOURCE_DIR}/algo
|
---|
107 | ${OPTIONAL_INCLUDE_DIR}
|
---|
108 | )
|
---|
109 | endif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
110 |
|
---|
111 | if(OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
112 | link_directories (
|
---|
113 | /usr/lib
|
---|
114 | /usr/lib/w32api
|
---|
115 | /cygdrive/c/WINDOWS/system32/
|
---|
116 | ${OPTIONAL_LINK_DIR}
|
---|
117 | )
|
---|
118 | else (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
119 | link_directories (
|
---|
120 | ${OPTIONAL_LINK_DIR}
|
---|
121 | )
|
---|
122 | endif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
123 |
|
---|
124 | #----------------------- global options ------------------------------
|
---|
125 |
|
---|
126 | if (OSCamOperatingSystem MATCHES "Linux")
|
---|
127 | set (DEFAULT_CS_CONFDIR "/usr/local/etc")
|
---|
128 | elseif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
129 | if (NOT HAVE_PCSC EQUAL 0)
|
---|
130 | add_definitions ("-DWITH_PCSC=1")
|
---|
131 | endif (NOT HAVE_PCSC EQUAL 0)
|
---|
132 | set (DEFAULT_CS_CONFDIR "/usr/local/etc")
|
---|
133 | elseif (OSCamOperatingSystem MATCHES "Tuxbox")
|
---|
134 | set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
|
---|
135 | elseif (OSCamOperatingSystem MATCHES "TripleDragon")
|
---|
136 | add_definitions ("-DSTB04SCI=1")
|
---|
137 | set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
|
---|
138 | elseif (OSCamOperatingSystem MATCHES "NeutrinoHD")
|
---|
139 | add_definitions ("-DWITH_COOLAPI=1")
|
---|
140 | set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
|
---|
141 | elseif (OSCamOperatingSystem MATCHES "SlugOS")
|
---|
142 | set (DEFAULT_CS_CONFDIR "/var/etc")
|
---|
143 | elseif (OSCamOperatingSystem MATCHES "OpenWRT")
|
---|
144 | if (CS_OS_HW MATCHES "wrt350nv2")
|
---|
145 | set (DEFAULT_CS_CONFDIR "/etc/oscam")
|
---|
146 | elseif (CS_OS_HW MATCHES "dockstar")
|
---|
147 | set (DEFAULT_CS_CONFDIR "/usr/oscam")
|
---|
148 | endif (CS_OS_HW MATCHES "wrt350nv2")
|
---|
149 | elseif (OSCamOperatingSystem MATCHES "Fonera2")
|
---|
150 | set (DEFAULT_CS_CONFDIR "/var/etc")
|
---|
151 | elseif (OSCamOperatingSystem MATCHES "DIR-825")
|
---|
152 | set (DEFAULT_CS_CONFDIR "/var/etc")
|
---|
153 | elseif (OSCamOperatingSystem MATCHES "AZBox")
|
---|
154 | add_definitions ("-DWITH_AZBOX=1")
|
---|
155 | set (DEFAULT_CS_CONFDIR "/PLUGINS/OpenXCAS/oscamCAS")
|
---|
156 | elseif (OSCamOperatingSystem MATCHES "MCA")
|
---|
157 | add_definitions ("-DWITH_MCA=1")
|
---|
158 | set (DEFAULT_CS_CONFDIR "/var/mca/d1")
|
---|
159 | elseif (OSCamOperatingSystem MATCHES "agv2+w")
|
---|
160 | set (DEFAULT_CS_CONFDIR "/etc")
|
---|
161 | elseif (OSCamOperatingSystem MATCHES "WRT54G")
|
---|
162 | set (DEFAULT_CS_CONFDIR "/jffs/etc/config/oscam")
|
---|
163 | elseif (OSCamOperatingSystem MATCHES "Amino")
|
---|
164 | set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
|
---|
165 | elseif (OSCamOperatingSystem MATCHES "QboxHD")
|
---|
166 | add_definitions ("-DQBOXHD=1")
|
---|
167 | set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
|
---|
168 | elseif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
169 | add_definitions ("-static -DWITH_PCSC=1")
|
---|
170 | set (DEFAULT_CS_CONFDIR ".")
|
---|
171 | elseif (OSCamOperatingSystem MATCHES "FreeBSD")
|
---|
172 | add_definitions ("-I/usr/local/include -L/usr/local/lib")
|
---|
173 | set (DEFAULT_CS_CONFDIR ".")
|
---|
174 | elseif (OSCamOperatingSystem MATCHES "FriendlyARM")
|
---|
175 | set (DEFAULT_CS_CONFDIR ".")
|
---|
176 | endif (OSCamOperatingSystem MATCHES "Linux")
|
---|
177 |
|
---|
178 | set (CS_CONFDIR ${DEFAULT_CS_CONFDIR} CACHE STRING "Default path for the config files")
|
---|
179 | add_definitions ("-DCS_CONFDIR=\\\"${CS_CONFDIR}\\\"")
|
---|
180 |
|
---|
181 | # Manage config.h based on command line parameters
|
---|
182 | # Manipulate config file based on given parameters and read unset parameters
|
---|
183 |
|
---|
184 | execute_process (COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/config.sh --show-valid OUTPUT_VARIABLE config_vars_string OUTPUT_STRIP_TRAILING_WHITESPACE)
|
---|
185 | string(REGEX MATCHALL "[A-Z0-9_]+" config_vars ${config_vars_string})
|
---|
186 |
|
---|
187 | MACRO(GENERATE_OSCAM_CONFIG fullpath)
|
---|
188 | foreach(option ${config_vars})
|
---|
189 | if(DEFINED ${option})
|
---|
190 | if(${option})
|
---|
191 | execute_process (COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/config.sh --enable ${option})
|
---|
192 | else(${option})
|
---|
193 | execute_process (COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/config.sh --disable ${option})
|
---|
194 | endif(${option})
|
---|
195 | endif(DEFINED ${option})
|
---|
196 | endforeach(option)
|
---|
197 | ENDMACRO(GENERATE_OSCAM_CONFIG fullpath)
|
---|
198 |
|
---|
199 | #----------------------- subdirectories ------------------------------
|
---|
200 |
|
---|
201 | include (CheckIncludeFile)
|
---|
202 | GENERATE_OSCAM_CONFIG("${CMAKE_CURRENT_SOURCE_DIR}/config.h")
|
---|
203 |
|
---|
204 | check_include_file ("pthread.h" HAVE_PTHREAD)
|
---|
205 | if (HAVE_PTHREAD)
|
---|
206 | message(STATUS " pthread found. Adding pthread support ")
|
---|
207 | add_definitions ("-DHAVE_PTHREAD_H")
|
---|
208 | elseif (HAVE_PTHREAD)
|
---|
209 | message(STATUS " no pthread found. No smartreader ")
|
---|
210 | endif (HAVE_PTHREAD)
|
---|
211 |
|
---|
212 | check_include_file ("openssl/aes.h" HAVE_LIBCRYPTO)
|
---|
213 | if (HAVE_LIBCRYPTO)
|
---|
214 | add_definitions ("-DWITH_LIBCRYPTO=1")
|
---|
215 | endif (HAVE_LIBCRYPTO)
|
---|
216 |
|
---|
217 | execute_process (COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/config.sh --enabled WITH_SSL OUTPUT_VARIABLE CONFIG_WITH_SSL OUTPUT_STRIP_TRAILING_WHITESPACE)
|
---|
218 | if (CONFIG_WITH_SSL MATCHES "Y")
|
---|
219 | set (WITH_SSL TRUE)
|
---|
220 | endif (CONFIG_WITH_SSL MATCHES "Y")
|
---|
221 |
|
---|
222 | find_package(OpenSSL QUIET)
|
---|
223 | if (OPENSSL_FOUND)
|
---|
224 | include_directories(${OPENSSL_INCLUDE_DIR})
|
---|
225 | message(STATUS " openssl found.")
|
---|
226 | else (OPENSSL_FOUND)
|
---|
227 | message(STATUS " openssl not found.")
|
---|
228 | if (WITH_SSL)
|
---|
229 | message(FATAL " ssl support requested but not found! ")
|
---|
230 | endif (WITH_SSL)
|
---|
231 | endif (OPENSSL_FOUND)
|
---|
232 |
|
---|
233 | if (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
234 | if (LIBRTDIR)
|
---|
235 | check_include_file ("${LIBRTDIR}/include/time.h" HAVE_LIBRT_STATIC)
|
---|
236 | if (HAVE_LIBRT_STATIC)
|
---|
237 | if (EXISTS ${LIBRTDIR}/lib/librt.a)
|
---|
238 | message(STATUS " static librt found : ${LIBRTDIR}/lib/librt.a (needed by libusb).")
|
---|
239 | add_definitions ("-I${LIBRTDIR}/include/")
|
---|
240 | add_library(imp_librt STATIC IMPORTED)
|
---|
241 | set_property(TARGET imp_librt PROPERTY IMPORTED_LOCATION ${LIBRTDIR}/lib/librt.a)
|
---|
242 | else (EXISTS ${LIBRTDIR}/lib/librt.a)
|
---|
243 | message(STATUS " ${LIBRTDIR}/lib/librt.a not found (needed by libusb). No smartreader support)")
|
---|
244 | set (HAVE_LIBRT_STATIC False)
|
---|
245 | endif (EXISTS ${LIBRTDIR}/lib/librt.a)
|
---|
246 | else (HAVE_LIBRT_STATIC)
|
---|
247 | message(STATUS " no librt found (needed by libusb). No smartreader support")
|
---|
248 | endif (HAVE_LIBRT_STATIC)
|
---|
249 | else (LIBRTDIR)
|
---|
250 | check_include_file ("time.h" HAVE_LIBRT)
|
---|
251 | if (HAVE_LIBRT)
|
---|
252 | message(STATUS " librt found (needed by libusb).")
|
---|
253 | else (HAVE_LIBRT)
|
---|
254 | message(STATUS " no librt found (needed by libusb. No smartreader support")
|
---|
255 | endif (HAVE_LIBRT)
|
---|
256 | endif (LIBRTDIR)
|
---|
257 | if (WITH_STAPI)
|
---|
258 | if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/stapi/liboscam_stapi.a)
|
---|
259 | message(STATUS " liboscam_stapi.a found")
|
---|
260 | add_definitions ("-DWITH_STAPI=1")
|
---|
261 | add_library(stapilib STATIC IMPORTED)
|
---|
262 | set_property(TARGET stapilib PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/stapi/liboscam_stapi.a)
|
---|
263 | set (HAVE_LIBSTAPI True)
|
---|
264 | else (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/stapi/liboscam_stapi.a)
|
---|
265 | message(FATAL " liboscam_stapi.a support requested but not found! ")
|
---|
266 | set (HAVE_LIBSTAPI False)
|
---|
267 | endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/stapi/liboscam_stapi.a)
|
---|
268 | endif (WITH_STAPI)
|
---|
269 | else (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
270 | set (HAVE_LIBRT True)
|
---|
271 | endif (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
272 |
|
---|
273 |
|
---|
274 | if( HAVE_LIBRT OR HAVE_LIBRT_STATIC)
|
---|
275 | if (LIBUSBDIR)
|
---|
276 | check_include_file ("${LIBUSBDIR}/include/libusb-1.0/libusb.h" HAVE_LIBUSB)
|
---|
277 | if (HAVE_LIBUSB AND HAVE_PTHREAD)
|
---|
278 | if (EXISTS ${LIBUSBDIR}/lib/libusb-1.0.a)
|
---|
279 | if (NOT STATIC_LIBUSB EQUAL 0)
|
---|
280 | message(STATUS " libusb 1.0 found (${LIBUSBDIR}/lib/libusb-1.0.a). Adding smartreader support ")
|
---|
281 | add_definitions ("-DWITH_LIBUSB=1")
|
---|
282 | add_definitions ("-I${LIBUSBDIR}/include/")
|
---|
283 | add_library(imp_libusb STATIC IMPORTED)
|
---|
284 | set_property(TARGET imp_libusb PROPERTY IMPORTED_LOCATION ${LIBUSBDIR}/lib/libusb-1.0.a)
|
---|
285 | else (NOT STATIC_LIBUSB EQUAL 0)
|
---|
286 | set (CMAKE_FIND_ROOT_PATH ${LIBUSBDIR})
|
---|
287 | find_library (LIBUSB_LIBRARY NAMES usb-1.0)
|
---|
288 | message(STATUS "libusb 1.0 found (${LIBUSB_LIBRARY}). Adding smartreader support ")
|
---|
289 | add_definitions ("-DWITH_LIBUSB=1")
|
---|
290 | add_definitions ("-I${LIBUSBDIR}/include/")
|
---|
291 | add_library(imp_libusb SHARED IMPORTED)
|
---|
292 | set_property(TARGET imp_libusb PROPERTY IMPORTED_LOCATION ${LIBUSB_LIBRARY} )
|
---|
293 | endif (NOT STATIC_LIBUSB EQUAL 0)
|
---|
294 | else (EXISTS ${LIBUSBDIR}/lib/libusb-1.0.a)
|
---|
295 | message(STATUS " libusb 1.0 not found (${LIBUSBDIR}/lib/libusb). No smartreader support ")
|
---|
296 | set (HAVE_LIBUSB False)
|
---|
297 | set (HAVE_LIBRT False)
|
---|
298 | set (HAVE_LIBRT_STATIC False)
|
---|
299 | endif (EXISTS ${LIBUSBDIR}/lib/libusb-1.0.a)
|
---|
300 | else (HAVE_LIBUSB AND HAVE_PTHREAD)
|
---|
301 | message(STATUS " no libusb 1.0 found. No smartreader support")
|
---|
302 | set (HAVE_LIBUSB False)
|
---|
303 | set (HAVE_LIBRT False)
|
---|
304 | set (HAVE_LIBRT_STATIC False)
|
---|
305 | endif (HAVE_LIBUSB AND HAVE_PTHREAD)
|
---|
306 | else (LIBUSBDIR)
|
---|
307 | if (NOT HAVE_LIBUSB EQUAL 0)
|
---|
308 | check_include_file ("libusb-1.0/libusb.h" HAVE_LIBUSB)
|
---|
309 | check_include_file ("libusb-1.0/libusb.h" PRESENT)
|
---|
310 | endif(NOT HAVE_LIBUSB EQUAL 0)
|
---|
311 | if (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
312 | if (NOT HAVE_LIBUSB EQUAL 0 AND NOT PRESENT)
|
---|
313 | find_file (USBINCL_LOC "libusb-1.0/libusb.h")
|
---|
314 | if (EXISTS ${USBINCL_LOC})
|
---|
315 | add_definitions ("-I/usr/local/include -L/usr/local/lib -I/usr/include -L/usr/lib")
|
---|
316 | set (HAVE_LIBUSB True)
|
---|
317 | set (PRESENT True)
|
---|
318 | endif (EXISTS ${USBINCL_LOC})
|
---|
319 | endif (NOT HAVE_LIBUSB EQUAL 0 AND NOT PRESENT)
|
---|
320 | endif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
321 | if (STATIC_LIBUSB EQUAL 0)
|
---|
322 | if(HAVE_LIBUSB AND HAVE_PTHREAD AND PRESENT)
|
---|
323 | message(STATUS " libusb 1.0 found (libusb-1.0.so) Adding smartreader support ")
|
---|
324 | add_definitions ("-DWITH_LIBUSB=1")
|
---|
325 | set (STATICLIBUSB False)
|
---|
326 | endif(HAVE_LIBUSB AND HAVE_PTHREAD AND PRESENT)
|
---|
327 | else(STATIC_LIBUSB EQUAL 0)
|
---|
328 | if (HAVE_LIBUSB AND HAVE_PTHREAD AND PRESENT)
|
---|
329 | if (WSSP EQUAL 1)
|
---|
330 | message(STATUS " static libusb 1.0 found (libusb-1.0.a). Adding smartreader support ")
|
---|
331 | else (WSSP EQUAL 1)
|
---|
332 | message(STATUS " libusb 1.0 found . Adding smartreader support ")
|
---|
333 | endif (WSSP EQUAL 1)
|
---|
334 | add_definitions ("-DWITH_LIBUSB=1")
|
---|
335 | set (STATICLIBUSB True)
|
---|
336 | else (HAVE_LIBUSB AND HAVE_PTHREAD AND PRESENT)
|
---|
337 | message(STATUS " no libusb 1.0 found. No smartreader support")
|
---|
338 | set (HAVE_LIBUSB False)
|
---|
339 | endif (HAVE_LIBUSB AND HAVE_PTHREAD AND PRESENT)
|
---|
340 | endif(STATIC_LIBUSB EQUAL 0)
|
---|
341 | endif (LIBUSBDIR)
|
---|
342 | endif( HAVE_LIBRT OR HAVE_LIBRT_STATIC)
|
---|
343 |
|
---|
344 | check_include_file ("PCSC/wintypes.h" HAVE_PCSC)
|
---|
345 | if (HAVE_PCSC)
|
---|
346 | FIND_PATH (PCSC_PATH PCSC/wintypes.h)
|
---|
347 | if(OPTIONAL_INCLUDE_DIR AND EXISTS ${OPTIONAL_INCLUDE_DIR}/PCSC/wintypes.h)
|
---|
348 | message(STATUS " PCSC headers found (${OPTIONAL_INCLUDE_DIR}/PCSC). Adding PCSC support ")
|
---|
349 | add_definitions ("-DWITH_PCSC=1")
|
---|
350 | add_definitions ("-I${OPTIONAL_INCLUDE_DIR}/PCSC")
|
---|
351 | elseif (EXISTS ${PCSC_PATH}/PCSC/wintypes.h AND NOT OPTIONAL_INCLUDE_DIR)
|
---|
352 | message(STATUS " PCSC headers found (${PCSC_PATH}/PCSC). Adding PCSC support ")
|
---|
353 | add_definitions ("-DWITH_PCSC=1")
|
---|
354 | add_definitions ("-I${PCSC_PATH}/PCSC")
|
---|
355 | else (OPTIONAL_INCLUDE_DIR AND EXISTS ${OPTIONAL_INCLUDE_DIR}/PCSC/wintypes.h)
|
---|
356 | if (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
357 | set (HAVE_PCSC False)
|
---|
358 | if(OPTIONAL_INCLUDE_DIR)
|
---|
359 | message(STATUS " PCSC headers not found (not in /usr/include/PCSC or /usr/local/include/PCSC or ${OPTIONAL_INCLUDE_DIR}/PCSC). No PCSC support ")
|
---|
360 | else(OPTIONAL_INCLUDE_DIR)
|
---|
361 | message(STATUS " PCSC headers not found (not in /usr/include/PCSC or /usr/local/include/PCSC). No PCSC support ")
|
---|
362 | endif(OPTIONAL_INCLUDE_DIR)
|
---|
363 | endif (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
364 | endif(OPTIONAL_INCLUDE_DIR AND EXISTS ${OPTIONAL_INCLUDE_DIR}/PCSC/wintypes.h)
|
---|
365 | else (HAVE_PCSC)
|
---|
366 | if (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
367 | add_definitions ("-Icygwin")
|
---|
368 | set (HAVE_PCSC "1")
|
---|
369 | endif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
370 | endif (HAVE_PCSC)
|
---|
371 |
|
---|
372 | #----------------------- subdirectories ------------------------------
|
---|
373 |
|
---|
374 | add_subdirectory (csctapi)
|
---|
375 | add_subdirectory (algo)
|
---|
376 | add_subdirectory (cscrypt)
|
---|
377 | if( HAVE_LIBRT OR HAVE_LIBRT_STATIC)
|
---|
378 | if (HAVE_LIBUSB)
|
---|
379 | add_subdirectory (utils)
|
---|
380 | endif (HAVE_LIBUSB)
|
---|
381 | endif( HAVE_LIBRT OR HAVE_LIBRT_STATIC)
|
---|
382 |
|
---|
383 | #----------------------- file groups ------------------------------
|
---|
384 | execute_process (COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/config.sh --enabled MODULE_CAMD33 OUTPUT_VARIABLE CAMD33 OUTPUT_STRIP_TRAILING_WHITESPACE)
|
---|
385 | if (CAMD33 MATCHES "N")
|
---|
386 | set (CAMD_33 "module-camd33*")
|
---|
387 | endif (CAMD33 MATCHES "N")
|
---|
388 | if (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
389 | file (GLOB csmodules_mac "module-dvbapi*" "module-lcd*" "${CAMD_33}")
|
---|
390 | file (GLOB csmodules_srcs "module-*.c")
|
---|
391 | list (REMOVE_ITEM csmodules_srcs ${csmodules_mac})
|
---|
392 | file (GLOB csmodules_hdrs "module-*.h")
|
---|
393 | list (REMOVE_ITEM csmodules_hdrs ${csmodules_mac})
|
---|
394 | file (GLOB csreaders_srcs "reader-*.c")
|
---|
395 | file (GLOB csreaders_hdrs "reader-*.h")
|
---|
396 | file (GLOB csoscam_srcs "oscam-*.c")
|
---|
397 | file (GLOB csoscam_hdrs "oscam-*.h")
|
---|
398 | file (GLOB exe_srcs "oscam.c")
|
---|
399 | file (GLOB exe_hdrs "globals.h")
|
---|
400 | file (GLOB all_srcs ${csmodules_srcs} ${csreaders_srcs} ${csoscam_srcs} ${exe_srcs})
|
---|
401 | else (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
402 | file (GLOB csmodules_srcs "module-*.c")
|
---|
403 | file (GLOB csmodules_hdrs "module-*.h")
|
---|
404 | file (GLOB csreaders_srcs "reader-*.c")
|
---|
405 | file (GLOB csreaders_hdrs "reader-*.h")
|
---|
406 | file (GLOB csoscam_srcs "oscam-*.c")
|
---|
407 | file (GLOB csoscam_hdrs "oscam-*.h")
|
---|
408 | file (GLOB exe_srcs "oscam.c")
|
---|
409 | file (GLOB exe_hdrs "globals.h")
|
---|
410 | file (GLOB all_srcs ${csmodules_srcs} ${csreaders_srcs} ${csoscam_srcs} ${exe_srcs})
|
---|
411 | endif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
412 | #----------------------- modules ------------------------------
|
---|
413 |
|
---|
414 | set (csmodules "csmodules")
|
---|
415 | add_library (${csmodules} STATIC ${csmodules_srcs} ${csmodules_hdrs})
|
---|
416 |
|
---|
417 | #----------------------- readers ------------------------------
|
---|
418 |
|
---|
419 | set (csreaders "csreaders")
|
---|
420 | add_library (${csreaders} STATIC ${csreaders_srcs} ${csreaders_hdrs})
|
---|
421 |
|
---|
422 | #----------------------- other oscam files ------------------------------
|
---|
423 |
|
---|
424 | set (csoscam "csoscam")
|
---|
425 | add_library (${csoscam} STATIC ${csoscam_srcs} ${csoscam_hdrs})
|
---|
426 |
|
---|
427 | #----------------------- the executable ------------------------------
|
---|
428 |
|
---|
429 | set (exe_name "oscam")
|
---|
430 | add_executable (${exe_name} ${exe_srcs} ${exe_hdrs})
|
---|
431 | target_link_libraries (${exe_name} ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt algo)
|
---|
432 | if(HAVE_LIBRT AND HAVE_LIBUSB)
|
---|
433 | if (LIBUSBDIR)
|
---|
434 | target_link_libraries (${exe_name} imp_libusb)
|
---|
435 | else(LIBUSBDIR)
|
---|
436 | if (STATICLIBUSB)
|
---|
437 | target_link_libraries (${exe_name} libusb-1.0.a)
|
---|
438 | else (STATICLIBUSB)
|
---|
439 | target_link_libraries (${exe_name} usb-1.0)
|
---|
440 | endif(STATICLIBUSB)
|
---|
441 | endif(LIBUSBDIR)
|
---|
442 | if (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
443 | target_link_libraries (${exe_name} rt)
|
---|
444 | endif (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
445 | if (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
446 | target_link_libraries (${exe_name} setupapi)
|
---|
447 | target_link_libraries (${exe_name} ole32)
|
---|
448 | target_link_libraries (${exe_name} shell32)
|
---|
449 | endif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
450 | endif(HAVE_LIBRT AND HAVE_LIBUSB)
|
---|
451 |
|
---|
452 | if (HAVE_LIBRT_STATIC AND HAVE_LIBUSB)
|
---|
453 | if (LIBUSBDIR)
|
---|
454 | target_link_libraries (${exe_name} imp_libusb)
|
---|
455 | else(LIBUSBDIR)
|
---|
456 | if (STATICLIBUSB)
|
---|
457 | target_link_libraries (${exe_name} libusb-1.0.a)
|
---|
458 | else (STATICLIBUSB)
|
---|
459 | target_link_libraries (${exe_name} usb-1.0)
|
---|
460 | endif(STATICLIBUSB)
|
---|
461 | endif(LIBUSBDIR)
|
---|
462 | if (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
463 | target_link_libraries (${exe_name} imp_librt)
|
---|
464 | endif (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
465 | if (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
466 | target_link_libraries (${exe_name} setupapi)
|
---|
467 | target_link_libraries (${exe_name} ole32)
|
---|
468 | target_link_libraries (${exe_name} shell32)
|
---|
469 | endif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
470 | endif (HAVE_LIBRT_STATIC AND HAVE_LIBUSB)
|
---|
471 |
|
---|
472 | if (HAVE_PTHREAD)
|
---|
473 | target_link_libraries (${exe_name} pthread)
|
---|
474 | endif (HAVE_PTHREAD)
|
---|
475 |
|
---|
476 | if (WITH_SSL)
|
---|
477 | target_link_libraries (${exe_name} ssl)
|
---|
478 | endif (WITH_SSL)
|
---|
479 |
|
---|
480 | if (HAVE_LIBCRYPTO)
|
---|
481 | target_link_libraries (${exe_name} crypto)
|
---|
482 | endif (HAVE_LIBCRYPTO)
|
---|
483 |
|
---|
484 | if (HAVE_PCSC)
|
---|
485 | if (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
486 | if (NOT OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
487 | target_link_libraries (${exe_name} pcsclite)
|
---|
488 | endif (NOT OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
489 | endif (NOT OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
490 | endif (HAVE_PCSC)
|
---|
491 |
|
---|
492 | if (HAVE_LIBSTAPI)
|
---|
493 | target_link_libraries(${exe_name} stapilib)
|
---|
494 | endif (HAVE_LIBSTAPI)
|
---|
495 |
|
---|
496 | add_dependencies (${exe_name} ${csoscam} ${csreaders} ${csmodules})
|
---|
497 |
|
---|
498 | #----------------------- specific options ------------------------------
|
---|
499 |
|
---|
500 | if (OSCamOperatingSystem MATCHES "Linux")
|
---|
501 | elseif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
502 | if (NOT HAVE_PCSC EQUAL 0)
|
---|
503 | FIND_LIBRARY (PCSC_LIBRARY PCSC)
|
---|
504 | message (STATUS "PCSC Mac OS X found : ${PCSC_LIBRARY}")
|
---|
505 | add_definitions ("-DWITH_PCSC=1")
|
---|
506 | target_link_libraries ( ${exe_name} ${PCSC_LIBRARY})
|
---|
507 | set (HAVE_PCSC True)
|
---|
508 | FIND_LIBRARY (IOKit_LIBRARY IOKit)
|
---|
509 | target_link_libraries ( ${exe_name} ${IOKit_LIBRARY})
|
---|
510 | FIND_LIBRARY (CoreFoundation_LIBRARY CoreFoundation)
|
---|
511 | target_link_libraries ( ${exe_name} ${CoreFoundation_LIBRARY})
|
---|
512 | else (NOT HAVE_PCSC EQUAL 0)
|
---|
513 | message (STATUS "PCSC Mac OS X not found no pcsc support")
|
---|
514 | endif (NOT HAVE_PCSC EQUAL 0)
|
---|
515 | elseif (OSCamOperatingSystem MATCHES "Tuxbox")
|
---|
516 | target_link_libraries ( ${exe_name} dl)
|
---|
517 | elseif (OSCamOperatingSystem MATCHES "TripleDragon")
|
---|
518 | target_link_libraries ( ${exe_name} dl)
|
---|
519 | elseif (OSCamOperatingSystem MATCHES "SlugOS")
|
---|
520 | elseif (OSCamOperatingSystem MATCHES "OpenWRT")
|
---|
521 | elseif (OSCamOperatingSystem MATCHES "Fonera2")
|
---|
522 | elseif (OSCamOperatingSystem MATCHES "DIR-825")
|
---|
523 | elseif (OSCamOperatingSystem MATCHES "agv2+w")
|
---|
524 | elseif (OSCamOperatingSystem MATCHES "WRT54G")
|
---|
525 | elseif (OSCamOperatingSystem MATCHES "Amino")
|
---|
526 | elseif (OSCamOperatingSystem MATCHES "QboxHD")
|
---|
527 | elseif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
528 | message (STATUS "Windows system PCSC : winscard.dll")
|
---|
529 | target_link_libraries (${exe_name} winscard)
|
---|
530 | target_link_libraries (${exe_name} setupapi )
|
---|
531 | target_link_libraries (${exe_name} ole32)
|
---|
532 | target_link_libraries (${exe_name} shell32)
|
---|
533 | elseif (OSCamOperatingSystem MATCHES "NeutrinoHD")
|
---|
534 | target_link_libraries ( ${exe_name} rt nxp )
|
---|
535 | elseif (OSCamOperatingSystem MATCHES "AZBox")
|
---|
536 | add_library(xcas STATIC IMPORTED)
|
---|
537 | set_property(TARGET xcas PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/extapi/openxcas/libOpenXCASAPI.a)
|
---|
538 | target_link_libraries(${exe_name} xcas)
|
---|
539 | endif (OSCamOperatingSystem MATCHES "Linux")
|
---|
540 |
|
---|
541 | #----------------------- put svnversion in the build ------------------------------
|
---|
542 | # at every target rebuild, we re-build the oscam.c compilation...
|
---|
543 |
|
---|
544 | # add the needed dependency
|
---|
545 | add_dependencies (${exe_name} svnversion)
|
---|
546 | add_dependencies (${csoscam} svnversion-log)
|
---|
547 |
|
---|
548 | # how to re-build the files which printout the version
|
---|
549 | add_custom_target (
|
---|
550 | svnversion
|
---|
551 | ALL
|
---|
552 | touch ${CMAKE_CURRENT_SOURCE_DIR}/oscam.c
|
---|
553 | )
|
---|
554 | add_custom_target (
|
---|
555 | svnversion-log
|
---|
556 | ALL
|
---|
557 | touch ${CMAKE_CURRENT_SOURCE_DIR}/oscam-log.c
|
---|
558 | )
|
---|
559 |
|
---|
560 | execute_process (COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/config.sh --oscam-revision COMMAND tr -d '\n' OUTPUT_VARIABLE CS_SVN_VERSION)
|
---|
561 | add_definitions ("-D'CS_SVN_VERSION=\"${CS_SVN_VERSION}\"'")
|
---|
562 |
|
---|
563 | execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine COMMAND tr -d '\n' OUTPUT_VARIABLE CS_TARGET)
|
---|
564 | add_definitions ("-D'CS_TARGET=\"${CS_TARGET}\"'")
|
---|
565 | #----------------------- global compile and link options ------------------------------
|
---|
566 | # disable warning about unused but set variables in gcc 4.6+
|
---|
567 | if (CMAKE_COMPILER_IS_GNUCC)
|
---|
568 | execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
|
---|
569 | string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION})
|
---|
570 | list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR)
|
---|
571 | list(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR)
|
---|
572 | add_definitions ("-W -Wall -fno-strict-aliasing")
|
---|
573 | set (CMAKE_C_FLAGS "-O2")
|
---|
574 | set (CMAKE_C_FLAGS_DEBUG "-O0 -ggdb")
|
---|
575 | set (CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb")
|
---|
576 | endif (CMAKE_COMPILER_IS_GNUCC)
|
---|
577 | # some optimisations
|
---|
578 | if (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
579 | if (SWVER GREATER 10.6)
|
---|
580 | if (SWVER EQUAL 10.7 AND XCODEVER LESS 4.3)
|
---|
581 | add_definitions("-isysroot /Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
582 | else (SWVER EQUAL 10.7 AND XCODEVER LESS 4.3)
|
---|
583 | add_definitions("-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
584 | endif (SWVER EQUAL 10.7 AND XCODEVER LESS 4.3)
|
---|
585 | elseif(SWVER LESS 10.7)
|
---|
586 | add_definitions("-isysroot /Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
587 | endif (SWVER GREATER 10.6)
|
---|
588 | endif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
589 |
|
---|
590 | # we don't want the '-rdynamic' in the link command
|
---|
591 | set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
---|
592 |
|
---|
593 | # we want to strip if not Debug build
|
---|
594 | if (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
595 | if (SWVER MATCHES "10.8")
|
---|
596 | if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
597 | set (CMAKE_EXE_LINKER_FLAGS "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
598 | else (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
599 | message (STATUS " building with debug")
|
---|
600 | set (CMAKE_EXE_LINKER_FLAGS "-ggdb -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
601 | endif (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
602 | elseif (SWVER MATCHES "10.7")
|
---|
603 | if (SWVER EQUAL 10.7 AND XCODEVER LESS 4.3)
|
---|
604 | if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
605 | set (CMAKE_EXE_LINKER_FLAGS "-isysroot /Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
606 | else (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
607 | message (STATUS " building with debug")
|
---|
608 | set (CMAKE_EXE_LINKER_FLAGS "-ggdb -isysroot /Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
609 | endif (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
610 | else(SWVER EQUAL 10.7 AND XCODEVER LESS 4.3)
|
---|
611 | if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
612 | set (CMAKE_EXE_LINKER_FLAGS "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
613 | else (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
614 | message (STATUS " building with debug")
|
---|
615 | set (CMAKE_EXE_LINKER_FLAGS "-ggdb -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
616 | endif (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
617 | endif(SWVER EQUAL 10.7 AND XCODEVER LESS 4.3)
|
---|
618 | elseif (SWVER MATCHES "10.6")
|
---|
619 | if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
620 | set (CMAKE_EXE_LINKER_FLAGS "-isysroot /Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
621 | else (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
622 | message (STATUS " building with debug")
|
---|
623 | set (CMAKE_EXE_LINKER_FLAGS "-ggdb -isysroot /Developer/SDKs/MacOSX${SWVER}.sdk")
|
---|
624 | endif (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
625 | endif (SWVER MATCHES "10.8")
|
---|
626 | else (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
627 | if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
628 | set (CMAKE_EXE_LINKER_FLAGS "-s")
|
---|
629 | else (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
630 | message (STATUS " building with debug")
|
---|
631 | set (CMAKE_EXE_LINKER_FLAGS "-ggdb")
|
---|
632 | endif (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
---|
633 | endif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
634 |
|
---|
635 | if (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
636 | set (CMAKE_EXE_LINKER_FLAGS "--enable-stdcall-fixup")
|
---|
637 | endif (OSCamOperatingSystem MATCHES "Windows/Cygwin")
|
---|
638 |
|
---|
639 | #----------------------- installation -----------------------------
|
---|
640 |
|
---|
641 | file (GLOB config_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/oscam.*")
|
---|
642 | file (GLOB doc_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/txt/*.txt")
|
---|
643 | file (GLOB man1_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/man/*.1")
|
---|
644 | file (GLOB man5_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/man/*.5")
|
---|
645 | file (GLOB example_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.ac"
|
---|
646 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.cert"
|
---|
647 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.conf"
|
---|
648 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.guess"
|
---|
649 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.ird"
|
---|
650 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.server"
|
---|
651 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.services"
|
---|
652 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.srvid"
|
---|
653 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/example/oscam.user")
|
---|
654 | file (GLOB monitor_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/monitor/mpcs*.sh"
|
---|
655 | "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/monitor/mpcs*.tar")
|
---|
656 |
|
---|
657 | install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${exe_name}${CMAKE_EXECUTABLE_SUFFIX} DESTINATION bin COMPONENT bin)
|
---|
658 | install (FILES ${config_files} DESTINATION etc COMPONENT config)
|
---|
659 | install (FILES ${doc_files} DESTINATION share/doc/oscam COMPONENT doc)
|
---|
660 | install (FILES ${man1_files} DESTINATION share/man/man1 COMPONENT doc)
|
---|
661 | install (FILES ${man5_files} DESTINATION share/man/man5 COMPONENT doc)
|
---|
662 | install (FILES ${example_files} DESTINATION share/doc/oscam/example COMPONENT doc)
|
---|
663 | install (FILES ${monitor_files} DESTINATION share/doc/oscam/monitor COMPONENT doc)
|
---|
664 |
|
---|
665 | #----------------------- we can use CPack to build pacakges --------------------------
|
---|
666 |
|
---|
667 | # get version from source file
|
---|
668 | execute_process (COMMAND grep CS_VERSION ${CMAKE_CURRENT_SOURCE_DIR}/globals.h
|
---|
669 | OUTPUT_VARIABLE CS_VERSION)
|
---|
670 | string (REGEX REPLACE ".*\"\(.*\)\".*" "\\1" CS_VERSION ${CS_VERSION})
|
---|
671 | string (REGEX REPLACE "\(.*\)\\..*\\..*" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${CS_VERSION})
|
---|
672 | string (REGEX REPLACE ".*\\.\(.*\)\\..*" "\\1" CPACK_PACKAGE_VERSION_MINOR ${CS_VERSION})
|
---|
673 | string (REGEX REPLACE ".*\\..*\\.\(.*\)" "\\1" CPACK_PACKAGE_VERSION_PATCH ${CS_VERSION})
|
---|
674 | set (CPACK_PACKAGE_VERSION
|
---|
675 | "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
---|
676 |
|
---|
677 | # compute my filename
|
---|
678 | set (CPACK_PACKAGE_FILE_NAME
|
---|
679 | "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${CS_TARGET}")
|
---|
680 |
|
---|
681 | # wich archive we want to generate
|
---|
682 | set (CPACK_GENERATOR "TGZ")
|
---|
683 |
|
---|
684 | # what to put in the archive
|
---|
685 | set (CPACK_STRIP_FILES TRUE)
|
---|
686 | set (CPACK_COMPONENTS_ALL bin)# config doc)
|
---|
687 |
|
---|
688 | # ok, we can now use CPack
|
---|
689 | include (CPack)
|
---|
690 |
|
---|
691 | #----------------------- printout resume -----------------------------
|
---|
692 |
|
---|
693 | message (STATUS "")
|
---|
694 | message (STATUS " operating system: ${OSCamOperatingSystem}")
|
---|
695 | message (STATUS " target system: ${CS_TARGET}")
|
---|
696 | message (STATUS " revision: ${CS_SVN_VERSION}")
|
---|
697 | if (HAVE_LIBCRYPTO)
|
---|
698 | message (STATUS " use system libcrypto functions")
|
---|
699 | else (HAVE_LIBCRYPTO)
|
---|
700 | message (STATUS " use built-in crypt functions")
|
---|
701 | endif (HAVE_LIBCRYPTO)
|
---|
702 | if (HAVE_PCSC)
|
---|
703 | message (STATUS " use system pcsc functions")
|
---|
704 | endif (HAVE_PCSC)
|
---|
705 | if (HAVE_PTHREAD)
|
---|
706 | message (STATUS " use system pthread functions")
|
---|
707 | endif (HAVE_PTHREAD)
|
---|
708 | if(WSSP)
|
---|
709 | # disabling ennoying Dev warning in some cases
|
---|
710 | endif(WSSP)
|
---|
711 | if(STATIC_LIBUSB)
|
---|
712 | # disabling ennoying Dev warning in some cases
|
---|
713 | endif(STATIC_LIBUSB)
|
---|
714 | if (HAVE_LIBUSB)
|
---|
715 | if(STATIC_LIBUSB EQUAL 0)
|
---|
716 | message (STATUS " You selected to disable static libusb system libusb used")
|
---|
717 | endif(STATIC_LIBUSB EQUAL 0)
|
---|
718 | if (WSSP EQUAL 1)
|
---|
719 | if(STATICLIBUSB AND NOT LIBUSBDIR)
|
---|
720 | message (STATUS " use static libusb functions")
|
---|
721 | else(STATICLIBUSB AND NOT LIBUSBDIR)
|
---|
722 | if (LIBUSBDIR AND STATIC_LIBUSB EQUAL 0)
|
---|
723 | message(STATUS " use system libusb from selected LIBUSBDIR functions")
|
---|
724 | elseif (LIBUSBDIR)
|
---|
725 | message(STATUS " use static libusb from selected LIBUSBDIR functions")
|
---|
726 | else(LIBUSBDIR AND STATIC_LIBUSB EQUAL 0)
|
---|
727 | message(STATUS " use system libusb functions")
|
---|
728 | endif(LIBUSBDIR AND STATIC_LIBUSB EQUAL 0)
|
---|
729 | endif(STATICLIBUSB AND NOT LIBUSBDIR)
|
---|
730 | else (WSSP EQUAL 1)
|
---|
731 | message(STATUS " use libusb functions")
|
---|
732 | endif(WSSP EQUAL 1)
|
---|
733 | endif (HAVE_LIBUSB)
|
---|
734 |
|
---|
735 | message (STATUS "")
|
---|