This repository has been archived by the owner on Sep 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
143 lines (122 loc) · 4.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
cmake_minimum_required (VERSION 3.3)
project(dinghy VERSION 0.1.0 LANGUAGES C)
include(GNUInstallDirs)
option(DY_DBUS_SYSTEM_BUS "Expose remote control interface on system bus" OFF)
set(DY_DBUS_OWN_USER "" CACHE STRING
"Additional user allowed to own the well-known name on the system bus")
option(DY_USE_WEBKITGTK "Use WebKitGTK+ instead of WPEWebKit" OFF)
option(DY_USE_MODE_MONITOR "Use the SysFS graphics mode monitor" OFF)
set(DY_USE_DRM_MODE_MONITOR OFF CACHE BOOL "Enable the DRM/KMS graphics mode monitor")
set(DY_APPID "" CACHE STRING "Default GApplication unique identifier")
set(DY_HOME_URI "" CACHE STRING "Default home URI")
if (NOT DY_APPID OR DY_APPID STREQUAL "")
if (DY_USE_WEBKITGTK)
set(DY_DEFAULT_APPID com.igalia.DinghyGtk)
else ()
set(DY_DEFAULT_APPID com.igalia.Dinghy)
endif ()
else ()
set(DY_DEFAULT_APPID ${DY_APPID})
endif ()
if (DY_HOME_URI AND NOT DY_HOME_URI STREQUAL "")
set(DY_DEFAULT_HOME_URI ${DY_HOME_URI})
endif ()
if (BUILD_SHARED_LIBS)
set(DINGHYCORE_COMPONENT "runtime")
else()
set(DINGHYCORE_COMPONENT "development")
endif()
add_definitions(-DDY_INSIDE_DINGHY__=1)
add_definitions(-DG_LOG_DOMAIN=\"Dy\")
configure_file(dy-config.h.in dy-config.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
find_package(PkgConfig)
# libdinghycore
set(DINGHYCORE_API_HEADERS
dinghy.h
dy-launcher.h
dy-request-handler.h
dy-directory-files-handler.h
dy-utils.h
dy-webkit-utils.h
${CMAKE_CURRENT_BINARY_DIR}/dy-config.h
)
set(DINGHYCORE_SOURCES
dy-launcher.c
dy-request-handler.c
dy-directory-files-handler.c
dy-utils.c
dy-webkit-utils.c
)
pkg_check_modules(GIO REQUIRED gio-2.0)
pkg_check_modules(SOUP REQUIRED libsoup-2.4)
if (DY_USE_WEBKITGTK)
list(APPEND DINGHYCORE_SOURCES dy-gtk-utils.c)
pkg_check_modules(WEB_ENGINE REQUIRED webkit2gtk-4.0)
else ()
pkg_check_modules(WEB_ENGINE REQUIRED wpe-webkit wpe)
endif ()
set(DINGHYCORE_INCLUDE_DIRS ${WEB_ENGINE_INCLUDE_DIRS} ${SOUP_INCLUDE_DIRS})
set(DINGHYCORE_LDFLAGS ${WEB_ENGINE_LDFLAGS} ${SOUP_LDFLAGS})
if (DY_USE_MODE_MONITOR)
list(APPEND DINGHYCORE_SOURCES
dy-mode-monitor.c
dy-sysfs-mode-monitor.c
)
list(APPEND DINGHYCORE_API_HEADERS
dy-mode-monitor.h
dy-sysfs-mode-monitor.h
)
# If libudev is available, build also de DRM/KMS mode monitor.
pkg_check_modules(UDEV libudev)
pkg_check_modules(LIBDRM libdrm)
if (UDEV_FOUND AND LIBDRM_FOUND)
set(DY_USE_DRM_MODE_MONITOR ON)
list(APPEND DINGHYCORE_SOURCES dy-drm-mode-monitor.c)
list(APPEND DINGHYCORE_API_HEADERS dy-drm-mode-monitor.h)
list(APPEND DINGHYCORE_INCLUDE_DIRS ${UDEV_INCLUDE_DIRS} ${LIBDRM_INCLUDE_DIRS})
list(APPEND DINGHYCORE_LDFLAGS ${UDEV_LDFLAGS} ${LIBDRM_LDFLAGS})
else ()
message(WARNING "DRM/KMS mode monitor won't be built: libudev not found")
endif ()
endif ()
if (DY_DBUS_SYSTEM_BUS)
# Generate and install D-Bus policy configuration file.
configure_file(dbus/policy.conf.in ${DY_DEFAULT_APPID}.conf @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${DY_DEFAULT_APPID}.conf
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d
COMPONENT "runtime"
)
# Let the source code know that the option is enabled.
add_definitions(-DDY_DBUS_SYSTEM_BUS=1)
add_definitions(-DDY_DBUS_OWN_USER=\"${DY_DBUS_OWN_USER}\")
endif ()
add_library(dinghycore ${DINGHYCORE_SOURCES})
set_property(TARGET dinghycore PROPERTY C_STANDARD 99)
target_include_directories(dinghycore PUBLIC ${DINGHYCORE_INCLUDE_DIRS})
target_link_libraries(dinghycore ${DINGHYCORE_LDFLAGS})
add_executable(dinghy dinghy.c)
set_property(TARGET dinghy PROPERTY C_STANDARD 99)
target_link_libraries(dinghy dinghycore)
add_executable(dinghyctl dinghyctl.c dy-utils.c)
set_property(TARGET dinghyctl PROPERTY C_STANDARD 99)
target_include_directories(dinghyctl PUBLIC ${GIO_INCLUDE_DIRS} ${SOUP_INCLUDE_DIRS})
target_link_libraries(dinghyctl ${GIO_LDFLAGS} ${SOUP_LDFLAGS})
install(TARGETS dinghy dinghyctl
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT "runtime"
)
install(TARGETS dinghycore
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${DINGHYCORE_COMPONENT}
)
install(FILES ${DINGHYCORE_API_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dinghy
COMPONENT "development"
)
configure_file(dinghycore.pc.in dinghycore.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dinghycore.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
COMPONENT "development"
)