source: trunk/CMakeLists.txt@ 108

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

Better handling of CS_CONFDIR.

File size: 4.8 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 elseif (OSCAM_SYSTEM_NAME MATCHES "Fonera2")
11 set (OSCamOperatingSystem "Fonera2")
12 elseif (OSCAM_SYSTEM_NAME MATCHES "Amino")
13 set (OSCamOperatingSystem "Amino")
14 else (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
15 set (OSCamOperatingSystem "Unknown")
16 endif (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
17else (CMAKE_CROSSCOMPILING)
18 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
19 set (OSCamOperatingSystem "Linux")
20 elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
21 set (OSCamOperatingSystem "Mac OS X")
22 else (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
23 set (OSCamOperatingSystem "Unknown")
24 endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
25endif (CMAKE_CROSSCOMPILING)
26
27#----------------------- some paths ------------------------------
28
29set (OPTIONAL_LINK_DIR "" CACHE STRING "Some optional link directories")
30set (OPTIONAL_INCLUDE_DIR "" CACHE STRING "Some optional include directories")
31
32include_directories (
33 ${CMAKE_CURRENT_SOURCE_DIR}/csctapi
34 ${CMAKE_CURRENT_SOURCE_DIR}/cscrypt
35 ${OPTIONAL_INCLUDE_DIR}
36 )
37link_directories (${OPTIONAL_LINK_DIR})
38
39#----------------------- global options ------------------------------
40
41if (OSCamOperatingSystem MATCHES "Linux")
42 add_definitions ("-DOS_LINUX")
43 set (DEFAULT_CS_CONFDIR "/usr/local/etc")
44elseif (OSCamOperatingSystem MATCHES "Mac OS X")
45 add_definitions ("-DOS_MACOSX -DNEED_DAEMON -DCS_NOSHM -DHAVE_PTHREAD_H -DUSE_PTHREAD")
46 set (DEFAULT_CS_CONFDIR "/usr/local/etc")
47elseif (OSCamOperatingSystem MATCHES "Tuxbox")
48 add_definitions ("-DOS_LINUX -DTUXBOX -DPPC")
49 set (DEFAULT_CS_CONFDIR "/var/tuxbox/config")
50elseif (OSCamOperatingSystem MATCHES "Fonera2")
51 add_definitions ("-DOS_LINUX -DMIPSEL -DUCLIBC")
52 set (DEFAULT_CS_CONFDIR "/var/etc")
53elseif (OSCamOperatingSystem MATCHES "Amino")
54 add_definitions ("-DOS_LINUX")
55 set (DEFAULT_CS_CONFDIR "/usr/local/etc")
56endif (OSCamOperatingSystem MATCHES "Linux")
57
58set (CS_CONFDIR ${DEFAULT_CS_CONFDIR} CACHE STRING "Default path for the config files")
59add_definitions ("-DCS_CONFDIR=\"${CS_CONFDIR}\"")
60
61#----------------------- subdirectories ------------------------------
62
63add_subdirectory (csctapi)
64add_subdirectory (cscrypt)
65
66#----------------------- file groups ------------------------------
67
68file (GLOB csmodules_srcs "module-*.c")
69file (GLOB csmodules_hdrs "module-*.h")
70file (GLOB csreaders_srcs "reader-*.c")
71file (GLOB csreaders_hdrs "reader-*.h")
72file (GLOB csoscam_srcs "oscam-*.c")
73file (GLOB csoscam_hdrs "oscam-*.h")
74file (GLOB exe_srcs "oscam.c")
75file (GLOB exe_hdrs "globals.h")
76file (GLOB all_srcs ${csmodules_srcs} ${csreaders_srcs} ${csoscam_srcs} ${exe_srcs})
77
78#----------------------- modules ------------------------------
79
80set (csmodules "csmodules")
81add_library (${csmodules} STATIC ${csmodules_srcs} ${csmodules_hdrs})
82
83#----------------------- readers ------------------------------
84
85set (csreaders "csreaders")
86add_library (${csreaders} STATIC ${csreaders_srcs} ${csreaders_hdrs})
87
88#----------------------- other oscam files ------------------------------
89
90set (csoscam "csoscam")
91add_library (${csoscam} STATIC ${csoscam_srcs} ${csoscam_hdrs})
92
93#----------------------- the executable ------------------------------
94
95set (exe_name "oscam")
96add_executable (${exe_name} ${exe_srcs} ${exe_hdrs})
97target_link_libraries (${exe_name} crypto pthread ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt)
98add_dependencies (${exe_name} ${csoscam} ${csreaders} ${csmodules})
99
100#----------------------- specific options ------------------------------
101
102if (OSCamOperatingSystem MATCHES "Linux")
103elseif (OSCamOperatingSystem MATCHES "Mac OS X")
104elseif (OSCamOperatingSystem MATCHES "Tuxbox")
105 target_link_libraries ( ${exe_name} dl)
106elseif (OSCamOperatingSystem MATCHES "Fonera2")
107elseif (OSCamOperatingSystem MATCHES "Amino")
108endif (OSCamOperatingSystem MATCHES "Linux")
109
110set_source_files_properties (${all_srcs} PROPERTIES COMPILE_FLAGS "-O3 -Winline -Werror -finline-functions -fomit-frame-pointer")
111
112#----------------------- installation -----------------------------
113
114file (GLOB config_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/oscam.*")
115file (GLOB doc_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/*.txt")
116
117install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${exe_name} DESTINATION bin COMPONENT bin)
118install (FILES ${config_files} DESTINATION etc COMPONENT config)
119install (FILES ${doc_files} DESTINATION share/doc/oscam COMPONENT doc)
120
121#----------------------- printout resume -----------------------------
122
123message (STATUS "")
124message (STATUS " operating system: ${OSCamOperatingSystem}")
125message (STATUS "")
Note: See TracBrowser for help on using the repository browser.