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.
18 cmake_minimum_required(VERSION 3.0)
20 set(TARGET_LIBHS homescreen)
21 add_definitions("-std=c++11")
23 pkg_check_modules(libhs_depends json-c libafbwsc libsystemd)
24 set(libhs_sources libhomescreen.cpp)
26 include_directories(${LIBSM_INCLUDE_DIR})
27 link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
29 add_library(${TARGET_LIBHS} SHARED ${libhs_sources})
30 target_compile_options(${TARGET_LIBHS} PUBLIC ${libhs_depends_CFLAGS})
33 target_compile_options(${TARGET_LIBHS} PRIVATE -g -O0)
34 else(DEFINED DEBUGMODE)
35 target_compile_options(${TARGET_LIBHS} PRIVATE -g -O2)
36 endif(DEFINED DEBUGMODE)
38 include_directories(${TARGET_LIBHS} ${libhs_depends_INCLUDE_DIRS})
39 target_link_libraries(${TARGET_LIBHS} afbwsc -lpthread ${link_libraries} ${libhs_depends_LIBRARIES})
41 if(DEFINED CMAKE_INSTALL_LIBDIR)
42 INSTALL(TARGETS ${TARGET_LIBHS}
43 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
44 endif(DEFINED CMAKE_INSTALL_LIBDIR)
47 pkg_check_modules(test_depends glib-2.0 gio-2.0 gio-unix-2.0)
48 add_executable(libhomescreen-demo test.cpp)
49 include_directories(libhomescreen-demo ${test_depends_INCLUDE_DIRS})
50 TARGET_LINK_LIBRARIES(libhomescreen-demo
54 ${test_depends_LIBRARIES}
55 ${libhs_depends_LIBRARIES}
58 #add_subdirectory(test)