Merge lp:~pimvullers/ergo/cmake-gsettings into lp:ergo

Proposed by Pim Vullers
Status: Needs review
Proposed branch: lp:~pimvullers/ergo/cmake-gsettings
Merge into: lp:ergo
Diff against target: 1428 lines (+944/-397)
15 files modified
CMakeLists.txt (+3/-25)
cmake/FindVala.cmake (+65/-0)
cmake/GSettings.cmake (+42/-0)
cmake/Makefile (+286/-0)
cmake/ParseArguments.cmake (+36/-0)
cmake/README (+10/-0)
cmake/README.Vala.rst (+173/-0)
cmake/Tests.cmake (+5/-0)
cmake/Translations.cmake (+41/-0)
cmake/ValaPrecompile.cmake (+187/-0)
cmake/ValaVersion.cmake (+96/-0)
cmake/vala/FindVala.cmake (+0/-65)
cmake/vala/ParseArguments.cmake (+0/-36)
cmake/vala/ValaPrecompile.cmake (+0/-175)
cmake/vala/ValaVersion.cmake (+0/-96)
To merge this branch: bzr merge lp:~pimvullers/ergo/cmake-gsettings
Reviewer Review Type Date Requested Status
Ergo Developers Pending
Review via email: mp+96434@code.launchpad.net

Description of the change

Updated the cmake modules to the latest version from lp:~xapantu/+junk/cmake-modules
Updated CMakeLists.txt to use the new module for GSettings

To post a comment you must log in.

Unmerged revisions

34. By Pim Vullers

