~midori/midori/trunk

« back to all changes in this revision

Viewing changes to cmake/GIR.cmake

  • Committer: gue5t
  • Date: 2014-03-04 07:48:13 UTC
  • mto: This revision was merged to the branch mainline in revision 6585.
  • Revision ID: gue5t@midori.launchpad-20140304074813-kxu2exrw21ddjg6n
Implement GIR build support

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# GIR.cmake
 
2
#
 
3
# Macros for building Gobject Introspection bindings for Midori API
 
4
find_program (GIR_SCANNER_BIN g-ir-scanner)
 
5
find_program (GIR_COMPILER_BIN g-ir-compiler)
 
6
 
 
7
if (GIR_SCANNER_BIN AND GIR_COMPILER_BIN)
 
8
 
 
9
    set (GIR_FOUND TRUE)
 
10
    set (GIR_VERSION "${MIDORI_MAJOR_VERSION}.${MIDORI_MINOR_VERSION}")
 
11
    macro (gir_build module namespace)
 
12
        add_custom_target ("g-ir-scanner_${module}" ALL
 
13
            ${GIR_SCANNER_BIN} -Imidori -I${CMAKE_SOURCE_DIR}/ -I${CMAKE_BINARY_DIR}/midori -I${CMAKE_SOURCE_DIR}/${module} -I${CMAKE_SOURCE_DIR}/toolbars -I.
 
14
                --header-only -n ${namespace} --identifier-prefix ${namespace}
 
15
                ${CMAKE_SOURCE_DIR}/${module}/${module}-*.c ${CMAKE_SOURCE_DIR}/${module}/${module}-*.h
 
16
                --pkg gtk+-2.0 --pkg webkit-1.0 --pkg gio-2.0 --pkg gobject-2.0
 
17
                --warn-all -iGObject-2.0 -iGLib-2.0 -iGtk-2.0
 
18
                --nsversion ${GIR_VERSION}
 
19
                -o ${CMAKE_CURRENT_BINARY_DIR}/${namespace}-${GIR_VERSION}.gir
 
20
                WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
 
21
 
 
22
    endmacro (gir_build module namespace)
 
23
 
 
24
    macro (gir module namespace)
 
25
        gir_build (${module} ${namespace})
 
26
 
 
27
        install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${namespace}-${GIR_VERSION}.gir"
 
28
            DESTINATION "${CMAKE_INSTALL_DATADIR}/gir-1.0/")
 
29
    endmacro (gir module)
 
30
endif ()