Merge lp:~elementary-pantheon/pantheon-greeter/update-cmake-modules into lp:~elementary-pantheon/pantheon-greeter/trunk

Proposed by Sergey "Shnatsel" Davidoff on 2014-07-25
Status: Work in progress
Proposed branch: lp:~elementary-pantheon/pantheon-greeter/update-cmake-modules
Merge into: lp:~elementary-pantheon/pantheon-greeter/trunk
Diff against target: 636 lines (+203/-311)
6 files modified
CMakeLists.txt (+1/-1)
cmake/FindGirCompiler.cmake (+56/-0)
cmake/GObjectIntrospectionMacros.cmake (+34/-0)
cmake/Makefile (+0/-286)
cmake/Translations.cmake (+37/-12)
cmake/ValaPrecompile.cmake (+75/-12)
To merge this branch: bzr merge lp:~elementary-pantheon/pantheon-greeter/update-cmake-modules
Reviewer Review Type Date Requested Status
Sergey "Shnatsel" Davidoff (community) Needs Fixing on 2014-07-25
Review via email: mp+228366@code.launchpad.net

This proposal supersedes a proposal from 2014-07-25.

Description of the change

Drop the included autogenerated makefile and update CMake modules to latest version from https://code.launchpad.net/~elementary-apps/+junk/cmake-modules

Build now fails with the following error log:

...
Scanning dependencies of target pantheon-greeter
make[3]: Leaving directory `/home/virtual/Code/update-cmake-modules/obj-x86_64-linux-gnu'
make -f CMakeFiles/pantheon-greeter.dir/build.make CMakeFiles/pantheon-greeter.dir/build
make[3]: Entering directory `/home/virtual/Code/update-cmake-modules/obj-x86_64-linux-gnu'
/usr/bin/cmake -E cmake_progress_report /home/virtual/Code/update-cmake-modules/obj-x86_64-linux-gnu/CMakeFiles 3
[ 11%] Building C object CMakeFiles/pantheon-greeter.dir/Utilities.c.o
/usr/bin/x86_64-linux-gnu-gcc -DGETTEXT_PACKAGE=\"pantheon-greeter\" -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -I/home/virtual/Code/update-cmake-modules/obj-x86_64-linux-gnu -w -pthread -I/usr/include/granite -I/usr/include/cairo -I/usr/include/gee-0.8 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/gtk-3.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/libxml2 -I/usr/include/clutter-gtk-1.0 -I/usr/include/clutter-1.0 -I/usr/include/cogl -I/usr/include/json-glib-1.0 -I/usr/include/libdrm -I/usr/include/libindicator3-0.4 -I/usr/include/lightdm-gobject-1 -o CMakeFiles/pantheon-greeter.dir/Utilities.c.o -c /home/virtual/Code/update-cmake-modules/obj-x86_64-linux-gnu/Utilities.c
x86_64-linux-gnu-gcc: error: /home/virtual/Code/update-cmake-modules/obj-x86_64-linux-gnu/Utilities.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
make[3]: *** [CMakeFiles/pantheon-greeter.dir/Utilities.c.o] Error 4
make[3]: Leaving directory `/home/virtual/Code/update-cmake-modules/obj-x86_64-linux-gnu'
make[2]: *** [CMakeFiles/pantheon-greeter.dir/all] Error 2
make[2]: Leaving directory `/home/virtual/Code/update-cmake-modules/obj-x86_64-linux-gnu'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/virtual/Code/update-cmake-modules/obj-x86_64-linux-gnu'
dh_auto_build: make -j1 returned exit code 2
make: *** [build] Error 2

To post a comment you must log in.
Sergey "Shnatsel" Davidoff (shnatsel) wrote : Posted in a previous version of this proposal

tom95 [11:01 PM] shnatsel: yeah, vala_precompile was updated, the first argument is now the targetname. So it assumes PopOver.vala is the target and not a source file that it has to compile

shnatsel [11:02 PM] How do I fix that?

tom95 [11:02 PM] shnatsel: you insert pantheon-greeter right after VALA_C

review: Needs Fixing

tom95 [12:02 AM] for some reason valac decides to not output a .c file for the first vala file it receives, I have no clue why

review: Needs Fixing