updated cmake modules to the latest set from xapantu, fixed gsettings config in CMakeLists.txt

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 2011-10-16 21:04:46 +0000
3+++ CMakeLists.txt 2012-03-07 19:17:22 +0000
4@@ -1,6 +1,6 @@
5 project (ergo)
6 cmake_minimum_required (VERSION 2.8)
7-list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/vala)
8+list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
9
10 #
11 # Base bits
12@@ -122,30 +122,8 @@
13 #
14 # GSettings Schema
15 #
16-SET (ERGO_SCHEMAS "org.elementary.Ergo.gschema.xml")
17-
18-# Have an option to not install the schema into where GLib is
19-option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" OFF)
20-if (GSETTINGS_LOCALINSTALL)
21- SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
22-else (GSETTINGS_LOCALINSTALL)
23- execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
24- SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
25-endif (GSETTINGS_LOCALINSTALL)
26-
27-# Run the validator and error if it fails
28-execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
29-execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${ERGO_SCHEMAS} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
30-
31-if (_schemas_invalid)
32- message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
33-endif (_schemas_invalid)
34-
35-# Actually install and recomple schemas
36-message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
37-install (FILES ${ERGO_SCHEMAS} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
38-install (CODE "message (STATUS \"Compiling GSettings schemas\")")
39-install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
40+include(GSettings)
41+add_schema("org.elementary.Ergo.gschema.xml")
42
43 # Pack all
44 SET(CPACK_GENERATOR "DEB")
45
46=== added file 'cmake/FindVala.cmake'
47--- cmake/FindVala.cmake 1970-01-01 00:00:00 +0000
48+++ cmake/FindVala.cmake 2012-03-07 19:17:22 +0000
49@@ -0,0 +1,65 @@
50+##
51+# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
52+#
53+# Redistribution and use in source and binary forms, with or without
54+# modification, are permitted provided that the following conditions are met:
55+#
56+# 1. Redistributions of source code must retain the above copyright notice,
57+# this list of conditions and the following disclaimer.
58+#
59+# 2. Redistributions in binary form must reproduce the above copyright notice,
60+# this list of conditions and the following disclaimer in the documentation
61+# and/or other materials provided with the distribution.
62+#
63+# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
64+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
65+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
66+# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
67+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
68+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
69+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
70+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
71+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
72+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
73+#
74+# The views and conclusions contained in the software and documentation are those
75+# of the authors and should not be interpreted as representing official policies,
76+# either expressed or implied, of Jakob Westhoff
77+##
78+
79+##
80+# Find module for the Vala compiler (valac)
81+#
82+# This module determines wheter a Vala compiler is installed on the current
83+# system and where its executable is.
84+#
85+# Call the module using "find_package(Vala) from within your CMakeLists.txt.
86+#
87+# The following variables will be set after an invocation:
88+#
89+# VALA_FOUND Whether the vala compiler has been found or not
90+# VALA_EXECUTABLE Full path to the valac executable if it has been found
91+# VALA_VERSION Version number of the available valac
92+##
93+
94+
95+# Search for the valac executable in the usual system paths.
96+find_program(VALA_EXECUTABLE
97+ NAMES valac)
98+
99+# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
100+# Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
101+# VALA_EXECUTABLE is set)
102+
103+include(FindPackageHandleStandardArgs)
104+find_package_handle_standard_args(Vala DEFAULT_MSG VALA_EXECUTABLE)
105+
106+mark_as_advanced(VALA_EXECUTABLE)
107+
108+# Determine the valac version
109+if(VALA_FOUND)
110+ execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
111+ OUTPUT_VARIABLE "VALA_VERSION")
112+ string(REPLACE "Vala" "" "VALA_VERSION" ${VALA_VERSION})
113+ string(STRIP ${VALA_VERSION} "VALA_VERSION")
114+endif(VALA_FOUND)
115
116=== added file 'cmake/GSettings.cmake'
117--- cmake/GSettings.cmake 1970-01-01 00:00:00 +0000
118+++ cmake/GSettings.cmake 2012-03-07 19:17:22 +0000
119@@ -0,0 +1,42 @@
120+# GSettings.cmake, CMake macros written for Marlin, feel free to re-use them.
121+
122+option (GSETTINGS_LOCALINSTALL "Install GSettings Schemas locally instead of to the GLib prefix" ON)
123+
124+option (GSETTINGS_COMPILE "Compile GSettings Schemas after installation" ${GSETTINGS_LOCALINSTALL})
125+
126+if(GSETTINGS_LOCALINSTALL)
127+ message(STATUS "GSettings schemas will be installed locally.")
128+endif()
129+
130+if(GSETTINGS_COMPILE)
131+ message(STATUS "GSettings shemas will be compiled.")
132+endif()
133+
134+macro(add_schema SCHEMA_NAME)
135+
136+ set(PKG_CONFIG_EXECUTABLE pkg-config)
137+ # Have an option to not install the schema into where GLib is
138+ if (GSETTINGS_LOCALINSTALL)
139+ SET (GSETTINGS_DIR "${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas/")
140+ else (GSETTINGS_LOCALINSTALL)
141+ execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE)
142+ SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/")
143+ endif (GSETTINGS_LOCALINSTALL)
144+
145+ # Run the validator and error if it fails
146+ execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE)
147+ execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE)
148+
149+ if (_schemas_invalid)
150+ message (SEND_ERROR "Schema validation error: ${_schemas_invalid}")
151+ endif (_schemas_invalid)
152+
153+ # Actually install and recomple schemas
154+ message (STATUS "GSettings schemas will be installed into ${GSETTINGS_DIR}")
155+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL)
156+
157+ if (GSETTINGS_COMPILE)
158+ install (CODE "message (STATUS \"Compiling GSettings schemas\")")
159+ install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})")
160+ endif ()
161+endmacro()
162
163=== added file 'cmake/Makefile'
164--- cmake/Makefile 1970-01-01 00:00:00 +0000
165+++ cmake/Makefile 2012-03-07 19:17:22 +0000
166@@ -0,0 +1,286 @@
167+# CMAKE generated file: DO NOT EDIT!
168+# Generated by "Unix Makefiles" Generator, CMake Version 2.8
169+
170+# Default target executed when no arguments are given to make.
171+default_target: all
172+.PHONY : default_target
173+
174+#=============================================================================
175+# Special targets provided by cmake.
176+
177+# Disable implicit rules so canoncical targets will work.
178+.SUFFIXES:
179+
180+# Remove some rules from gmake that .SUFFIXES does not remove.
181+SUFFIXES =
182+
183+.SUFFIXES: .hpux_make_needs_suffix_list
184+
185+# Suppress display of executed commands.
186+$(VERBOSE).SILENT:
187+
188+# A target that is always out of date.
189+cmake_force:
190+.PHONY : cmake_force
191+
192+#=============================================================================
193+# Set environment variables for the build.
194+
195+# The shell in which to execute make rules.
196+SHELL = /bin/sh
197+
198+# The CMake executable.
199+CMAKE_COMMAND = /usr/bin/cmake
200+
201+# The command to remove a file.
202+RM = /usr/bin/cmake -E remove -f
203+
204+# The top-level source directory on which CMake was run.
205+CMAKE_SOURCE_DIR = /home/mefrio/Scrivania/cmake
206+
207+# The top-level build directory on which CMake was run.
208+CMAKE_BINARY_DIR = /home/mefrio/Scrivania/cmake/cmake
209+
210+#=============================================================================
211+# Targets provided globally by CMake.
212+
213+# Special rule for the target edit_cache
214+edit_cache:
215+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
216+ /usr/bin/cmake -i .
217+.PHONY : edit_cache
218+
219+# Special rule for the target edit_cache
220+edit_cache/fast: edit_cache
221+.PHONY : edit_cache/fast
222+
223+# Special rule for the target install
224+install: preinstall
225+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
226+ /usr/bin/cmake -P cmake_install.cmake
227+.PHONY : install
228+
229+# Special rule for the target install
230+install/fast: preinstall/fast
231+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
232+ /usr/bin/cmake -P cmake_install.cmake
233+.PHONY : install/fast
234+
235+# Special rule for the target install/local
236+install/local: preinstall
237+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
238+ /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
239+.PHONY : install/local
240+
241+# Special rule for the target install/local
242+install/local/fast: install/local
243+.PHONY : install/local/fast
244+
245+# Special rule for the target install/strip
246+install/strip: preinstall
247+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
248+ /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
249+.PHONY : install/strip
250+
251+# Special rule for the target install/strip
252+install/strip/fast: install/strip
253+.PHONY : install/strip/fast
254+
255+# Special rule for the target list_install_components
256+list_install_components:
257+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
258+.PHONY : list_install_components
259+
260+# Special rule for the target list_install_components
261+list_install_components/fast: list_install_components
262+.PHONY : list_install_components/fast
263+
264+# Special rule for the target rebuild_cache
265+rebuild_cache:
266+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
267+ /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
268+.PHONY : rebuild_cache
269+
270+# Special rule for the target rebuild_cache
271+rebuild_cache/fast: rebuild_cache
272+.PHONY : rebuild_cache/fast
273+
274+# The main all target
275+all: cmake_check_build_system
276+ $(CMAKE_COMMAND) -E cmake_progress_start /home/mefrio/Scrivania/cmake/cmake/CMakeFiles /home/mefrio/Scrivania/cmake/cmake/CMakeFiles/progress.marks
277+ $(MAKE) -f CMakeFiles/Makefile2 all
278+ $(CMAKE_COMMAND) -E cmake_progress_start /home/mefrio/Scrivania/cmake/cmake/CMakeFiles 0
279+.PHONY : all
280+
281+# The main clean target
282+clean:
283+ $(MAKE) -f CMakeFiles/Makefile2 clean
284+.PHONY : clean
285+
286+# The main clean target
287+clean/fast: clean
288+.PHONY : clean/fast
289+
290+# Prepare targets for installation.
291+preinstall: all
292+ $(MAKE) -f CMakeFiles/Makefile2 preinstall
293+.PHONY : preinstall
294+
295+# Prepare targets for installation.
296+preinstall/fast:
297+ $(MAKE) -f CMakeFiles/Makefile2 preinstall
298+.PHONY : preinstall/fast
299+
300+# clear depends
301+depend:
302+ $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
303+.PHONY : depend
304+
305+#=============================================================================
306+# Target rules for targets named scratch
307+
308+# Build rule for target.
309+scratch: cmake_check_build_system
310+ $(MAKE) -f CMakeFiles/Makefile2 scratch
311+.PHONY : scratch
312+
313+# fast build rule for target.
314+scratch/fast:
315+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/build
316+.PHONY : scratch/fast
317+
318+src/entry.o: src/entry.c.o
319+.PHONY : src/entry.o
320+
321+# target to build an object file
322+src/entry.c.o:
323+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.o
324+.PHONY : src/entry.c.o
325+
326+src/entry.i: src/entry.c.i
327+.PHONY : src/entry.i
328+
329+# target to preprocess a source file
330+src/entry.c.i:
331+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.i
332+.PHONY : src/entry.c.i
333+
334+src/entry.s: src/entry.c.s
335+.PHONY : src/entry.s
336+
337+# target to generate assembly for a file
338+src/entry.c.s:
339+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/entry.c.s
340+.PHONY : src/entry.c.s
341+
342+src/main_window.o: src/main_window.c.o
343+.PHONY : src/main_window.o
344+
345+# target to build an object file
346+src/main_window.c.o:
347+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.o
348+.PHONY : src/main_window.c.o
349+
350+src/main_window.i: src/main_window.c.i
351+.PHONY : src/main_window.i
352+
353+# target to preprocess a source file
354+src/main_window.c.i:
355+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.i
356+.PHONY : src/main_window.c.i
357+
358+src/main_window.s: src/main_window.c.s
359+.PHONY : src/main_window.s
360+
361+# target to generate assembly for a file
362+src/main_window.c.s:
363+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/main_window.c.s
364+.PHONY : src/main_window.c.s
365+
366+src/menu.o: src/menu.c.o
367+.PHONY : src/menu.o
368+
369+# target to build an object file
370+src/menu.c.o:
371+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.o
372+.PHONY : src/menu.c.o
373+
374+src/menu.i: src/menu.c.i
375+.PHONY : src/menu.i
376+
377+# target to preprocess a source file
378+src/menu.c.i:
379+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.i
380+.PHONY : src/menu.c.i
381+
382+src/menu.s: src/menu.c.s
383+.PHONY : src/menu.s
384+
385+# target to generate assembly for a file
386+src/menu.c.s:
387+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/menu.c.s
388+.PHONY : src/menu.c.s
389+
390+src/notebook.o: src/notebook.c.o
391+.PHONY : src/notebook.o
392+
393+# target to build an object file
394+src/notebook.c.o:
395+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.o
396+.PHONY : src/notebook.c.o
397+
398+src/notebook.i: src/notebook.c.i
399+.PHONY : src/notebook.i
400+
401+# target to preprocess a source file
402+src/notebook.c.i:
403+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.i
404+.PHONY : src/notebook.c.i
405+
406+src/notebook.s: src/notebook.c.s
407+.PHONY : src/notebook.s
408+
409+# target to generate assembly for a file
410+src/notebook.c.s:
411+ $(MAKE) -f CMakeFiles/scratch.dir/build.make CMakeFiles/scratch.dir/src/notebook.c.s
412+.PHONY : src/notebook.c.s
413+
414+# Help Target
415+help:
416+ @echo "The following are some of the valid targets for this Makefile:"
417+ @echo "... all (the default if no target is provided)"
418+ @echo "... clean"
419+ @echo "... depend"
420+ @echo "... edit_cache"
421+ @echo "... install"
422+ @echo "... install/local"
423+ @echo "... install/strip"
424+ @echo "... list_install_components"
425+ @echo "... rebuild_cache"
426+ @echo "... scratch"
427+ @echo "... src/entry.o"
428+ @echo "... src/entry.i"
429+ @echo "... src/entry.s"
430+ @echo "... src/main_window.o"
431+ @echo "... src/main_window.i"
432+ @echo "... src/main_window.s"
433+ @echo "... src/menu.o"
434+ @echo "... src/menu.i"
435+ @echo "... src/menu.s"
436+ @echo "... src/notebook.o"
437+ @echo "... src/notebook.i"
438+ @echo "... src/notebook.s"
439+.PHONY : help
440+
441+
442+
443+#=============================================================================
444+# Special targets to cleanup operation of make.
445+
446+# Special rule to run CMake to check the build system integrity.
447+# No rule that depends on this can have commands that come from listfiles
448+# because they might be regenerated.
449+cmake_check_build_system:
450+ $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
451+.PHONY : cmake_check_build_system
452+
453
454=== added file 'cmake/ParseArguments.cmake'
455--- cmake/ParseArguments.cmake 1970-01-01 00:00:00 +0000
456+++ cmake/ParseArguments.cmake 2012-03-07 19:17:22 +0000
457@@ -0,0 +1,36 @@
458+##
459+# This is a helper Macro to parse optional arguments in Macros/Functions
460+# It has been taken from the public CMake wiki.
461+# See http://www.cmake.org/Wiki/CMakeMacroParseArguments for documentation and
462+# licensing.
463+##
464+macro(parse_arguments prefix arg_names option_names)
465+ set(DEFAULT_ARGS)
466+ foreach(arg_name ${arg_names})
467+ set(${prefix}_${arg_name})
468+ endforeach(arg_name)
469+ foreach(option ${option_names})
470+ set(${prefix}_${option} FALSE)
471+ endforeach(option)
472+
473+ set(current_arg_name DEFAULT_ARGS)
474+ set(current_arg_list)
475+ foreach(arg ${ARGN})
476+ set(larg_names ${arg_names})
477+ list(FIND larg_names "${arg}" is_arg_name)
478+ if(is_arg_name GREATER -1)
479+ set(${prefix}_${current_arg_name} ${current_arg_list})
480+ set(current_arg_name ${arg})
481+ set(current_arg_list)
482+ else(is_arg_name GREATER -1)
483+ set(loption_names ${option_names})
484+ list(FIND loption_names "${arg}" is_option)
485+ if(is_option GREATER -1)
486+ set(${prefix}_${arg} TRUE)
487+ else(is_option GREATER -1)
488+ set(current_arg_list ${current_arg_list} ${arg})
489+ endif(is_option GREATER -1)
490+ endif(is_arg_name GREATER -1)
491+ endforeach(arg)
492+ set(${prefix}_${current_arg_name} ${current_arg_list})
493+endmacro(parse_arguments)
494
495=== added file 'cmake/README'
496--- cmake/README 1970-01-01 00:00:00 +0000
497+++ cmake/README 2012-03-07 19:17:22 +0000
498@@ -0,0 +1,10 @@
499+ Elementary CMake modules
500+
501+This is a set of CMake modules: Translations, GSettings, and Vala modules.
502+
503+For all the Vala related modules see README.Vala.rst:
504+ - ParseArguments.cmake
505+ - ValaPrecompile.cmake
506+ - ValaVersion.cmake
507+ - FindVala.cmake
508+
509
510=== added file 'cmake/README.Vala.rst'
511--- cmake/README.Vala.rst 1970-01-01 00:00:00 +0000
512+++ cmake/README.Vala.rst 2012-03-07 19:17:22 +0000
513@@ -0,0 +1,173 @@
514+==========
515+Vala CMake
516+==========
517+:Author:
518+ Jakob Westhoff
519+:Version:
520+ Draft
521+
522+
523+Overview
524+========
525+
526+Vala CMake is a collection of macros for the CMake_ build system to allow the
527+creation and management of projects developed using the Vala_ programming
528+language or its "Genie" flavor (less tested).
529+
530+
531+Installation
532+============
533+
534+To use the Vala macros in your own project you need to copy the macro files to
535+an arbitrary folder in your projects directory and reference them in your
536+``CMakeLists.txt`` file.
537+
538+Assuming the macros are stored under ``cmake/vala`` in your projects folder you
539+need to add the following information to your base ``CMakeLists.txt``::
540+
541+ list(APPEND CMAKE_MODULE_PATH
542+ ${CMAKE_SOURCE_DIR}/cmake/vala
543+ )
544+
545+After the new module path as been added you can simply include the provided
546+modules or use the provided find routines.
547+
548+
549+Finding Vala
550+============
551+
552+The find module for vala works like any other Find module in CMake.
553+You can use it by simply calling the usual ``find_package`` function. Default
554+parameters like ``REQUIRED`` and ``QUIETLY`` are supported.
555+
556+::
557+
558+ find_package(Vala REQUIRED)
559+
560+After a successful call to the find_package function the following variables
561+will be set:
562+
563+VALA_FOUND
564+ Whether the vala compiler has been found or not
565+
566+VALA_EXECUTABLE
567+ Full path to the valac executable if it has been found
568+
569+VALA_VERSION
570+ Version number of the available valac
571+
572+
573+Precompiling Vala sources
574+=========================
575+
576+CMake is mainly supposed to handle c or c++ based projects. Luckily every vala
577+program is translated into plain c code using the vala compiler, followed by
578+normal compilation of the generated c program using gcc.
579+
580+The macro ``vala_precompile`` uses that fact to create c files from your .vala
581+sources for further CMake processing.
582+
583+The first parameter provided is a variable, which will be filled with a list of
584+c files outputted by the vala compiler. This list can than be used in
585+conjunction with functions like ``add_executable`` or others to create the
586+necessary compile rules with CMake.
587+
588+The initial variable is followed by a list of .vala files to be compiled.
589+Please take care to add every vala file belonging to the currently compiled
590+project or library as Vala will otherwise not be able to resolve all
591+dependencies.
592+
593+The following sections may be specified afterwards to provide certain options
594+to the vala compiler:
595+
596+PACKAGES
597+ A list of vala packages/libraries to be used during the compile cycle. The
598+ package names are exactly the same, as they would be passed to the valac
599+ "--pkg=" option.
600+
601+OPTIONS
602+ A list of optional options to be passed to the valac executable. This can be
603+ used to pass "--thread" for example to enable multi-threading support.
604+
605+DIRECTORY
606+ Specify the directory where the output source files will be stored. If
607+ ommitted, the source files will be stored in CMAKE_CURRENT_BINARY_DIR.
608+
609+CUSTOM_VAPIS
610+ A list of custom vapi files to be included for compilation. This can be
611+ useful to include freshly created vala libraries without having to install
612+ them in the system.
613+
614+GENERATE_VAPI
615+ Pass all the needed flags to the compiler to create an internal vapi for
616+ the compiled library. The provided name will be used for this and a
617+ <provided_name>.vapi file will be created.
618+
619+GENERATE_HEADER
620+ Let the compiler generate a header file for the compiled code. There will
621+ be a header file as well as an internal header file being generated called
622+ <provided_name>.h and <provided_name>_internal.h
623+
624+The following call is a simple example to the vala_precompile macro showing an
625+example to every of the optional sections::
626+
627+ vala_precompile(VALA_C
628+ source1.vala
629+ source2.vala
630+ source3.vala
631+ PACKAGES
632+ gtk+-2.0
633+ gio-1.0
634+ posix
635+ OPTIONS
636+ --thread
637+ CUSTOM_VAPIS
638+ some_vapi.vapi
639+ GENERATE_VAPI
640+ myvapi
641+ GENERATE_HEADER
642+ myheader
643+ )
644+
645+Most important is the variable VALA_C which will contain all the generated c
646+file names after the call. The easiest way to use this information is to tell
647+CMake to create an executable out of it.
648+
649+::
650+
651+ add_executable(myexecutable ${VALA_C})
652+
653+
654+Further reading
655+===============
656+
657+The `Pdf Presenter Console`__ , which is a vala based project of mine, makes
658+heavy usage of the here described macros. To look at a real world example of
659+these macros the mentioned project is the right place to take a look. The svn
660+trunk of it can be found at::
661+
662+ svn://pureenergy.cc/pdf_presenter_console/trunk
663+
664+
665+__ http://westhoffswelt.de/projects/pdf_presenter_console.html
666+
667+
668+Acknowledgments
669+===============
670+
671+Thanks go out to Florian Sowade, a fellow local PHP-Usergroupie, who helped me
672+a lot with the initial version of this macros and always answered my mostly
673+dumb CMake questions.
674+
675+.. _CMake: http://cmake.org
676+.. _Vala: http://live.gnome.org/Vala
677+.. _Genie: http://live.gnome.org/Genie
678+
679+
680+
681
682+..
683+ Local Variables:
684+ mode: rst
685+ fill-column: 79
686+ End:
687+ vim: et syn=rst tw=79
688
689=== added file 'cmake/Tests.cmake'
690--- cmake/Tests.cmake 1970-01-01 00:00:00 +0000
691+++ cmake/Tests.cmake 2012-03-07 19:17:22 +0000
692@@ -0,0 +1,5 @@
693+# Test macros for Marlin, feel free to re-use them.
694+
695+macro(add_test_executable EXE_NAME)
696+ add_test(${EXE_NAME} gtester ${CMAKE_CURRENT_BINARY_DIR}/${EXE_NAME})
697+endmacro()
698
699=== added file 'cmake/Translations.cmake'
700--- cmake/Translations.cmake 1970-01-01 00:00:00 +0000
701+++ cmake/Translations.cmake 2012-03-07 19:17:22 +0000
702@@ -0,0 +1,41 @@
703+# Translations.cmake, CMake macros written for Marlin, feel free to re-use them
704+
705+macro(add_translations_directory NLS_PACKAGE)
706+ add_custom_target (i18n ALL COMMENT “Building i18n messages.”)
707+ find_program (MSGFMT_EXECUTABLE msgfmt)
708+ file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po)
709+ foreach (PO_INPUT ${PO_FILES})
710+ get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE)
711+ set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo)
712+ add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT})
713+
714+ install (FILES ${MO_OUTPUT} DESTINATION
715+ share/locale/${PO_INPUT_BASE}/LC_MESSAGES
716+ RENAME ${NLS_PACKAGE}.mo)
717+ endforeach (PO_INPUT ${PO_FILES})
718+endmacro(add_translations_directory)
719+
720+
721+macro(add_translations_catalog NLS_PACKAGE)
722+ add_custom_target (pot COMMENT “Building translation catalog.”)
723+ find_program (XGETTEXT_EXECUTABLE xgettext)
724+
725+
726+ set(C_SOURCE "")
727+
728+ foreach(FILES_INPUT ${ARGN})
729+ file (GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.c)
730+ foreach(C_FILE ${SOURCE_FILES})
731+ set(C_SOURCE ${C_SOURCE} ${C_FILE})
732+ endforeach()
733+ file (GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.vala)
734+ foreach(C_FILE ${SOURCE_FILES})
735+ set(C_SOURCE ${C_SOURCE} ${C_FILE})
736+ endforeach()
737+ endforeach()
738+
739+ add_custom_command (TARGET pot COMMAND
740+ ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
741+ ${VALA_SOURCE} ${C_SOURCE} --keyword="_" --keyword="N_" --from-code=UTF-8
742+ )
743+endmacro()
744
745=== added file 'cmake/ValaPrecompile.cmake'
746--- cmake/ValaPrecompile.cmake 1970-01-01 00:00:00 +0000
747+++ cmake/ValaPrecompile.cmake 2012-03-07 19:17:22 +0000
748@@ -0,0 +1,187 @@
749+##
750+# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
751+#
752+# Redistribution and use in source and binary forms, with or without
753+# modification, are permitted provided that the following conditions are met:
754+#
755+# 1. Redistributions of source code must retain the above copyright notice,
756+# this list of conditions and the following disclaimer.
757+#
758+# 2. Redistributions in binary form must reproduce the above copyright notice,
759+# this list of conditions and the following disclaimer in the documentation
760+# and/or other materials provided with the distribution.
761+#
762+# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
763+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
764+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
765+# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
766+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
767+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
768+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
769+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
770+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
771+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
772+#
773+# The views and conclusions contained in the software and documentation are those
774+# of the authors and should not be interpreted as representing official policies,
775+# either expressed or implied, of Jakob Westhoff
776+##
777+
778+include(ParseArguments)
779+find_package(Vala REQUIRED)
780+
781+##
782+# Compile vala files to their c equivalents for further processing.
783+#
784+# The "vala_precompile" macro takes care of calling the valac executable on the
785+# given source to produce c files which can then be processed further using
786+# default cmake functions.
787+#
788+# The first parameter provided is a variable, which will be filled with a list
789+# of c files outputted by the vala compiler. This list can than be used in
790+# conjuction with functions like "add_executable" or others to create the
791+# neccessary compile rules with CMake.
792+#
793+# The initial variable is followed by a list of .vala files to be compiled.
794+# Please take care to add every vala file belonging to the currently compiled
795+# project or library as Vala will otherwise not be able to resolve all
796+# dependencies.
797+#
798+# The following sections may be specified afterwards to provide certain options
799+# to the vala compiler:
800+#
801+# PACKAGES
802+# A list of vala packages/libraries to be used during the compile cycle. The
803+# package names are exactly the same, as they would be passed to the valac
804+# "--pkg=" option.
805+#
806+# OPTIONS
807+# A list of optional options to be passed to the valac executable. This can be
808+# used to pass "--thread" for example to enable multi-threading support.
809+#
810+# CUSTOM_VAPIS
811+# A list of custom vapi files to be included for compilation. This can be
812+# useful to include freshly created vala libraries without having to install
813+# them in the system.
814+#
815+# GENERATE_VAPI
816+# Pass all the needed flags to the compiler to create an internal vapi for
817+# the compiled library. The provided name will be used for this and a
818+# <provided_name>.vapi file will be created.
819+#
820+# GENERATE_HEADER
821+# Let the compiler generate a header file for the compiled code. There will
822+# be a header file as well as an internal header file being generated called
823+# <provided_name>.h and <provided_name>_internal.h
824+#
825+# The following call is a simple example to the vala_precompile macro showing
826+# an example to every of the optional sections:
827+#
828+# vala_precompile(VALA_C
829+# source1.vala
830+# source2.vala
831+# source3.vala
832+# PACKAGES
833+# gtk+-2.0
834+# gio-1.0
835+# posix
836+# DIRECTORY
837+# gen
838+# OPTIONS
839+# --thread
840+# CUSTOM_VAPIS
841+# some_vapi.vapi
842+# GENERATE_VAPI
843+# myvapi
844+# GENERATE_HEADER
845+# myheader
846+# )
847+#
848+# Most important is the variable VALA_C which will contain all the generated c
849+# file names after the call.
850+##
851+
852+macro(vala_precompile output)
853+ parse_arguments(ARGS "PACKAGES;OPTIONS;DIRECTORY;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN})
854+ if(ARGS_DIRECTORY)
855+ set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY})
856+ else(ARGS_DIRECTORY)
857+ set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
858+ endif(ARGS_DIRECTORY)
859+ include_directories(${DIRECTORY})
860+ set(vala_pkg_opts "")
861+ foreach(pkg ${ARGS_PACKAGES})
862+ list(APPEND vala_pkg_opts "--pkg=${pkg}")
863+ endforeach(pkg ${ARGS_PACKAGES})
864+ set(in_files "")
865+ set(out_files "")
866+ set(${output} "")
867+ foreach(src ${ARGS_DEFAULT_ARGS})
868+ string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" src ${src})
869+ string(REGEX MATCH "^/" IS_MATCHED ${src})
870+ if(${IS_MATCHED} MATCHES "/")
871+ list(APPEND in_files "${src}")
872+ else()
873+ list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
874+ endif()
875+ string(REPLACE ".vala" ".c" src ${src})
876+ string(REPLACE ".gs" ".c" src ${src})
877+ if(${IS_MATCHED} MATCHES "/")
878+ get_filename_component(VALA_FILE_NAME ${src} NAME)
879+ set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${VALA_FILE_NAME}")
880+ list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${VALA_FILE_NAME}")
881+ else()
882+ set(out_file "${DIRECTORY}/${src}")
883+ list(APPEND out_files "${DIRECTORY}/${src}")
884+ endif()
885+ list(APPEND ${output} ${out_file})
886+ endforeach(src ${ARGS_DEFAULT_ARGS})
887+
888+ set(custom_vapi_arguments "")
889+ if(ARGS_CUSTOM_VAPIS)
890+ foreach(vapi ${ARGS_CUSTOM_VAPIS})
891+ if(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
892+ list(APPEND custom_vapi_arguments ${vapi})
893+ else (${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
894+ list(APPEND custom_vapi_arguments ${CMAKE_CURRENT_SOURCE_DIR}/${vapi})
895+ endif(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
896+ endforeach(vapi ${ARGS_CUSTOM_VAPIS})
897+ endif(ARGS_CUSTOM_VAPIS)
898+
899+ set(vapi_arguments "")
900+ if(ARGS_GENERATE_VAPI)
901+ list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi")
902+ set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi")
903+
904+ # Header and internal header is needed to generate internal vapi
905+ if (NOT ARGS_GENERATE_HEADER)
906+ set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
907+ endif(NOT ARGS_GENERATE_HEADER)
908+ endif(ARGS_GENERATE_VAPI)
909+
910+ set(header_arguments "")
911+ if(ARGS_GENERATE_HEADER)
912+ list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
913+ list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
914+ list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
915+ list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
916+ endif(ARGS_GENERATE_HEADER)
917+
918+ add_custom_command(OUTPUT ${out_files}
919+ COMMAND
920+ ${VALA_EXECUTABLE}
921+ ARGS
922+ "-C"
923+ ${header_arguments}
924+ ${vapi_arguments}
925+ "-b" ${CMAKE_CURRENT_SOURCE_DIR}
926+ "-d" ${DIRECTORY}
927+ ${vala_pkg_opts}
928+ ${ARGS_OPTIONS}
929+ ${in_files}
930+ ${custom_vapi_arguments}
931+ DEPENDS
932+ ${in_files}
933+ ${ARGS_CUSTOM_VAPIS}
934+ )
935+endmacro(vala_precompile)
936
937=== added file 'cmake/ValaVersion.cmake'
938--- cmake/ValaVersion.cmake 1970-01-01 00:00:00 +0000
939+++ cmake/ValaVersion.cmake 2012-03-07 19:17:22 +0000
940@@ -0,0 +1,96 @@
941+##
942+# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
943+#
944+# Redistribution and use in source and binary forms, with or without
945+# modification, are permitted provided that the following conditions are met:
946+#
947+# 1. Redistributions of source code must retain the above copyright notice,
948+# this list of conditions and the following disclaimer.
949+#
950+# 2. Redistributions in binary form must reproduce the above copyright notice,
951+# this list of conditions and the following disclaimer in the documentation
952+# and/or other materials provided with the distribution.
953+#
954+# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
955+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
956+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
957+# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
958+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
959+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
960+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
961+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
962+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
963+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
964+#
965+# The views and conclusions contained in the software and documentation are those
966+# of the authors and should not be interpreted as representing official policies,
967+# either expressed or implied, of Jakob Westhoff
968+##
969+
970+include(ParseArguments)
971+find_package(Vala REQUIRED)
972+
973+##
974+# Ensure a certain valac version is available
975+#
976+# The initial argument is the version to check for
977+#
978+# It may be followed by a optional parameter to specifiy a version range. The
979+# following options are valid:
980+#
981+# EXACT
982+# Vala needs to be available in the exact version given
983+#
984+# MINIMUM
985+# The provided version is the minimum version. Therefore Vala needs to be
986+# available in the given version or any higher version
987+#
988+# MAXIMUM
989+# The provided version is the maximum. Therefore Vala needs to be available
990+# in the given version or any version older than this
991+#
992+# If no option is specified the version will be treated as a minimal version.
993+##
994+macro(ensure_vala_version version)
995+ parse_arguments(ARGS "" "MINIMUM;MAXIMUM;EXACT" ${ARGN})
996+ set(compare_message "")
997+ set(error_message "")
998+ if(ARGS_MINIMUM)
999+ set(compare_message "a minimum ")
1000+ set(error_message "or greater ")
1001+ elseif(ARGS_MAXIMUM)
1002+ set(compare_message "a maximum ")
1003+ set(error_message "or less ")
1004+ endif(ARGS_MINIMUM)
1005+
1006+ message(STATUS
1007+ "checking for ${compare_message}Vala version of ${version}"
1008+ )
1009+
1010+ unset(version_accepted)
1011+
1012+ # MINIMUM is the default if no option is specified
1013+ if(ARGS_EXACT)
1014+ if(${VALA_VERSION} VERSION_EQUAL ${version} )
1015+ set(version_accepted TRUE)
1016+ endif(${VALA_VERSION} VERSION_EQUAL ${version})
1017+ elseif(ARGS_MAXIMUM)
1018+ if(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
1019+ set(version_accepted TRUE)
1020+ endif(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
1021+ else(ARGS_MAXIMUM)
1022+ if(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
1023+ set(version_accepted TRUE)
1024+ endif(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
1025+ endif(ARGS_EXACT)
1026+
1027+ if (NOT version_accepted)
1028+ message(FATAL_ERROR
1029+ "Vala version ${version} ${error_message}is required."
1030+ )
1031+ endif(NOT version_accepted)
1032+
1033+ message(STATUS
1034+ " found Vala, version ${VALA_VERSION}"
1035+ )
1036+endmacro(ensure_vala_version)
1037
1038=== removed directory 'cmake/vala'
1039=== removed file 'cmake/vala/FindVala.cmake'
1040--- cmake/vala/FindVala.cmake 2011-07-11 21:14:27 +0000
1041+++ cmake/vala/FindVala.cmake 1970-01-01 00:00:00 +0000
1042@@ -1,65 +0,0 @@
1043-##
1044-# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
1045-#
1046-# Redistribution and use in source and binary forms, with or without
1047-# modification, are permitted provided that the following conditions are met:
1048-#
1049-# 1. Redistributions of source code must retain the above copyright notice,
1050-# this list of conditions and the following disclaimer.
1051-#
1052-# 2. Redistributions in binary form must reproduce the above copyright notice,
1053-# this list of conditions and the following disclaimer in the documentation
1054-# and/or other materials provided with the distribution.
1055-#
1056-# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
1057-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1058-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
1059-# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1060-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1061-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1062-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1063-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
1064-# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
1065-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1066-#
1067-# The views and conclusions contained in the software and documentation are those
1068-# of the authors and should not be interpreted as representing official policies,
1069-# either expressed or implied, of Jakob Westhoff
1070-##
1071-
1072-##
1073-# Find module for the Vala compiler (valac)
1074-#
1075-# This module determines wheter a Vala compiler is installed on the current
1076-# system and where its executable is.
1077-#
1078-# Call the module using "find_package(Vala) from within your CMakeLists.txt.
1079-#
1080-# The following variables will be set after an invocation:
1081-#
1082-# VALA_FOUND Whether the vala compiler has been found or not
1083-# VALA_EXECUTABLE Full path to the valac executable if it has been found
1084-# VALA_VERSION Version number of the available valac
1085-##
1086-
1087-
1088-# Search for the valac executable in the usual system paths.
1089-find_program(VALA_EXECUTABLE
1090- NAMES valac)
1091-
1092-# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
1093-# Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
1094-# VALA_EXECUTABLE is set)
1095-
1096-include(FindPackageHandleStandardArgs)
1097-find_package_handle_standard_args(Vala DEFAULT_MSG VALA_EXECUTABLE)
1098-
1099-mark_as_advanced(VALA_EXECUTABLE)
1100-
1101-# Determine the valac version
1102-if(VALA_FOUND)
1103- execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
1104- OUTPUT_VARIABLE "VALA_VERSION")
1105- string(REPLACE "Vala" "" "VALA_VERSION" ${VALA_VERSION})
1106- string(STRIP ${VALA_VERSION} "VALA_VERSION")
1107-endif(VALA_FOUND)
1108
1109=== removed file 'cmake/vala/ParseArguments.cmake'
1110--- cmake/vala/ParseArguments.cmake 2011-07-11 21:14:27 +0000
1111+++ cmake/vala/ParseArguments.cmake 1970-01-01 00:00:00 +0000
1112@@ -1,36 +0,0 @@
1113-##
1114-# This is a helper Macro to parse optional arguments in Macros/Functions
1115-# It has been taken from the public CMake wiki.
1116-# See http://www.cmake.org/Wiki/CMakeMacroParseArguments for documentation and
1117-# licensing.
1118-##
1119-macro(parse_arguments prefix arg_names option_names)
1120- set(DEFAULT_ARGS)
1121- foreach(arg_name ${arg_names})
1122- set(${prefix}_${arg_name})
1123- endforeach(arg_name)
1124- foreach(option ${option_names})
1125- set(${prefix}_${option} FALSE)
1126- endforeach(option)
1127-
1128- set(current_arg_name DEFAULT_ARGS)
1129- set(current_arg_list)
1130- foreach(arg ${ARGN})
1131- set(larg_names ${arg_names})
1132- list(FIND larg_names "${arg}" is_arg_name)
1133- if(is_arg_name GREATER -1)
1134- set(${prefix}_${current_arg_name} ${current_arg_list})
1135- set(current_arg_name ${arg})
1136- set(current_arg_list)
1137- else(is_arg_name GREATER -1)
1138- set(loption_names ${option_names})
1139- list(FIND loption_names "${arg}" is_option)
1140- if(is_option GREATER -1)
1141- set(${prefix}_${arg} TRUE)
1142- else(is_option GREATER -1)
1143- set(current_arg_list ${current_arg_list} ${arg})
1144- endif(is_option GREATER -1)
1145- endif(is_arg_name GREATER -1)
1146- endforeach(arg)
1147- set(${prefix}_${current_arg_name} ${current_arg_list})
1148-endmacro(parse_arguments)
1149
1150=== removed file 'cmake/vala/ValaPrecompile.cmake'
1151--- cmake/vala/ValaPrecompile.cmake 2011-07-11 21:14:27 +0000
1152+++ cmake/vala/ValaPrecompile.cmake 1970-01-01 00:00:00 +0000
1153@@ -1,175 +0,0 @@
1154-##
1155-# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
1156-#
1157-# Redistribution and use in source and binary forms, with or without
1158-# modification, are permitted provided that the following conditions are met:
1159-#
1160-# 1. Redistributions of source code must retain the above copyright notice,
1161-# this list of conditions and the following disclaimer.
1162-#
1163-# 2. Redistributions in binary form must reproduce the above copyright notice,
1164-# this list of conditions and the following disclaimer in the documentation
1165-# and/or other materials provided with the distribution.
1166-#
1167-# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
1168-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1169-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
1170-# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1171-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1172-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1173-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1174-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
1175-# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
1176-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1177-#
1178-# The views and conclusions contained in the software and documentation are those
1179-# of the authors and should not be interpreted as representing official policies,
1180-# either expressed or implied, of Jakob Westhoff
1181-##
1182-
1183-include(ParseArguments)
1184-find_package(Vala REQUIRED)
1185-
1186-##
1187-# Compile vala files to their c equivalents for further processing.
1188-#
1189-# The "vala_precompile" macro takes care of calling the valac executable on the
1190-# given source to produce c files which can then be processed further using
1191-# default cmake functions.
1192-#
1193-# The first parameter provided is a variable, which will be filled with a list
1194-# of c files outputted by the vala compiler. This list can than be used in
1195-# conjuction with functions like "add_executable" or others to create the
1196-# neccessary compile rules with CMake.
1197-#
1198-# The initial variable is followed by a list of .vala files to be compiled.
1199-# Please take care to add every vala file belonging to the currently compiled
1200-# project or library as Vala will otherwise not be able to resolve all
1201-# dependencies.
1202-#
1203-# The following sections may be specified afterwards to provide certain options
1204-# to the vala compiler:
1205-#
1206-# PACKAGES
1207-# A list of vala packages/libraries to be used during the compile cycle. The
1208-# package names are exactly the same, as they would be passed to the valac
1209-# "--pkg=" option.
1210-#
1211-# OPTIONS
1212-# A list of optional options to be passed to the valac executable. This can be
1213-# used to pass "--thread" for example to enable multi-threading support.
1214-#
1215-# CUSTOM_VAPIS
1216-# A list of custom vapi files to be included for compilation. This can be
1217-# useful to include freshly created vala libraries without having to install
1218-# them in the system.
1219-#
1220-# GENERATE_VAPI
1221-# Pass all the needed flags to the compiler to create an internal vapi for
1222-# the compiled library. The provided name will be used for this and a
1223-# <provided_name>.vapi file will be created.
1224-#
1225-# GENERATE_HEADER
1226-# Let the compiler generate a header file for the compiled code. There will
1227-# be a header file as well as an internal header file being generated called
1228-# <provided_name>.h and <provided_name>_internal.h
1229-#
1230-# The following call is a simple example to the vala_precompile macro showing
1231-# an example to every of the optional sections:
1232-#
1233-# vala_precompile(VALA_C
1234-# source1.vala
1235-# source2.vala
1236-# source3.vala
1237-# PACKAGES
1238-# gtk+-2.0
1239-# gio-1.0
1240-# posix
1241-# DIRECTORY
1242-# gen
1243-# OPTIONS
1244-# --thread
1245-# CUSTOM_VAPIS
1246-# some_vapi.vapi
1247-# GENERATE_VAPI
1248-# myvapi
1249-# GENERATE_HEADER
1250-# myheader
1251-# )
1252-#
1253-# Most important is the variable VALA_C which will contain all the generated c
1254-# file names after the call.
1255-##
1256-
1257-macro(vala_precompile output)
1258- parse_arguments(ARGS "PACKAGES;OPTIONS;DIRECTORY;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN})
1259- if(ARGS_DIRECTORY)
1260- set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY})
1261- else(ARGS_DIRECTORY)
1262- set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
1263- endif(ARGS_DIRECTORY)
1264- include_directories(${DIRECTORY})
1265- set(vala_pkg_opts "")
1266- foreach(pkg ${ARGS_PACKAGES})
1267- list(APPEND vala_pkg_opts "--pkg=${pkg}")
1268- endforeach(pkg ${ARGS_PACKAGES})
1269- set(in_files "")
1270- set(out_files "")
1271- set(${output} "")
1272- foreach(src ${ARGS_DEFAULT_ARGS})
1273- list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
1274- string(REPLACE ".vala" ".c" src ${src})
1275- string(REPLACE ".gs" ".c" src ${src})
1276- set(out_file "${DIRECTORY}/${src}")
1277- list(APPEND out_files "${DIRECTORY}/${src}")
1278- list(APPEND ${output} ${out_file})
1279- endforeach(src ${ARGS_DEFAULT_ARGS})
1280-
1281- set(custom_vapi_arguments "")
1282- if(ARGS_CUSTOM_VAPIS)
1283- foreach(vapi ${ARGS_CUSTOM_VAPIS})
1284- if(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
1285- list(APPEND custom_vapi_arguments ${vapi})
1286- else (${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
1287- list(APPEND custom_vapi_arguments ${CMAKE_CURRENT_SOURCE_DIR}/${vapi})
1288- endif(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
1289- endforeach(vapi ${ARGS_CUSTOM_VAPIS})
1290- endif(ARGS_CUSTOM_VAPIS)
1291-
1292- set(vapi_arguments "")
1293- if(ARGS_GENERATE_VAPI)
1294- list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi")
1295- set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi")
1296-
1297- # Header and internal header is needed to generate internal vapi
1298- if (NOT ARGS_GENERATE_HEADER)
1299- set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
1300- endif(NOT ARGS_GENERATE_HEADER)
1301- endif(ARGS_GENERATE_VAPI)
1302-
1303- set(header_arguments "")
1304- if(ARGS_GENERATE_HEADER)
1305- list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
1306- list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
1307- list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h")
1308- list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
1309- endif(ARGS_GENERATE_HEADER)
1310-
1311- add_custom_command(OUTPUT ${out_files}
1312- COMMAND
1313- ${VALA_EXECUTABLE}
1314- ARGS
1315- "-C"
1316- ${header_arguments}
1317- ${vapi_arguments}
1318- "-b" ${CMAKE_CURRENT_SOURCE_DIR}
1319- "-d" ${DIRECTORY}
1320- ${vala_pkg_opts}
1321- ${ARGS_OPTIONS}
1322- ${in_files}
1323- ${custom_vapi_arguments}
1324- DEPENDS
1325- ${in_files}
1326- ${ARGS_CUSTOM_VAPIS}
1327- )
1328-endmacro(vala_precompile)
1329
1330=== removed file 'cmake/vala/ValaVersion.cmake'
1331--- cmake/vala/ValaVersion.cmake 2011-07-11 21:14:27 +0000
1332+++ cmake/vala/ValaVersion.cmake 1970-01-01 00:00:00 +0000
1333@@ -1,96 +0,0 @@
1334-##
1335-# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
1336-#
1337-# Redistribution and use in source and binary forms, with or without
1338-# modification, are permitted provided that the following conditions are met:
1339-#
1340-# 1. Redistributions of source code must retain the above copyright notice,
1341-# this list of conditions and the following disclaimer.
1342-#
1343-# 2. Redistributions in binary form must reproduce the above copyright notice,
1344-# this list of conditions and the following disclaimer in the documentation
1345-# and/or other materials provided with the distribution.
1346-#
1347-# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
1348-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1349-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
1350-# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1351-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1352-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1353-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1354-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
1355-# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
1356-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1357-#
1358-# The views and conclusions contained in the software and documentation are those
1359-# of the authors and should not be interpreted as representing official policies,
1360-# either expressed or implied, of Jakob Westhoff
1361-##
1362-
1363-include(ParseArguments)
1364-find_package(Vala REQUIRED)
1365-
1366-##
1367-# Ensure a certain valac version is available
1368-#
1369-# The initial argument is the version to check for
1370-#
1371-# It may be followed by a optional parameter to specifiy a version range. The
1372-# following options are valid:
1373-#
1374-# EXACT
1375-# Vala needs to be available in the exact version given
1376-#
1377-# MINIMUM
1378-# The provided version is the minimum version. Therefore Vala needs to be
1379-# available in the given version or any higher version
1380-#
1381-# MAXIMUM
1382-# The provided version is the maximum. Therefore Vala needs to be available
1383-# in the given version or any version older than this
1384-#
1385-# If no option is specified the version will be treated as a minimal version.
1386-##
1387-macro(ensure_vala_version version)
1388- parse_arguments(ARGS "" "MINIMUM;MAXIMUM;EXACT" ${ARGN})
1389- set(compare_message "")
1390- set(error_message "")
1391- if(ARGS_MINIMUM)
1392- set(compare_message "a minimum ")
1393- set(error_message "or greater ")
1394- elseif(ARGS_MAXIMUM)
1395- set(compare_message "a maximum ")
1396- set(error_message "or less ")
1397- endif(ARGS_MINIMUM)
1398-
1399- message(STATUS
1400- "checking for ${compare_message}Vala version of ${version}"
1401- )
1402-
1403- unset(version_accepted)
1404-
1405- # MINIMUM is the default if no option is specified
1406- if(ARGS_EXACT)
1407- if(${VALA_VERSION} VERSION_EQUAL ${version} )
1408- set(version_accepted TRUE)
1409- endif(${VALA_VERSION} VERSION_EQUAL ${version})
1410- elseif(ARGS_MAXIMUM)
1411- if(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
1412- set(version_accepted TRUE)
1413- endif(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
1414- else(ARGS_MAXIMUM)
1415- if(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
1416- set(version_accepted TRUE)
1417- endif(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version})
1418- endif(ARGS_EXACT)
1419-
1420- if (NOT version_accepted)
1421- message(FATAL_ERROR
1422- "Vala version ${version} ${error_message}is required."
1423- )
1424- endif(NOT version_accepted)
1425-
1426- message(STATUS
1427- " found Vala, version ${VALA_VERSION}"
1428- )
1429-endmacro(ensure_vala_version)

Subscribers

People subscribed via source and target branches

to all changes: