-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
108 lines (87 loc) · 3.19 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
# @@@LICENSE
#
# Copyright (c) 2011-2014 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.
#
# LICENSE@@@
#
# PmLogDaemon/CMakeLists.txt
#
cmake_minimum_required(VERSION 2.8.7)
project(PmLogDaemon C)
include(webOS/webOS)
webos_modules_init(1 0 0 QUALIFIER RC4)
webos_component(3 1 0)
include(FindPkgConfig)
# Check that we have glib-2.0
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
include_directories(${GLIB2_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${GLIB2_CFLAGS_OTHER})
# Check that we have PmLogLib
pkg_check_modules(PMLOGLIB REQUIRED PmLogLib)
include_directories(${PMLOGLIB_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${PMLOGLIB_CFLAGS_OTHER})
# Check that we have PmLogLib-private
pkg_check_modules(PMLOGLIB_PRV REQUIRED PmLogLib-private)
include_directories(${PMLOGLIB_PRV_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${PMLOGLIB_PRV_CFLAGS_OTHER})
# Check that we have librdx
pkg_check_modules(LIBRDX REQUIRED rdx)
include_directories(${LIBRDX_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${LIBRDX_CFLAGS_OTHER})
# Check that we have libpbnjson
pkg_check_modules(PBNJSON_C REQUIRED pbnjson_c)
include_directories(${PBNJSON_C_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${PBNJSON_C_CFLAGS_OTHER})
# Check that we have luna-service2
pkg_check_modules(LUNASERVICE2 REQUIRED luna-service2)
include_directories(${LUNASERVICE2_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${LUNASERVICE2_CFLAGS_OTHER})
# Get the zlib library
include(FindZLIB)
if(NOT ZLIB_FOUND)
message(FATAL_ERROR "ZLIB not found!")
endif()
webos_include_install_paths()
include_directories(src)
webos_add_compiler_flags(ALL -Wall -Wconversion)
set(PRODUCTION_BUILD FALSE CACHE BOOL "Restrict production logging to whitelist logs")
if(PRODUCTION_BUILD)
webos_add_compiler_flags(ALL -DPRODUCTION_BUILD)
endif()
set(ENABLE_LOGGING TRUE CACHE BOOL "Enable logging")
if(ENABLE_LOGGING)
webos_add_compiler_flags(ALL -DPMLOGDAEMON_ENABLE_LOGGING)
endif()
set(SOURCE_FILES
src/main.c
src/ring.c
src/config.c
src/util.c)
# Build the PmLogDaemon executable
add_executable(PmLogDaemon ${SOURCE_FILES})
target_link_libraries(PmLogDaemon
${GLIB2_LDFLAGS}
${PMLOGLIB_LDFLAGS}
${PMLOGLIB_PRV_LDFLAGS}
${LIBRDX_LDFLAGS}
${PBNJSON_C_LDFLAGS}
${ZLIB_LIBRARIES}
${LUNASERVICE2_LDFLAGS}
-lrt)
webos_build_daemon()
webos_build_system_bus_files()
install(PROGRAMS scripts/public/show_disk_usage.sh DESTINATION @WEBOS_INSTALL_DATADIR@/PmLogDaemon)
install(FILES files/whitelist.txt DESTINATION @WEBOS_INSTALL_SYSCONFDIR@/PmLogDaemon/)
webos_config_build_doxygen(doc Doxyfile)