From 6a027662aee9a0e696839000b1aee26fe8bf8531 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Wed, 18 Dec 2019 17:24:07 +0000 Subject: [PATCH] Update Linux appdata file and CMake version strings CHANGED: Update the Linux appdata file to include new tags * Include version tags (and others) in the appdata file * Refactor the version string generation to clean it up Cherry-pick of: 3370e89967b5e03afbda86f9b9091651ccc0bb96 e54c954aedd517554ac04c10d9a33d62c831281f --- CMakeLists.txt | 13 +++++- CMakeModules/CreateGitVersionHeader.cmake | 2 + CMakeModules/KiCadFullVersion.cmake | 40 ++++++++++++++++ .../WritePlatformMetadata_linux.cmake | 46 +++++++++++++++++++ CMakeModules/WriteVersionHeader.cmake | 20 +------- Documentation/development/compiling.md | 2 +- common/CMakeLists.txt | 10 ++-- ...kicad.appdata.xml => kicad.appdata.xml.in} | 43 +++++++++++++---- 8 files changed, 141 insertions(+), 35 deletions(-) create mode 100644 CMakeModules/KiCadFullVersion.cmake create mode 100644 CMakeModules/WritePlatformMetadata_linux.cmake rename resources/linux/appdata/{kicad.appdata.xml => kicad.appdata.xml.in} (62%) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc9b794b9e..41a60b4001 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -894,6 +894,14 @@ add_custom_target( uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" ) +################################################# +# Generate platform metadata files +################################################# +if( UNIX AND NOT APPLE ) + include( ${CMAKE_MODULE_PATH}/WritePlatformMetadata_linux.cmake ) +endif() + + #================================================ # Installation #================================================ @@ -919,7 +927,7 @@ if( UNIX AND NOT APPLE ) set( UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime ) set( UNIX_ICON_FILES ${UNIX_MIME_DIR}/icons ) set( UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications ) - set( UNIX_APPDATA_FILES resources/linux/appdata ) + set( UNIX_APPDATA_FILES ${PROJECT_BINARY_DIR}/resources/linux/appdata ) # Install Mime directory install( DIRECTORY ${UNIX_ICON_FILES} @@ -943,6 +951,9 @@ if( UNIX AND NOT APPLE ) install( DIRECTORY ${UNIX_APPDATA_FILES} DESTINATION share COMPONENT resources + FILES_MATCHING + PATTERN "*appdata.xml" + PATTERN "*.in" EXCLUDE ) endif() diff --git a/CMakeModules/CreateGitVersionHeader.cmake b/CMakeModules/CreateGitVersionHeader.cmake index f465534f05..1b2ac483a5 100644 --- a/CMakeModules/CreateGitVersionHeader.cmake +++ b/CMakeModules/CreateGitVersionHeader.cmake @@ -27,6 +27,8 @@ macro( create_git_version_header _git_src_path ) find_package( Git ) if( GIT_FOUND ) + message( STATUS "Using Git to determine build version string." ) + set( _Git_SAVED_LC_ALL "$ENV{LC_ALL}" ) set( ENV{LC_ALL} C ) diff --git a/CMakeModules/KiCadFullVersion.cmake b/CMakeModules/KiCadFullVersion.cmake new file mode 100644 index 0000000000..f1f8af59b0 --- /dev/null +++ b/CMakeModules/KiCadFullVersion.cmake @@ -0,0 +1,40 @@ +# +# This program source code file is part of KICAD, a free EDA CAD application. +# +# Copyright (C) 2019 Ian McInerney +# Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, you may find one here: +# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html +# or you may search the http://www.gnu.org website for the version 2 license, +# or you may write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# + +# This file will create the full KiCad version string. The base of this string +# will be either the git tag followed by the commit hash (if built inside a git +# repository), or the version from KiCadVersion.cmake. The user-provided +# KICAD_VERSION_EXTRA is then appended to the base version string. + +# Use git to determine the version string if it's available. +include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake ) +create_git_version_header( ${SRC_PATH} ) + +# $KICAD_VERSION is set in KiCadVersion.cmake or by git (if it is available). +set( KICAD_VERSION_FULL "${KICAD_VERSION}" ) + +# Optional user version information defined at configuration. +if( KICAD_VERSION_EXTRA ) + set( KICAD_VERSION_FULL "${KICAD_VERSION_FULL}-${KICAD_VERSION_EXTRA}" ) +endif() diff --git a/CMakeModules/WritePlatformMetadata_linux.cmake b/CMakeModules/WritePlatformMetadata_linux.cmake new file mode 100644 index 0000000000..dcb435a183 --- /dev/null +++ b/CMakeModules/WritePlatformMetadata_linux.cmake @@ -0,0 +1,46 @@ +# +# This program source code file is part of KICAD, a free EDA CAD application. +# +# Copyright (C) 2019 Ian McInerney +# Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, you may find one here: +# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html +# or you may search the http://www.gnu.org website for the version 2 license, +# or you may write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# + +# This file will configure the linux appdata.xml file to include the version +# and build date. + +message( STATUS "Creating linux metadata" ) + +# Create the KiCad version strings +set( SRC_PATH ${PROJECT_SOURCE_DIR} ) +include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake ) +include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake ) + +# Create the date of the configure +string( TIMESTAMP KICAD_CONFIG_TIMESTAMP "%Y-%m-%d" ) + +# Configure the KiCad appdata file +configure_file( ${PROJECT_SOURCE_DIR}/resources/linux/appdata/kicad.appdata.xml.in + ${PROJECT_BINARY_DIR}/resources/linux/appdata/kicad.appdata.xml + @ONLY ) + +# Ensure the file was configured successfully +if( NOT EXISTS ${PROJECT_BINARY_DIR}/resources/linux/appdata/kicad.appdata.xml ) + message( FATAL_ERROR "Configuration failed to write file kicad.appdata.xml." ) +endif() diff --git a/CMakeModules/WriteVersionHeader.cmake b/CMakeModules/WriteVersionHeader.cmake index d58c39b405..c0e9142f9f 100644 --- a/CMakeModules/WriteVersionHeader.cmake +++ b/CMakeModules/WriteVersionHeader.cmake @@ -22,25 +22,9 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # -# Automagically create version header file if the version string was -# not defined during the build configuration. If CreateGitVersionHeader -# cannot determine the current repo version, a version.h file is still -# created with KICAD_VERSION set in KiCadVersion.cmake. +# Create the KiCad version strings include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake ) - -# Always use git if it's available to determine the version string. -message( STATUS "Using Git to determine build version string." ) -include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake ) -create_git_version_header( ${SRC_PATH} ) - -# $KICAD_VERSION will always be set to something. Even if it is the default -# value set in KiCadVersion.cmake -set( KICAD_VERSION_FULL "${KICAD_VERSION}" ) - -# Optional user version information defined at configuration. -if( KICAD_VERSION_EXTRA ) - set( KICAD_VERSION_FULL "${KICAD_VERSION_FULL}-${KICAD_VERSION_EXTRA}" ) -endif() +include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake ) set( _wvh_new_version_text "/* Do not modify this file, it was automatically generated by CMake. */ diff --git a/Documentation/development/compiling.md b/Documentation/development/compiling.md index 73a0490d96..5421c5d8eb 100644 --- a/Documentation/development/compiling.md +++ b/Documentation/development/compiling.md @@ -222,7 +222,7 @@ and can cause Pcbnew to crash if Python scripts create an invalid object state w The KiCad version string is defined by the output of `git describe --dirty` when git is available or the version string defined in CMakeModules/KiCadVersion.cmake with the value of -KICAD_VERSION_EXTRA appended to the former. If the KICAD_VERSION_EXTRA variable is not define, +KICAD_VERSION_EXTRA appended to the former. If the KICAD_VERSION_EXTRA variable is not defined, it is not appended to the version string. If the KICAD_VERSION_EXTRA variable is defined it is appended along with a leading '-' to the full version string as follows: diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index c23c834070..ae0d536d5f 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -153,10 +153,10 @@ install( TARGETS lib_kicad endif() -# KiCad build version string defaults to "no-vcs-found" which forces the build version header -# command to look for git to create the version string header when the .git path is found in -# the source path. -set( KICAD_BRANCH_NAME "" CACHE STRING "KiCad repository name." ) +# The build version string defaults to the value in the KiCadVersion.cmake file. +# If being built inside a git repository, the git tag and commit hash are used to create +# a new version string instead. The user can supply an additional string to be appended +# to the end inside the KICAD_VERSION_EXTRA variable set( KICAD_VERSION_EXTRA "" CACHE STRING "User defined configuration string to append to KiCad version." ) @@ -164,8 +164,6 @@ set( KICAD_VERSION_EXTRA "" CACHE STRING add_custom_target( version_header ALL COMMAND ${CMAKE_COMMAND} - -DKICAD_VERSION=${KICAD_VERSION} - -DKICAD_BRANCH_NAME=${KICAD_BRANCH_NAME} -DKICAD_VERSION_EXTRA=${KICAD_VERSION_EXTRA} -DOUTPUT_FILE=${CMAKE_BINARY_DIR}/kicad_build_version.h -DSRC_PATH=${PROJECT_SOURCE_DIR} diff --git a/resources/linux/appdata/kicad.appdata.xml b/resources/linux/appdata/kicad.appdata.xml.in similarity index 62% rename from resources/linux/appdata/kicad.appdata.xml rename to resources/linux/appdata/kicad.appdata.xml.in index 2fc29f0c18..8fa827c1c4 100644 --- a/resources/linux/appdata/kicad.appdata.xml +++ b/resources/linux/appdata/kicad.appdata.xml.in @@ -1,16 +1,30 @@ - + - kicad.desktop + org.kicad_pcb.kicad KiCad - AGPL-3.0+ + + AGPL-3.0-or-later CC-BY-SA-4.0 + EDA Suite EDA Lösung Suite EDA EDA Programpaket + + kicad + eeschema + pcbnew + gerbview + pl_editor + bitmap2component + pcb_calculator + + + kicad + KiCad EDA @@ -46,27 +60,38 @@ - http://kicad-pcb.org/img/screenshots/appstream/kicad.png + https://kicad-pcb.org/img/screenshots/appstream/kicad.png Eeschema Schematic Editor - http://kicad-pcb.org/img/screenshots/appstream/eeschema.png + https://kicad-pcb.org/img/screenshots/appstream/eeschema.png PcbNew PCB Layout - http://kicad-pcb.org/img/screenshots/appstream/pcbnew.png + https://kicad-pcb.org/img/screenshots/appstream/pcbnew.png PcbNew 3D Viewer - http://kicad-pcb.org/img/screenshots/appstream/3dviewer.png + https://kicad-pcb.org/img/screenshots/appstream/3dviewer.png - http://kicad-pcb.org/ - http://kicad-pcb.org/help/report-a-bug/ + https://kicad-pcb.org/ + https://kicad-pcb.org/help/report-a-bug/ + https://docs.kicad-pcb.org/ + https://kicad-pcb.org/ + kicad-developers@lists.launchpad.net The KiCad Developers + + + + + + + +