aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: c7d351d0be973efd1b4cbb53c60cb54a992fba13 (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

add_library(ayatana-common SHARED
    utils.c
)

target_link_libraries(ayatana-common
    ${DEPS_LIBRARIES}
)

target_compile_definitions (ayatana-common PUBLIC GETTEXT_PACKAGE="${GETTEXT_PACKAGE}" LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")

if(ENABLE_LOMIRI_FEATURES)
    add_definitions( -DLOMIRI_FEATURES_ENABLED )
endif()

set(PUBLIC_HEADERS
    utils.h
)

set_target_properties(ayatana-common
    PROPERTIES
    VERSION ${API_VERSION}.0.0
    SOVERSION ${ABI_VERSION}
)

configure_file(libayatana-common.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libayatana-common.pc @ONLY)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libayatana-common.pc DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)
install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}/ayatana/common)
install(TARGETS ayatana-common DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})

# AyatanaCommon.gir

if (INTROSPECTION_FOUND)
    add_custom_command(
        OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.gir"
        DEPENDS "ayatana-common"
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        COMMAND
        ${INTROSPECTION_SCANNER}
        utils.c utils.h
        --no-libtool
        --namespace=AyatanaCommon
        --nsversion=0.0
        --c-include=ayatana/common/utils.h
        --quiet
        --warn-all
        --include=GLib-2.0
        --library="ayatana-common"
        --library-path=${CMAKE_CURRENT_BINARY_DIR}
        --output "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.gir"
    )

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

# AyatanaCommon.typelib

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

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

# AyatanaCommon.vapi

    if (VALA_COMPILER)
        add_custom_command(
            OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi"
            DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.typelib"
            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
            COMMAND
            ${VAPI_GEN}
            --library=AyatanaCommon
            AyatanaCommon-0.0.gir
        )

        install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/vala/vapi")

        add_custom_target("src" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon.vapi")

    else()

        add_custom_target("src" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaCommon-0.0.typelib")

    endif()

endif()