CMake Fixes + Snap port to core20 (#1174)

* CMake: use PROJECT_VERSION instead of solvespace_*_VERSION

In 006539b, solvespace_MAJOR_VERSION etc. were removed.
However, these variables were still referenced in some places.
Solution: Use PROJECT_VERSION instead.

* CMake: re-add link directories for solvespace target

006539b removed the call to link_directories for gtkmm, jsonc & fontconfig.
This leads to linking errors if those libraries are in "non-standard"
paths.
Fix this by introducing a target specific target_link_directories call.

Fixes #1173

* snap: port to core20 & adapt to CMake changes

Moving to core20 was long overdue anyway, and
the recent CMake changes necessitated some fixes.
Also switch to LZO compression for (way) better cold start
performance.
pull/1175/head
Maximilian Federle 2022-01-02 20:04:57 +01:00 committed by GitHub
parent b71c728262
commit 34efb6de77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 25 deletions

View File

@ -15,9 +15,9 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>${solvespace_VERSION_MAJOR}.${solvespace_VERSION_MINOR}~${solvespace_GIT_HASH}</string> <string>${PROJECT_VERSION}~${solvespace_GIT_HASH}</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>${solvespace_VERSION_MAJOR}.${solvespace_VERSION_MINOR}</string> <string>${PROJECT_VERSION}</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>© 2008-2016 Jonathan Westhues and other authors</string> <string>© 2008-2016 Jonathan Westhues and other authors</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>

View File

@ -1,5 +1,5 @@
name: solvespace name: solvespace
base: core18 base: core20
summary: Parametric 2d/3d CAD summary: Parametric 2d/3d CAD
adopt-info: solvespace adopt-info: solvespace
description: | description: |
@ -14,6 +14,7 @@ description: |
confinement: strict confinement: strict
license: GPL-3.0 license: GPL-3.0
compression: lzo
layout: layout:
/usr/share/solvespace: /usr/share/solvespace:
@ -23,13 +24,11 @@ apps:
solvespace: solvespace:
command: usr/bin/solvespace command: usr/bin/solvespace
desktop: solvespace.desktop desktop: solvespace.desktop
extensions: [gnome-3-34] extensions: [gnome-3-38]
plugs: [opengl, unity7, home, removable-media, gsettings, network] plugs: [opengl, unity7, home, removable-media, gsettings, network]
environment:
__EGL_VENDOR_LIBRARY_DIRS: $SNAP/gnome-platform/usr/share/glvnd/egl_vendor.d:$SNAP/usr/share/glvnd/egl_vendor.d
cli: cli:
command: usr/bin/solvespace-cli command: usr/bin/solvespace-cli
extensions: [gnome-3-34] extensions: [gnome-3-38]
plugs: [home, removable-media, network] plugs: [home, removable-media, network]
parts: parts:
@ -39,20 +38,24 @@ parts:
source-type: local source-type: local
override-pull: | override-pull: |
snapcraftctl pull snapcraftctl pull
version_major=$(grep "solvespace_VERSION_MAJOR" CMakeLists.txt | tr -d "()" | cut -d" " -f2) git submodule update --init extlib/libdxfrw extlib/mimalloc extlib/eigen
version_minor=$(grep "solvespace_VERSION_MINOR" CMakeLists.txt | tr -d "()" | cut -d" " -f2) override-build: |
version="$version_major.$version_minor~$(git rev-parse --short=8 HEAD)" snapcraftctl build
project_version=$(grep CMAKE_PROJECT_VERSION:STATIC CMakeCache.txt | cut -d "=" -f2)
cd $SNAPCRAFT_PART_SRC
version="$project_version~$(git rev-parse --short=8 HEAD)"
snapcraftctl set-version "$version" snapcraftctl set-version "$version"
git describe --exact-match HEAD && grade="stable" || grade="devel" git describe --exact-match HEAD && grade="stable" || grade="devel"
snapcraftctl set-grade "$grade" snapcraftctl set-grade "$grade"
git submodule update --init extlib/libdxfrw extlib/mimalloc extlib/eigen cmake-parameters:
configflags:
- -DCMAKE_INSTALL_PREFIX=/usr - -DCMAKE_INSTALL_PREFIX=/usr
- -DCMAKE_BUILD_TYPE=Release - -DCMAKE_BUILD_TYPE=Release
- -DENABLE_TESTS=OFF - -DENABLE_TESTS=OFF
- -DSNAP=ON - -DSNAP=ON
- -DENABLE_OPENMP=ON - -DENABLE_OPENMP=ON
- -DENABLE_LTO=ON - -DENABLE_LTO=ON
build-snaps:
- gnome-3-38-2004-sdk
build-packages: build-packages:
- zlib1g-dev - zlib1g-dev
- libpng-dev - libpng-dev
@ -63,7 +66,6 @@ parts:
- libsigc++-2.0-dev - libsigc++-2.0-dev
- libspnav-dev - libspnav-dev
- git - git
- g++
stage-packages: stage-packages:
- libspnav0 - libspnav0
- libsigc++-2.0-0v5 - libsigc++-2.0-0v5
@ -71,11 +73,14 @@ parts:
cleanup: cleanup:
after: [solvespace] after: [solvespace]
plugin: nil plugin: nil
build-snaps: [core18, gnome-3-34-1804] build-snaps: [gnome-3-38-2004]
override-prime: | override-prime: |
# Remove all files from snap that are already included in the base snap or in
# any connected content snaps
set -eux set -eux
for snap in "core18" "gnome-3-34-1804"; do # List all content-snaps and base snaps you're using here for snap in "gnome-3-38-2004"; do # List all content-snaps you're using here
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \; cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" "$SNAPCRAFT_PRIME/usr/{}" \;
done done
for cruft in bug lintian man; do
rm -rf $SNAPCRAFT_PRIME/usr/share/$cruft
done
find $SNAPCRAFT_PRIME/usr/share/doc/ -type f -not -name 'copyright' -delete
find $SNAPCRAFT_PRIME/usr/share -type d -empty -delete

View File

@ -1,6 +1,6 @@
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION ${solvespace_VERSION_MAJOR},${solvespace_VERSION_MINOR},0,0 FILEVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,0
PRODUCTVERSION ${solvespace_VERSION_MAJOR},${solvespace_VERSION_MINOR},0,0 PRODUCTVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},0,0
FILEFLAGSMASK 0 FILEFLAGSMASK 0
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32 FILEOS VOS_NT_WINDOWS32
@ -13,9 +13,9 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "The SolveSpace authors" VALUE "CompanyName", "The SolveSpace authors"
VALUE "ProductName", "SolveSpace" VALUE "ProductName", "SolveSpace"
VALUE "ProductVersion", "${solvespace_VERSION_MAJOR}.${solvespace_VERSION_MINOR}~${solvespace_GIT_HASH}" VALUE "ProductVersion", "${PROJECT_VERSION}~${solvespace_GIT_HASH}"
VALUE "FileDescription", "SolveSpace, a parametric 2d/3d CAD" VALUE "FileDescription", "SolveSpace, a parametric 2d/3d CAD"
VALUE "FileVersion", "${solvespace_VERSION_MAJOR}.${solvespace_VERSION_MINOR}~${solvespace_GIT_HASH}" VALUE "FileVersion", "${PROJECT_VERSION}~${solvespace_GIT_HASH}"
VALUE "OriginalFilename", "solvespace.exe" VALUE "OriginalFilename", "solvespace.exe"
VALUE "InternalName", "solvespace" VALUE "InternalName", "solvespace"
VALUE "LegalCopyright", "(c) 2008-2021 Jonathan Westhues and other authors" VALUE "LegalCopyright", "(c) 2008-2021 Jonathan Westhues and other authors"

