blob: 1d23671caf2ffa2ff1a9adecfb84558a30f8f168 (
plain)
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
set(HEADERS
app-indicator.h
)
set(SOURCES
app-indicator.c
app-indicator-enum-types.c
application-service-marshal.c
generate-id.c
gen-notification-item.xml.c
gen-notification-watcher.xml.c
)
if (FLAVOUR_GTK3)
set (ayatana_appindicator_gtkver "ayatana-appindicator3")
set (ayatana_appindicator_girver "AyatanaAppIndicator3")
set (gtk_girver "Gtk-3.0")
elseif (FLAVOUR_GTK2)
set (ayatana_appindicator_gtkver "ayatana-appindicator")
set (ayatana_appindicator_girver "AyatanaAppIndicator")
set (gtk_girver "Gtk-2.0")
endif()
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/app-indicator.h" DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/lib${ayatana_appindicator_gtkver}-0.1/libayatana-appindicator")
# ayatana-appindicator{,3}-0.1.pc
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${ayatana_appindicator_gtkver}-0.1.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_gtkver}-0.1.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_gtkver}-0.1.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
# app-indicator-enum-types.h
find_program(GLIB_MKENUMS glib-mkenums)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/app-indicator-enum-types.h"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND
${GLIB_MKENUMS}
--template app-indicator-enum-types.h.in
${HEADERS}
--output="${CMAKE_CURRENT_BINARY_DIR}/app-indicator-enum-types.h"
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/app-indicator-enum-types.h" DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/lib${ayatana_appindicator_gtkver}-0.1/libayatana-appindicator")
# app-indicator-enum-types.c
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/app-indicator-enum-types.c"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/app-indicator-enum-types.h"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND
${GLIB_MKENUMS}
--template app-indicator-enum-types.c.in
${HEADERS}
--output="${CMAKE_CURRENT_BINARY_DIR}/app-indicator-enum-types.c"
)
find_program(GLIB_GENMARSHAL glib-genmarshal)
# application-service-marshal.h
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/application-service-marshal.h"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/app-indicator-enum-types.c"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND
${GLIB_GENMARSHAL}
--prefix=_application_service_marshal
--header application-service-marshal.list
--quiet
--output="${CMAKE_CURRENT_BINARY_DIR}/application-service-marshal.h"
)
# application-service-marshal.c
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/application-service-marshal.c"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/application-service-marshal.h"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND
${GLIB_GENMARSHAL}
--prefix=_application_service_marshal
--body application-service-marshal.list
--include-header=application-service-marshal.h
--quiet
--output="${CMAKE_CURRENT_BINARY_DIR}/application-service-marshal.c"
)
# gen-notification-item.xml.h
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/gen-notification-item.xml.h" "extern const char * _notification_item;")
# gen-notification-item.xml.c
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/notification-item.xml" GEN_NOTIFICATION_ITEM_XML_C)
string(REPLACE "\"" "\\\"" GEN_NOTIFICATION_ITEM_XML_C ${GEN_NOTIFICATION_ITEM_XML_C})
string(REPLACE "\n" "\\n\"\n\"" GEN_NOTIFICATION_ITEM_XML_C ${GEN_NOTIFICATION_ITEM_XML_C})
string(REGEX REPLACE "\n\"$" "\n" GEN_NOTIFICATION_ITEM_XML_C ${GEN_NOTIFICATION_ITEM_XML_C})
string(PREPEND GEN_NOTIFICATION_ITEM_XML_C "const char * _notification_item = \n\"")
string(APPEND GEN_NOTIFICATION_ITEM_XML_C "\;")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/gen-notification-item.xml.c" ${GEN_NOTIFICATION_ITEM_XML_C})
# gen-notification-watcher.xml.h
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/gen-notification-watcher.xml.h" "extern const char * _notification_watcher;")
# gen-notification-watcher.xml.c
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/notification-watcher.xml" GEN_NOTIFICATION_WATCHER_XML_C)
string(REPLACE "\"" "\\\"" GEN_NOTIFICATION_WATCHER_XML_C ${GEN_NOTIFICATION_WATCHER_XML_C})
string(REPLACE "\n" "\\n\"\n\"" GEN_NOTIFICATION_WATCHER_XML_C ${GEN_NOTIFICATION_WATCHER_XML_C})
string(REGEX REPLACE "\n\"$" "\n" GEN_NOTIFICATION_WATCHER_XML_C ${GEN_NOTIFICATION_WATCHER_XML_C})
string(PREPEND GEN_NOTIFICATION_WATCHER_XML_C "const char * _notification_watcher = \n\"")
string(APPEND GEN_NOTIFICATION_WATCHER_XML_C "\;")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/gen-notification-watcher.xml.c" ${GEN_NOTIFICATION_WATCHER_XML_C})
# libayatana-appindicator{,3}.so
set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_library("${ayatana_appindicator_gtkver}" SHARED ${SOURCES})
set_target_properties("${ayatana_appindicator_gtkver}" PROPERTIES VERSION 1.0.0 SOVERSION 1)
target_compile_definitions("${ayatana_appindicator_gtkver}" PUBLIC G_LOG_DOMAIN="libayatana-appindicator")
target_include_directories("${ayatana_appindicator_gtkver}" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_include_directories("${ayatana_appindicator_gtkver}" PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories("${ayatana_appindicator_gtkver}" PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries("${ayatana_appindicator_gtkver}" ${PROJECT_DEPS_LIBRARIES})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${ayatana_appindicator_gtkver}.so" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${ayatana_appindicator_gtkver}.so.1" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${ayatana_appindicator_gtkver}.so.1.0.0" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}")
# AyatanaAppIndicator{,3}-0.1.gir
find_package(GObjectIntrospection REQUIRED)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_girver}-0.1.gir"
DEPENDS "${ayatana_appindicator_gtkver}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND
${INTROSPECTION_SCANNER}
app-indicator.c ${HEADERS}
--add-include-path=${CMAKE_CURRENT_BINARY_DIR}
--c-include=libayatana-appindicator/app-indicator.h
--symbol-prefix=app
--identifier-prefix=App
--namespace=${ayatana_appindicator_girver}
--nsversion=0.1
--quiet
--warn-all
--include=GObject-2.0
--include=${gtk_girver}
--library-path=${CMAKE_CURRENT_BINARY_DIR}
--library="${ayatana_appindicator_gtkver}"
--output "${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_girver}-0.1.gir"
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_girver}-0.1.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0")
# AyatanaAppIndicator{,3}-0.1.typelib
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_girver}-0.1.typelib"
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_girver}-0.1.gir"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND
${INTROSPECTION_COMPILER}
--includedir=${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_girver}-0.1.gir
-o "${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_girver}-0.1.typelib"
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_girver}-0.1.typelib" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/girepository-1.0")
add_custom_target(src ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${ayatana_appindicator_girver}-0.1.typelib")
|