~writer-devs/writer/trunk

« back to all changes in this revision

Viewing changes to cmake/GObjectIntrospectionMacros.cmake

  • Committer: Anthony Huben
  • Date: 2014-09-05 01:46:13 UTC
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: harp37@gmail.com-20140905014613-r5s0s8v662e4n4p4
Add initial support for cmake.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
macro(add_target_gir TARGET_NAME GIR_NAME HEADER CFLAGS GRANITE_VERSION)
 
2
    set(PACKAGES "")
 
3
    foreach(PKG ${ARGN})
 
4
        set(PACKAGES ${PACKAGES} --include=${PKG})
 
5
    endforeach()
 
6
    install(CODE "set(ENV{LD_LIBRARY_PATH} \"${CMAKE_CURRENT_BINARY_DIR}:\$ENV{LD_LIBRARY_PATH}\")
 
7
    execute_process(COMMAND g-ir-scanner ${CFLAGS} -n ${GIR_NAME}
 
8
            --quiet
 
9
            --library ${TARGET_NAME} ${PACKAGES}
 
10
            -o ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir
 
11
            -L${CMAKE_CURRENT_BINARY_DIR}
 
12
            --nsversion=${GRANITE_VERSION} ${HEADER})")
 
13
    install(CODE "execute_process(COMMAND g-ir-compiler ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir -o ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.typelib)")
 
14
    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir DESTINATION share/gir-1.0/)
 
15
    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.typelib DESTINATION lib/girepository-1.0/)
 
16
endmacro()
 
17
 
 
18
macro(add_target_gir_with_executable TARGET_NAME EXE_NAME GIR_NAME HEADER EXE_HEADER CFLAGS GRANITE_VERSION)
 
19
    set(PACKAGES "")
 
20
    foreach(PKG ${ARGN})
 
21
        set(PACKAGES ${PACKAGES} --include=${PKG})
 
22
    endforeach()
 
23
    install(CODE "set(ENV{LD_LIBRARY_PATH} \"${CMAKE_CURRENT_BINARY_DIR}:\$ENV{LD_LIBRARY_PATH}\")
 
24
    execute_process(COMMAND g-ir-scanner ${CFLAGS} -n ${GIR_NAME}
 
25
            --quiet
 
26
            --library ${TARGET_NAME} --program ${EXE_NAME} ${PACKAGES}
 
27
            -o ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir
 
28
            -L${CMAKE_CURRENT_BINARY_DIR}
 
29
            -I${CMAKE_CURRENT_BINARY_DIR}
 
30
            --nsversion=${GRANITE_VERSION} ${HEADER} ${EXE_HEADER})")
 
31
    install(CODE "execute_process(COMMAND g-ir-compiler ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir -o ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.typelib)")
 
32
    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir DESTINATION share/gir-1.0/)
 
33
    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.typelib DESTINATION lib/girepository-1.0/)
 
34
endmacro()