Skip to content

Commit

Permalink
Add custom Windows tile (#1787)
Browse files Browse the repository at this point in the history
* Add custom Windows tile

* Fix debug_and_release configuration for core_lib and tests
  • Loading branch information
J5lx authored Oct 1, 2023
1 parent a4d6330 commit f09d0ca
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 42 deletions.
12 changes: 8 additions & 4 deletions .github/actions/create-package/create-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ wayland-decoration-client,wayland-graphics-integration-client,wayland-shell-inte
create_package_macos() {
echo "::group::Clean"
make clean
mv bin Pencil2D
mkdir Pencil2D
mv app/Pencil2D.app Pencil2D/
pushd Pencil2D >/dev/null
echo "::endgroup::"

Expand Down Expand Up @@ -88,16 +89,19 @@ create_package_macos() {
}

create_package_windows() {
echo "::group::Set up application files"
nmake install INSTALL_ROOT="$(cygpath -w "${PWD}/Pencil2D")"
echo "::endgroup::"

echo "Copy FFmpeg plugin"
local platform="${INPUT_ARCH%%_*}"
local ffmpeg="ffmpeg-${platform}.zip"
curl -fsSLO "https://github.com/pencil2d/pencil2d-deps/releases/download/ffmpge-v4.1.1/$ffmpeg"
"${WINDIR}\\System32\\tar" xf "${ffmpeg}"
mkdir bin/plugins
mv "ffmpeg.exe" bin/plugins/
mkdir Pencil2D/plugins
mv "ffmpeg.exe" Pencil2D/plugins/
rm -rf "${ffmpeg}"

mv bin Pencil2D
echo "Remove files"
find \( -name '*.pdb' -o -name '*.ilk' \) -delete
echo "::group::Deploy Qt libraries"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:

- name: Configure build
run: mkdir build; ${{runner.os == 'Linux' && matrix.qt == 6 && 'qmake6' || 'qmake'}}
-o build PREFIX=/usr CONFIG+=release CONFIG+=GIT
-o build PREFIX=/usr CONFIG-=debug_and_release CONFIG+=release CONFIG+=GIT
CONFIG+=PENCIL2D_${{github.ref == 'refs/heads/release' && 'RELEASE' || 'NIGHTLY'}}
${{matrix.qt == 6 && 'CONFIG+=c++17 QMAKE_CXX_FLAGS+=-std=c++17' || ''}}

Expand All @@ -102,7 +102,7 @@ jobs:

- name: Run tests
env: { QT_QPA_PLATFORM: minimal }
run: build/tests/bin/tests
run: build/tests/tests

- name: Create package
id: package
Expand Down
37 changes: 25 additions & 12 deletions app/app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@

! include( ../util/common.pri ) { error( Could not find the common.pri file! ) }

QT += core widgets gui xml multimedia svg network

TEMPLATE = app
TARGET = pencil2d
QMAKE_APPLICATION_BUNDLE_NAME = Pencil2D

CONFIG += precompile_header lrelease embed_translations
QT += core widgets gui xml multimedia svg network

DESTDIR = ../bin
MOC_DIR = .moc
OBJECTS_DIR = .obj
UI_DIR = .ui
TARGET = pencil2d

RESOURCES += data/app.qrc

Expand Down Expand Up @@ -111,7 +104,6 @@ HEADERS += \
src/checkupdatesdialog.h \
src/presetdialog.h \
src/repositionframesdialog.h \
src/presetdialog.h \
src/commandlineparser.h \
src/commandlineexporter.h \
src/statusbar.h \
Expand Down Expand Up @@ -219,10 +211,30 @@ macx {
QMAKE_BUNDLE_DATA += FILE_ICONS

QMAKE_TARGET_BUNDLE_PREFIX += org.pencil2d
QMAKE_APPLICATION_BUNDLE_NAME = Pencil2D
}

win32 {
target.path = /
visualelements.path = /
visualelements.files = data/pencil2d.VisualElementsManifest.xml $$OUT_PWD\resources.pri
visualelements.CONFIG += no_check_exist
visualelements.depends += resources.pri
resources.path = /resources
resources.files = data/resources/*

PRI_CONFIG = data/resources.xml
PRI_INDEX_NAME = Pencil2D
RC_FILE = data/pencil2d.rc
INSTALLS += target visualelements resources

makepri.name = makepri
makepri.input = PRI_CONFIG
makepri.output = ${QMAKE_FILE_IN_BASE}.pri
makepri.commands = makepri new /o /in $$PRI_INDEX_NAME /pr ${QMAKE_FILE_PATH} /cf ${QMAKE_FILE_IN} /of ${QMAKE_FILE_OUT}
silent: makepri.commands = @echo makepri ${QMAKE_FILE_IN} && $$makepri.commands
makepri.CONFIG = no_link
QMAKE_EXTRA_COMPILERS += makepri
}

unix:!macx {
Expand Down Expand Up @@ -253,8 +265,9 @@ unix:!macx {

INCLUDEPATH += ../../core_lib/src

CONFIG(debug,debug|release) BUILDTYPE = debug
CONFIG(release,debug|release) BUILDTYPE = release
BUILDTYPE =
debug_and_release:CONFIG(debug,debug|release) BUILDTYPE = debug
debug_and_release:CONFIG(release,debug|release) BUILDTYPE = release

win32-msvc* {
LIBS += -L$$OUT_PWD/../core_lib/$$BUILDTYPE/ -lcore_lib
Expand Down
8 changes: 8 additions & 0 deletions app/data/pencil2d.VisualElementsManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<VisualElements
BackgroundColor="white"
ForegroundText="dark"
Square70x70Logo="tile70.png"
Square150x150Logo="tile150.png"
ShowNameOnSquare150x150Logo="off"/>
</Application>
10 changes: 10 additions & 0 deletions app/data/resources.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources targetOsVersion="6.2.1" majorVersion="1">
<index root="\" startIndexAt="resources\">
<default>
<qualifier name="scale" value="100"/>
<qualifier name="Language" value="en-US"/>
</default>
<indexer-config type="folder" foldernameAsQualifier="true" filenameAsQualifier="true" qualifierDelimiter="."/>
</index>
</resources>
Binary file added app/data/resources/tile150.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/resources/tile150.scale-140.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/resources/tile150.scale-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/resources/tile150.scale-80.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/resources/tile70.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/resources/tile70.scale-140.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/resources/tile70.scale-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/data/resources/tile70.scale-80.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 1 addition & 6 deletions core_lib/core_lib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@

! include( ../util/common.pri ) { error( Could not find the common.pri file! ) }

QT += core widgets gui xml multimedia svg

TEMPLATE = lib
CONFIG += staticlib precompile_header
QT += core widgets gui xml multimedia svg

RESOURCES += data/core_lib.qrc

MOC_DIR = .moc
OBJECTS_DIR = .obj
UI_DIR = .ui

INCLUDEPATH += src \
src/graphics \
src/graphics/bitmap \
Expand Down
15 changes: 5 additions & 10 deletions tests/tests.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@

! include( ../util/common.pri ) { error( Could not find the common.pri file! ) }

QT += core widgets gui xml multimedia svg testlib

TEMPLATE = app

TARGET = tests

CONFIG += console
CONFIG -= app_bundle
QT += core widgets gui xml multimedia svg testlib

MOC_DIR = .moc
OBJECTS_DIR = .obj
DESTDIR = bin
TARGET = tests

RESOURCES += data/tests.qrc

Expand Down Expand Up @@ -52,8 +46,9 @@ SOURCES += \

INCLUDEPATH += $$PWD/../core_lib/src

CONFIG(debug,debug|release) BUILDTYPE = debug
CONFIG(release,debug|release) BUILDTYPE = release
BUILDTYPE =
debug_and_release:CONFIG(debug,debug|release) BUILDTYPE = debug
debug_and_release:CONFIG(release,debug|release) BUILDTYPE = release

win32-msvc* {
LIBS += -L$$OUT_PWD/../core_lib/$$BUILDTYPE/ -lcore_lib
Expand Down
8 changes: 4 additions & 4 deletions util/appveyor-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ build_script:
- mingw32-make -j2

after_build:
- windeployqt "%APPVEYOR_BUILD_FOLDER%\build\bin\pencil2d.exe"
- windeployqt "%APPVEYOR_BUILD_FOLDER%\build\app\release\pencil2d.exe"

test_script:
- echo "Running tests"
- cd "%APPVEYOR_BUILD_FOLDER%\build\tests\bin"
- cd "%APPVEYOR_BUILD_FOLDER%\build\tests\release"
- tests.exe

for:
Expand Down Expand Up @@ -70,4 +70,4 @@ for:
matrix:
exclude:
- image: Visual Studio 2015
platform: x64
platform: x64
6 changes: 3 additions & 3 deletions util/appveyor-msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ build_script:
- nmake

after_build:
- windeployqt "%APPVEYOR_BUILD_FOLDER%\build\bin\pencil2d.exe"
- windeployqt "%APPVEYOR_BUILD_FOLDER%\build\app\release\pencil2d.exe"

test_script:
- echo "Running tests"
- tests\bin\tests.exe
- tests\release\tests.exe

for:
- matrix:
Expand Down Expand Up @@ -87,4 +87,4 @@ for:
matrix:
exclude:
- image: Visual Studio 2013
platform: x64
platform: x64
1 change: 0 additions & 1 deletion util/common.pri
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

VERSION = 0.6.6
DEFINES += APP_VERSION=\\\"$$VERSION\\\"

Expand Down

0 comments on commit f09d0ca

Please sign in to comment.