-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
85 lines (70 loc) · 2.76 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
# Copyright (c) 2008-2018 LG Electronics, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 2.8.7)
project(novacomd C)
include(webOS/webOS)
include(FindPkgConfig)
webos_modules_init(1 0 0 QUALIFIER RC4)
webos_component(2 0 0)
webos_machine_impl_dep()
add_definitions(-DBUILDVERSION="${WEBOS_COMPONENT_VERSION}")
webos_add_compiler_flags(ALL -DPLATFORM_PTHREADS=1)
webos_add_compiler_flags(ALL -Wall -g -O2)
include_directories(include)
file(GLOB lib_files src/lib/*.c)
file(GLOB cksum_files src/lib/cksum/*.c)
file(GLOB novacom_files src/novacom/*.c)
# Device and host have different sources
if(${WEBOS_TARGET_MACHINE_IMPL} STREQUAL host)
pkg_check_modules(LIBUSB REQUIRED libusb)
include_directories(${LIBUSB_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${LIBUSB_CFLAGS_OTHER})
file(GLOB target_files src/host/*.c)
webos_add_compiler_flags(ALL -DHOST=1)
set(upstartfile files/launch/host/novacomd.conf)
else()
pkg_check_modules(NYXLIB REQUIRED nyx)
include_directories(${NYXLIB_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${NYXLIB_CFLAGS_OTHER})
file(GLOB target_files src/device/*.c)
list(APPEND target_files src/platform_pthreads.c)
webos_add_compiler_flags(ALL -DDEVICE=1)
if(${WEBOS_TARGET_MACHINE_IMPL} STREQUAL emulator)
set(upstartfile files/launch/emulator/novacomd.conf)
else()
set(upstartfile files/launch/device/novacomd.conf)
endif()
endif()
# device build gets ${device_files} and src/platform_pthreads.c
# host build gets src/host files (see makefile)
add_executable(novacomd ${lib_files}
${cksum_files}
${novacom_files}
${target_files}
src/platform_pthreads.c
src/main.c src/log.c src/socket.c
src/transport.c
src/transport_inet.c
src/transport_usb.c)
# Link against the libusb of host system when building standalone
if(${WEBOS_TARGET_MACHINE_IMPL} STREQUAL host)
target_link_libraries(novacomd ${LIBUSB_LIBRARIES})
else()
target_link_libraries(novacomd ${NYXLIB_LDFLAGS})
endif()
target_link_libraries(novacomd pthread)
target_link_libraries(novacomd rt)
webos_build_daemon(NAME novacomd LAUNCH ${upstartfile})