source: trunk/CMakeLists.txt@ 109

Last change on this file since 109 was 109, checked in by smurzch2, 11 years ago

Define CS_OS* in the CMakeLists.txt

File size: 5.6 KB
Line 
1project (OSCam C)
2
3cmake_minimum_required (VERSION 2.6)
4
5#----------------------- detect system ------------------------------
6
7if (CMAKE_CROSSCOMPILING)
8 if (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
9 set (OSCamOperatingSystem "Tuxbox")
10 set (CS_OS_HW "tuxbox")
11 set (CS_OS_SYS "linux")
12 elseif (OSCAM_SYSTEM_NAME MATCHES "Fonera2")
13 set (OSCamOperatingSystem "Fonera2")
14 set (CS_OS_HW "fonera2")
15 set (CS_OS_SYS "linux")
16 elseif (OSCAM_SYSTEM_NAME MATCHES "Amino")
17 set (OSCamOperatingSystem "Amino")
18 set (CS_OS_HW "amino")
19 set (CS_OS_SYS "linux")
20 else (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
21 set (OSCamOperatingSystem "Unknown")
22 set (CS_OS_HW "unknown")
23 set (CS_OS_SYS "unknown")
24 endif (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
25else (CMAKE_CROSSCOMPILING)
26 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
27 set (OSCamOperatingSystem "Linux")
28 set (CS_OS_HW "pc")
29 set (CS_OS_SYS "linux")
30 elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
31 set (OSCamOperatingSystem "Mac OS X")
32 set (CS_OS_HW "mac")
33 set (CS_OS_SYS "macosx")
34 else (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
35 set (OSCamOperatingSystem "Unknown")
36 set (CS_OS_HW "unknown")
37 set (CS_OS_SYS "unknown")
38 endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
39endif (CMAKE_CROSSCOMPILING)
40
41#----------------------- some paths ------------------------------
42
43set (OPTIONAL_LINK_DIR "" CACHE STRING "Some optional link directories")
44set (OPTIONAL_INCLUDE_DIR "" CACHE STRING "Some optional include directories")
45
46include_directories (
47 ${CMAKE_CURRENT_SOURCE_DIR}/csctapi
48 ${CMAKE_CURRENT_SOURCE_DIR}/cscrypt
49 ${OPTIONAL_INCLUDE_DIR}
50 )
51link_directories (${OPTIONAL_LINK_DIR})
52
53#----------------------- global options ------------------------------
54
55if (OSCamOperatingSystem MATCHES "Linux")
56 add_definitions ("-DOS_LINUX")
57 set (DEFAULT_CS_CONFDIR "/usr/local/etc")
58elseif (OSCamOperatingSystem MATCHES "Mac OS X")
59 add_definitions ("-DOS_MACOSX -DNEED_DAEMON -DCS_NOSHM -DHAVE_PTHREAD_H -DUSE_PTHREAD")
60 set (DEFAULT_CS_CONFDIR "/usr/local/etc")
61elseif (OSCamOperatingSystem MATCHES "Tuxbox")
62 add_definitions ("-DOS_LINUX -DTUXBOX -DPPC")
63 set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
64elseif (OSCamOperatingSystem MATCHES "Fonera2")
65 add_definitions ("-DOS_LINUX -DMIPSEL -DUCLIBC")
66 set (DEFAULT_CS_CONFDIR "/var/etc")
67elseif (OSCamOperatingSystem MATCHES "Amino")
68 add_definitions ("-DOS_LINUX")
69 set (DEFAULT_CS_CONFDIR "/usr/local/etc")
70endif (OSCamOperatingSystem MATCHES "Linux")
71
72set (CS_CONFDIR ${DEFAULT_CS_CONFDIR} CACHE STRING "Default path for the config files")
73add_definitions ("-DCS_CONFDIR=\"${CS_CONFDIR}\"")
74
75set (CS_OS_CPU ${CMAKE_SYSTEM_PROCESSOR})
76set (CS_OSTYPE ${CS_OS_CPU}-${CS_OS_HW}-${CS_OS_SYS})
77
78add_definitions ("-DCS_OSTYPE=\"${CS_OSTYPE}\"")
79add_definitions ("-DCS_OS_CPU=\"${CS_OS_CPU}\"")
80add_definitions ("-DCS_OS_HW=\"${CS_OS_HW}\"")
81add_definitions ("-DCS_OS_SYS=\"${CS_OS_SYS}\"")
82
83#----------------------- subdirectories ------------------------------
84
85add_subdirectory (csctapi)
86add_subdirectory (cscrypt)
87
88#----------------------- file groups ------------------------------
89
90file (GLOB csmodules_srcs "module-*.c")
91file (GLOB csmodules_hdrs "module-*.h")
92file (GLOB csreaders_srcs "reader-*.c")
93file (GLOB csreaders_hdrs "reader-*.h")
94file (GLOB csoscam_srcs "oscam-*.c")
95file (GLOB csoscam_hdrs "oscam-*.h")
96file (GLOB exe_srcs "oscam.c")
97file (GLOB exe_hdrs "globals.h")
98file (GLOB all_srcs ${csmodules_srcs} ${csreaders_srcs} ${csoscam_srcs} ${exe_srcs})
99
100#----------------------- modules ------------------------------
101
102set (csmodules "csmodules")
103add_library (${csmodules} STATIC ${csmodules_srcs} ${csmodules_hdrs})
104
105#----------------------- readers ------------------------------
106
107set (csreaders "csreaders")
108add_library (${csreaders} STATIC ${csreaders_srcs} ${csreaders_hdrs})
109
110#----------------------- other oscam files ------------------------------
111
112set (csoscam "csoscam")
113add_library (${csoscam} STATIC ${csoscam_srcs} ${csoscam_hdrs})
114
115#----------------------- the executable ------------------------------
116
117set (exe_name "oscam")
118add_executable (${exe_name} ${exe_srcs} ${exe_hdrs})
119target_link_libraries (${exe_name} crypto pthread ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt)
120add_dependencies (${exe_name} ${csoscam} ${csreaders} ${csmodules})
121
122#----------------------- specific options ------------------------------
123
124if (OSCamOperatingSystem MATCHES "Linux")
125elseif (OSCamOperatingSystem MATCHES "Mac OS X")
126elseif (OSCamOperatingSystem MATCHES "Tuxbox")
127 target_link_libraries ( ${exe_name} dl)
128elseif (OSCamOperatingSystem MATCHES "Fonera2")
129elseif (OSCamOperatingSystem MATCHES "Amino")
130endif (OSCamOperatingSystem MATCHES "Linux")
131
132set_source_files_properties (${all_srcs} PROPERTIES COMPILE_FLAGS "-O3 -Winline -Werror -finline-functions -fomit-frame-pointer")
133
134#----------------------- installation -----------------------------
135
136file (GLOB config_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/oscam.*")
137file (GLOB doc_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/*.txt")
138
139install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${exe_name} DESTINATION bin COMPONENT bin)
140install (FILES ${config_files} DESTINATION etc COMPONENT config)
141install (FILES ${doc_files} DESTINATION share/doc/oscam COMPONENT doc)
142
143#----------------------- printout resume -----------------------------
144
145message (STATUS "")
146message (STATUS " operating system: ${OSCamOperatingSystem}")
147message (STATUS " system type: ${CS_OSTYPE}")
148message (STATUS " system: ${CS_OS_SYS}")
149message (STATUS " cpu: ${CS_OS_CPU}")
150message (STATUS " hw: ${CS_OS_HW}")
151message (STATUS "")
Note: See TracBrowser for help on using the repository browser.