Skip to content

Commit

Permalink
Qmaketocmake7 (GPSBabel#933)
Browse files Browse the repository at this point in the history
* packaging improvements.

parse package_app arguments.
add fields to macos info.plist.
pass copyright year down.
make windows workflows match.

* fix windows rc copyright

* automate copyright date for gui in windows.
  • Loading branch information
tsteven4 authored Oct 16, 2022
1 parent 2e32545 commit ab0fa19
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
run: |
.\tools\ci_setup_windows.ps1 -qtdir "$Home\Cache\Qt\${{ matrix.QT_VERSION }}\${{ matrix.COMPILER }}" -arch "${{ matrix.ARCH }}" -host_arch "${{ matrix.HOST_ARCH }}" -vcversion "${{ matrix.VCVERSION }}"
if ( "${{ matrix.generator }}" ) {
.\tools\ci_script_windows.ps1 -generator "${{ matrix.GENERATOR }}" -arch "${{ matrix.ARCH }}"
.\tools\ci_script_windows.ps1 -generator "${{ matrix.GENERATOR }}" -arch "${{ matrix.ARCH }}" -toolset "${{ matrix.TOOLSET }}"
} else {
.\tools\make_windows_release.ps1 -iscc "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" -buildinstaller true -flow "${{ matrix.FLOW }}" -arch "${{ matrix.ARCH }}"
}
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/windows_ondemand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
COMPILER: 'msvc2017_64'
METHOD: 'aqt'
GENERATOR: 'Visual Studio 16 2019'
RELEASE: false
os: windows-2019
- QT_VERSION: '5.12.12'
ARCH: 'amd64'
Expand All @@ -28,27 +29,31 @@ jobs:
TOOLSET: 'v141,version=14.16.27023'
METHOD: 'aqt'
GENERATOR: 'Visual Studio 16 2019'
RELEASE: false
os: windows-2019
- QT_VERSION: '5.12.12'
ARCH: 'x86'
HOST_ARCH: 'amd64'
COMPILER: 'msvc2017'
METHOD: 'aqt'
GENERATOR: 'Visual Studio 16 2019'
RELEASE: false
os: windows-2019
- QT_VERSION: '6.2.4'
ARCH: 'amd64'
HOST_ARCH: 'amd64'
COMPILER: 'msvc2019_64'
METHOD: 'aqt'
GENERATOR: 'Visual Studio 16 2019'
RELEASE: false
os: windows-2019
- QT_VERSION: '6.2.4'
ARCH: 'amd64'
HOST_ARCH: 'amd64'
COMPILER: 'msvc2019_64'
METHOD: 'aqt'
GENERATOR: 'Visual Studio 17 2022'
RELEASE: false
os: windows-latest

steps:
Expand Down Expand Up @@ -100,6 +105,17 @@ jobs:
PNAME=./bld/gui/package/gpsbabel.exe GBTEMP=./gbtemp ./testo 2>&1
PNAME=./bld/gui/package/gpsbabel.exe GBTEMP=./gbtemp ./test_encoding_utf8 2>&1
- name: Deploy
# This only handles continous releases now, for other events artifacts may be saved in
# the 'Upload Artifacts' step.
if: ( github.event_name == 'push' ) && ( github.ref == 'refs/heads/master' ) && matrix.RELEASE
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: Continuous-${{ runner.os }}
run: |
./tools/uploadtool/upload_github.sh bld/gui/GPSBabel-*-Setup.exe
- name: 'Upload Artifacts'
uses: actions/upload-artifact@v3
with:
Expand Down
1 change: 1 addition & 0 deletions gbversion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ list(GET VERSION_COMPONENTS 2 GB.MICRO)
set(GB.BUILD 32 CACHE STRING "Fourth component of Windows VERSIONINFO resource FILEVERSION and PRODUCTVERSION parameters.")
set(GB.PACKAGE_RELEASE "" CACHE STRING "String to append to VERSION tuple.") # .e.g. "-beta20190413"
set(GB.SHA $ENV{GITHUB_SHA})
string(TIMESTAMP GB.COPYRIGHT_YEAR "%Y" UTC)

# may be overridden on cmake command line
set(DOCVERSION ${GB.VERSION} CACHE STRING "String appended to documentation location for www.gpsbabel.org.")
1 change: 1 addition & 0 deletions gbversion.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define VER_PRODUCT @GB.MAJOR@,@GB.MINOR@,@GB.MICRO@,@GB.BUILD@
#define VER_FILE_STR "@GB.MAJOR@[email protected]@[email protected]@@GB.PACKAGE_RELEASE@"
#define VER_PRODUCT_STR "@GB.MAJOR@[email protected]@[email protected]@@GB.PACKAGE_RELEASE@"
#define VER_COPYRIGHT_YEAR @GB.COPYRIGHT_YEAR@
#else
#define VERSION "@GB.MAJOR@[email protected]@[email protected]@@GB.PACKAGE_RELEASE@"
constexpr char kVersionSHA[] = "@GB.SHA@";
Expand Down
1 change: 1 addition & 0 deletions gbversion.h.qmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define VER_PRODUCT $${GB.MAJOR},$${GB.MINOR},$${GB.MICRO},$${GB.BUILD}
#define VER_FILE_STR \"$${GB.MAJOR}.$${GB.MINOR}.$${GB.MICRO}$${GB.PACKAGE_RELEASE}\"
#define VER_PRODUCT_STR \"$${GB.MAJOR}.$${GB.MINOR}.$${GB.MICRO}$${GB.PACKAGE_RELEASE}\"
#define VER_COPYRIGHT_YEAR $${GB.COPYRIGHT_YEAR}
#else
#define VERSION \"$${GB.MAJOR}.$${GB.MINOR}.$${GB.MICRO}$${GB.PACKAGE_RELEASE}\"
constexpr char kVersionSHA[] = \"$${GB.SHA}\";
Expand Down
1 change: 1 addition & 0 deletions gbversion.pri
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ GB.MICRO = $$member(GB.VERSION_COMPONENTS, 2)
GB.BUILD = 32
# GB.PACKAGE_RELEASE = "-beta20190413"
GB.SHA = $$(GITHUB_SHA)
GB.COPYRIGHT_YEAR = 2022

# may be overridden on qmake command line
!defined(DOCVERSION, var) {
Expand Down
12 changes: 8 additions & 4 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,12 @@ if(APPLE)

# Info.plist has not been debugged with the cmake flow, it's a bit different than with the qmake flow.
set_target_properties(gpsbabelfe PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME GPSBabel
MACOSX_BUNDLE_BUNDLE_VERSION ${GB.BUILD}
MACOSX_BUNDLE_COPYRIGHT "© 2002-${GB.COPYRIGHT_YEAR} Robert Lipe"
MACOSX_BUNDLE_GUI_IDENTIFIER org.gpsbabel.gpsbabelfe
MACOSX_BUNDLE_ICON_FILE ${MACOSX_BUNDLE_ICON_FILE}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION}
)
else()
target_sources(gpsbabelfe PRIVATE ${SOURCES} ${HEADERS} ${RESOURCES})
Expand Down Expand Up @@ -197,16 +201,16 @@ else()
if(APPLE)
get_target_property(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
add_custom_target(package_app
COMMAND QMAKE=${_qmake_executable} ${CMAKE_CURRENT_SOURCE_DIR}/package_app $<TARGET_BUNDLE_DIR:gpsbabelfe> $<TARGET_FILE:gpsbabel> ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/package_app -a $<TARGET_BUNDLE_DIR:gpsbabelfe> -l -q ${_qmake_executable} -g $<TARGET_FILE:gpsbabel> -s ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_BUNDLE_DIR:gpsbabelfe>/../GPSBabelFE.dmg ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS gpsbabelfe gpsbabel coretool_lrelease
DEPENDS gpsbabelfe gpsbabel gpsbabelfe_lrelease coretool_lrelease
VERBATIM
USES_TERMINAL)
elseif(UNIX)
get_target_property(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
add_custom_target(package_app
COMMAND QMAKE=${_qmake_executable} ${CMAKE_CURRENT_SOURCE_DIR}/package_app $<TARGET_FILE_DIR:gpsbabelfe> $<TARGET_FILE:gpsbabel> ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS gpsbabelfe gpsbabel coretool_lrelease
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/package_app -a $<TARGET_FILE_DIR:gpsbabelfe> -l -q ${_qmake_executable} -g $<TARGET_FILE:gpsbabel> -s ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS gpsbabelfe gpsbabel gpsbabelfe_lrelease coretool_lrelease
VERBATIM
USES_TERMINAL)
elseif(WIN32)
Expand Down
6 changes: 5 additions & 1 deletion gui/app.rc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include <winver.h>
#include "gbversion.h"

#define stringize_(S) #S
#define stringize(S) stringize_(S)
#define copyright_str(YEAR) stringize(\xa9 2002-##YEAR Robert Lipe)

IDI_ICON1 ICON "images/appicon.ico"

VS_VERSION_INFO VERSIONINFO
Expand All @@ -24,7 +28,7 @@ BEGIN
VALUE "FileDescription", "GPS format converter"
VALUE "FileVersion", VER_FILE_STR
VALUE "InternalName", "GPSBabelFE.exe"
VALUE "LegalCopyright", L"\x00a9 2002-2022 Robert Lipe"
VALUE "LegalCopyright", copyright_str(VER_COPYRIGHT_YEAR)
VALUE "OriginalFilename", "GPSBabelFE.exe"
VALUE "ProductName", "GPSBabel"
VALUE "ProductVersion", VER_PRODUCT_STR
Expand Down
56 changes: 37 additions & 19 deletions gui/package_app
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function convert_qt_translations()
echo '</plist>' >> "$resourceskel"
fi

pushd "$(${QMAKE} -query QT_INSTALL_TRANSLATIONS)" > /dev/null
pushd "${QT_INSTALL_TRANSLATIONS}" > /dev/null
languages=($(echo qtbase_??.qm | sed 's/qtbase_\(..\).qm/\1/g'))
for language in "${languages[@]}"
do
Expand All @@ -67,35 +67,52 @@ function convert_qt_translations()
fi
}

QMAKE="${QMAKE:-qmake}"

LUPDATE="$(${QMAKE} -query QT_INSTALL_BINS)/lupdate"
LRELEASE="$(${QMAKE} -query QT_INSTALL_BINS)/lrelease"
LCONVERT="$(${QMAKE} -query QT_INSTALL_BINS)/lconvert"
MACDEPLOYQT="$(${QMAKE} -query QT_INSTALL_BINS)/macdeployqt"

GPSBABEL=${2:-../gpsbabel}
SOURCEDIR=${3:-.}

case "$(uname -s)" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
*) echo "Unknown kernel name $(uname -s)." 1>&2; exit 1;;
esac

# update our translations and compile them.
"${LUPDATE}" "${SOURCEDIR}/app.pro"
"${LRELEASE}" "${SOURCEDIR}/app.pro"
if [ "${machine}" = "Linux" ]; then
APPDIR=GPSBabelFE
else
APPDIR=GPSBabelFE.app
fi
SKIP_UPDATE_RELEASE=
GPSBABEL=../gpsbabel
QMAKE=qmake
SOURCEDIR=.
while getopts a:lg:q:s: name
do
case $name in
a) APPDIR="$OPTARG";;
l) SKIP_UPDATE_RELEASE=1;;
g) GPSBABEL="$OPTARG";;
q) QMAKE="$OPTARG";;
s) SOURCEDIR="$OPTARG";;
?) printf "Usage: %s: [-a package_directory] [-g gpsbabel] [-l] [-q qmake] [-s source_directory]\n" "$0"
exit 2;;
esac
done
# need absolute paths for convert_qt_translations()
APPDIR="$( cd "${APPDIR}" && pwd )"

