~writer-devs/writer/trunk

« back to all changes in this revision

Viewing changes to cmake/ValaPrecompile.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:
118
118
    parse_arguments(ARGS "TARGET;PACKAGES;OPTIONS;DIRECTORY;GENERATE_GIR;GENERATE_SYMBOLS;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN})
119
119
 
120
120
    if(ARGS_DIRECTORY)
121
 
        set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY})
 
121
        set(DIRECTORY ${ARGS_DIRECTORY})
122
122
    else(ARGS_DIRECTORY)
123
123
        set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
124
124
    endif(ARGS_DIRECTORY)
144
144
        string(REPLACE ".gs" ".c" src ${src})
145
145
        if(${IS_MATCHED} MATCHES "/")
146
146
            get_filename_component(VALA_FILE_NAME ${src} NAME)
147
 
            set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${VALA_FILE_NAME}")
148
 
            list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${VALA_FILE_NAME}")
 
147
            set(out_file "${DIRECTORY}/${VALA_FILE_NAME}")
 
148
            list(APPEND out_files "${DIRECTORY}/${VALA_FILE_NAME}")
149
149
        else()
150
150
            set(out_file "${DIRECTORY}/${src}")
151
151
            list(APPEND out_files "${DIRECTORY}/${src}")
185
185
    endif(ARGS_GENERATE_HEADER)
186
186
 
187
187
    set(gir_arguments "")
188
 
    set(gircomp_command "")
189
188
    if(ARGS_GENERATE_GIR)
190
189
        list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_GIR}.gir")
191
190
        list(APPEND out_files_display "${ARGS_GENERATE_GIR}.gir")
192
191
        set(gir_arguments "--gir=${ARGS_GENERATE_GIR}.gir")
193
 
 
194
 
        include (FindGirCompiler)
195
 
        find_package(GirCompiler REQUIRED)
196
 
        
197
 
        set(gircomp_command 
198
 
            COMMAND 
199
 
                ${G_IR_COMPILER_EXECUTABLE}
200
 
            ARGS 
201
 
                "${DIRECTORY}/${ARGS_GENERATE_GIR}.gir"
202
 
                -o "${DIRECTORY}/${ARGS_GENERATE_GIR}.typelib")
203
192
    endif(ARGS_GENERATE_GIR)
204
193
 
205
194
    set(symbols_arguments "")
211
200
 
212
201
    # Workaround for a bug that would make valac run twice. This file is written
213
202
    # after the vala compiler generates C source code.
214
 
    set(OUTPUT_STAMP ${CMAKE_CURRENT_BINARY_DIR}/${target_name}_valac.stamp)
 
203
    set (extra_name ${extra_name}_ )
 
204
    set(OUTPUT_STAMP ${CMAKE_CURRENT_BINARY_DIR}/${target_name}${extra_name}valac.stamp)
215
205
 
216
206
    add_custom_command(
217
207
    OUTPUT
228
218
        "-d" ${DIRECTORY} 
229
219
        ${vala_pkg_opts} 
230
220
        ${ARGS_OPTIONS} 
231
 
        "-g"
232
 
        "--save-temps"
233
221
        ${in_files} 
234
222
        ${custom_vapi_arguments}
235
223
    COMMAND
241
229
        ${ARGS_CUSTOM_VAPIS}
242
230
    COMMENT
243
231
        "Generating ${out_files_display}"
244
 
    ${gircomp_command}
245
232
    )
246
233
 
247
234
    # This command will be run twice for some reason (pass a non-empty string to COMMENT