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

Proposed by Sergey "Shnatsel" Davidoff on 2014-07-21
Status: Merged
Approved by: xapantu on 2014-07-21
Approved revision: 429
Merged at revision: 429
Proposed branch: lp:~shnatsel/slingshot/update-cmake-modules
Merge into: lp:~elementary-pantheon/slingshot/trunk
Diff against target: 125 lines (+74/-14)
3 files modified
cmake/GObjectIntrospectionMacros.cmake (+34/-0)
cmake/Translations.cmake (+37/-13)
cmake/ValaPrecompile.cmake (+3/-1)
To merge this branch: bzr merge lp:~shnatsel/slingshot/update-cmake-modules
Reviewer Review Type Date Requested Status
elementary Pantheon team 2014-07-21 Pending
Review via email: mp+227531@code.launchpad.net

Commit message

Update CMake modules to revision 14 of lp:~elementary-apps/+junk/cmake-modules

Description of the change

Update CMake modules to revision 14 of lp:~elementary-apps/+junk/cmake-modules

Does not break build and Slingshot appears to work as before.

This will fix a number of issues with translation, add support for comments intended for translators, and suppress C compiler warnings by default, among other things.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'cmake/GObjectIntrospectionMacros.cmake'
2--- cmake/GObjectIntrospectionMacros.cmake 1970-01-01 00:00:00 +0000
3+++ cmake/GObjectIntrospectionMacros.cmake 2014-07-21 11:30:12 +0000
4@@ -0,0 +1,34 @@
5+macro(add_target_gir TARGET_NAME GIR_NAME HEADER CFLAGS GRANITE_VERSION)
6+ set(PACKAGES "")
7+ foreach(PKG ${ARGN})
8+ set(PACKAGES ${PACKAGES} --include=${PKG})
9+ endforeach()
10+ install(CODE "set(ENV{LD_LIBRARY_PATH} \"${CMAKE_CURRENT_BINARY_DIR}:\$ENV{LD_LIBRARY_PATH}\")
11+ execute_process(COMMAND g-ir-scanner ${CFLAGS} -n ${GIR_NAME}
12+ --quiet
13+ --library ${TARGET_NAME} ${PACKAGES}
14+ -o ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir
15+ -L${CMAKE_CURRENT_BINARY_DIR}
16+ --nsversion=${GRANITE_VERSION} ${HEADER})")
17+ 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)")
18+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir DESTINATION share/gir-1.0/)
19+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.typelib DESTINATION lib/girepository-1.0/)
20+endmacro()
21+
22+macro(add_target_gir_with_executable TARGET_NAME EXE_NAME GIR_NAME HEADER EXE_HEADER CFLAGS GRANITE_VERSION)
23+ set(PACKAGES "")
24+ foreach(PKG ${ARGN})
25+ set(PACKAGES ${PACKAGES} --include=${PKG})
26+ endforeach()
27+ install(CODE "set(ENV{LD_LIBRARY_PATH} \"${CMAKE_CURRENT_BINARY_DIR}:\$ENV{LD_LIBRARY_PATH}\")
28+ execute_process(COMMAND g-ir-scanner ${CFLAGS} -n ${GIR_NAME}
29+ --quiet
30+ --library ${TARGET_NAME} --program ${EXE_NAME} ${PACKAGES}
31+ -o ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir
32+ -L${CMAKE_CURRENT_BINARY_DIR}
33+ -I${CMAKE_CURRENT_BINARY_DIR}
34+ --nsversion=${GRANITE_VERSION} ${HEADER} ${EXE_HEADER})")
35+ 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)")
36+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.gir DESTINATION share/gir-1.0/)
37+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_NAME}-${GRANITE_VERSION}.typelib DESTINATION lib/girepository-1.0/)
38+endmacro()
39
40=== modified file 'cmake/Translations.cmake' (properties changed: +x to -x)
41--- cmake/Translations.cmake 2013-12-26 00:08:04 +0000
42+++ cmake/Translations.cmake 2014-07-21 11:30:12 +0000
43@@ -20,23 +20,47 @@
44 add_custom_target (pot COMMENT “Building translation catalog.”)
45 find_program (XGETTEXT_EXECUTABLE xgettext)
46
47-
48 set(C_SOURCE "")
49+ set(VALA_SOURCE "")
50+ set(GLADE_SOURCE "")
51
52 foreach(FILES_INPUT ${ARGN})
53- file (GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.c)
54- foreach(C_FILE ${SOURCE_FILES})
55- set(C_SOURCE ${C_SOURCE} ${C_FILE})
56- endforeach()
57- file (GLOB_RECURSE SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.vala)
58- foreach(C_FILE ${SOURCE_FILES})
59- set(C_SOURCE ${C_SOURCE} ${C_FILE})
60+ set(BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT})
61+
62+ file (GLOB_RECURSE SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ ${BASE_DIRECTORY}/*.c)
63+ foreach(C_FILE ${SOURCE_FILES})
64+ set(C_SOURCE ${C_SOURCE} ${C_FILE})
65+ endforeach()
66+
67+ file (GLOB_RECURSE SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ ${BASE_DIRECTORY}/*.vala)
68+ foreach(VALA_C_FILE ${SOURCE_FILES})
69+ set(VALA_SOURCE ${VALA_SOURCE} ${VALA_C_FILE})
70+ endforeach()
71+
72+ file (GLOB_RECURSE SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ ${BASE_DIRECTORY}/*.ui)
73+ foreach(GLADE_C_FILE ${SOURCE_FILES})
74+ set(GLADE_SOURCE ${GLADE_SOURCE} ${GLADE_C_FILE})
75 endforeach()
76 endforeach()
77
78- add_custom_command (TARGET pot COMMAND
79- ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
80- ${VALA_SOURCE} ${C_SOURCE} --add-comments="/" --keyword="_" --keyword="N_" --keyword="C_:1c,2"
81- --keyword="NC_:1c,2" --keyword="ngettext:1,2" --keyword="N_" --keyword="Q_:1g" --from-code=UTF-8
82- )
83+ set(BASE_XGETTEXT_COMMAND
84+ ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE}
85+ -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
86+ --add-comments="/" --keyword="_" --keyword="N_" --keyword="C_:1c,2" --keyword="NC_:1c,2" --keyword="ngettext:1,2" --keyword="Q_:1g" --from-code=UTF-8)
87+
88+ set(CONTINUE_FLAG "")
89+
90+ IF(NOT "${C_SOURCE}" STREQUAL "")
91+ add_custom_command(TARGET pot WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${BASE_XGETTEXT_COMMAND} ${C_SOURCE})
92+ set(CONTINUE_FLAG "-j")
93+ ENDIF()
94+
95+ IF(NOT "${VALA_SOURCE}" STREQUAL "")
96+ add_custom_command(TARGET pot WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${BASE_XGETTEXT_COMMAND} ${CONTINUE_FLAG} -LC\# ${VALA_SOURCE})
97+ set(CONTINUE_FLAG "-j")
98+ ENDIF()
99+
100+ IF(NOT "${GLADE_SOURCE}" STREQUAL "")
101+ add_custom_command (TARGET pot WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${BASE_XGETTEXT_COMMAND} ${CONTINUE_FLAG} -LGlade ${GLADE_SOURCE})
102+ ENDIF()
103 endmacro()
104
105=== modified file 'cmake/ValaPrecompile.cmake'
106--- cmake/ValaPrecompile.cmake 2013-12-26 00:08:04 +0000
107+++ cmake/ValaPrecompile.cmake 2014-07-21 11:30:12 +0000
108@@ -212,7 +212,7 @@
109 # Workaround for a bug that would make valac run twice. This file is written
110 # after the vala compiler generates C source code.
111 set(OUTPUT_STAMP ${CMAKE_CURRENT_BINARY_DIR}/${target_name}_valac.stamp)
112-
113+
114 add_custom_command(
115 OUTPUT
116 ${OUTPUT_STAMP}
117@@ -228,6 +228,8 @@
118 "-d" ${DIRECTORY}
119 ${vala_pkg_opts}
120 ${ARGS_OPTIONS}
121+ "-g"
122+ "--save-temps"
123 ${in_files}
124 ${custom_vapi_arguments}
125 COMMAND

Subscribers

People subscribed via source and target branches