/[pcsx2_0.9.7]/trunk/cmake/Translation.cmake
ViewVC logotype

Contents of /trunk/cmake/Translation.cmake

Parent Directory Parent Directory | Revision Log Revision Log


Revision 401 - (show annotations) (download)
Fri Feb 25 17:31:09 2011 UTC (9 years, 4 months ago) by william
File size: 3514 byte(s)
Auto Commited Import of: pcsx2-0.9.7-DEBUG (upstream: v0.9.7.4358 local: v0.9.7.313-latest) in ./trunk
1 # Macro to compile po file
2 # It based on FindGettext.cmake files.
3 # The macro was adapted for PCSX2 need. Several pot file, language based on directory instead of file
4
5 # Copyright (c) 2007-2009 Kitware, Inc., Insight Consortium
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are
10 # met:
11 #
12 # * Redistributions of source code must retain the above copyright notice,
13 # this list of conditions and the following disclaimer.
14 #
15 # * Redistributions in binary form must reproduce the above copyright notice,
16 # this list of conditions and the following disclaimer in the documentation
17 # and/or other materials provided with the distribution.
18 #
19 # * The names of Kitware, Inc., the Insight Consortium, or the names of
20 # any consortium members, or of any contributors, may not be used to
21 # endorse or promote products derived from this software without
22 # specific prior written permission.
23 #
24 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
25 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
28 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
35 MACRO(GETTEXT_CREATE_TRANSLATIONS_PCSX2 _potFile _firstPoFileArg)
36 # make it a real variable, so we can modify it here
37 SET(_firstPoFile "${_firstPoFileArg}")
38
39 SET(_gmoFiles)
40 GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE)
41 GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
42
43 SET(_addToAll)
44 IF(${_firstPoFile} STREQUAL "ALL")
45 SET(_addToAll "ALL")
46 SET(_firstPoFile)
47 ENDIF(${_firstPoFile} STREQUAL "ALL")
48
49 FOREACH (_currentPoFile ${_firstPoFile} ${ARGN})
50 GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE)
51 GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH)
52 GET_FILENAME_COMPONENT(_gmoBase ${_absFile} NAME_WE)
53 GET_FILENAME_COMPONENT(_lang ${_abs_PATH} NAME_WE)
54 SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}__${_gmoBase}.gmo)
55
56 ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile}
57 COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
58 COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
59 DEPENDS ${_absPotFile} ${_absFile} )
60
61 IF (L10N_PORTABLE)
62 INSTALL(FILES ${_gmoFile} DESTINATION ${PROJECT_SOURCE_DIR}/bin/Langs/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
63 ELSE (L10N_PORTABLE)
64 INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
65 ENDIF (L10N_PORTABLE)
66
67 SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
68
69 ENDFOREACH (_currentPoFile )
70
71 IF(NOT LINUX_PACKAGE)
72 ADD_CUSTOM_TARGET(translations_${_potBasename} ${_addToAll} DEPENDS ${_gmoFiles})
73 ENDIF(NOT LINUX_PACKAGE)
74
75 ENDMACRO(GETTEXT_CREATE_TRANSLATIONS_PCSX2 )

  ViewVC Help
Powered by ViewVC 1.1.22