forked from djp952/pvr.rtlradio
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
108 lines (91 loc) · 3.95 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
cmake_minimum_required(VERSION 3.12)
project(pvr.rtlradio)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
option(DISTRIBUTION_BUILD "Linux distribution build (without use of depends folder)" OFF)
if(CORE_SYSTEM_NAME STREQUAL windowsstore OR
CORE_SYSTEM_NAME STREQUAL darwin_embedded OR
CORE_SYSTEM_NAME STREQUAL android)
set(USB_DEVICE_SUPPORT False)
else()
option(USB_DEVICE_SUPPORT "Build add-on with USB device support, if set to \"OFF\" RTL-SDR can only be accessed via network" ON)
endif()
# Set values used about configure of settings.xml.in on add-on
if(NOT USB_DEVICE_SUPPORT)
set(SETTINGS_XML_IN_CONNECTION_TYPE_NOTE "USB device not supported on this add-on, due to this the following setting is not usable and marked as not visible.")
set(SETTINGS_XML_IN_CONNECTION_TYPE_DEFAULT "1")
set(SETTINGS_XML_IN_CONNECTION_TYPE_VISIBLE "false")
set(SETTINGS_XML_IN_NO_USB_BEGIN "<!--")
set(SETTINGS_XML_IN_NO_USB_END "-->")
else()
set(SETTINGS_XML_IN_CONNECTION_TYPE_NOTE "USB device supported on this add-on.")
set(SETTINGS_XML_IN_CONNECTION_TYPE_DEFAULT "0")
set(SETTINGS_XML_IN_CONNECTION_TYPE_VISIBLE "true")
set(SETTINGS_XML_IN_NO_USB_BEGIN "")
set(SETTINGS_XML_IN_NO_USB_END "")
endif()
find_package(Kodi REQUIRED)
find_package(FFTW REQUIRED)
find_package(FDK_AAC REQUIRED)
find_package(glm REQUIRED)
find_package(MPG123 REQUIRED)
find_package(RapidJSON 1.1.0 REQUIRED)
find_package(SQLite3 REQUIRED)
if(USB_DEVICE_SUPPORT)
find_package(libusb-1.0 REQUIRED)
find_package(rtlsdr REQUIRED)
endif()
if(NOT WIN32 AND (APP_RENDER_SYSTEM STREQUAL "gl" OR NOT APP_RENDER_SYSTEM))
find_package(OpenGl REQUIRED)
set(DEPLIBS ${OPENGL_LIBRARIES})
set(includes ${OPENGL_INCLUDE_DIR})
add_definitions(${OPENGL_DEFINITIONS})
else()
find_package(OpenGLES REQUIRED)
set(DEPLIBS ${OPENGLES_LIBRARIES})
set(includes ${OPENGLES_INCLUDE_DIR})
add_definitions(${OPENGLES_DEFINITIONS})
endif()
add_definitions(-DDABLIN_AAC_FDKAAC -DFFTW_NO_Complex -Drtlsdr_EXPORTS=1)
include_directories(${KODI_INCLUDE_DIR}/.. # Hack way with "/..", need bigger Kodi cmake rework to match right include ways
${FFTW_INCLUDE_DIRS}
${FDK_AAC_INCLUDE_DIRS}
${GLM_INCLUDE_DIR}
${MPG123_INCLUDE_DIR}
${RAPIDJSON_INCLUDE_DIRS}
${SQLITE3_INCLUDE_DIR})
list(APPEND DEPLIBS ${FDK_AAC_LIBRARIES}
${FFTW_LONGDOUBLE_LIB}
${MPG123_LIBRARIES}
${SQLITE3_LIBRARY})
if(USB_DEVICE_SUPPORT)
if(NOT DISTRIBUTION_BUILD)
list(APPEND DEPLIBS ${LIBUSB_1_LIBRARIES})
endif()
include_directories(${LIBUSB_1_INCLUDE_DIRS}
${rtlsdr_INCLUDE_DIRS})
list(APPEND DEPLIBS ${RTLSDR_LIBRARIES})
add_definitions(-DUSB_DEVICE_SUPPORT)
endif()
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/dsp_dab)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/dsp_fm)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/dsp_hd)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/gui)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/exception_control)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/utils)
list(APPEND DEPLIBS code_src
code_src_dsp_dab
code_src_dsp_fm
code_src_dsp_hd
code_src_gui
code_src_utils
code_src_exception_control
$<$<BOOL:${WIN32}>:ws2_32>
$<$<BOOL:${WIN32}>:Shlwapi>)
set(PVRRTLRADIO_SOURCES src/addon.cpp)
set(PVRRTLRADIO_HEADERS src/addon.h)
build_addon(${CMAKE_PROJECT_NAME} PVRRTLRADIO DEPLIBS)
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "VERSION_PRODUCTNAME_ANSI=\"${CMAKE_PROJECT_NAME}\"")
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "VERSION_VERSION3_ANSI=\"${PVRRTLRADIO_VERSION}\"")
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/src)
include(CPack)