[102] | 1 | project (OSCam C)
|
---|
| 2 |
|
---|
| 3 | cmake_minimum_required (VERSION 2.6)
|
---|
| 4 |
|
---|
| 5 | #----------------------- detect system ------------------------------
|
---|
| 6 |
|
---|
| 7 | if (CMAKE_CROSSCOMPILING)
|
---|
| 8 | if (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
|
---|
| 9 | set (OSCamOperatingSystem "Tuxbox")
|
---|
| 10 | elseif (OSCAM_SYSTEM_NAME MATCHES "Fonera2")
|
---|
| 11 | set (OSCamOperatingSystem "Fonera2")
|
---|
[104] | 12 | elseif (OSCAM_SYSTEM_NAME MATCHES "Amino")
|
---|
| 13 | set (OSCamOperatingSystem "Amino")
|
---|
[102] | 14 | else (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
|
---|
| 15 | set (OSCamOperatingSystem "Unknown")
|
---|
| 16 | endif (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
|
---|
| 17 | else (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")
|
---|
| 25 | endif (CMAKE_CROSSCOMPILING)
|
---|
| 26 |
|
---|
| 27 | #----------------------- some paths ------------------------------
|
---|
| 28 |
|
---|
| 29 | set (OPTIONAL_LINK_DIR "" CACHE STRING "Some optional link directories")
|
---|
| 30 | set (OPTIONAL_INCLUDE_DIR "" CACHE STRING "Some optional include directories")
|
---|
| 31 |
|
---|
| 32 | include_directories (
|
---|
| 33 | ${CMAKE_CURRENT_SOURCE_DIR}/csctapi
|
---|
| 34 | ${CMAKE_CURRENT_SOURCE_DIR}/cscrypt
|
---|
| 35 | ${OPTIONAL_INCLUDE_DIR}
|
---|
| 36 | )
|
---|
| 37 | link_directories (${OPTIONAL_LINK_DIR})
|
---|
| 38 |
|
---|
| 39 | #----------------------- global options ------------------------------
|
---|
| 40 |
|
---|
[105] | 41 | set (CS_CONFDIR "/usr/local/etc" CACHE STRING "Default path for the config files")
|
---|
| 42 | add_definitions ("-DCS_CONFDIR=\"${CS_CONFDIR}\"")
|
---|
| 43 |
|
---|
[102] | 44 | if (OSCamOperatingSystem MATCHES "Linux")
|
---|
| 45 | add_definitions ("-DOS_LINUX")
|
---|
| 46 | elseif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
| 47 | add_definitions ("-DOS_MACOSX -DNEED_DAEMON -DCS_NOSHM -DHAVE_PTHREAD_H -DUSE_PTHREAD")
|
---|
| 48 | elseif (OSCamOperatingSystem MATCHES "Tuxbox")
|
---|
| 49 | add_definitions ("-DOS_LINUX -DTUXBOX -DPPC")
|
---|
| 50 | elseif (OSCamOperatingSystem MATCHES "Fonera2")
|
---|
| 51 | add_definitions ("-DOS_LINUX -DMIPSEL -DUCLIBC")
|
---|
[104] | 52 | elseif (OSCamOperatingSystem MATCHES "Amino")
|
---|
| 53 | add_definitions ("-DOS_LINUX")
|
---|
[102] | 54 | endif (OSCamOperatingSystem MATCHES "Linux")
|
---|
| 55 |
|
---|
| 56 | #----------------------- subdirectories ------------------------------
|
---|
| 57 |
|
---|
| 58 | add_subdirectory (csctapi)
|
---|
| 59 | add_subdirectory (cscrypt)
|
---|
| 60 |
|
---|
| 61 | #----------------------- file groups ------------------------------
|
---|
| 62 |
|
---|
| 63 | file (GLOB csmodules_srcs "module-*.c")
|
---|
| 64 | file (GLOB csmodules_hdrs "module-*.h")
|
---|
| 65 | file (GLOB csreaders_srcs "reader-*.c")
|
---|
| 66 | file (GLOB csreaders_hdrs "reader-*.h")
|
---|
| 67 | file (GLOB csoscam_srcs "oscam-*.c")
|
---|
| 68 | file (GLOB csoscam_hdrs "oscam-*.h")
|
---|
| 69 | file (GLOB exe_srcs "oscam.c")
|
---|
| 70 | file (GLOB exe_hdrs "globals.h")
|
---|
| 71 | file (GLOB all_srcs ${csmodules_srcs} ${csreaders_srcs} ${csoscam_srcs} ${exe_srcs})
|
---|
| 72 |
|
---|
| 73 | #----------------------- modules ------------------------------
|
---|
| 74 |
|
---|
| 75 | set (csmodules "csmodules")
|
---|
| 76 | add_library (${csmodules} STATIC ${csmodules_srcs} ${csmodules_hdrs})
|
---|
| 77 |
|
---|
| 78 | #----------------------- readers ------------------------------
|
---|
| 79 |
|
---|
| 80 | set (csreaders "csreaders")
|
---|
| 81 | add_library (${csreaders} STATIC ${csreaders_srcs} ${csreaders_hdrs})
|
---|
| 82 |
|
---|
| 83 | #----------------------- other oscam files ------------------------------
|
---|
| 84 |
|
---|
| 85 | set (csoscam "csoscam")
|
---|
| 86 | add_library (${csoscam} STATIC ${csoscam_srcs} ${csoscam_hdrs})
|
---|
| 87 |
|
---|
| 88 | #----------------------- the executable ------------------------------
|
---|
| 89 |
|
---|
| 90 | set (exe_name "oscam")
|
---|
| 91 | add_executable (${exe_name} ${exe_srcs} ${exe_hdrs})
|
---|
| 92 | target_link_libraries (${exe_name} crypto pthread ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt)
|
---|
| 93 | add_dependencies (${exe_name} ${csoscam} ${csreaders} ${csmodules})
|
---|
| 94 |
|
---|
| 95 | #----------------------- specific options ------------------------------
|
---|
| 96 |
|
---|
| 97 | if (OSCamOperatingSystem MATCHES "Linux")
|
---|
| 98 | elseif (OSCamOperatingSystem MATCHES "Mac OS X")
|
---|
| 99 | elseif (OSCamOperatingSystem MATCHES "Tuxbox")
|
---|
| 100 | target_link_libraries ( ${exe_name} dl)
|
---|
| 101 | elseif (OSCamOperatingSystem MATCHES "Fonera2")
|
---|
[104] | 102 | elseif (OSCamOperatingSystem MATCHES "Amino")
|
---|
[102] | 103 | endif (OSCamOperatingSystem MATCHES "Linux")
|
---|
| 104 |
|
---|
| 105 | set_source_files_properties (${all_srcs} PROPERTIES COMPILE_FLAGS "-O3 -Winline -Werror -finline-functions -fomit-frame-pointer")
|
---|
| 106 |
|
---|
| 107 | #----------------------- printout resume -----------------------------
|
---|
| 108 |
|
---|
| 109 | message (STATUS "")
|
---|
| 110 | message (STATUS " operating system: ${OSCamOperatingSystem}")
|
---|
| 111 | message (STATUS "")
|
---|