~writer-devs/writer/trunk

« back to all changes in this revision

Viewing changes to cmake/Valadoc.cmake

  • Committer: harp37 at gmail
  • Date: 2014-11-25 00:55:20 UTC
  • mto: This revision was merged to the branch mainline in revision 70.
  • Revision ID: harp37@gmail.com-20141125005520-6ax4j204vr1bby2i
CMake is nearly there.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
include(ParseArguments)
 
2
find_package(Valadoc REQUIRED)
 
3
 
 
4
macro(valadoc target outdir)
 
5
        parse_arguments(ARGS "PACKAGES;OPTIONS;CUSTOM_VAPIS" "" ${ARGN})
 
6
        set(vala_pkg_opts "")
 
7
        foreach(pkg ${ARGS_PACKAGES})
 
8
                list(APPEND vala_pkg_opts "--pkg=${pkg}")
 
9
        endforeach(pkg ${ARGS_PACKAGES})
 
10
 
 
11
        set(vapi_dir_opts "")
 
12
        foreach(src ${ARGS_CUSTOM_VAPIS})
 
13
                get_filename_component(pkg ${src} NAME_WE)
 
14
                list(APPEND vala_pkg_opts "--pkg=${pkg}")
 
15
                
 
16
                get_filename_component(path ${src} PATH)
 
17
                list(APPEND vapi_dir_opts "--vapidir=${path}")
 
18
        endforeach(src ${ARGS_DEFAULT_ARGS})
 
19
        list(REMOVE_DUPLICATES vapi_dir_opts)
 
20
 
 
21
        add_custom_command(TARGET ${target}
 
22
        COMMAND
 
23
                ${VALADOC_EXECUTABLE}
 
24
        ARGS
 
25
                "--force"
 
26
                "-b" ${CMAKE_CURRENT_SOURCE_DIR}
 
27
                "-o" ${outdir}
 
28
                "--package-name=${CMAKE_PROJECT_NAME}"
 
29
                "--package-version=${PROJECT_VERSION}"
 
30
                ${vala_pkg_opts}
 
31
                ${vapi_dir_opts}
 
32
                ${ARGS_OPTIONS}
 
33
                ${in_files} 
 
34
        DEPENDS
 
35
                ${in_files}
 
36
                ${ARGS_CUSTOM_VAPIS}
 
37
        )
 
38
endmacro(valadoc)