diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-03-14 16:37:50 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2016-03-14 16:37:50 +0000 |
| commit | b8d22beef5345210ad27cdc2685083aeae6f8f3b (patch) | |
| tree | d69b8bfd19d3627a8425a1b265c2abf229b05354 /CMakeScripts/Modules | |
| parent | fixes for update to trunk (diff) | |
| parent | "Relative to" option for node alignment. (diff) | |
| download | inkscape-b8d22beef5345210ad27cdc2685083aeae6f8f3b.tar.gz inkscape-b8d22beef5345210ad27cdc2685083aeae6f8f3b.zip | |
update to trunk
(bzr r13708.1.39)
Diffstat (limited to 'CMakeScripts/Modules')
| -rw-r--r-- | CMakeScripts/Modules/FindGettext.cmake | 237 | ||||
| -rw-r--r-- | CMakeScripts/Modules/FindPopplerCairo.cmake | 6 | ||||
| -rw-r--r-- | CMakeScripts/Modules/FindPotrace.cmake | 62 | ||||
| -rw-r--r-- | CMakeScripts/Modules/FindSigC++.cmake | 22 | ||||
| -rw-r--r-- | CMakeScripts/Modules/sigcpp_test.cpp | 15 |
5 files changed, 338 insertions, 4 deletions
diff --git a/CMakeScripts/Modules/FindGettext.cmake b/CMakeScripts/Modules/FindGettext.cmake new file mode 100644 index 000000000..753040b40 --- /dev/null +++ b/CMakeScripts/Modules/FindGettext.cmake @@ -0,0 +1,237 @@ +#.rst: +# FindGettext +# ----------- +# +# Find GNU gettext tools +# +# This module looks for the GNU gettext tools. This module defines the +# following values: +# +# :: +# +# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool. +# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool. +# GETTEXT_FOUND: True if gettext has been found. +# GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8) +# +# +# +# Additionally it provides the following macros: +# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN ) +# +# :: +# +# This will create a target "translations" which will convert the +# given input po files into the binary output mo file. If the +# ALL option is used, the translations will also be created when +# building the default target. +# +# GETTEXT_PROCESS_POT( <potfile> [ALL] [INSTALL_DESTINATION <destdir>] +# LANGUAGES <lang1> <lang2> ... ) +# +# :: +# +# Process the given pot file to mo files. +# If INSTALL_DESTINATION is given then automatically install rules will be created, +# the language subdirectory will be taken into account (by default use share/locale/). +# If ALL is specified, the pot file is processed when building the all traget. +# It creates a custom target "potfile". +# +# GETTEXT_PROCESS_PO_FILES( <lang> [ALL] [INSTALL_DESTINATION <dir>] +# PO_FILES <po1> <po2> ... ) +# +# :: +# +# Process the given po files to mo files for the given language. +# If INSTALL_DESTINATION is given then automatically install rules will be created, +# the language subdirectory will be taken into account (by default use share/locale/). +# If ALL is specified, the po files are processed when building the all traget. +# It creates a custom target "pofiles". + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# Copyright 2007 Alexander Neundorf <neundorf@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) +#============================================================================= +# This file got changed for Inkscape's purposes to name the .mo files installed with +# GETTEXT_PROCESS_PO_FILES ${CMAKE_PROJECT_NAME}.mo instead of <language>.mo + +find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge) + +find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt) + +if(GETTEXT_MSGMERGE_EXECUTABLE) + execute_process(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version + OUTPUT_VARIABLE gettext_version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (gettext_version MATCHES "^msgmerge \\(.*\\) [0-9]") + string(REGEX REPLACE "^msgmerge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" GETTEXT_VERSION_STRING "${gettext_version}") + endif() + unset(gettext_version) +endif() + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext + REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE + VERSION_VAR GETTEXT_VERSION_STRING) + +include(CMakeParseArguments) + +function(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) + set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") + get_property(currentCounter GLOBAL PROPERTY "${propertyName}") + if(NOT currentCounter) + set(currentCounter 1) + endif() + set(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE) + math(EXPR currentCounter "${currentCounter} + 1") + set_property(GLOBAL PROPERTY ${propertyName} ${currentCounter} ) +endfunction() + +macro(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg) + # make it a real variable, so we can modify it here + set(_firstPoFile "${_firstPoFileArg}") + + set(_gmoFiles) + get_filename_component(_potName ${_potFile} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) + + set(_addToAll) + if(${_firstPoFile} STREQUAL "ALL") + set(_addToAll "ALL") + set(_firstPoFile) + endif() + + foreach (_currentPoFile ${_firstPoFile} ${ARGN}) + get_filename_component(_absFile ${_currentPoFile} ABSOLUTE) + get_filename_component(_abs_PATH ${_absFile} PATH) + get_filename_component(_lang ${_absFile} NAME_WE) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) + + add_custom_command( + OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} + DEPENDS ${_absPotFile} ${_absFile} + ) + + install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + set(_gmoFiles ${_gmoFiles} ${_gmoFile}) + + endforeach () + + if(NOT TARGET translations) + add_custom_target(translations) + endif() + + _GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName) + + add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles}) + + add_dependencies(translations ${uniqueTargetName}) + +endmacro() + + +function(GETTEXT_PROCESS_POT_FILE _potFile) + set(_gmoFiles) + set(_options ALL) + set(_oneValueArgs INSTALL_DESTINATION) + set(_multiValueArgs LANGUAGES) + + CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + + get_filename_component(_potName ${_potFile} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName}) + get_filename_component(_absPotFile ${_potFile} ABSOLUTE) + + foreach (_lang ${_parsedArguments_LANGUAGES}) + set(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po") + set(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo") + + add_custom_command( + OUTPUT "${_poFile}" + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile} + DEPENDS ${_absPotFile} + ) + + add_custom_command( + OUTPUT "${_gmoFile}" + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile} + DEPENDS ${_absPotFile} ${_poFile} + ) + + if(_parsedArguments_INSTALL_DESTINATION) + install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + endif() + list(APPEND _gmoFiles ${_gmoFile}) + endforeach () + + if(NOT TARGET potfiles) + add_custom_target(potfiles) + endif() + + _GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName) + + if(_parsedArguments_ALL) + add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) + else() + add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles}) + endif() + + add_dependencies(potfiles ${uniqueTargetName}) + +endfunction() + + +function(GETTEXT_PROCESS_PO_FILES _lang) + set(_options ALL) + set(_oneValueArgs INSTALL_DESTINATION) + set(_multiValueArgs PO_FILES) + set(_gmoFiles) + + CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) + + foreach(_current_PO_FILE ${_parsedArguments_PO_FILES}) + get_filename_component(_name ${_current_PO_FILE} NAME) + string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name}) + set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo) + add_custom_command(OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS ${_current_PO_FILE} + ) + + if(_parsedArguments_INSTALL_DESTINATION) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${CMAKE_PROJECT_NAME}.mo) + endif() + list(APPEND _gmoFiles ${_gmoFile}) + endforeach() + + + if(NOT TARGET pofiles) + add_custom_target(pofiles) + endif() + + _GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName) + + if(_parsedArguments_ALL) + add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles}) + else() + add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles}) + endif() + + add_dependencies(pofiles ${uniqueTargetName}) + +endfunction() diff --git a/CMakeScripts/Modules/FindPopplerCairo.cmake b/CMakeScripts/Modules/FindPopplerCairo.cmake index 2565e7bb2..bde884ec6 100644 --- a/CMakeScripts/Modules/FindPopplerCairo.cmake +++ b/CMakeScripts/Modules/FindPopplerCairo.cmake @@ -23,9 +23,9 @@ else (POPPLER_LIBRARIES AND POPPLER_INCLUDE_DIRS) # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) if (PKG_CONFIG_FOUND) - INKSCAPE_PKG_CONFIG_FIND(POPPLER poppler >=0.5.9 poppler-config.h poppler poppler) + INKSCAPE_PKG_CONFIG_FIND(POPPLER poppler >=0.20.0 poppler-config.h poppler poppler) if (POPPLER_FOUND) - INKSCAPE_PKG_CONFIG_FIND(POPPLER_GLIB poppler-glib >=0.5.9 poppler/glib/poppler.h "" poppler-glib) + INKSCAPE_PKG_CONFIG_FIND(POPPLER_GLIB poppler-glib >=0.20.0 poppler/glib/poppler.h "" poppler-glib) if (POPPLER_GLIB_FOUND) list(APPEND POPPLER_INCLUDE_DIRS ${POPPLER_GLIB_INCLUDE_DIRS}) list(APPEND POPPLER_LIBRARIES ${POPPLER_GLIB_LIBRARIES}) @@ -36,7 +36,7 @@ else (POPPLER_LIBRARIES AND POPPLER_INCLUDE_DIRS) endif (CAIRO_SVG_FOUND) endif (POPPLER_GLIB_FOUND) if (ENABLE_POPPLER_CAIRO) - INKSCAPE_PKG_CONFIG_FIND(POPPLER_CAIRO poppler-cairo >=0.5.9 cairo.h cairo cairo) + INKSCAPE_PKG_CONFIG_FIND(POPPLER_CAIRO poppler-cairo >=0.20.0 cairo.h cairo cairo) if (POPPLER_GLIB_FOUND AND POPPLER_CAIRO_FOUND AND NOT CAIRO_SVG_FOUND) list(APPEND POPPLER_INCLUDE_DIRS ${POPPLER_CAIRO_INCLUDE_DIRS}) list(APPEND POPPLER_LIBRARIES ${POPPLER_CAIRO_LIBRARIES}) diff --git a/CMakeScripts/Modules/FindPotrace.cmake b/CMakeScripts/Modules/FindPotrace.cmake new file mode 100644 index 000000000..9ab995278 --- /dev/null +++ b/CMakeScripts/Modules/FindPotrace.cmake @@ -0,0 +1,62 @@ +# POTRACE_FOUND - system has Potrace +# POTRACE_INCLUDE_DIRS - the Potrace include directory +# POTRACE_LIBRARIES - The libraries needed to use Potrace + +IF (POTRACE_LIBRARIES AND POTRACE_INCLUDE_DIRS) + # in cache already + SET(POTRACE_FOUND TRUE) +ELSE (POTRACE_LIBRARIES AND POTRACE_INCLUDE_DIRS) + FIND_PATH (POTRACE_INCLUDE_DIR + NAMES + potracelib.h + PATHS + /usr/include + /usr/local/include + $ENV{DEVLIBS_PATH}/include + PATH_SUFFIXES + potrace + ) + + FIND_LIBRARY (POTRACE_LIBRARY + NAMES + potrace + libpotrace + PATHS + /usr/lib + /usr/local/lib + $ENV{DEVLIBS_PATH}/lib + ) + + if (POTRACE_LIBRARY) + set (POTRACE_FOUND TRUE) + endif (POTRACE_LIBRARY) + + set (POTRACE_INCLUDE_DIRS + ${POTRACE_INCLUDE_DIR} + ) + + if (POTRACE_FOUND) + set(POTRACE_LIBRARIES + ${POTRACE_LIBRARIES} + ${POTRACE_LIBRARY} + ) + endif (POTRACE_FOUND) + + if (POTRACE_INCLUDE_DIRS AND POTRACE_LIBRARIES) + set(POTRACE_FOUND TRUE) + endif (POTRACE_INCLUDE_DIRS AND POTRACE_LIBRARIES) + + if (POTRACE_FOUND) + if (NOT Potrace_FIND_QUIETLY) + message(STATUS "Found Potrace: ${POTRACE_LIBRARIES}") + endif (NOT Potrace_FIND_QUIETLY) + else (POTRACE_FOUND) + if (Potrace_FIND_REQUIRED) + message(FATAL_ERROR "Could not find potrace") + endif (Potrace_FIND_REQUIRED) + endif (POTRACE_FOUND) + + # show the POTRACE_INCLUDE_DIRS and POTRACE_LIBRARIES variables only in the advanced view + MARK_AS_ADVANCED(POTRACE_INCLUDE_DIRS POTRACE_LIBRARIES) + +endif (POTRACE_LIBRARIES AND POTRACE_INCLUDE_DIRS) diff --git a/CMakeScripts/Modules/FindSigC++.cmake b/CMakeScripts/Modules/FindSigC++.cmake index ed0abc545..8046410b5 100644 --- a/CMakeScripts/Modules/FindSigC++.cmake +++ b/CMakeScripts/Modules/FindSigC++.cmake @@ -13,7 +13,6 @@ # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # - if (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS) # in cache already set(SIGC++_FOUND TRUE) @@ -103,4 +102,25 @@ else (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS) endif (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS) +# Try to add -std=c++11 if needed - see: +# https://bugs.launchpad.net/inkscape/+bug/1488079 + +macro (sigcpp_compile extra_cppflags) + try_compile(SIGCPP_COMPILES_FINE "${CMAKE_BINARY_DIR}/sigcpp-bindir" + SOURCES "${CMAKE_SOURCE_DIR}/CMakeScripts/Modules/sigcpp_test.cpp" + COMPILE_DEFINITIONS ${_SIGC++_CFLAGS} ${extra_cppflags} + LINK_LIBRARIES ${SIGC++_LIBRARIES}) +endmacro() + + +sigcpp_compile("") +if (NOT "${SIGCPP_COMPILES_FINE}") + set (cppflag "-std=c++11") + sigcpp_compile("${cppflag}") + if ("${SIGCPP_COMPILES_FINE}") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cppflag}") + else() + message(FATAL_ERROR "Could not compile against SIGC++") + endif() +endif() diff --git a/CMakeScripts/Modules/sigcpp_test.cpp b/CMakeScripts/Modules/sigcpp_test.cpp new file mode 100644 index 000000000..b4cf2c773 --- /dev/null +++ b/CMakeScripts/Modules/sigcpp_test.cpp @@ -0,0 +1,15 @@ +/* + * Building this using: + + g++ `pkg-config --cflags sigc++-2.0` sigcpp_test.cpp + + Results in an error. + * */ +#include <stddef.h> +#include <string> +#include <sigc++/signal.h> + +int main() +{ + return 0; +} |
