[latexila] CMake: ITS Tool function
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] CMake: ITS Tool function
- Date: Mon, 18 Jul 2011 01:00:11 +0000 (UTC)
commit 8dac06c63c01aa9ccabc228c94181fc3587b1daf
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Mon Jul 18 03:00:09 2011 +0200
CMake: ITS Tool function
CMakeLists.txt | 9 +++---
cmake/itstool.cmake | 43 ++++++++++++++++++++++++++++++++
cmake/{ => vala}/README.rst | 0
data/build_tools/CMakeLists.txt | 39 ++++++-----------------------
help/CMakeLists.txt | 52 ++++++---------------------------------
src/build_tools.vala | 1 -
6 files changed, 64 insertions(+), 80 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 71626da..dd00a9e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,13 +71,14 @@ link_libraries (
${X11_LIBRARIES}
)
-include_directories (vapi src/C ${latexila_BINARY_DIR}/src)
+add_subdirectory (data)
+add_subdirectory (help)
add_subdirectory (man)
+add_subdirectory (src/ui)
+
+include_directories (vapi src/C ${latexila_BINARY_DIR}/src)
if (BUILD_VALA)
add_subdirectory (src)
else ()
add_subdirectory (src/C)
endif ()
-add_subdirectory (src/ui)
-add_subdirectory (data)
-add_subdirectory (help)
diff --git a/cmake/itstool.cmake b/cmake/itstool.cmake
new file mode 100644
index 0000000..3db65a8
--- /dev/null
+++ b/cmake/itstool.cmake
@@ -0,0 +1,43 @@
+function (itstool target_name src_dir tmp_dir install_dir)
+ install (DIRECTORY "${src_dir}/C" DESTINATION ${install_dir})
+
+ # Get list of XML files
+ file (GLOB path_files "${src_dir}/C/*")
+ set (list_files)
+ foreach (path_file ${path_files})
+ get_filename_component (file ${path_file} NAME)
+ set (list_files ${list_files} ${file})
+ endforeach ()
+
+ set (all_new_files)
+
+ # Foreach language
+ file (GLOB po_files "${src_dir}/*.po")
+ foreach (po_file ${po_files})
+ # Get the language name
+ get_filename_component (lang ${po_file} NAME_WE)
+
+ # Get the paths of the new files
+ set (lang_files)
+ foreach (file ${list_files})
+ set (lang_files ${lang_files} "${tmp_dir}/${lang}/${file}")
+ endforeach ()
+
+ # Generate the new files from the .po
+ set (mo_file "${tmp_dir}/${lang}.mo")
+ add_custom_command (
+ OUTPUT ${lang_files}
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file}
+ COMMAND mkdir ${tmp_dir}/${lang}
+ COMMAND itstool -m ${mo_file} -o ${tmp_dir}/${lang}/ ${path_files}
+ DEPENDS ${po_file}
+ )
+
+ # Install the directory (which contains only the XML files)
+ install (DIRECTORY ${tmp_dir}/${lang} DESTINATION ${install_dir})
+
+ set (all_new_files ${all_new_files} ${lang_files})
+ endforeach ()
+
+ add_custom_target (${target_name} ALL DEPENDS ${all_new_files})
+endfunction ()
diff --git a/cmake/README.rst b/cmake/vala/README.rst
similarity index 100%
rename from cmake/README.rst
rename to cmake/vala/README.rst
diff --git a/data/build_tools/CMakeLists.txt b/data/build_tools/CMakeLists.txt
index 0ef195e..61942d3 100644
--- a/data/build_tools/CMakeLists.txt
+++ b/data/build_tools/CMakeLists.txt
@@ -1,31 +1,8 @@
-set (bt_dir ${DATA_DIR}/build_tools)
-set (tmp_bt_dir "${latexila_BINARY_DIR}/data/build_tools")
-
-install (DIRECTORY "C" DESTINATION ${bt_dir})
-
-set (all_new_bt)
-
-# Foreach language
-file (GLOB po_files *.po)
-foreach (po_file ${po_files})
- # Get the language name
- get_filename_component (lang ${po_file} NAME_WE)
-
- # Generate the new XML file
- set (mo_file "${tmp_bt_dir}/${lang}.mo")
- set (new_bt "${tmp_bt_dir}/${lang}/build_tools.xml")
- add_custom_command (
- OUTPUT ${new_bt}
- COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file}
- COMMAND mkdir ${tmp_bt_dir}/${lang}
- COMMAND itstool -m ${mo_file} -o ${tmp_bt_dir}/${lang}/ ${latexila_SOURCE_DIR}/data/build_tools/C/build_tools.xml
- DEPENDS ${po_file}
- )
-
- # Install the directory (which contains only the pages)
- install (DIRECTORY ${tmp_bt_dir}/${lang} DESTINATION ${bt_dir})
-
- set (all_new_bt ${all_new_bt} ${new_bt})
-endforeach ()
-
-add_custom_target (build_tools ALL DEPENDS ${all_new_bt})
+include ("${latexila_SOURCE_DIR}/cmake/itstool.cmake")
+
+itstool (
+ "build_tools" # target name
+ "${latexila_SOURCE_DIR}/data/build_tools" # src dir
+ "${latexila_BINARY_DIR}/data/build_tools" # tmp dir
+ "${DATA_DIR}/build_tools" # install dir
+)
diff --git a/help/CMakeLists.txt b/help/CMakeLists.txt
index 0d8e913..ff3c462 100644
--- a/help/CMakeLists.txt
+++ b/help/CMakeLists.txt
@@ -1,44 +1,8 @@
-set (help_dir "share/gnome/help/latexila")
-set (tmp_help_dir "${latexila_BINARY_DIR}/help")
-
-install (DIRECTORY "C" DESTINATION ${help_dir})
-
-# Get list of pages
-file (GLOB path_pages "C/*.page")
-set (list_pages)
-foreach (path_page ${path_pages})
- get_filename_component (page ${path_page} NAME)
- set (list_pages ${list_pages} ${page})
-endforeach ()
-
-set (all_new_pages)
-
-# Foreach language
-file (GLOB po_files *.po)
-foreach (po_file ${po_files})
- # Get the language name
- get_filename_component (lang ${po_file} NAME_WE)
-
- # Get the paths of the new pages
- set (lang_pages)
- foreach (page ${list_pages})
- set (lang_pages ${lang_pages} "${tmp_help_dir}/${lang}/${page}")
- endforeach ()
-
- # Generate the new pages from the .po
- set (mo_file "${tmp_help_dir}/${lang}.mo")
- add_custom_command (
- OUTPUT ${lang_pages}
- COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file}
- COMMAND mkdir ${tmp_help_dir}/${lang}
- COMMAND itstool -m ${mo_file} -o ${tmp_help_dir}/${lang}/ ${latexila_SOURCE_DIR}/help/C/*.page
- DEPENDS ${po_file}
- )
-
- # Install the directory (which contains only the pages)
- install (DIRECTORY ${tmp_help_dir}/${lang} DESTINATION ${help_dir})
-
- set (all_new_pages ${all_new_pages} ${lang_pages})
-endforeach ()
-
-add_custom_target (documentation ALL DEPENDS ${all_new_pages})
+include ("${latexila_SOURCE_DIR}/cmake/itstool.cmake")
+
+itstool (
+ "documentation" # target name
+ "${latexila_SOURCE_DIR}/help" # src dir
+ "${latexila_BINARY_DIR}/help" # tmp dir
+ "${CMAKE_INSTALL_PREFIX}/share/gnome/help/latexila" # install dir
+)
diff --git a/src/build_tools.vala b/src/build_tools.vala
index e420db8..b34caf9 100644
--- a/src/build_tools.vala
+++ b/src/build_tools.vala
@@ -258,7 +258,6 @@ public class BuildTools
unowned string[] language_names = Intl.get_language_names ();
foreach (string language_name in language_names)
{
- stdout.printf ("language_name: %s\n", language_name);
files += File.new_for_path (Path.build_filename (Config.DATA_DIR,
"build_tools", language_name, "build_tools.xml"));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]