View File

@ -88,7 +88,7 @@ target_link_libraries(slvs PRIVATE slvs_deps)
set_target_properties(slvs PROPERTIES set_target_properties(slvs PROPERTIES
PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/slvs.h PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/slvs.h
VERSION ${solvespace_VERSION_MAJOR}.${solvespace_VERSION_MINOR} VERSION ${PROJECT_VERSION}
SOVERSION 1) SOVERSION 1)
if(NOT WIN32) if(NOT WIN32)
@ -204,7 +204,7 @@ if(HAVE_GETTEXT)
--keyword --keyword=_ --keyword=N_ --keyword=C_:2,1c --keyword=CN_:2,1c --keyword --keyword=_ --keyword=N_ --keyword=C_:2,1c --keyword=CN_:2,1c
--force-po --width=100 --sort-by-file --force-po --width=100 --sort-by-file
--package-name=SolveSpace --package-name=SolveSpace
--package-version=${solvespace_VERSION_MAJOR}.${solvespace_VERSION_MINOR} --package-version=${PROJECT_VERSION}
"--copyright-holder=the PACKAGE authors" "--copyright-holder=the PACKAGE authors"
--msgid-bugs-address=whitequark@whitequark.org --msgid-bugs-address=whitequark@whitequark.org
--from-code=utf-8 --output=${gen_output_pot} ${inputs} --from-code=utf-8 --output=${gen_output_pot} ${inputs}
@ -308,6 +308,10 @@ if(ENABLE_GUI)
${GTKMM_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS}
${JSONC_INCLUDE_DIRS} ${JSONC_INCLUDE_DIRS}
${FONTCONFIG_INCLUDE_DIRS}) ${FONTCONFIG_INCLUDE_DIRS})
target_link_directories(solvespace PRIVATE
${GTKMM_LIBRARY_DIRS}
${JSONC_LIBRARY_DIRS}
${FONTCONFIG_LIBRARY_DIRS})
target_link_libraries(solvespace PRIVATE target_link_libraries(solvespace PRIVATE
${GTKMM_LIBRARIES} ${GTKMM_LIBRARIES}
${JSONC_LIBRARIES} ${JSONC_LIBRARIES}

View File

@ -1,7 +1,7 @@
#ifndef SOLVESPACE_CONFIG_H #ifndef SOLVESPACE_CONFIG_H
#define SOLVESPACE_CONFIG_H #define SOLVESPACE_CONFIG_H
#define PACKAGE_VERSION "@solvespace_VERSION_MAJOR@.@solvespace_VERSION_MINOR@~@solvespace_GIT_HASH@" #define PACKAGE_VERSION "@PROJECT_VERSION@~@solvespace_GIT_HASH@"
/* Non-OS X *nix only */ /* Non-OS X *nix only */
#define UNIX_DATADIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATAROOTDIR@/solvespace" #define UNIX_DATADIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATAROOTDIR@/solvespace"