b9dc94bc192465e8548e5fcaad7b86f9de193eb9
[apps/agl-service-homescreen.git] / libhomescreen / CMakeLists.txt
1 #
2 # Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3 #
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
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15 #
16
17
18 cmake_minimum_required(VERSION 3.0)
19
20 set(TARGET_LIBHS homescreen)
21 add_definitions("-std=c++11")
22
23 pkg_check_modules(libhs_depends  json-c libafbwsc libsystemd)
24 set(libhs_sources libhomescreen.cpp)
25
26 include_directories(${LIBSM_INCLUDE_DIR})
27 link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined)
28
29 add_library(${TARGET_LIBHS} SHARED ${libhs_sources})
30 target_compile_options(${TARGET_LIBHS} PUBLIC ${libhs_depends_CFLAGS})
31
32 if(DEFINED DEBUGMODE)
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)
37
38 include_directories(${TARGET_LIBHS} ${libhs_depends_INCLUDE_DIRS})
39 target_link_libraries(${TARGET_LIBHS} afbwsc -lpthread ${link_libraries} ${libhs_depends_LIBRARIES})
40
41 if(DEFINED CMAKE_INSTALL_LIBDIR)
42     INSTALL(TARGETS ${TARGET_LIBHS}
43     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
44 endif(DEFINED CMAKE_INSTALL_LIBDIR)
45
46 #####################
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
51     homescreen
52     ${link_libraries}
53     -lpthread
54     ${test_depends_LIBRARIES}
55     ${libhs_depends_LIBRARIES}
56 )
57 #####################
58 #add_subdirectory(test)