diff options
-rw-r--r-- | CMakeLists.txt | 51 | ||||
-rw-r--r-- | README.adoc | 11 | ||||
-rw-r--r-- | Win32Depends.cmake | 8 | ||||
-rw-r--r-- | cmake/FindGettext.cmake | 99 | ||||
-rw-r--r-- | config.h.in | 2 | ||||
-rw-r--r-- | share/org.logdiag.gschema.xml | 2 |
6 files changed, 36 insertions, 137 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f7726a..e2745f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,6 @@ -project (logdiag C) # The last version with Windows XP support is 3.13, we want to keep that -cmake_minimum_required (VERSION 2.8.12) - -# Default to 2.8.12 behaviour -cmake_policy (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.9) +project (logdiag VERSION 0.2.0 LANGUAGES C) # Options option (OPTION_USE_VERA "Use vera++ for source code style checks" OFF) @@ -11,14 +8,6 @@ option (OPTION_NOINSTALL "Only for developers; work without installing" OFF) option (BUILD_TESTING "Build tests" OFF) # Project information -set (project_VERSION_MAJOR "0") -set (project_VERSION_MINOR "2") -set (project_VERSION_PATCH "0") - -set (project_VERSION "${project_VERSION_MAJOR}") -set (project_VERSION "${project_VERSION}.${project_VERSION_MINOR}") -set (project_VERSION "${project_VERSION}.${project_VERSION_PATCH}") - set (project_URL "https://git.janouch.name/p/logdiag") # For custom modules @@ -91,7 +80,6 @@ else (NOT WIN32) # For whatever reason this now seems to be required set (LUA_INCLUDE_DIR "${WIN32_DEPENDS_PATH}/include") - # XXX: this seems to require CMake 3.0 ... include it in the project? find_package (Lua REQUIRED) if (LUA_VERSION_STRING VERSION_LESS "5.2") message (FATAL_ERROR "Lua 5.2 not found") @@ -115,7 +103,7 @@ foreach (file ${project_PO_FILES}) list (APPEND project_TRANSLATIONS "${translation}") endforeach (file) -# Documentation +# Documentation--gtk-doc 1.25 is required find_package (GtkDoc 1.25) set (project_DOC_DIR "${PROJECT_BINARY_DIR}/liblogdiag") @@ -251,9 +239,13 @@ if (BUILD_TESTING) foreach (name ${logdiag_TESTS}) add_executable (test-${name} tests/${name}.c) target_link_libraries (test-${name} liblogdiag ${logdiag_LIBS}) - - add_test (test-${name} test-${name}) + add_test (NAME test-${name} COMMAND test-${name}) + list (APPEND logdiag_TEST_TARGETS test-${name}) endforeach (name) + if (WIN32 AND NOT CMAKE_CROSSCOMPILING) + set_tests_properties (${logdiag_TEST_TARGETS} + PROPERTIES ENVIRONMENT "PATH=${WIN32_DEPENDS_PATH}/bin") + endif () endif (BUILD_TESTING) # Generate documentation @@ -385,25 +377,20 @@ else (WIN32) install (FILES LICENSE NEWS DESTINATION share/doc/${PROJECT_NAME}) endif (WIN32) -install (FILES ${GSETTINGS_SCHEMAS} - DESTINATION share/glib-2.0/schemas) +install (DIRECTORY share/gui share/library DESTINATION share/${PROJECT_NAME}) +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} + 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 Eric Janouch") set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>") set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") -set (CPACK_PACKAGE_VERSION_MAJOR ${project_VERSION_MAJOR}) -set (CPACK_PACKAGE_VERSION_MINOR ${project_VERSION_MINOR}) -set (CPACK_PACKAGE_VERSION_PATCH ${project_VERSION_PATCH}) +set (CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) if (WIN32) set (CPACK_GENERATOR "NSIS;ZIP") @@ -413,11 +400,13 @@ else (WIN32) endif (WIN32) set (CPACK_PACKAGE_FILE_NAME - "${PROJECT_NAME}-${project_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") -set (CPACK_PACKAGE_INSTALL_DIRECTORY - "${PROJECT_NAME} ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") + "${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") +set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${CPACK_PACKAGE_VERSION}") + +# XXX: It is still possible to install multiple copies, making commands collide. +set (CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) +set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME}") -# FIXME: It is possible to install multiple copies. Everything screws up then. set (CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/share\\\\header.bmp") set (CPACK_NSIS_INSTALLED_ICON_NAME "logdiag.exe") set (CPACK_NSIS_CREATE_ICONS_EXTRA " @@ -451,7 +440,7 @@ set (CPACK_RPM_PACKAGE_URL "${project_URL}") set (CPACK_SOURCE_GENERATOR "TGZ;ZIP") set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user;/win32-depends;/liblogdiag/ld-marshal.[ch]") -set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${project_VERSION}") +set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") include (CPack) diff --git a/README.adoc b/README.adoc index fbd7109..ab899d8 100644 --- a/README.adoc +++ b/README.adoc @@ -15,7 +15,7 @@ a package with the latest development version from Archlinux's AUR. Requirements ------------ Runtime dependencies: GTK+ >= 3.8, json-glib >= 0.10.4, lua >= 5.2 + -Build dependencies: CMake >= 2.8.12 +Build dependencies: CMake >= 3.9 Build from source on Unix-like systems -------------------------------------- @@ -53,8 +53,11 @@ Build from source on Windows ---------------------------- _Note that with the current method we're stuck with GTK+ 3.8.2._ -First install CMake >= 3.1 and MinGW. Add both to your system path. If you want -to build an installation package, also install NSIS. +First install CMake and MinGW. Add both to your system path. If you want +to build an installation package, also install NSIS. If you want to build within +a path containing spaces, fix your FindPkgConfig.cmake to say: + + separate_arguments(_pkgconfig_invoke_result UNIX_COMMAND "${_pkgconfig_invoke_result}") Run the following command in the directory with source files to automatically fetch and setup all dependencies (contact me if the script becomes obsolete, @@ -63,6 +66,8 @@ releasing a new version in order to resolve compatibility issues): > cmake -P Win32Depends.cmake +Note that Windows XP is no longer able to reliably download from HTTPS sources. + Reserve a directory for an out-of-source build: > mkdir build diff --git a/Win32Depends.cmake b/Win32Depends.cmake index 63e9cd5..515072c 100644 --- a/Win32Depends.cmake +++ b/Win32Depends.cmake @@ -28,8 +28,12 @@ set (pkg_7za_urls "${pkg_7za_root}/7-Zip/9.20/7za920.zip") set (pkg_7za_md5 "2fac454a90ae96021f4ffc607d4c00f8") set (pkg_gtk_root "http://ftp.gnome.org/pub/gnome/binaries/win32") -set (pkg_gtk_urls "${pkg_gtk_root}/dependencies/gettext-tools-0.17.zip") -set (pkg_gtk_md5 "09baff956ebd1c391c7f71e9bd768edd") +set (pkg_gtk_urls + "${pkg_gtk_root}/dependencies/gettext-tools-0.17.zip" + "${pkg_gtk_root}/dependencies/gettext-runtime-0.17-1.zip") +set (pkg_gtk_md5 + "09baff956ebd1c391c7f71e9bd768edd" + "110394b4b1e0a50cd440f1e8729d159c") # https://sourceforge.net/projects/urlget/files # /GTK%2B%203%20binary%20for%20Windows/GTK%2B%203.16.6/ diff --git a/cmake/FindGettext.cmake b/cmake/FindGettext.cmake deleted file mode 100644 index 5b66acb..0000000 --- a/cmake/FindGettext.cmake +++ /dev/null @@ -1,99 +0,0 @@ -# - 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. -# -# Additionally it provides the following macros: -# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN ) -# This will create a target "${PROJECT_NAME}_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. - -#============================================================================= -# Copyright 2007-2009 Kitware, Inc. -# Copyright 2010-2011 Přemysl Eric Janouch -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the Kitware nor the names of contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -# OF SUCH DAMAGE. -#============================================================================= - -find_program (GETTEXT_MSGMERGE_EXECUTABLE msgmerge) -find_program (GETTEXT_MSGFMT_EXECUTABLE msgfmt) - -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 (_potBasename ${_potFile} NAME_WE) - get_filename_component (_absPotFile ${_potFile} ABSOLUTE) - - set (_addToAll) - if (${_firstPoFile} STREQUAL "ALL") - set (_addToAll "ALL") - set (_firstPoFile) - endif (${_firstPoFile} STREQUAL "ALL") - - 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) - - # msgmerge versions older than 0.11 don't actually support --update - # and --backup, let's try to workaround that (tested on 0.10.40). - execute_process (COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} -V - OUTPUT_VARIABLE _msgmergeVersion) - string (REGEX MATCH "0[.][0-9]+" _msgmergeVersion ${_msgmergeVersion}) - if ("${_msgmergeVersion}" MATCHES "[.]10|[.][0-9]") - set (_msgmergeParams --quiet -s - ${_absFile} -o ${_absFile} ${_absPotFile}) - else ("${_msgmergeVersion}" MATCHES "[.]10|[.][0-9]") - set (_msgmergeParams --quiet --update --backup=none -s - ${_absFile} ${_absPotFile}) - endif ("${_msgmergeVersion}" MATCHES "[.]10|[.][0-9]") - - add_custom_command ( - OUTPUT ${_gmoFile} - COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} ${_msgmergeParams} - 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 (_currentPoFile) - - add_custom_target (${PROJECT_NAME}_translations ${_addToAll} - DEPENDS ${_gmoFiles}) -endmacro (GETTEXT_CREATE_TRANSLATIONS) - -include (FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS (Gettext DEFAULT_MSG - GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE) - - diff --git a/config.h.in b/config.h.in index 9ddcf53..a7b11ad 100644 --- a/config.h.in +++ b/config.h.in @@ -9,7 +9,7 @@ #define __CONFIG_H__ #define PROJECT_NAME "${PROJECT_NAME}" -#define PROJECT_VERSION "${project_VERSION}" +#define PROJECT_VERSION "${PROJECT_VERSION}" #define PROJECT_URL "${project_URL}" #cmakedefine OPTION_NOINSTALL diff --git a/share/org.logdiag.gschema.xml b/share/org.logdiag.gschema.xml index aed6cb1..71131d4 100644 --- a/share/org.logdiag.gschema.xml +++ b/share/org.logdiag.gschema.xml @@ -1,5 +1,5 @@ <schemalist> - <schema id="org.logdiag" path="/apps/logdiag/" gettext-domain="logdiag"> + <schema id="org.logdiag" path="/org/logdiag/" gettext-domain="logdiag"> <key name="show-main-toolbar" type="b"> <default>true</default> <summary>Whether to show the main toolbar</summary> |