From 61f7536e2259dc496211dfca21b2a0e4eef3d9f4 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Wed, 28 Jan 2015 00:16:41 +0100 Subject: Fix to work on Windows XP --- CMakeLists.txt | 27 ++++++++++++++++----------- README.md | 7 ++++--- Win32Depends.cmake | 9 ++++++--- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c766271..c9785fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,7 @@ pkg_check_modules (GTK3 REQUIRED gtk+-3.0) if (NOT WIN32) pkg_search_module (Lua52 REQUIRED lua5.2 lua-5.2 lua>=5.2) else (NOT WIN32) + # XXX: this seems to require CMake 3.0 ... include it in the project? find_package (Lua REQUIRED) if (NOT LUA_FOUND OR LUA_VERSION_STRING VERSION_LESS "5.2") message (FATAL_ERROR "Lua 5.2 not found") @@ -328,17 +329,6 @@ if (OPTION_NOINSTALL) endif (OPTION_NOINSTALL) # Installation -install (FILES ${GSETTINGS_SCHEMAS} - DESTINATION share/glib-2.0/schemas) -install (CODE " # DESTDIR is not in use on Windows - if (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\") - execute_process (COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE} - \"\${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas\") - endif (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\")") - -install (DIRECTORY share/gui share/library - DESTINATION share/${PROJECT_NAME}) - if (WIN32) install (TARGETS logdiag DESTINATION .) install (DIRECTORY @@ -352,6 +342,10 @@ if (WIN32) install (DIRECTORY ${WIN32_DEPENDS_PATH}/lib/gdk-pixbuf-2.0 DESTINATION lib) + install (DIRECTORY + ${WIN32_DEPENDS_PATH}/share/glib-2.0/schemas + DESTINATION share/glib-2.0 + FILES_MATCHING PATTERN "org.gtk.Settings.*") # Avoid partial translations file (GLOB locales ${WIN32_DEPENDS_PATH}/share/locale/*) @@ -375,6 +369,17 @@ else (WIN32) install (FILES LICENSE NEWS DESTINATION share/doc/${PROJECT_NAME}) endif (WIN32) +install (FILES ${GSETTINGS_SCHEMAS} + DESTINATION share/glib-2.0/schemas) +install (CODE " # DESTDIR is not in use on Windows + if (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\") + execute_process (COMMAND ${GLIB_COMPILE_SCHEMAS_EXECUTABLE} + \"\${CMAKE_INSTALL_PREFIX}/share/glib-2.0/schemas\") + endif (WIN32 OR \"\$ENV{DESTDIR}\" STREQUAL \"\")") + +install (DIRECTORY share/gui share/library + DESTINATION share/${PROJECT_NAME}) + # CPack set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Schematic editor") set (CPACK_PACKAGE_VENDOR "Premysl Janouch") diff --git a/README.md b/README.md index 054e0d8..d7bf789 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,8 @@ Leave out the fakeroot for CMake >= 2.8.9, it's been fixed since. ## Building from sources on Windows -First install CMake 2.8 and MinGW. Add both to your system path. If you want to -build an installation package, also install NSIS. +First install CMake >= 3.1 and MinGW. Add both to your system path. If you want +to build an installation package, also install NSIS. Run the following command in the directory with source files to automatically fetch and setup all dependencies (contact me if the script becomes obsolete, @@ -85,6 +85,7 @@ By default, that is if you specify no generator, both packages are built. ## Cross-compiling for Windows +The procedure is almost exactly the same as before, including the requirements. Just install MinGW-w64 and let automation take care of the rest. $ cmake -P Win32Depends.cmake @@ -93,5 +94,5 @@ Just install MinGW-w64 and let automation take care of the rest. $ cmake .. \ -DCMAKE_TOOLCHAIN_FILE=../ToolchainDebianMinGWW64.cmake \ -DCMAKE_BUILD_TYPE=Release - $ cpack -G ZIP + $ cpack diff --git a/Win32Depends.cmake b/Win32Depends.cmake index a4b07e5..61347da 100644 --- a/Win32Depends.cmake +++ b/Win32Depends.cmake @@ -1,5 +1,8 @@ # Usage: cmake -P Win32Depends.cmake +# Only CMake 3.1+ supports XZ archives and 7z doesn't also untar automatically +cmake_minimum_required (VERSION 3.1) + # Directories set (working_dir ${CMAKE_CURRENT_BINARY_DIR}/win32-depends) set (pkg_dir ${working_dir}/packages) @@ -123,13 +126,13 @@ foreach (pkg_set ${pkg_list}) get_filename_component (filename ${url} NAME) message (STATUS "Extracting ${filename}...") - if (filename MATCHES "7z$") + if (filename MATCHES "\\.7z$") set (extract_command ${sevenzip_executable} x) set (quiet OUTPUT_QUIET) - else (filename MATCHES "7z$") + else (filename MATCHES "\\.7z$") set (extract_command ${CMAKE_COMMAND} -E tar xf) set (quiet) - endif (filename MATCHES "7z$") + endif (filename MATCHES "\\.7z$") set (filename ${pkg_dir}/${filename}) if (pkg_${pkg_set}_strip) -- cgit v1.2.3-70-g09d2