-
Notifications
You must be signed in to change notification settings - Fork 32
/
CMakeLists.txt
98 lines (80 loc) · 3.09 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
cmake_minimum_required(VERSION 3.6)
project(hyperion-webos VERSION 1.0 LANGUAGES C CXX)
set(_cflags_list "")
list(APPEND _cflags_list
-mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=neon
)
list(JOIN _cflags_list " " COMMON_FLAGS)
add_subdirectory(libyuv)
add_subdirectory(tv-native-apis)
add_subdirectory(fbs)
add_compile_options(${_cflags_list} -Wall -Wextra -Wpedantic -Werror -DSECURITY_COMPATIBILITY)
find_package(PkgConfig REQUIRED)
# ---
# find required packages
include(FindPkgConfig)
pkg_check_modules(GTHREAD2 REQUIRED gthread-2.0)
include_directories(${GTHREAD2_INCLUDE_DIRS})
pkg_check_modules(PBNJSON REQUIRED pbnjson_c)
include_directories(${PBNJSON_INCLUDE_DIRS})
# -- check for glib 2.0
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
include_directories(${GLIB2_INCLUDE_DIRS})
pkg_check_modules(LS2 REQUIRED luna-service2)
include_directories(${LS2_INCLUDE_DIRS})
pkg_check_modules(PMLOG REQUIRED PmLogLib)
include_directories(${PMLOG_INCLUDE_DIRS})
find_package(Git)
add_custom_target(version
${CMAKE_COMMAND} -D SRC=${CMAKE_SOURCE_DIR}/src/version.h.in
-D DST=${CMAKE_BINARY_DIR}/version.h
-D GIT_EXECUTABLE=${GIT_EXECUTABLE}
-P ${CMAKE_SOURCE_DIR}/GenerateVersionHeader.cmake
)
add_executable(hyperion-webos
src/main.c
src/settings.c
src/service.c
src/unicapture.c
src/converter.c
src/log.c
src/utils.c
src/hyperion_client.c
src/json_rpc_client.c
)
set_target_properties(hyperion-webos PROPERTIES
BUILD_RPATH_USE_ORIGIN ON
INSTALL_RPATH "$ORIGIN:$ORIGIN/lib"
BUILD_RPATH "$ORIGIN:$ORIGIN/lib"
# TODO: use above options after upgrading to CMake 3.11
# LINK_FLAGS "-Wl,-rpath,'$ORIGIN:$ORIGIN/lib' -Wl,-z,origin"
)
target_include_directories(hyperion-webos PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(hyperion-webos fbs flatccrt pthread dl yuv rt ${GTHREAD2_LDFLAGS} ${PBNJSON_LDFLAGS} ${LS2_LDFLAGS} ${GLIB2_LDFLAGS} ${PMLOG_LDFLAGS})
add_dependencies(hyperion-webos version gm_backend dile_vt_backend halgal_backend vtcapture_backend)
set_property(TARGET hyperion-webos PROPERTY ENABLE_EXPORTS 1)
# "Unified" v2 Backends
add_library(gm_backend SHARED
src/backends/libgm.c
)
target_include_directories(gm_backend PRIVATE src src/backends)
target_link_libraries(gm_backend gm)
add_library(dile_vt_backend SHARED
src/backends/libdile_vt.c
)
target_include_directories(dile_vt_backend PRIVATE src src/backends)
target_link_libraries(dile_vt_backend dile_vt)
# libdile_vt.so seems to be missing DT_NEEDED for libPmLogLib.so.3 - let's just
# add it over to our library. For some reason adding PmLogLib loaded via
# pkgconfig to target_link_libraries doesn't work...
set_target_properties(dile_vt_backend PROPERTIES LINK_FLAGS "-lPmLogLib")
add_library(halgal_backend SHARED
src/backends/libhalgal.c
)
target_include_directories(halgal_backend PRIVATE src src/backends)
target_link_libraries(halgal_backend halgal)
add_library(vtcapture_backend SHARED
src/backends/libvtcapture.cpp
)
target_include_directories(vtcapture_backend PRIVATE src src/backends)
target_link_libraries(vtcapture_backend vtcapture)