Change the protocol from ivi-controller to ivi-wm
[apps/agl-service-windowmanager-2017.git] / src / 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 wlproto(IVI_CON ivi-wm)
18
19 include(FindPkgConfig)
20 pkg_check_modules(AFB REQUIRED afb-daemon)
21 pkg_check_modules(SD REQUIRED libsystemd>=222)
22
23 # We do not want a prefix for our module
24 set(CMAKE_SHARED_MODULE_PREFIX "")
25
26 set(TARGETS_WM windowmanager-service)
27
28 add_library(${TARGETS_WM} MODULE
29    main.cpp
30    wayland_ivi_wm.cpp
31    wayland_ivi_wm.hpp
32    util.cpp
33    util.hpp
34    layout.cpp
35    layout.hpp
36    ${IVI_CON_PROTO}
37    json_helper.cpp
38    json_helper.hpp
39    app.hpp app.cpp
40    result.hpp
41    layers.cpp
42    layers.hpp
43    controller_hooks.hpp
44    config.cpp
45    config.hpp
46    policy.hpp)
47
48 target_include_directories(${TARGETS_WM}
49     PRIVATE
50         ${AFB_INCLUDE_DIRS}
51         ${SD_INCLUDE_DIRS}
52         ../include
53         ../src)
54
55 target_link_libraries(${TARGETS_WM}
56     PRIVATE
57         ${AFB_LIBRARIES}
58         ${WLC_LIBRARIES}
59         ${SD_LIBRARIES})
60
61 target_compile_definitions(${TARGETS_WM}
62     PRIVATE
63         AFB_BINDING_VERSION=2
64         # We do not want source location of messages
65         AFB_BINDING_PRAGMA_NO_VERBOSE_DETAILS
66         WINMAN_VERSION_STRING="${PACKAGE_VERSION}"
67         _GNU_SOURCE)
68
69 if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Release")
70    target_compile_definitions(${TARGETS_WM}
71        PRIVATE
72            _GLIBCXX_DEBUG)
73 endif()
74
75 target_compile_options(${TARGETS_WM}
76     PRIVATE
77         -Wall -Wextra -Wno-unused-parameter -Wno-comment)
78
79 set_target_properties(${TARGETS_WM}
80     PROPERTIES
81     # INTERPROCEDURAL_OPTIMIZATION ON
82
83         CXX_EXTENSIONS OFF
84         CXX_STANDARD 14
85         CXX_STANDARD_REQUIRED ON
86
87         C_EXTENSIONS OFF
88         C_STANDARD 99
89         C_STANDARD_REQUIRED ON
90
91         LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../export.map")
92
93 if (LINK_LIBCXX)
94    set_target_properties(${TARGETS_WM}
95            PROPERTIES
96            LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../export.map -lc++")
97 endif()
98
99 if (NOT ${SANITIZER_MODE} STREQUAL "none" AND NOT ${SANITIZER_MODE} STREQUAL "")
100    target_compile_options(${TARGETS_WM}
101       PRIVATE
102          -fsanitize=${SANITIZER_MODE} -g -fno-omit-frame-pointer)
103    set_target_properties(${TARGETS_WM}
104       PROPERTIES
105          LINK_FLAGS "-fsanitize=${SANITIZER_MODE} -g")
106 endif()
107
108 if(NOT EXISTS ${PROJECT_BINARY_DIR}/package)
109    add_custom_command(TARGET ${TARGETS_WM} POST_BUILD
110       COMMAND cp -rf ${PROJECT_SOURCE_DIR}/package ${PROJECT_BINARY_DIR}
111    )
112 endif()
113
114 add_custom_command(TARGET ${TARGETS_WM} POST_BUILD
115    COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/lib
116    COMMAND cp -rf ${PROJECT_BINARY_DIR}/src/${TARGETS_WM}.so ${PROJECT_BINARY_DIR}/package/root/lib
117    COMMAND mkdir -p ${PROJECT_BINARY_DIR}/package/root/etc
118    COMMAND cp -f ${PROJECT_SOURCE_DIR}/layers.json ${PROJECT_BINARY_DIR}/package/root/etc
119 )
120
121 add_custom_target(package DEPENDS ${PROJECT_BINARY_DIR}/package/root
122    COMMAND wgtpkg-pack -f -o ${PROJECT_BINARY_DIR}/package/${TARGETS_WM}-2017.wgt ${PROJECT_BINARY_DIR}/package/root
123 )