forked from intel/dynamic-application-loader-host-interface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
315 lines (247 loc) · 8.87 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
cmake_minimum_required(VERSION 3.4)
project(jhi)
include (GNUInstallDirs)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin_linux)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin_linux)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin_linux)
set(CMAKE_CONFIG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin_linux)
####################
# teetransport #
####################
set(TEETRANSPORT_HEADER_FILES
common/include/teetransport.h
teetransport/teetransport_internal.h)
set(TEETRANSPORT_SOURCE_FILES
teetransport/teetransport.c
teetransport/teetransport_internal.c
teetransport/transport/socket/teetransport_socket.c
teetransport/transport/socket/teetransport_socket_wrapper.c
teetransport/transport/socket/lib/socket_linux.c
teetransport/transport/libtee/teetransport_libtee.c
teetransport/transport/libtee/teetransport_libtee_wrapper.c
teetransport/transport/libtee/teetransport_libtee_client_metadata.c
teetransport/transport/dal_device/teetransport_dal_device.c
teetransport/transport/dal_device/teetransport_dal_device_wrapper.c
thirdparty/LibTEE/src/linux/metee_linux.c
thirdparty/LibTEE/src/linux/mei.c)
add_library(teetransport STATIC ${TEETRANSPORT_SOURCE_FILES} ${TEETRANSPORT_HEADER_FILES})
target_include_directories(teetransport PUBLIC
teetransport/transport/socket
teetransport/transport/socket/lib
teetransport/transport/libtee
teetransport/transport/dal_device
teetransport
common/include
thirdparty/LibTEE/include
thirdparty/LibTEE/src/linux)
#################
# bhplugin1 #
#################
set(BHPLUGIN1_HEADER_FILES
plugins/bhplugin1/jhi_plugin.h
plugins/bhplugin1/jhi_plugin_types.h
plugins/bhplugin1/jhi_plugin_register.h)
set(BHPLUGIN1_SOURCE_FILES
plugins/bhplugin1/jhi_plugin.cpp
thirdparty/bhplugin1/Beihai/tools/jhi_lib/BeihaiPlugin.cpp)
add_library(bhplugin1 STATIC ${BHPLUGIN1_SOURCE_FILES} ${BHPLUGIN1_HEADER_FILES})
target_include_directories(bhplugin1 PUBLIC
thirdparty/bhplugin1/Beihai/tools/jhi_lib
thirdparty/bhplugin2/FW/src/apps/dal_ivm
common/include)
#################
# bhplugin2 #
#################
set(BHPLUGIN2_HEADER_FILES
plugins/bhplugin2/jhi_plugin.h
plugins/bhplugin2/jhi_plugin_internal.h
plugins/bhplugin2/jhi_plugin_register.h)
set(BHPLUGIN2_SOURCE_FILES
plugins/bhplugin2/jhi_plugin.cpp
thirdparty/bhplugin2/FW/src/apps/dal_ivm/Beihai/bhp/impl/bhp_impl.cpp
thirdparty/bhplugin2/FW/src/apps/dal_ivm/Beihai/bhp/impl/bhp_platform_linux.cpp
thirdparty/bhplugin2/FW/src/apps/dal_ivm/Beihai/bhp/impl/bhp_impl_admin.cpp
thirdparty/bhplugin2/FW/src/apps/dal_ivm/Beihai/bhp/impl/bhp_impl_ta.cpp
thirdparty/bhplugin2/FW/src/apps/dal_ivm/Beihai/shared/admin_pack/bh_acp_util.c
thirdparty/bhplugin2/FW/src/apps/dal_ivm/Beihai/shared/admin_pack/admin_pack_ext.c
thirdparty/bhplugin2/FW/src/apps/dal_ivm/Beihai/shared/admin_pack/admin_pack_int.c)
add_library(bhplugin2 STATIC ${BHPLUGIN2_SOURCE_FILES} ${BHPLUGIN2_HEADER_FILES})
target_include_directories(bhplugin2 PUBLIC
thirdparty/bhplugin2/FW/src/apps/dal_ivm/Beihai/bhp/include
thirdparty/bhplugin2/FW/src/apps/dal_ivm/Beihai/shared/include
thirdparty/bhplugin2/FW/src/apps/dal_ivm/beihai_shared/include
thirdparty/bhplugin2/FW/src/apps/dal_ivm
common/include)
##############
# libjhi #
##############
set(LIBJHI_HEADER_FILES
common/include/jhi.h
common/include/dbg.h)
set(LIBJHI_SOURCE_FILES
libjhi/jhi.cpp
libjhi/CommandInvoker.cpp
libjhi/CommandsClientSocketsLinux.cpp
common/dbg-linux.cpp
common/dbg.cpp
common/locker-pthread.cpp
common/jhi_event_linux.cpp
common/reg-linux.cpp
common/misc.cpp)
add_library(jhi SHARED ${LIBJHI_SOURCE_FILES} ${LIBJHI_HEADER_FILES})
target_include_directories(jhi PUBLIC
libjhi
thirdparty/bhplugin2/FW/src/apps/dal_ivm
common/include)
target_link_libraries(jhi uuid pthread)
#####################
# teemanagement #
#####################
set(TEEMANAGEMENT_HEADER_FILES )
set(TEEMANAGEMENT_SOURCE_FILES
teemanagement/teemanagement.cpp
common/locker-pthread.cpp)
add_library(teemanagement SHARED ${TEEMANAGEMENT_SOURCE_FILES} ${TEEMANAGEMENT_HEADER_FILES})
target_include_directories(teemanagement PUBLIC
thirdparty/bhplugin2/FW/src/apps/dal_ivm
libjhi
common/include)
target_link_libraries(teemanagement jhi pthread)
############
# jhid #
############
set(JHID_HEADER_FILES common/include/dbg.h)
set(JHID_SOURCE_FILES
service/JHIMain.cpp
service/GlobalsManager.cpp
service/ReadWriteLockPThread.cpp
service/init.cpp
service/EventManager.cpp
service/AppletsManager.cpp
service/SessionsManager.cpp
service/install.cpp
service/AppletsPackageReader.cpp
service/uninstall.cpp
service/appProp.cpp
service/FWInfoLinux.cpp
service/closeSession.cpp
service/XmlReaderLibXml2.cpp
service/createSession.cpp
service/LinuxService.cpp
service/CommandsServerSocketsLinux.cpp
service/CommandDispatcher.cpp
service/getSCount.cpp
service/getSessionStat.cpp
service/sar.cpp
service/SendCmdPkg.cpp
external/libb64-1.2/src/cdecode.c
common/dbg-linux.cpp
common/dbg.cpp
common/locker-pthread.cpp
common/reg-linux.cpp
common/misc.cpp
common/jhi_event_linux.cpp
common/jhi_semaphore-linux.cpp)
add_executable(jhid ${JHID_SOURCE_FILES} ${JHID_HEADER_FILES})
include(FindLibXml2)
target_include_directories(jhid PUBLIC
thirdparty/bhplugin2/FW/src/apps/dal_ivm
common/FWUpdate
common/include
plugins
external/libb64-1.2/include
${LIBXML2_INCLUDE_DIR})
link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
target_link_libraries(jhid pthread dl teetransport bhplugin1 bhplugin2 uuid xml2)
if(${INIT_SYSTEM} MATCHES SysVinit)
target_compile_definitions(jhid PUBLIC SYSVINIT)
else()
target_link_libraries(jhid systemd)
endif()
#################
# SmokeTest #
#################
set(SMOKETEST_HEADER_FILES )
set(SMOKETEST_SOURCE_FILES
test/smoketest/smoketest.cpp
common/reg-linux.cpp
common/misc.cpp)
add_executable(smoketest ${SMOKETEST_SOURCE_FILES} ${SMOKETEST_HEADER_FILES})
target_include_directories(smoketest PUBLIC
test/smoketest
thirdparty/bhplugin2/FW/src/apps/dal_ivm
common/include)
target_link_libraries(smoketest jhi teemanagement pthread)
############
# BIST #
############
set (BIST_SOURCE_FILES test/bist/bist.cpp)
add_executable(bist ${BIST_SOURCE_FILES})
target_include_directories(bist PUBLIC
thirdparty/bhplugin2/FW/src/apps/dal_ivm
common/include)
target_link_libraries(bist jhi teemanagement)
###############
# Install #
###############
# Set filesystem paths
set(CONFDIR /etc/jhi)
set(TMPFILESDIR /usr/lib/tmpfiles.d)
if(NOT APPLETS_DIR)
set(APPLETS_DIR /usr/lib/dal/applets)
else()
message("APPLETS_DIR set to " ${APPLETS_DIR} ".")
endif()
if(NOT APP_REPO_DIR)
set(APP_REPO_DIR /var/cache/dal/applet_repository)
else()
message("APP_REPO_DIR set to " ${APP_REPO_DIR} ".")
endif()
configure_file(service/linux/jhi.conf.cmake
${CMAKE_CONFIG_OUTPUT_DIRECTORY}/jhi.conf)
# Choose init system (define init script install location)
if(${INIT_SYSTEM} MATCHES SysVinit)
set(INIT_DIR /etc/init.d)
install(DIRECTORY DESTINATION ${APP_REPO_DIR})
else() # systemd, default.
execute_process(COMMAND pkg-config systemd --variable=systemdsystemunitdir
OUTPUT_VARIABLE SYSTEMD_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
#Enable when moving to CMake 3.4 instead of the current variable definition
#pkg_get_variable(SYSTEMD_DIR systemd systemdsystemunitdir)
install(FILES
service/linux/jhi-applet-dir.conf
DESTINATION ${TMPFILESDIR}
RENAME jhi.conf)
install(CODE "execute_process(COMMAND chmod +x ./service/linux/mk_applet_repo_dir.sh)")
install(CODE "execute_process(COMMAND ./service/linux/mk_applet_repo_dir.sh)")
endif()
# Perform installation
install(DIRECTORY DESTINATION ${APPLETS_DIR})
install(DIRECTORY DESTINATION ${CONFDIR})
install(TARGETS
jhid
DESTINATION ${CMAKE_INSTALL_SBINDIR})
install(TARGETS
jhi
teemanagement
DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES
applets/SpoolerApplet.dalp
DESTINATION ${APPLETS_DIR})
install(FILES
${CMAKE_CONFIG_OUTPUT_DIRECTORY}/jhi.conf
DESTINATION ${CONFDIR})
# Choose init system (choose init script)
if(${INIT_SYSTEM} MATCHES SysVinit)
install(PROGRAMS
service/linux/jhi
DESTINATION ${INIT_DIR})
else() # systemd, default.
configure_file(service/linux/jhi.service.cmake
${CMAKE_CONFIG_OUTPUT_DIRECTORY}/jhi.service)
install(FILES
${CMAKE_CONFIG_OUTPUT_DIRECTORY}/jhi.service
DESTINATION ${SYSTEMD_DIR})
endif()