aboutsummaryrefslogtreecommitdiff
path: root/libmessaging-menu/CMakeLists.txt
blob: 2d3d6ac0544e65fd41cf7fe4a4b5947ea81c91ad (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
# messaging-menu.pc

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/messaging-menu.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/messaging-menu.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")

# messaging-menu-app.h
# messaging-menu-message.h
# messaging-menu.h

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/messaging-menu-app.h" DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/messaging-menu")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/messaging-menu-message.h" DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/messaging-menu")
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/messaging-menu.h" DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/messaging-menu")

# libmessaging-menu.so

set(
    SOURCES
    messaging-menu-app.c
    messaging-menu-message.c
)

set(
    SOURCES_GEN
    ${CMAKE_BINARY_DIR}/src/indicator-messages-service.c
    ${CMAKE_BINARY_DIR}/src/indicator-messages-application.c
)

set_source_files_properties(${SOURCES_GEN} PROPERTIES GENERATED TRUE)
set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_library("messaging-menu" SHARED ${SOURCES} ${SOURCES_GEN})
set_target_properties("messaging-menu" PROPERTIES VERSION 0.0.0 SOVERSION 0)
target_include_directories("messaging-menu" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS} "${CMAKE_BINARY_DIR}/src")
target_link_libraries("messaging-menu" ${PROJECT_DEPS_LIBRARIES})
add_dependencies("messaging-menu" "ayatana-indicator-messages-service")
install(TARGETS "messaging-menu" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}")

# MessagingMenu-1.0.gir

find_package(GObjectIntrospection REQUIRED)

set(
    HEADERS
    messaging-menu-app.h
    messaging-menu-message.h
)

add_custom_command(
    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.gir"
    DEPENDS "messaging-menu"
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    COMMAND
    ${INTROSPECTION_SCANNER}
    ${HEADERS} ${SOURCES}
    --namespace=MessagingMenu
    --nsversion=1.0
    --quiet
    --warn-all
    --include=GObject-2.0
    --include=Gio-2.0
    --pkg-export=messaging-menu
    --library="messaging-menu"
    --c-include="messaging-menu.h"
    --library-path=${CMAKE_CURRENT_BINARY_DIR}
    --output "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.gir"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0")

# MessagingMenu-1.0.typelib

add_custom_command(
    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.typelib"
    DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.gir"
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    COMMAND
    ${INTROSPECTION_COMPILER}
    --includedir=${CMAKE_CURRENT_BINARY_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.gir
    -o "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.typelib"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.typelib" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/girepository-1.0")

# MessagingMenu-1.0.vapi

find_package(Vala REQUIRED)

add_custom_command(
    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.vapi"
    DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.typelib"
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    COMMAND
    ${VAPI_GEN}
    --library=MessagingMenu-1.0
    --pkg gio-2.0
    MessagingMenu-1.0.gir
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.vapi" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/vala/vapi")

add_custom_target("libmessaging-menu" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/MessagingMenu-1.0.vapi")