LCONVERT="$(${QMAKE} -query QT_INSTALL_BINS)/lconvert"
LUPDATE="$(${QMAKE} -query QT_INSTALL_BINS)/lupdate"
LRELEASE="$(${QMAKE} -query QT_INSTALL_BINS)/lrelease"
MACDEPLOYQT="$(${QMAKE} -query QT_INSTALL_BINS)/macdeployqt"
QT_INSTALL_TRANSLATIONS="$(${QMAKE} -query QT_INSTALL_TRANSLATIONS)"

if [ -z "${SKIP_UPDATE_RELEASE}" ]; then
# update our translations and compile them.
"${LUPDATE}" "${SOURCEDIR}/app.pro"
"${LRELEASE}" "${SOURCEDIR}/app.pro"
fi

if [ "${machine}" = "Linux" ]; then
# need absolute paths for convert_qt_translations()
APPDIR="$( cd "${1:-GPSBabelFE}" && pwd )"
LANGDIR="${APPDIR}/translations"
else
# need absolute paths for convert_qt_translations()
APPDIR="$( cd "${1:-GPSBabelFE.app}" && pwd )"
LANGDIR="${APPDIR}/Contents/MacOS/translations"
APPBUNDLE=$(basename "$APPDIR")
fi

rm -fr "${LANGDIR}"
Expand All @@ -120,6 +137,7 @@ else # Mac
pushd "${APPDIR}/.."
rm -f GPSBabelFE.dmg
# macdeploytqt likes relative paths or else the dmg mount points get funky.
APPBUNDLE="$(basename "$APPDIR")"
"${MACDEPLOYQT}" "${APPBUNDLE}" -executable="${APPBUNDLE}/Contents/MacOS/gpsbabel" -dmg -verbose=2
popd
fi
6 changes: 5 additions & 1 deletion win32/gpsbabel.rc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include <winver.h>
#include "gbversion.h"

#define stringize_(S) #S
#define stringize(S) stringize_(S)
#define copyright_str(YEAR) stringize(\xa9 2002-##YEAR Robert Lipe)

IDI_ICON1 ICON "gpsbabel.ico"

VS_VERSION_INFO VERSIONINFO
Expand All @@ -24,7 +28,7 @@ BEGIN
VALUE "FileDescription", "GPS format converter"
VALUE "FileVersion", VER_FILE_STR
VALUE "InternalName", "gpsbabel.exe"
VALUE "LegalCopyright", L"\x00a9 2002-2022 Robert Lipe"
VALUE "LegalCopyright", copyright_str(VER_COPYRIGHT_YEAR)
VALUE "OriginalFilename", "gpsbabel.exe"
VALUE "ProductName", "GPSBabel"
VALUE "ProductVersion", VER_PRODUCT_STR
Expand Down

0 comments on commit ab0fa19

Please sign in to comment.