aboutsummaryrefslogtreecommitdiff
path: root/gpgme-vala/CMakeLists.txt
blob: a510d293ad5afbfc1a7f02a6b409a82e28a690a7 (plain) (blame)
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
find_package(Vala REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(GPGME REQUIRED)
include(${VALA_USE_FILE})

set(GPGME_VALA_PACKAGES
    gee-0.8
    glib-2.0
)

pkg_check_modules(GPGME_VALA REQUIRED ${GPGME_VALA_PACKAGES})

vala_precompile(GPGME_VALA_C
SOURCES
    "src/gpgme_helper.vala"
CUSTOM_VAPIS
    "${CMAKE_CURRENT_SOURCE_DIR}/vapi/gpgme.vapi"
    "${CMAKE_CURRENT_SOURCE_DIR}/vapi/gpgme_public.vapi"
    "${CMAKE_CURRENT_SOURCE_DIR}/vapi/gpg-error.vapi"
PACKAGES
    ${GPGME_VALA_PACKAGES}
GENERATE_VAPI
    gpgme-vala
GENERATE_HEADER
    gpgme-vala
OPTIONS
    -g
    --thread
)

set(CFLAGS ${VALA_CFLAGS} ${GPGME_VALA_CFLAGS} ${GPGME_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/src)
add_definitions(${CFLAGS})
add_library(gpgme-vala SHARED ${GPGME_VALA_C} src/gpgme_fix.c)
target_link_libraries(gpgme-vala ${GPGME_VALA_LIBRARIES} ${GPGME_LIBRARIES})

add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gpgme-vala/gpgme.vapi
COMMAND
    cat "${CMAKE_BINARY_DIR}/gpgme-vala/gpgme-vala.vapi" "${CMAKE_CURRENT_SOURCE_DIR}/vapi/gpgme_public.vapi" > "${CMAKE_BINARY_DIR}/gpgme-vala/gpgme.vapi"
DEPENDS
    ${CMAKE_BINARY_DIR}/gpgme-vala/gpgme-vala.vapi
    ${CMAKE_CURRENT_SOURCE_DIR}/vapi/gpgme_public.vapi
)

add_custom_target(gpgme-vapi
DEPENDS
    ${CMAKE_BINARY_DIR}/gpgme-vala/gpgme.vapi
)