~donadigo/power-installer/power-installer-legacy

« back to all changes in this revision

Viewing changes to cmake/ValaPrecompile.cmake

  • Committer: donadigo
  • Date: 2015-01-01 16:48:17 UTC
  • Revision ID: donadigos159@gmail.com-20150101164817-adb4kpdmnkkooakz
Updated version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
##
2
2
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
3
3
# Copyright 2012 elementary.
4
 
 
4
#
5
5
# Redistribution and use in source and binary forms, with or without
6
6
# modification, are permitted provided that the following conditions are met:
7
 
 
7
#
8
8
#    1. Redistributions of source code must retain the above copyright notice,
9
9
#       this list of conditions and the following disclaimer.
10
 
 
10
#
11
11
#    2. Redistributions in binary form must reproduce the above copyright notice,
12
12
#       this list of conditions and the following disclaimer in the documentation
13
13
#       and/or other materials provided with the distribution.
14
 
 
14
#
15
15
# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
16
16
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17
17
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
22
22
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23
23
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24
24
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 
 
25
#
26
26
# The views and conclusions contained in the software and documentation are those
27
27
# of the authors and should not be interpreted as representing official policies,
28
28
# either expressed or implied, of Jakob Westhoff
32
32
find_package(Vala REQUIRED)
33
33
 
34
34
##
35
 
# Compile vala files to their c equivalents for further processing. 
 
35
# Compile vala files to their c equivalents for further processing.
36
36
#
37
37
# The "vala_precompile" macro takes care of calling the valac executable on the
38
38
# given source to produce c files which can then be processed further using
39
39
# default cmake functions.
40
 
 
40
#
41
41
# The first parameter provided is a variable, which will be filled with a list
42
42
# of c files outputted by the vala compiler. This list can than be used in
43
43
# conjuction with functions like "add_executable" or others to create the
44
44
# neccessary compile rules with CMake.
45
 
 
45
#
46
46
# The initial variable is followed by a list of .vala files to be compiled.
47
47
# Please take care to add every vala file belonging to the currently compiled
48
48
# project or library as Vala will otherwise not be able to resolve all
49
49
# dependencies.
50
 
 
50
#
51
51
# The following sections may be specified afterwards to provide certain options
52
52
# to the vala compiler:
53
 
 
53
#
54
54
# PACKAGES
55
55
#   A list of vala packages/libraries to be used during the compile cycle. The
56
56
#   package names are exactly the same, as they would be passed to the valac
57
57
#   "--pkg=" option.
58
 
 
58
#
59
59
# OPTIONS
60
60
#   A list of optional options to be passed to the valac executable. This can be
61
61
#   used to pass "--thread" for example to enable multi-threading support.
69
69
#   Pass all the needed flags to the compiler to create an internal vapi for
70
70
#   the compiled library. The provided name will be used for this and a
71
71
#   <provided_name>.vapi file will be created.
72
 
 
72
#
73
73
# GENERATE_HEADER
74
74
#   Let the compiler generate a header file for the compiled code. There will
75
75
#   be a header file as well as an internal header file being generated called
82
82
#
83
83
# GENERATE_SYMBOLS
84
84
#   Output a <provided_name>.symbols file containing all the exported symbols.
85
 
 
85
#
86
86
# The following call is a simple example to the vala_precompile macro showing
87
87
# an example to every of the optional sections:
88
88
#
193
193
 
194
194
        include (FindGirCompiler)
195
195
        find_package(GirCompiler REQUIRED)
196
 
        
197
 
        set(gircomp_command 
198
 
            COMMAND 
 
196
 
 
197
        set(gircomp_command
 
198
            COMMAND
199
199
                ${G_IR_COMPILER_EXECUTABLE}
200
 
            ARGS 
 
200
            ARGS
201
201
                "${DIRECTORY}/${ARGS_GENERATE_GIR}.gir"
202
202
                -o "${DIRECTORY}/${ARGS_GENERATE_GIR}.typelib")
203
203
    endif(ARGS_GENERATE_GIR)
216
216
    add_custom_command(
217
217
    OUTPUT
218
218
        ${OUTPUT_STAMP}
219
 
    COMMAND 
220
 
        ${VALA_EXECUTABLE} 
221
 
    ARGS 
222
 
        "-C" 
223
 
        ${header_arguments} 
224
 
        ${vapi_arguments} 
225
 
        ${gir_arguments} 
226
 
        ${symbols_arguments} 
227
 
        "-b" ${CMAKE_CURRENT_SOURCE_DIR} 
228
 
        "-d" ${DIRECTORY} 
229
 
        ${vala_pkg_opts} 
230
 
        ${ARGS_OPTIONS} 
 
219
    COMMAND
 
220
        ${VALA_EXECUTABLE}
 
221
    ARGS
 
222
        "-C"
 
223
        ${header_arguments}
 
224
        ${vapi_arguments}
 
225
        ${gir_arguments}
 
226
        ${symbols_arguments}
 
227
        "-b" ${CMAKE_CURRENT_SOURCE_DIR}
 
228
        "-d" ${DIRECTORY}
 
229
        ${vala_pkg_opts}
 
230
        ${ARGS_OPTIONS}
231
231
        "-g"
232
 
        "--save-temps"
233
 
        ${in_files} 
 
232
        ${in_files}
234
233
        ${custom_vapi_arguments}
235
234
    COMMAND
236
235
        touch
237
236
    ARGS
238
237
        ${OUTPUT_STAMP}
239
 
    DEPENDS 
240
 
        ${in_files} 
 
238
    DEPENDS
 
239
        ${in_files}
241
240
        ${ARGS_CUSTOM_VAPIS}
242
241
    COMMENT
243
242
        "Generating ${out_files_display}"