Unmerged revisions

272. By Sergey "Shnatsel" Davidoff on 2014-07-25

update vala_precompile invocation in CMakeLists.txt, this should fix build

271. By Sergey "Shnatsel" Davidoff on 2014-07-25

Update CMake modules, drop autogenerated makefile

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-10-08 18:27:22 +0000
3+++ CMakeLists.txt 2014-07-25 19:26:37 +0000
4@@ -39,7 +39,7 @@
5 file(GLOB_RECURSE sources src/*.vala)
6
7 include (ValaPrecompile)
8-vala_precompile (VALA_C
9+vala_precompile (VALA_C pantheon-greeter
10 ${sources}
11 ${CMAKE_BINARY_DIR}/src/config.vala
12 PACKAGES
13
14=== added file 'cmake/FindGirCompiler.cmake'
15--- cmake/FindGirCompiler.cmake 1970-01-01 00:00:00 +0000
16+++ cmake/FindGirCompiler.cmake 2014-07-25 19:26:37 +0000
17@@ -0,0 +1,56 @@
18+##
19+# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
20+#
21+# Redistribution and use in source and binary forms, with or without
22+# modification, are permitted provided that the following conditions are met:
23+#
24+# 1. Redistributions of source code must retain the above copyright notice,
25+# this list of conditions and the following disclaimer.
26+#
27+# 2. Redistributions in binary form must reproduce the above copyright notice,
28+# this list of conditions and the following disclaimer in the documentation
29+# and/or other materials provided with the distribution.
30+#
31+# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
32+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
34+# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
39+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
40+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41+#
42+# The views and conclusions contained in the software and documentation are those
43+# of the authors and should not be interpreted as representing official policies,
44+# either expressed or implied, of Jakob Westhoff
45+##
46+
47+##
48+# Find module for the Gir compiler (g-ir-compiler)
49+#
50+# This module determines wheter a Gir compiler is installed on the current
51+# system and where its executable is.
52+#
53+# Call the module using "find_package(GirCompiler) from within your CMakeLists.txt.
54+#
55+# The following variables will be set after an invocation:
56+#
57+# G_IR_COMPILER_FOUND Whether the g-ir-compiler compiler has been found or not
58+# G_IR_COMPILER_EXECUTABLE Full path to the g-ir-compiler executable if it has been found
59+##
60+
61+
62+# Search for the g-ir-compiler executable in the usual system paths.
63+find_program (G_IR_COMPILER_EXECUTABLE
64+ NAMES g-ir-compiler)
65+
66+# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
67+# Furthermore set G_IR_COMPILER_FOUND to TRUE if the g-ir-compiler has been found (aka.
68+# G_IR_COMPILER_EXECUTABLE is set)
69+
70+include (FindPackageHandleStandardArgs)
71+find_package_handle_standard_args (GirCompiler DEFAULT_MSG G_IR_COMPILER_EXECUTABLE)
72+
73+mark_as_advanced (G_IR_COMPILER_EXECUTABLE)
74
75=== added file 'cmake/GObjectIntrospectionMacros.cmake'
76--- cmake/GObjectIntrospectionMacros.cmake 1970-01-01 00:00:00 +0000
77+++ cmake/GObjectIntrospectionMacros.cmake 2014-07-25 19:26:37 +0000
78@@ -0,0 +1,34 @@
79+macro(add_target_gir TARGET_NAME GIR_NAME HEADER CFLAGS GRANITE_VERSION)
80+ set(PACKAGES "")
81+ foreach(PKG ${ARGN})
82+ set(PACKAGES ${PACKAGES} --include=${PKG})
83+ endforeach()
84+ install(CODE "set(ENV{LD_LIBRARY_PATH} \"${CMAKE_CURRENT_BINARY_DIR}:\$ENV{LD_LIBRARY_PATH}\")
85+ execute_process(COMMAND g-ir-scanner ${CFLAGS} -n ${GIR_NAME}
86+ --quiet
87+ --library ${TARGET_NAME} ${PACKAGES}
88+ -o ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir
89+ -L${CMAKE_CURRENT_BINARY_DIR}
90+ --nsversion=${GRANITE_VERSION} ${HEADER})")
91+ 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)")
92+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir DESTINATION share/gir-1.0/)
93+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.typelib DESTINATION lib/girepository-1.0/)
94+endmacro()
95+
96+macro(add_target_gir_with_executable TARGET_NAME EXE_NAME GIR_NAME HEADER EXE_HEADER CFLAGS GRANITE_VERSION)
97+ set(PACKAGES "")
98+ foreach(PKG ${ARGN})
99+ set(PACKAGES ${PACKAGES} --include=${PKG})
100+ endforeach()
101+ install(CODE "set(ENV{LD_LIBRARY_PATH} \"${CMAKE_CURRENT_BINARY_DIR}:\$ENV{LD_LIBRARY_PATH}\")
102+ execute_process(COMMAND g-ir-scanner ${CFLAGS} -n ${GIR_NAME}
103+ --quiet
104+ --library ${TARGET_NAME} --program ${EXE_NAME} ${PACKAGES}
105+ -o ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir
106+ -L${CMAKE_CURRENT_BINARY_DIR}
107+ -I${CMAKE_CURRENT_BINARY_DIR}
108+ --nsversion=${GRANITE_VERSION} ${HEADER} ${EXE_HEADER})")
109+ 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)")
110+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir DESTINATION share/gir-1.0/)
111+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.typelib DESTINATION lib/girepository-1.0/)
112+endmacro()
113
114=== removed file 'cmake/Makefile'
115--- cmake/Makefile 2012-05-01 18:01:01 +0000
116+++ cmake/Makefile 1970-01-01 00:00:00 +0000
117@@ -1,286 +0,0 @@
118-# CMAKE generated file: DO NOT EDIT!
119-# Generated by "Unix Makefiles" Generator, CMake Version 2.8
120-
121-# Default target executed when no arguments are given to make.
122-default_target: all
123-.PHONY : default_target
124-
125-#=============================================================================
126-# Special targets provided by cmake.
127-
128-# Disable implicit rules so canoncical targets will work.
129-.SUFFIXES:
130-
131-# Remove some rules from gmake that .SUFFIXES does not remove.
132-SUFFIXES =
133-
134-.SUFFIXES: .hpux_make_needs_suffix_list
135-
136-# Suppress display of executed commands.
137-$(VERBOSE).SILENT:
138-
139-# A target that is always out of date.
140-cmake_force:
141-.PHONY : cmake_force
142-
143-#=============================================================================
144-# Set environment variables for the build.
145-
146-# The shell in which to execute make rules.
147-SHELL = /bin/sh
148-
149-# The CMake executable.
150-CMAKE_COMMAND = /usr/bin/cmake
151-
152-# The command to remove a file.
153-RM = /usr/bin/cmake -E remove -f
154-
155-# The top-level source directory on which CMake was run.
156-CMAKE_SOURCE_DIR = /home/mefrio/Scrivania/cmake
157-
158-# The top-level build directory on which CMake was run.
159-CMAKE_BINARY_DIR = /home/mefrio/Scrivania/cmake/cmake
160-
161-#=============================================================================
162-# Targets provided globally by CMake.
163-
164-# Special rule for the target edit_cache
165-edit_cache:
166- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
167- /usr/bin/cmake -i .
168-.PHONY : edit_cache
169-
170-# Special rule for the target edit_cache
171-edit_cache/fast: edit_cache
172-.PHONY : edit_cache/fast
173-
174-# Special rule for the target install
175-install: preinstall
176- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
177- /usr/bin/cmake -P cmake_install.cmake
178-.PHONY : install
179-
180-# Special rule for the target install
181-install/fast: preinstall/fast
182- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
183- /usr/bin/cmake -P cmake_install.cmake
184-.PHONY : install/fast
185-
186-# Special rule for the target install/local
187-install/local: preinstall
188- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
189- /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
190-.PHONY : install/local
191-
192-# Special rule for the target install/local
193-install/local/fast: install/local
194-.PHONY : install/local/fast
195-
196-# Special rule for the target install/strip
197-install/strip: preinstall
198- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
199- /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
200-.PHONY : install/strip
201-
202-# Special rule for the target install/strip
203-install/strip/fast: install/strip
204-.PHONY : install/strip/fast
205-
206-# Special rule for the target list_install_components
207-list_install_components:
208- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
209-.PHONY : list_install_components
210-
211-# Special rule for the target list_install_components
212-list_install_components/fast: list_install_components
213-.PHONY : list_install_components/fast
214-
215-# Special rule for the target rebuild_cache
216-rebuild_cache:
217- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
218- /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
219-.PHONY : rebuild_cache
220-
221-# Special rule for the target rebuild_cache
222-rebuild_cache/fast: rebuild_cache
223-.PHONY : rebuild_cache/fast
224-
225-# The main all target
226-all: cmake_check_build_system
227- $(CMAKE_COMMAND) -E cmake_progress_start /home/mefrio/Scrivania/cmake/cmake/CMakeFiles /home/mefrio/Scrivania/cmake/cmake/CMakeFiles/progress.marks
228- $(MAKE) -f CMakeFiles/Makefile2 all
229- $(CMAKE_COMMAND) -E cmake_progress_start /home/mefrio/Scrivania/cmake/cmake/CMakeFiles 0
230-.PHONY : all
231-
232-# The main clean target
233-clean:
234- $(MAKE) -f CMakeFiles/Makefile2 clean
235-.PHONY : clean
236-
237-# The main clean target
238-clean/fast: clean
239-.PHONY : clean/fast
240-
241-# Prepare targets for installation.
242-preinstall: all
243- $(MAKE) -f CMakeFiles/Makefile2 preinstall
244-.PHONY : preinstall
245-
246-# Prepare targets for installation.
247-preinstall/fast:
248- $(MAKE) -f CMakeFiles/Makefile2 preinstall
249-.PHONY : preinstall/fast
250-
251-# clear depends
252-depend:
253- $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
254-.PHONY : depend
255-
256-#=============================================================================
257-# Target rules for targets named scratch
258-
259-# Build rule for target.
260-scratch: cmake_check_build_system
261- $(MAKE) -f CMakeFiles/Makefile2 scratch
262-.PHONY : scratch
263-
264-# fast build rule for target.
265-scratch/fast:
266- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/build
267-.PHONY : scratch/fast
268-
269-src/entry.o: src/entry.c.o
270-.PHONY : src/entry.o
271-
272-# target to build an object file
273-src/entry.c.o:
274- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.o
275-.PHONY : src/entry.c.o
276-
277-src/entry.i: src/entry.c.i
278-.PHONY : src/entry.i
279-
280-# target to preprocess a source file
281-src/entry.c.i:
282- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.i
283-.PHONY : src/entry.c.i
284-
285-src/entry.s: src/entry.c.s
286-.PHONY : src/entry.s
287-
288-# target to generate assembly for a file
289-src/entry.c.s:
290- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.s
291-.PHONY : src/entry.c.s
292-
293-src/main_window.o: src/main_window.c.o
294-.PHONY : src/main_window.o
295-
296-# target to build an object file
297-src/main_window.c.o:
298- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.o
299-.PHONY : src/main_window.c.o
300-
301-src/main_window.i: src/main_window.c.i
302-.PHONY : src/main_window.i
303-
304-# target to preprocess a source file
305-src/main_window.c.i:
306- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.i
307-.PHONY : src/main_window.c.i
308-
309-src/main_window.s: src/main_window.c.s
310-.PHONY : src/main_window.s
311-
312-# target to generate assembly for a file
313-src/main_window.c.s:
314- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.s
315-.PHONY : src/main_window.c.s
316-
317-src/menu.o: src/menu.c.o
318-.PHONY : src/menu.o
319-
320-# target to build an object file
321-src/menu.c.o:
322- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.o
323-.PHONY : src/menu.c.o
324-
325-src/menu.i: src/menu.c.i
326-.PHONY : src/menu.i
327-
328-# target to preprocess a source file
329-src/menu.c.i:
330- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.i
331-.PHONY : src/menu.c.i
332-
333-src/menu.s: src/menu.c.s
334-.PHONY : src/menu.s
335-
336-# target to generate assembly for a file
337-src/menu.c.s:
338- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.s
339-.PHONY : src/menu.c.s
340-
341-src/notebook.o: src/notebook.c.o
342-.PHONY : src/notebook.o
343-
344-# target to build an object file
345-src/notebook.c.o:
346- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.o
347-.PHONY : src/notebook.c.o
348-
349-src/notebook.i: src/notebook.c.i
350-.PHONY : src/notebook.i
351-
352-# target to preprocess a source file
353-src/notebook.c.i:
354- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.i
355-.PHONY : src/notebook.c.i
356-
357-src/notebook.s: src/notebook.c.s
358-.PHONY : src/notebook.s
359-
360-# target to generate assembly for a file
361-src/notebook.c.s:
362- $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.s
363-.PHONY : src/notebook.c.s
364-
365-# Help Target
366-help:
367- @echo "The following are some of the valid targets for this Makefile:"
368- @echo "... all (the default if no target is provided)"
369- @echo "... clean"
370- @echo "... depend"
371- @echo "... edit_cache"
372- @echo "... install"
373- @echo "... install/local"
374- @echo "... install/strip"
375- @echo "... list_install_components"
376- @echo "... rebuild_cache"
377- @echo "... scratch"
378- @echo "... src/entry.o"
379- @echo "... src/entry.i"
380- @echo "... src/entry.s"
381- @echo "... src/main_window.o"
382- @echo "... src/main_window.i"
383- @echo "... src/main_window.s"
384- @echo "... src/menu.o"
385- @echo "... src/menu.i"
386- @echo "... src/menu.s"
387- @echo "... src/notebook.o"
388- @echo "... src/notebook.i"
389- @echo "... src/notebook.s"
390-.PHONY : help
391-
392-
393-
394-#=============================================================================
395-# Special targets to cleanup operation of make.
396-
397-# Special rule to run CMake to check the build system integrity.
398-# No rule that depends on this can have commands that come from listfiles
399-# because they might be regenerated.
400-cmake_check_build_system:
401- $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
402-.PHONY : cmake_check_build_system
403-
404
405=== modified file 'cmake/Translations.cmake'
406--- cmake/Translations.cmake 2013-01-05 00:23:48 +0000
407+++ cmake/Translations.cmake 2014-07-25 19:26:37 +0000
408@@ -20,22 +20,47 @@
409 add_custom_target (pot COMMENT “Building translation catalog.”)
410 find_program (XGETTEXT_EXECUTABLE xgettext)
411
412-
413 set(C_SOURCE "")
414+ set(VALA_SOURCE "")
415+ set(GLADE_SOURCE "")
416
417 foreach(FILES_INPUT ${ARGN})
418- file (GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.c)
419- foreach(C_FILE ${SOURCE_FILES})
420- set(C_SOURCE ${C_SOURCE} ${C_FILE})
421- endforeach()
422- file (GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.vala)
423- foreach(C_FILE ${SOURCE_FILES})
424- set(C_SOURCE ${C_SOURCE} ${C_FILE})
425+ set(BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT})
426+
427+ file (GLOB_RECURSE SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ ${BASE_DIRECTORY}/*.c)
428+ foreach(C_FILE ${SOURCE_FILES})
429+ set(C_SOURCE ${C_SOURCE} ${C_FILE})
430+ endforeach()
431+
432+ file (GLOB_RECURSE SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ ${BASE_DIRECTORY}/*.vala)
433+ foreach(VALA_C_FILE ${SOURCE_FILES})
434+ set(VALA_SOURCE ${VALA_SOURCE} ${VALA_C_FILE})
435+ endforeach()
436+
437+ file (GLOB_RECURSE SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ ${BASE_DIRECTORY}/*.ui)
438+ foreach(GLADE_C_FILE ${SOURCE_FILES})
439+ set(GLADE_SOURCE ${GLADE_SOURCE} ${GLADE_C_FILE})
440 endforeach()
441 endforeach()
442
443- add_custom_command (TARGET pot COMMAND
444- ${XGETTEXT_EXECUTABLE} -c -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
445- ${VALA_SOURCE} ${C_SOURCE} --keyword="_" --keyword="N_" --keyword="C_:1c,2" --from-code=UTF-8
446- )
447+ set(BASE_XGETTEXT_COMMAND
448+ ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE}
449+ -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
450+ --add-comments="/" --keyword="_" --keyword="N_" --keyword="C_:1c,2" --keyword="NC_:1c,2" --keyword="ngettext:1,2" --keyword="Q_:1g" --from-code=UTF-8)
451+
452+ set(CONTINUE_FLAG "")
453+
454+ IF(NOT "${C_SOURCE}" STREQUAL "")
455+ add_custom_command(TARGET pot WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${BASE_XGETTEXT_COMMAND} ${C_SOURCE})
456+ set(CONTINUE_FLAG "-j")
457+ ENDIF()
458+
459+ IF(NOT "${VALA_SOURCE}" STREQUAL "")
460+ add_custom_command(TARGET pot WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${BASE_XGETTEXT_COMMAND} ${CONTINUE_FLAG} -LC\# ${VALA_SOURCE})
461+ set(CONTINUE_FLAG "-j")
462+ ENDIF()
463+
464+ IF(NOT "${GLADE_SOURCE}" STREQUAL "")
465+ add_custom_command (TARGET pot WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${BASE_XGETTEXT_COMMAND} ${CONTINUE_FLAG} -LGlade ${GLADE_SOURCE})
466+ ENDIF()
467 endmacro()
468
469=== modified file 'cmake/ValaPrecompile.cmake'
470--- cmake/ValaPrecompile.cmake 2012-05-01 18:01:01 +0000
471+++ cmake/ValaPrecompile.cmake 2014-07-25 19:26:37 +0000
472@@ -1,5 +1,6 @@
473 ##
474 # Copyright 2009-2010 Jakob Westhoff. All rights reserved.
475+# Copyright 2012 elementary.
476 #
477 # Redistribution and use in source and binary forms, with or without
478 # modification, are permitted provided that the following conditions are met:
479@@ -74,10 +75,18 @@
480 # be a header file as well as an internal header file being generated called
481 # <provided_name>.h and <provided_name>_internal.h
482 #
483+# GENERATE_GIR
484+# Have the compiler generate a GObject-Introspection repository file with
485+# name: <provided_name>.gir. This can be later used to create a binary typelib
486+# using the GI compiler.
487+#
488+# GENERATE_SYMBOLS
489+# Output a <provided_name>.symbols file containing all the exported symbols.
490+#
491 # The following call is a simple example to the vala_precompile macro showing
492 # an example to every of the optional sections:
493 #
494-# vala_precompile(VALA_C
495+# vala_precompile(VALA_C mytargetname
496 # source1.vala
497 # source2.vala
498 # source3.vala
499@@ -95,14 +104,19 @@
500 # myvapi
501 # GENERATE_HEADER
502 # myheader
503+# GENERATE_GIR
504+# mygir
505+# GENERATE_SYMBOLS
506+# mysymbols
507 # )
508 #
509 # Most important is the variable VALA_C which will contain all the generated c
510 # file names after the call.
511 ##
512
513-macro(vala_precompile output)
514- parse_arguments(ARGS "PACKAGES;OPTIONS;DIRECTORY;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN})
515+macro(vala_precompile output target_name)
516+ parse_arguments(ARGS "TARGET;PACKAGES;OPTIONS;DIRECTORY;GENERATE_GIR;GENERATE_SYMBOLS;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN})
517+
518 if(ARGS_DIRECTORY)
519 set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY})
520 else(ARGS_DIRECTORY)
521@@ -115,15 +129,17 @@
522 endforeach(pkg ${ARGS_PACKAGES})
523 set(in_files "")
524 set(out_files "")
525+ set(out_files_display "")
526 set(${output} "")
527+
528 foreach(src ${ARGS_DEFAULT_ARGS})
529- string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" src ${src})
530 string(REGEX MATCH "^/" IS_MATCHED ${src})
531 if(${IS_MATCHED} MATCHES "/")
532- list(APPEND in_files "${src}")
533+ set(src_file_path ${src})
534 else()
535- list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
536+ set(src_file_path ${CMAKE_CURRENT_SOURCE_DIR}/${src})
537 endif()
538+ list(APPEND in_files ${src_file_path})
539 string(REPLACE ".vala" ".c" src ${src})
540 string(REPLACE ".gs" ".c" src ${src})
541 if(${IS_MATCHED} MATCHES "/")
542@@ -135,6 +151,7 @@
543 list(APPEND out_files "${DIRECTORY}/${src}")
544 endif()
545 list(APPEND ${output} ${out_file})
546+ list(APPEND out_files_display "${src}")
547 endforeach(src ${ARGS_DEFAULT_ARGS})
548
549 set(custom_vapi_arguments "")
550@@ -151,7 +168,8 @@
551 set(vapi_arguments "")
552 if(ARGS_GENERATE_VAPI)
553 list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi")
554- set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi")
555+ list(APPEND out_files_display "${ARGS_GENERATE_VAPI}.vapi")
556+ set(vapi_arguments "--library=${ARGS_GENERATE_VAPI}" "--vapi=${ARGS_GENERATE_VAPI}.vapi")
557
558 # Header and internal header is needed to generate internal vapi
559 if (NOT ARGS_GENERATE_HEADER)
560@@ -162,26 +180,71 @@
561 set(header_arguments "")
562 if(ARGS_GENERATE_HEADER)
563 list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
564- list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
565- list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
566- list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
567+ list(APPEND out_files_display "${ARGS_GENERATE_HEADER}.h")
568+ list(APPEND header_arguments "--header=${ARGS_GENERATE_HEADER}.h")
569 endif(ARGS_GENERATE_HEADER)
570
571- add_custom_command(OUTPUT ${out_files}
572+ set(gir_arguments "")
573+ set(gircomp_command "")
574+ if(ARGS_GENERATE_GIR)
575+ list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_GIR}.gir")
576+ list(APPEND out_files_display "${ARGS_GENERATE_GIR}.gir")
577+ set(gir_arguments "--gir=${ARGS_GENERATE_GIR}.gir")
578+
579+ include (FindGirCompiler)
580+ find_package(GirCompiler REQUIRED)
581+
582+ set(gircomp_command
583+ COMMAND
584+ ${G_IR_COMPILER_EXECUTABLE}
585+ ARGS
586+ "${DIRECTORY}/${ARGS_GENERATE_GIR}.gir"
587+ -o "${DIRECTORY}/${ARGS_GENERATE_GIR}.typelib")
588+ endif(ARGS_GENERATE_GIR)
589+
590+ set(symbols_arguments "")
591+ if(ARGS_GENERATE_SYMBOLS)
592+ list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_SYMBOLS}.symbols")
593+ list(APPEND out_files_display "${ARGS_GENERATE_SYMBOLS}.symbols")
594+ set(symbols_arguments "--symbols=${ARGS_GENERATE_SYMBOLS}.symbols")
595+ endif(ARGS_GENERATE_SYMBOLS)
596+
597+ # Workaround for a bug that would make valac run twice. This file is written
598+ # after the vala compiler generates C source code.
599+ set(OUTPUT_STAMP ${CMAKE_CURRENT_BINARY_DIR}/${target_name}_valac.stamp)
600+
601+ add_custom_command(
602+ OUTPUT
603+ ${OUTPUT_STAMP}
604 COMMAND
605 ${VALA_EXECUTABLE}
606 ARGS
607 "-C"
608 ${header_arguments}
609- ${vapi_arguments}
610+ ${vapi_arguments}
611+ ${gir_arguments}
612+ ${symbols_arguments}
613 "-b" ${CMAKE_CURRENT_SOURCE_DIR}
614 "-d" ${DIRECTORY}
615 ${vala_pkg_opts}
616 ${ARGS_OPTIONS}
617+ "-g"
618+ "--save-temps"
619 ${in_files}
620 ${custom_vapi_arguments}
621+ COMMAND
622+ touch
623+ ARGS
624+ ${OUTPUT_STAMP}
625 DEPENDS
626 ${in_files}
627 ${ARGS_CUSTOM_VAPIS}
628+ COMMENT
629+ "Generating ${out_files_display}"
630+ ${gircomp_command}
631 )
632+
633+ # This command will be run twice for some reason (pass a non-empty string to COMMENT
634+ # in order to see it). Since valac is not executed from here, this won't be a problem.
635+ add_custom_command(OUTPUT ${out_files} DEPENDS ${OUTPUT_STAMP} COMMENT "")
636 endmacro(vala_precompile)

Subscribers

People subscribed via source and target branches