a1c28c82dbb44829287431f5581aed130deba766
[apps/agl-service-windowmanager-2017.git] / libwindowmanager / 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 include(FindPkgConfig)
18
19 pkg_check_modules(AFB REQUIRED libafbwsc)
20 pkg_check_modules(SD REQUIRED libsystemd>=222)
21
22 set(TARGET_LIBWM windowmanager)
23
24 add_library(${TARGET_LIBWM} SHARED
25    libwindowmanager.cpp
26    libwindowmanager.h)
27
28 target_include_directories(${TARGET_LIBWM}
29     PRIVATE
30         ${AFB_INCLUDE_DIRS}
31         ${SD_INCLUDE_DIRS})
32
33 target_link_libraries(${TARGET_LIBWM}
34    PUBLIC
35         -lpthread
36         ${AFB_LIBRARIES}
37         ${SD_LIBRARIES})
38
39 target_compile_definitions(${TARGET_LIBWM}
40     PRIVATE
41         _GNU_SOURCE)  # XXX should I define this here?!
42
43 if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Release")
44    target_compile_definitions(${TARGET_LIBWM}
45            PRIVATE
46            _GLIBCXX_DEBUG)
47 endif()
48
49 target_compile_options(${TARGET_LIBWM}
50     PRIVATE
51         -Wall -Wextra -Wno-unused-parameter -Wno-comment)
52
53 set_target_properties(${TARGET_LIBWM}
54     PROPERTIES
55     # INTERPROCEDURAL_OPTIMIZATION ON
56         CXX_EXTENSIONS OFF
57         CXX_STANDARD 14
58         CXX_STANDARD_REQUIRED ON)
59
60 if (LINK_LIBCXX)
61    set_target_properties(${TARGET_LIBWM}
62            PROPERTIES
63            LINK_FLAGS "-lc++")
64 endif()
65
66 if (NOT ${SANITIZER_MODE} STREQUAL "none" AND NOT ${SANITIZER_MODE} STREQUAL "")
67    target_compile_options(${TARGET_LIBWM}
68       PRIVATE
69          -fsanitize=${SANITIZER_MODE} -g -fno-omit-frame-pointer)
70    set_target_properties(${TARGET_LIBWM}
71       PROPERTIES
72          LINK_FLAGS "-fsanitize=${SANITIZER_MODE} -g")
73 endif()
74
75 install(
76    TARGETS ${TARGET_LIBWM}
77    DESTINATION ${CMAKE_INSTALL_LIBDIR}
78    COMPONENT "runtime")
79
80 install(
81    FILES libwindowmanager.h
82    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
83    COMPONENT "development")
84
85 add_subdirectory(doc)