summaryrefslogtreecommitdiffstats
path: root/CMakeScripts
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2017-05-05 16:52:19 +0000
committerjabiertxof <info@marker.es>2017-05-05 16:52:19 +0000
commitbec0359a0d5b3f7db96417f003927c282c18a9f4 (patch)
treee45fa17927826da138e233499060e3142de86899 /CMakeScripts
parentUpdate to trunk (diff)
parentmerge lpeUpdDefaultParams (diff)
downloadinkscape-bec0359a0d5b3f7db96417f003927c282c18a9f4.tar.gz
inkscape-bec0359a0d5b3f7db96417f003927c282c18a9f4.zip
Update to trunk
(bzr r13645.1.174)
Diffstat (limited to 'CMakeScripts')
-rw-r--r--CMakeScripts/DefineDependsandFlags.cmake1
-rw-r--r--CMakeScripts/HelperFunctions.cmake139
-rw-r--r--CMakeScripts/Install.cmake20
-rw-r--r--CMakeScripts/InstallMSYS2.cmake71
4 files changed, 193 insertions, 38 deletions
diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake
index 29ccb3a91..8cc0f0cd9 100644
--- a/CMakeScripts/DefineDependsandFlags.cmake
+++ b/CMakeScripts/DefineDependsandFlags.cmake
@@ -39,6 +39,7 @@ if(WIN32)
endif()
endif()
+find_package(PkgConfig REQUIRED)
pkg_check_modules(INKSCAPE_DEP REQUIRED
harfbuzz
pangocairo
diff --git a/CMakeScripts/HelperFunctions.cmake b/CMakeScripts/HelperFunctions.cmake
index f4ed255d5..3cd9e2736 100644
--- a/CMakeScripts/HelperFunctions.cmake
+++ b/CMakeScripts/HelperFunctions.cmake
@@ -1,10 +1,8 @@
# pkg_check_variable() - a function to retrieve pkg-config variables in CMake
#
# source: http://bloerg.net/2015/03/06/pkg-config-variables-in-cmake.html
-
-find_package(PkgConfig REQUIRED)
-
function(pkg_check_variable _pkg _name)
+ find_package(PkgConfig REQUIRED)
string(TOUPPER ${_pkg} _pkg_upper)
string(TOUPPER ${_name} _name_upper)
string(REPLACE "-" "_" _pkg_upper ${_pkg_upper})
@@ -32,3 +30,138 @@ function(join OUTPUT GLUE)
endforeach()
set(${OUTPUT} "${_TMP_RESULT}" PARENT_SCOPE)
endfunction()
+
+
+
+# Checks if the last call to execute_process() was sucessful and throws an error otherwise.
+# ${result} and ${stderr} should hold the value of RESULT_VARIABLE and ERROR_VARIABLE respectively
+function(check_error result stderr)
+ if("${result}" STREQUAL 0)
+ if(NOT "${stderr}" STREQUAL "")
+ MESSAGE(WARNING "Process returned sucessfully but the following was output to stderr: ${stderr}")
+ endif()
+ else()
+ if("${stderr}" STREQUAL "")
+ MESSAGE(FATAL_ERROR "Process failed with error code: ${result}")
+ else()
+ MESSAGE(FATAL_ERROR "Process failed with error code: ${result} (stderr: ${stderr})")
+ endif()
+ endif()
+endfunction(check_error)
+
+
+
+# Get the list of files installed by pacman for package ${package_name} and return it as ${file_list}.
+# Paths are relative to the root directory of the MinGW installations (the directory returned by function "get_mingw_root()")
+function(list_files_pacman package_name file_list)
+ set(MINGW_PACKAGE_PREFIX $ENV{MINGW_PACKAGE_PREFIX}) # e.g. "mingw-w64-x86_64"
+ get_filename_component(MINGW_PREFIX $ENV{MINGW_PREFIX} NAME) # e.g. "mingw64"
+
+ # use pacman to list all files/folders installed by the package
+ execute_process(
+ COMMAND pacman -Ql ${MINGW_PACKAGE_PREFIX}-${package_name}
+ OUTPUT_FILE list_files_pacman_temp.txt
+ RESULT_VARIABLE res
+ ERROR_VARIABLE err
+ )
+ check_error("${res}" "${err}")
+
+ # clean up output
+ execute_process(
+ COMMAND grep -v '/$' # get rid of folders
+ COMMAND sed -e 's/^${MINGW_PACKAGE_PREFIX}-${package_name} //' # remove package name
+ COMMAND sed -e 's/^\\/${MINGW_PREFIX}\\///' # remove root path
+ COMMAND tr '\n' '\;' # finally replace newlines with semicolon
+ INPUT_FILE list_files_pacman_temp.txt
+ OUTPUT_VARIABLE out
+ RESULT_VARIABLE res
+ ERROR_VARIABLE err
+ )
+ check_error("${res}" "${err}")
+
+ SET(${file_list} ${out} PARENT_SCOPE)
+ file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/list_files_pacman_temp.txt)
+endfunction(list_files_pacman)
+
+
+
+# Get the list of files installed by pip for package ${package_name} and return it as ${file_list}.
+# Paths are relative to the python distributions "site-packages" folder, i.e. "${root}/lib/python2.7/site-packages"
+function(list_files_pip package_name file_list)
+ # use pip to show package information including full list of files installed by the package
+ execute_process(
+ COMMAND pip show -f ${package_name}
+ OUTPUT_FILE list_files_pip_temp.txt
+ RESULT_VARIABLE res
+ ERROR_VARIABLE err
+ )
+ check_error("${res}" "${err}")
+
+ # clean up output
+ execute_process(
+ COMMAND sed -e '1,/Files:/d' # strip everything but the files list
+ COMMAND tr -d ' ' # strip spaces
+ COMMAND tr '\n' '\;' # finally replace newlines with semicolon
+ INPUT_FILE list_files_pip_temp.txt
+ OUTPUT_VARIABLE out
+ RESULT_VARIABLE res
+ ERROR_VARIABLE err
+ )
+ check_error("${res}" "${err}")
+
+ SET(${file_list} ${out} PARENT_SCOPE)
+ file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/list_files_pip_temp.txt)
+endfunction(list_files_pip)
+
+
+
+# Install a list of files maintaining directory structure
+#
+# Options:
+# FILES - the list of files (absolute or relative paths)
+# ROOT - the root to search the files in (if file paths are relative)
+# DESTINATION - the destination where to install files to
+# INCLUDE - a (list of) regular expression(s) specifying which files to include
+# (omit or leave empty to inlcude all files)
+# EXCLUDE - a (list of) regular expression(s) specifying which files to exclude
+# (takes precedence over include rules)
+function(install_list)
+ # parse arguments
+ set(oneValueArgs ROOT DESTINATION)
+ set(multiValueArgs FILES INCLUDE EXCLUDE)
+ cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ #MESSAGE("ARG_FILES: ${ARG_FILES}" )
+ #MESSAGE("ARG_ROOT: ${ARG_ROOT}" )
+ #MESSAGE("ARG_DESTINATION: ${ARG_DESTINATION}" )
+ #MESSAGE("ARG_INCLUDE: ${ARG_INCLUDE}" )
+ #MESSAGE("ARG_EXCLUDE: ${ARG_EXCLUDE}" )
+ #MESSAGE("ARG_UNPARSED_ARGUMENTS: ${ARG_UNPARSED_ARGUMENTS}" )
+
+ # install the files
+ foreach(file ${ARG_FILES})
+ #MESSAGE("file: " ${file})
+
+ # check includes and excludes (excludes take precedence)
+ set(include_file 0)
+ if("${ARG_INCLUDE}" STREQUAL "") # start with the assumption to include all files by default
+ set(include_file 1)
+ endif()
+ foreach(include ${ARG_INCLUDE})
+ if("${file}" MATCHES "${include}")
+ set(include_file 1)
+ endif()
+ endforeach()
+ foreach(exclude ${ARG_EXCLUDE})
+ if("${file}" MATCHES "${exclude}")
+ set(include_file 0)
+ endif()
+ endforeach()
+
+ # install if file should be included
+ if(${include_file})
+ get_filename_component(directory ${file} DIRECTORY)
+ install(FILES "${ARG_ROOT}/${file}" DESTINATION "${ARG_DESTINATION}${directory}")
+ endif()
+ endforeach()
+endfunction(install_list)
diff --git a/CMakeScripts/Install.cmake b/CMakeScripts/Install.cmake
index 9250f3d00..f1fda7bcc 100644
--- a/CMakeScripts/Install.cmake
+++ b/CMakeScripts/Install.cmake
@@ -34,6 +34,9 @@ if(WIN32)
LGPL2.1.txt
DESTINATION ${CMAKE_INSTALL_PREFIX})
+ install(DIRECTORY doc
+ DESTINATION ${CMAKE_INSTALL_PREFIX})
+
# devlibs and mingw dlls
# There are differences in the devlibs for 64-Bit and 32-Bit build environments.
@@ -178,23 +181,6 @@ if(WIN32)
DESTINATION ${CMAKE_INSTALL_PREFIX})
endif()
- # Setup application data directories, poppler files, locales, icons and themes
- file(MAKE_DIRECTORY
- data
- doc
- modules
- plugins)
-
- install(DIRECTORY
- data
- doc
- modules
- plugins
- DESTINATION ${CMAKE_INSTALL_PREFIX}
- PATTERN hicolor/index.theme EXCLUDE # NOTE: Empty index.theme in hicolor icon theme causes SIGSEGV.
- PATTERN CMakeLists.txt EXCLUDE
- PATTERN *.am EXCLUDE)
-
# Generate a dummy file in hicolor/index.theme to avoid bug 1635207
file(GENERATE OUTPUT ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/index.theme
CONTENT "[Icon Theme]\nName=hicolor\nDirectories=")
diff --git a/CMakeScripts/InstallMSYS2.cmake b/CMakeScripts/InstallMSYS2.cmake
index 87867ff73..c8c580fe4 100644
--- a/CMakeScripts/InstallMSYS2.cmake
+++ b/CMakeScripts/InstallMSYS2.cmake
@@ -27,6 +27,9 @@ if(WIN32)
LGPL2.1.txt
DESTINATION ${CMAKE_INSTALL_PREFIX})
+ install(DIRECTORY doc
+ DESTINATION ${CMAKE_INSTALL_PREFIX})
+
# mingw dlls
install(FILES
${MINGW_BIN}/LIBEAY32.dll
@@ -142,23 +145,6 @@ if(WIN32)
DESTINATION ${CMAKE_INSTALL_PREFIX})
endif()
- # Setup application data directories, poppler files, locales, icons and themes
- file(MAKE_DIRECTORY
- data
- doc
- modules
- plugins)
-
- install(DIRECTORY
- data
- doc
- modules
- plugins
- DESTINATION ${CMAKE_INSTALL_PREFIX}
- PATTERN hicolor/index.theme EXCLUDE # NOTE: Empty index.theme in hicolor icon theme causes SIGSEGV.
- PATTERN CMakeLists.txt EXCLUDE
- PATTERN *.am EXCLUDE)
-
# Install hicolor/index.theme to avoid bug 1635207
install(FILES
${MINGW_PATH}/share/icons/hicolor/index.theme
@@ -167,13 +153,33 @@ if(WIN32)
install(DIRECTORY ${MINGW_PATH}/share/icons/Adwaita
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons)
+ # translations for libraries (we usually shouldn't need many)
+ install(DIRECTORY ${MINGW_PATH}/share/locale
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/share
+ FILES_MATCHING
+ PATTERN "*gtk30.mo"
+ PATTERN "*gtkspell3.mo")
+
install(DIRECTORY ${MINGW_PATH}/share/poppler
DESTINATION ${CMAKE_INSTALL_PREFIX}/share)
install(DIRECTORY ${MINGW_PATH}/share/glib-2.0/schemas
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/glib-2.0)
+ # fontconfig
install(DIRECTORY ${MINGW_PATH}/etc/fonts
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/etc
+ FILES_MATCHING PATTERN "fonts.conf" EXCLUDE)
+ # adjust fonts.conf to store font cache in AppData
+ set(cachedir_default "\\t^<cachedir^>/var/cache/fontconfig^</cachedir^>") # the '^' are needed to escape angle brackets on Windows command shell
+ set(cachedir_appdata "\\t^<cachedir^>LOCAL_APPDATA_FONTCONFIG_CACHE^</cachedir^>")
+ add_custom_command(
+ OUTPUT ${CMAKE_BINARY_DIR}/etc/fonts/fonts.conf
+ COMMAND sed 's!${cachedir_default}!${cachedir_appdata}\\n${cachedir_default}!' ${MINGW_PATH}/etc/fonts/fonts.conf > ${CMAKE_BINARY_DIR}/etc/fonts/fonts.conf
+ MAIN_DEPENDENCY ${MINGW_PATH}/etc/fonts/fonts.conf
+ )
+ add_custom_target(fonts_conf ALL DEPENDS ${CMAKE_BINARY_DIR}/etc/fonts/fonts.conf)
+ install(DIRECTORY ${CMAKE_BINARY_DIR}/etc/fonts
DESTINATION ${CMAKE_INSTALL_PREFIX}/etc)
# GTK 3.0
@@ -196,6 +202,11 @@ if(WIN32)
install(DIRECTORY ${MINGW_LIB}/aspell-0.60
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
+ # Aspell backend for Enchant (gtkspell uses Enchant to access Aspell dictionaries)
+ install(FILES
+ ${MINGW_LIB}/enchant/libenchant_aspell.dll
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/enchant)
+
# Necessary to run extensions on windows if it is not in the path
if (HAVE_MINGW64)
install(FILES
@@ -222,5 +233,29 @@ if(WIN32)
${MINGW_BIN}/libpython2.7.dll
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${MINGW_LIB}/python2.7
- DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+ PATTERN "python2.7/site-packages" EXCLUDE # specify individual packages to install below
+ PATTERN "python2.7/test" EXCLUDE # we don't need the Python testsuite
+ )
+
+ set(site_packages "lib/python2.7/site-packages")
+ # Python packages installed via pacman
+ set(packages "python2-lxml" "python2-numpy")
+ foreach(package ${packages})
+ list_files_pacman(${package} paths)
+ install_list(FILES ${paths}
+ ROOT ${MINGW_PATH}
+ INCLUDE ${site_packages} # only include content from "site-packages" (we might consider to install everything)
+ )
+ endforeach()
+ # Python packages installed via pip
+ set(packages "coverage" "pyserial" "scour" "six")
+ foreach(package ${packages})
+ list_files_pip(${package} paths)
+ install_list(FILES ${paths}
+ ROOT ${MINGW_PATH}/${site_packages}
+ DESTINATION ${site_packages}/
+ EXCLUDE "^\\.\\.\\/" # exclude content in parent directories (notably scripts installed to /bin)
+ )
+ endforeach()
endif() \ No newline at end of file