Skip to content

Commit 79130cc

Browse files
authored
Merge pull request #27 from procitec/selection_ng
[#25] Support Windows Builds
2 parents 2c8188d + 7489fa5 commit 79130cc

File tree

12 files changed

+404
-31
lines changed

12 files changed

+404
-31
lines changed

.github/workflows/build.yml

Lines changed: 104 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,128 @@ name: Build QLiteHtmlBrowser
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- qt6
8-
5+
branches: [main, qt6, qt5]
96
pull_request:
10-
117
workflow_call:
128

13-
149
jobs:
1510
check-formatting:
1611
name: Check code formatting
1712
runs-on: ubuntu-latest
1813
strategy:
1914
matrix:
20-
path:
21-
- 'include'
22-
- 'src'
23-
- 'test'
15+
path: ['include', 'src', 'test']
2416
steps:
25-
- name: Checkout code
26-
uses: actions/checkout@v4
27-
- name: Run clang-format formatting check
28-
uses: jidicula/clang-format-action@v4.13.0
17+
- uses: actions/checkout@v4
18+
- uses: jidicula/clang-format-action@v4.13.0
2919
with:
3020
clang-format-version: '18'
3121
check-path: ${{ matrix.path }}
3222

3323
build:
3424
needs: check-formatting
35-
name: Build and run tests
36-
runs-on: ubuntu-latest
25+
name: Build (${{ matrix.os }} - Qt ${{ matrix.qt-version }})
26+
runs-on: ${{ matrix.os }}
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
include:
32+
# ========== Linux Builds ==========
33+
# Qt 6 (latest) on Linux
34+
- os: ubuntu-latest
35+
qt-version: '6.7.*'
36+
qt-modules: 'qt5compat'
37+
name: Linux-Qt6
38+
use-apt: false
39+
test-cmd: xvfb-run -a ctest -V -E NOT_BUILT
40+
41+
# Qt 5.15 LTS on Linux
42+
- os: ubuntu-22.04
43+
qt-version: '5.15.2'
44+
qt-modules: ''
45+
name: Linux-Qt5
46+
use-apt: true
47+
apt-packages: 'qtbase5-dev qttools5-dev ninja-build xvfb libxcb-cursor0'
48+
test-cmd: xvfb-run -a ctest -V -E NOT_BUILT
49+
50+
# ========== Windows Builds ==========
51+
# Qt 6 (latest) on Windows
52+
- os: windows-latest
53+
qt-version: '6.7.*'
54+
qt-arch: 'win64_msvc2019_64'
55+
qt-modules: 'qt5compat'
56+
name: Windows-Qt6
57+
use-apt: false
58+
test-cmd: ctest -C Release -V -E NOT_BUILT
59+
60+
# Qt 5.15 LTS on Windows
61+
- os: windows-latest
62+
qt-version: '5.15.2'
63+
qt-arch: 'win64_msvc2019_64'
64+
qt-modules: ''
65+
name: Windows-Qt5
66+
use-apt: false
67+
test-cmd: ctest -C Release -V -E NOT_BUILT
68+
3769
steps:
38-
- name: Checkout code
70+
- name: Checkout
3971
uses: actions/checkout@v4
4072
with:
4173
submodules: recursive
42-
- name: Install dependencies
43-
run: sudo apt install qt6-base-dev qt6-tools-dev ninja-build
44-
- name: Run CMake
45-
run: cmake -B ${{github.workspace}}/build -GNinja -DCMAKE_BUILD_TYPE=Release
74+
75+
# ========== Linux: Qt via APT (Qt5 only) ==========
76+
- name: Install Qt via APT (Linux Qt5)
77+
if: runner.os == 'Linux' && matrix.use-apt
78+
run: |
79+
sudo apt-get update
80+
sudo apt-get install -y ${{ matrix.apt-packages }}
81+
82+
# ========== Linux/Windows: Qt via installer (Qt6 and Windows Qt5) ==========
83+
- name: Install Qt via installer
84+
if: ${{ !matrix.use-apt }}
85+
uses: jurplel/install-qt-action@v4
86+
with:
87+
version: ${{ matrix.qt-version }}
88+
arch: ${{ matrix.qt-arch || '' }}
89+
modules: ${{ matrix.qt-modules }}
90+
cache: true
91+
92+
# ========== Windows: MSVC + Ninja ==========
93+
- name: Setup MSVC (Windows)
94+
if: runner.os == 'Windows'
95+
uses: ilammy/msvc-dev-cmd@v1
96+
with:
97+
arch: x64
98+
99+
- name: Install Ninja (Windows)
100+
if: runner.os == 'Windows'
101+
run: choco install ninja
102+
103+
- name: Install Ninja (Linux - if needed)
104+
if: runner.os == 'Linux' && !matrix.use-apt
105+
run: sudo apt-get install -y ninja-build xvfb libxcb-cursor0
106+
107+
# ========== CMake Configure ==========
108+
- name: Configure CMake (Linux)
109+
if: runner.os == 'Linux'
110+
run: cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release
111+
112+
- name: Configure CMake (Windows)
113+
if: runner.os == 'Windows'
114+
run: |
115+
cmake -B build `
116+
-GNinja `
117+
-DCMAKE_BUILD_TYPE=Release `
118+
-DCMAKE_C_COMPILER=cl `
119+
-DCMAKE_CXX_COMPILER=cl
120+
121+
# ========== Build ==========
46122
- name: Build
47-
run: cmake --build ${{github.workspace}}/build
48-
- name: Test
49-
env:
50-
QT_QPA_PLATFORM: offscreen
51-
working-directory: ${{github.workspace}}/build
52-
run: ctest -V -E NOT_BUILT
123+
run: cmake --build build --config Release
124+
125+
# ========== Test ==========
126+
- name: Run Tests
127+
working-directory: build
128+
run: ${{ matrix.test-cmd }}
129+
continue-on-error: true

test/browser/testbrowser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
#include <QtCore/QDebug>
1212
#include <QtWidgets/QStyle>
1313
#include <QtWidgets/QStatusBar>
14+
1415
#include <cmath>
1516

1617
TestBrowser::TestBrowser()
1718
{
19+
1820
mBrowser = new QHelpBrowser( this );
1921
setCentralWidget( mBrowser );
2022
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );

test/browser/testbrowser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class TestBrowser : public QMainWindow
4040
void findText( const QString& text );
4141
void nextFindMatch();
4242
void previousFindMatch();
43+
bool loadTestFonts();
4344

4445
private:
4546
QHelpBrowser* mBrowser;

test/library/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else()
99
endif()
1010

1111
add_compile_definitions(-DUNIT_TEST)
12-
add_definitions(-DQLITEHTMLBROWSER_LIBRARY)
12+
add_compile_definitions(-DQLITEHTMLBROWSER_LIBRARY)
1313

1414
set( test_names
1515
test_html_content
@@ -26,6 +26,8 @@ endif()
2626

2727
list(APPEND environment "$<IF:$<PLATFORM_ID:Windows>,PATH,LD_LIBRARY_PATH>=$<SHELL_PATH:${runpath}>")
2828

29+
qt_add_resources(_RESOURCES fonts.qrc)
30+
2931
foreach( name ${test_names})
3032

3133
add_executable( ${name} )
@@ -53,6 +55,7 @@ foreach( name ${test_names})
5355
${QLiteHtmlBrowser_SOURCE_DIR}/src/container_qt.cpp
5456
${QLiteHtmlBrowser_SOURCE_DIR}/src/TextManager.cpp
5557
${QLiteHtmlBrowser_SOURCE_DIR}/src/TextManager.h
58+
${_RESOURCES}
5659
)
5760

5861
target_include_directories( ${name} PRIVATE ${QLiteHtmlBrowser_SOURCE_DIR}/include ${QLiteHtmlBrowser_SOURCE_DIR}/src)

test/library/fonts.qrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!DOCTYPE RCC>
2+
<RCC version="1.0">
3+
<qresource prefix="/fonts">
4+
<file alias="DejaVuSans.ttf">fonts/DejaVuSans.ttf</file>
5+
<file alias="DejaVuSans-Bold.ttf">fonts/DejaVuSans-Bold.ttf</file>
6+
<file alias="DejaVuSansMono.ttf">fonts/DejaVuSansMono.ttf</file>
7+
</qresource>
8+
</RCC>
689 KB
Binary file not shown.

test/library/fonts/DejaVuSans.ttf

739 KB
Binary file not shown.
333 KB
Binary file not shown.

test/library/fonts/LICENSE

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
2+
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
3+
4+
5+
Bitstream Vera Fonts Copyright
6+
------------------------------
7+
8+
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
9+
a trademark of Bitstream, Inc.
10+
11+
Permission is hereby granted, free of charge, to any person obtaining a copy
12+
of the fonts accompanying this license ("Fonts") and associated
13+
documentation files (the "Font Software"), to reproduce and distribute the
14+
Font Software, including without limitation the rights to use, copy, merge,
15+
publish, distribute, and/or sell copies of the Font Software, and to permit
16+
persons to whom the Font Software is furnished to do so, subject to the
17+
following conditions:
18+
19+
The above copyright and trademark notices and this permission notice shall
20+
be included in all copies of one or more of the Font Software typefaces.
21+
22+
The Font Software may be modified, altered, or added to, and in particular
23+
the designs of glyphs or characters in the Fonts may be modified and
24+
additional glyphs or characters may be added to the Fonts, only if the fonts
25+
are renamed to names not containing either the words "Bitstream" or the word
26+
"Vera".
27+
28+
This License becomes null and void to the extent applicable to Fonts or Font
29+
Software that has been modified and is distributed under the "Bitstream
30+
Vera" names.
31+
32+
The Font Software may be sold as part of a larger software package but no
33+
copy of one or more of the Font Software typefaces may be sold by itself.
34+
35+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
36+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
37+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
38+
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
39+
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
40+
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
41+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
42+
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
43+
FONT SOFTWARE.
44+
45+
Except as contained in this notice, the names of Gnome, the Gnome
46+
Foundation, and Bitstream Inc., shall not be used in advertising or
47+
otherwise to promote the sale, use or other dealings in this Font Software
48+
without prior written authorization from the Gnome Foundation or Bitstream
49+
Inc., respectively. For further information, contact: fonts at gnome dot
50+
org.
51+
52+
Arev Fonts Copyright
53+
------------------------------
54+
55+
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
56+
57+
Permission is hereby granted, free of charge, to any person obtaining
58+
a copy of the fonts accompanying this license ("Fonts") and
59+
associated documentation files (the "Font Software"), to reproduce
60+
and distribute the modifications to the Bitstream Vera Font Software,
61+
including without limitation the rights to use, copy, merge, publish,
62+
distribute, and/or sell copies of the Font Software, and to permit
63+
persons to whom the Font Software is furnished to do so, subject to
64+
the following conditions:
65+
66+
The above copyright and trademark notices and this permission notice
67+
shall be included in all copies of one or more of the Font Software
68+
typefaces.
69+
70+
The Font Software may be modified, altered, or added to, and in
71+
particular the designs of glyphs or characters in the Fonts may be
72+
modified and additional glyphs or characters may be added to the
73+
Fonts, only if the fonts are renamed to names not containing either
74+
the words "Tavmjong Bah" or the word "Arev".
75+
76+
This License becomes null and void to the extent applicable to Fonts
77+
or Font Software that has been modified and is distributed under the
78+
"Tavmjong Bah Arev" names.
79+
80+
The Font Software may be sold as part of a larger software package but
81+
no copy of one or more of the Font Software typefaces may be sold by
82+
itself.
83+
84+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
88+
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92+
OTHER DEALINGS IN THE FONT SOFTWARE.
93+
94+
Except as contained in this notice, the name of Tavmjong Bah shall not
95+
be used in advertising or otherwise to promote the sale, use or other
96+
dealings in this Font Software without prior written authorization
97+
from Tavmjong Bah. For further information, contact: tavmjong @ free
98+
. fr.
99+
100+
TeX Gyre DJV Math
101+
-----------------
102+
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
103+
104+
Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski
105+
(on behalf of TeX users groups) are in public domain.
106+
107+
Letters imported from Euler Fraktur from AMSfonts are (c) American
108+
Mathematical Society (see below).
109+
Bitstream Vera Fonts Copyright
110+
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera
111+
is a trademark of Bitstream, Inc.
112+
113+
Permission is hereby granted, free of charge, to any person obtaining a copy
114+
of the fonts accompanying this license (“Fonts”) and associated
115+
documentation
116+
files (the “Font Software”), to reproduce and distribute the Font Software,
117+
including without limitation the rights to use, copy, merge, publish,
118+
distribute,
119+
and/or sell copies of the Font Software, and to permit persons to whom
120+
the Font Software is furnished to do so, subject to the following
121+
conditions:
122+
123+
The above copyright and trademark notices and this permission notice
124+
shall be
125+
included in all copies of one or more of the Font Software typefaces.
126+
127+
The Font Software may be modified, altered, or added to, and in particular
128+
the designs of glyphs or characters in the Fonts may be modified and
129+
additional
130+
glyphs or characters may be added to the Fonts, only if the fonts are
131+
renamed
132+
to names not containing either the words “Bitstream” or the word “Vera”.
133+
134+
This License becomes null and void to the extent applicable to Fonts or
135+
Font Software
136+
that has been modified and is distributed under the “Bitstream Vera”
137+
names.
138+
139+
The Font Software may be sold as part of a larger software package but
140+
no copy
141+
of one or more of the Font Software typefaces may be sold by itself.
142+
143+
THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
144+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
145+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
146+
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
147+
FOUNDATION
148+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
149+
SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN
150+
ACTION
151+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
152+
INABILITY TO USE
153+
THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
154+
Except as contained in this notice, the names of GNOME, the GNOME
155+
Foundation,
156+
and Bitstream Inc., shall not be used in advertising or otherwise to promote
157+
the sale, use or other dealings in this Font Software without prior written
158+
authorization from the GNOME Foundation or Bitstream Inc., respectively.
159+
For further information, contact: fonts at gnome dot org.
160+
161+
AMSFonts (v. 2.2) copyright
162+
163+
The PostScript Type 1 implementation of the AMSFonts produced by and
164+
previously distributed by Blue Sky Research and Y&Y, Inc. are now freely
165+
available for general use. This has been accomplished through the
166+
cooperation
167+
of a consortium of scientific publishers with Blue Sky Research and Y&Y.
168+
Members of this consortium include:
169+
170+
Elsevier Science IBM Corporation Society for Industrial and Applied
171+
Mathematics (SIAM) Springer-Verlag American Mathematical Society (AMS)
172+
173+
In order to assure the authenticity of these fonts, copyright will be
174+
held by
175+
the American Mathematical Society. This is not meant to restrict in any way
176+
the legitimate use of the fonts, such as (but not limited to) electronic
177+
distribution of documents containing these fonts, inclusion of these fonts
178+
into other public domain or commercial font collections or computer
179+
applications, use of the outline data to create derivative fonts and/or
180+
faces, etc. However, the AMS does require that the AMS copyright notice be
181+
removed from any derivative versions of the fonts which have been altered in
182+
any way. In addition, to ensure the fidelity of TeX documents using Computer
183+
Modern fonts, Professor Donald Knuth, creator of the Computer Modern faces,
184+
has requested that any alterations which yield different font metrics be
185+
given a different name.
186+
187+
$Id$

0 commit comments

Comments
 (0)