2 # Copyright (c) 2017 TOYOTA MOTOR CORPORATION
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 cmake_minimum_required(VERSION 2.8)
19 set(TARGETS_HSBINDER homescreen-service)
24 pkg_check_modules(hs_binding_depends afb-daemon glib-2.0 gio-2.0 gio-unix-2.0 json-c)
25 set(binding_hs_sources
36 link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
37 include_directories(${PROJECT_SOURCE_DIR}/include)
38 add_library(${TARGETS_HSBINDER} MODULE ${binding_hs_sources})
40 target_compile_options(${TARGETS_HSBINDER} PRIVATE ${hs_binding_depends_CFLAGS})
42 target_compile_options(${TARGETS_HSBINDER} PRIVATE -g -O0)
43 else(DEFINED DEBUGMODE)
44 target_compile_options(${TARGETS_HSBINDER} PRIVATE -g -O2)
45 endif(DEFINED DEBUGMODE)
47 target_include_directories(${TARGETS_HSBINDER} PRIVATE ${hs_binding_depends_INCLUDE_DIRS})
48 target_link_libraries(${TARGETS_HSBINDER} ${CMAKE_THREAD_LIBS_INIT} ${link_libraries} ${hs_binding_depends_LIBRARIES})
50 # Binder exposes a unique public entry point
52 set_target_properties(${TARGETS_HSBINDER} PROPERTIES
54 LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
57 # installation directory
58 #INSTALL(TARGETS ${TARGETS_HSBINDER}
59 # LIBRARY DESTINATION ${binding_install_dir})
61 if(NOT EXISTS ${PROJECT_BINARY_DIR}/package)
62 add_custom_command(TARGET ${TARGETS_HSBINDER} POST_BUILD
63 COMMAND cp -rf ${PROJECT_SOURCE_DIR}/package ${PROJECT_BINARY_DIR}
67 add_custom_command(TARGET ${TARGETS_HSBINDER} POST_BUILD
68 COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/lib
69 COMMAND cp -rf ${PROJECT_BINARY_DIR}/src/${TARGETS_HSBINDER}.so ${PROJECT_BINARY_DIR}/package/root/lib
70 COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/etc
71 COMMAND cp -f ${CMAKE_SOURCE_DIR}/conf/*.json ${PROJECT_BINARY_DIR}/package/root/etc
74 add_custom_target(package DEPENDS ${PROJECT_BINARY_DIR}/package/root
75 COMMAND wgtpkg-pack -f -o ${PROJECT_BINARY_DIR}/package/${TARGETS_HSBINDER}.wgt ${PROJECT_BINARY_DIR}/package/root