Skip to content

Commit a54c1f7

Browse files
committed
Merge branch 'master' of github.com:buggins/coolreader
2 parents 0b7e959 + bd32cd1 commit a54c1f7

File tree

5 files changed

+153
-84
lines changed

5 files changed

+153
-84
lines changed

CMakeLists.txt

+4-8
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,10 @@ elseif ( ${GUI} STREQUAL WX )
450450
message("Will make CR3/WX")
451451
ADD_DEFINITIONS( ${DESKTOP_DEFS} -DCR_WX_SUPPORT=1 )
452452
SET(wxWidgets_USE_LIBS base core )
453-
FIND_PACKAGE(wxWidgets 2.8)
454-
IF (wxWidgets_FOUND)
455-
INCLUDE(${wxWidgets_USE_FILE})
456-
include_directories( ${wxWidgets_INCLUDE_DIRS} )
457-
message( "WX include: ${wxWidgets_INCLUDE_DIRS}" )
458-
ELSE (wxWidgets_FOUND)
459-
message("wxWidgets library not found!")
460-
ENDIF (wxWidgets_FOUND)
453+
FIND_PACKAGE(wxWidgets 2.8 REQUIRED)
454+
INCLUDE(${wxWidgets_USE_FILE})
455+
include_directories( ${wxWidgets_INCLUDE_DIRS} )
456+
message( "WX include: ${wxWidgets_INCLUDE_DIRS}" )
461457
ADD_SUBDIRECTORY(crengine)
462458
ADD_SUBDIRECTORY(cr3wx)
463459
elseif ( ${GUI} STREQUAL CRGUI_PB )

README.md

+146-71
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,34 @@ Directories
3434
cr3gui - CR3 with CR3GUI for e-ink devices sources
3535
cr3qt - CR3 with Qt based GUI
3636
cr3wx - CR3 with wxWidgets based GUI
37-
thirdparty - third party libraries, to use if not found in system (zlib, libpng, libjpeg, freetype, harfbuzz)
37+
thirdparty - third party libraries, to use if not found in system (zlib, libpng, libjpeg, freetype, etc...)
3838
thirdparty_repo - repository for third party libraries deployments
3939
thirdparty_unman - unmanaged third party libraries
4040
tinydict - small library for .dict file format support
4141
tools - miscellaneous configuration files
42-
android - Android port
42+
android - Android frontend
4343

4444
External dependencies
4545
---------------------
4646

47-
common: zlib, libpng, libjpeg, freetype, harfbuzz
47+
common: zlib, libpng, libjpeg, freetype, harfbuzz, fribidi, libunibreak, utf8proc, zstd
4848
cr3gui/xcb: libxcb, fontconfig
4949
cr3gui/nanoX: libnanoX
50-
cr3/Qt: qt4-core, qt4-gui
51-
cr3/wx: wxWidgets 2.8
50+
cr3/Qt: fontconfig, qt5-base, qt5-tools
51+
cr3/wx: fontconfig, wxWidgets 3.0
5252

5353
e.g., for Ubuntu you may use
5454

55-
> sudo apt-get install git-core cmake libqt4-dev libpng12-dev libfreetype6-dev libjpeg62-dev libfontconfig1-dev zlib1g-dev
55+
$ sudo apt install build-essential git cmake curl pkg-config zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev libunibreak-dev libzstd-dev libutf8proc-dev
56+
57+
To build Qt frontend:
58+
59+
$ sudo apt install qtbase5-dev qttools5-dev
60+
61+
To build wxWidgets frontend:
62+
63+
$ sudo apt install libwxgtk3.0-gtk3-dev
64+
5665

5766
Packaging
5867
---------
@@ -75,47 +84,161 @@ Android Build Instructions
7584

7685
In Windows can be used git bash terminal
7786

78-
> ./thirdparty-deploy.sh
87+
$ ./thirdparty-deploy.sh
7988

8089
* Use Android Studio - open subdirectory "android" as Android Studio project
8190

8291
Ensure that you have Android SDK and NDK installed
8392

8493

8594

86-
CMake Build Instructions
95+
CMake Build Instructions (Linux)
8796
------------------------
8897

89-
# Building QT version
90-
# libqt4-dev should be installed
91-
mkdir qtbuild
92-
cd qtbuild
93-
cmake -D GUI=QT -D CMAKE_BUILD_TYPE=Release -D MAX_IMAGE_SCALE_MUL=2 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1400000 -D CMAKE_INSTALL_PREFIX=/usr ..
94-
make
95-
sudo make install
98+
In case the installed libraries are outdated, run the `thirdparty-deploy.sh` script to download libraries sources of the recommended versions. In this case, the build system will build static libraries that were not found in the system.
99+
100+
$ ./thirdparty-deploy.sh
96101

102+
Building Qt version (qtbase5-dev, qttools5-dev should be installed)
97103

98-
# Building QT version, in DEBUG mode
99104
mkdir qtbuild
100105
cd qtbuild
101-
cmake -D GUI=QT -D CMAKE_BUILD_TYPE=Debug -D MAX_IMAGE_SCALE_MUL=2 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1400000 -D CMAKE_INSTALL_PREFIX=/usr ..
106+
cmake -D GUI=QT5 -D CMAKE_BUILD_TYPE=Release -D MAX_IMAGE_SCALE_MUL=2 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1400000 -D CMAKE_INSTALL_PREFIX=/usr ..
102107
make
103108
sudo make install
104109

105-
# Building QT version, in DEBUG mode, ANTIWORD development
110+
111+
Building Qt version, in DEBUG mode
112+
106113
mkdir qtbuild
107114
cd qtbuild
108-
cmake -D GUI=QT -D CMAKE_BUILD_TYPE=Debug -D ENABLE_ANTIWORD=1 -D MAX_IMAGE_SCALE_MUL=2 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1400000 -D CMAKE_INSTALL_PREFIX=/usr ..
115+
cmake -D GUI=QT5 -D CMAKE_BUILD_TYPE=Debug -D MAX_IMAGE_SCALE_MUL=2 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1400000 -D CMAKE_INSTALL_PREFIX=/usr ..
109116
make
110117
sudo make install
111118

112-
# Building wxWidgets version
113-
# libwxgtk2.8-dev should be installed
119+
Building wxWidgets version (libwxgtk3.0-gtk3-dev should be installed)
120+
114121
mkdir wxbuild
115122
cd wxbuild
116-
cmake -D GUI=WX -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr ..
123+
cmake -D GUI=WX -D CMAKE_BUILD_TYPE=Release -D MAX_IMAGE_SCALE_MUL=2 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1400000 -D CMAKE_INSTALL_PREFIX=/usr ..
117124
make
118125

126+
127+
Qt Build under Windows (Using MSYS2)
128+
======================
129+
130+
- Download and install msys2 from https://www.msys2.org/
131+
- Update MSYS2:
132+
133+
Run "MSYS2 MSYS" from start menu
134+
135+
$ pacman -Sy
136+
$ pacman -Su
137+
138+
Run "MSYS2 MSYS" from Start menu again.<br/>
139+
Update the rest of the base packages:
140+
141+
$ pacman -Su
142+
143+
- Install build tools & dependencies:
144+
145+
Run "MSYS2 MSYS" from start menu.<br/>
146+
Using pacman package manager install required packages:
147+
148+
$ pacman -S --needed base-devel mingw-w64-x86_64-toolchain
149+
$ pacman -S git curl
150+
$ pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-pkgconf mingw-w64-x86_64-zlib mingw-w64-x86_64-libpng mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-freetype mingw-w64-x86_64-fontconfig mingw-w64-x86_64-harfbuzz mingw-w64-x86_64-fribidi mingw-w64-x86_64-zstd
151+
152+
To build Qt frontend:
153+
154+
$ pacman -S mingw-w64-x86_64-qt5
155+
156+
- Prepare:
157+
158+
Run "MSYS2 MinGW 64-bit" from start menu
159+
160+
$ git clone https://github.com/buggins/coolreader.git
161+
$ cd coolreader
162+
163+
Since package libunibreak not exists in MSYS2, we must build static version of this library, to do this, we need to call the script thirdparty-deploy.sh to download sources:
164+
165+
$ ./thirdparty-deploy.sh
166+
167+
Build system will build static libraries that were not found in the system.
168+
169+
- Compile:
170+
171+
Now we can build program:
172+
173+
$ mkdir qtbuild
174+
$ cd qtbuild
175+
$ cmake -G "MSYS Makefiles" -D CMAKE_BUILD_TYPE=Release -D GUI=QT5 -D MAX_IMAGE_SCALE_MUL=2 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1400000 -D CMAKE_INSTALL_PREFIX=dist ..
176+
$ make
177+
$ make install
178+
179+
Now in qtbuild/dist directory we have CoolReader binary & data.<br/>
180+
To add Qt runtime libraries, call:
181+
182+
$ cd dist
183+
$ windeployqt --compiler-runtime --no-webkit2 --no-angle --no-opengl-sw --no-quick-import .
184+
185+
To add thirdparty runtime libraries, call:
186+
187+
$ cp -pv /mingw64/bin/{libfontconfig-1.dll,libexpat-1.dll,libfreetype-6.dll,libbz2-1.dll,libbrotlidec.dll,libbrotlicommon.dll,libharfbuzz-0.dll,libglib-2.0-0.dll,libintl-8.dll,libiconv-2.dll,libpcre-1.dll,libgraphite2.dll,libpng16-16.dll,zlib1.dll,libfribidi-0.dll,libjpeg-8.dll,libutf8proc.dll,libzstd.dll,libdouble-conversion.dll,libicuin68.dll,libicuuc68.dll,libicudt68.dll,libpcre2-16-0.dll} .
188+
189+
After updating any library in MSYS 2, this list may need to be corrected. If after that the program does not start with an error about the missing dll, then you need to copy this library from `/mingw64/bin/` to `qtbuild/dist`.
190+
191+
Qt Build under Windows (Using Qt SDK, obsolete)
192+
======================
193+
194+
Using Qt SDK
195+
196+
Environment setup:
197+
198+
- Download and install Qt SDK, git, cmake, msys
199+
- Copy contents of git and cmake dirs to QT/mingw/
200+
- Copy make.exe from msys/bin to QT/mingw/bin
201+
202+
Run Qt SDK / Qt Command Prompt. Execute:
203+
204+
> sh
205+
> git clone https://github.com/buggins/coolreader.git
206+
> cd coolreader
207+
> mkdir qtbuild
208+
> cd qtbuild
209+
> cmake -D GUI=QT -D CMAKE_BUILD_TYPE=Release -G "MSYS Makefiles" -D USE_QT_ZLIB=1 -D CMAKE_INSTALL_PREFIX=dist ..
210+
> make
211+
> make install
212+
213+
cmake -D GUI=QT -D CMAKE_BUILD_TYPE=Release -G "Visual Studio 9 2008" -D USE_QT_ZLIB=1 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1500000 -D CMAKE_INSTALL_PREFIX=dist ..
214+
cmake -D GUI=QT -D CMAKE_BUILD_TYPE=Release -G "Visual Studio 10" -D USE_QT_ZLIB=1 -D MAX_IMAGE_SCALE_MUL=2 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1500000 -D CMAKE_INSTALL_PREFIX=dist ..
215+
216+
to disable console, use /SUBSYSTEM:WINDOWS linker option instead of /SUBSYSTEM:CONSOLE
217+
218+
For Qt5, use GUI=QT5 instead of GUI=QT
219+
220+
For building Qt5 app from QtCreator remove -G (generator) parameter:
221+
222+
Release build:
223+
224+
-D GUI=QT5 -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=dist ..
225+
226+
Debug build:
227+
228+
-D GUI=QT5 -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=dist ..
229+
230+
It will put built cr3.exe and all necessary distribution files to directory qtbuild/dist.
231+
232+
You need also add following DLLs to this directory in order to get cr3.exe working:
233+
234+
- mingwm10.dll
235+
- QtCore4.dll
236+
- QtGui4.dll
237+
- libz.dll
238+
239+
CMake Build Instructions (obsolete)
240+
------------------------
241+
119242
# Building ARM version on OpenInkpot:
120243
mkdir armbuild
121244
cd armbuild
@@ -214,55 +337,7 @@ CMake Build Instructions
214337
make
215338

216339

217-
QT Build under Windows
218-
======================
219-
220-
Using QT SDK
221-
222-
Environment setup:
223-
224-
- Download and install QT SDK, git, cmake, msys
225-
- Copy contents of git and cmake dirs to QT/mingw/
226-
- Copy make.exe from msys/bin to QT/mingw/bin
227-
228-
Run Qt SDK / Qt Command Prompt. Execute:
229-
230-
> sh
231-
> git clone git://crengine.git.sourceforge.net/gitroot/crengine/crengine cr3
232-
> cd cr3
233-
> mkdir qtbuild
234-
> cd qtbuild
235-
> cmake -D GUI=QT -D CMAKE_BUILD_TYPE=Release -G "MSYS Makefiles" -D USE_QT_ZLIB=1 -D CMAKE_INSTALL_PREFIX=dist ..
236-
> make
237-
> make install
238-
239-
cmake -D GUI=QT -D CMAKE_BUILD_TYPE=Release -G "Visual Studio 9 2008" -D USE_QT_ZLIB=1 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1500000 -D CMAKE_INSTALL_PREFIX=dist ..
240-
cmake -D GUI=QT -D CMAKE_BUILD_TYPE=Release -G "Visual Studio 10" -D USE_QT_ZLIB=1 -D MAX_IMAGE_SCALE_MUL=2 -D DOC_DATA_COMPRESSION_LEVEL=3 -D DOC_BUFFER_SIZE=0x1500000 -D CMAKE_INSTALL_PREFIX=dist ..
241-
242-
to disable console, use /SUBSYSTEM:WINDOWS linker option instead of /SUBSYSTEM:CONSOLE
243-
244-
For QT5, use GUI=QT5 instead of GUI=QT
245-
246-
For building Qt5 app from QtCreator remove -G (generator) parameter:
247-
248-
Release build:
249-
250-
-D GUI=QT5 -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=dist ..
251-
252-
Debug build:
253-
254-
-D GUI=QT5 -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=dist ..
255-
256-
It will put built cr3.exe and all necessary distribution files to directory qtbuild/dist.
257-
258-
You need also add following DLLs to this directory in order to get cr3.exe working:
259-
260-
- mingwm10.dll
261-
- QtCore4.dll
262-
- QtGui4.dll
263-
- libz.dll
264-
265-
Qt Build under Mac OSX
340+
Qt Build under Mac OSX (obsolete)
266341
======================
267342

268343
#configure and make Qt as static libraries

cr3qt/CMakeLists.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,7 @@ ELSE()
222222
INSTALL( TARGETS cr3 RUNTIME DESTINATION . )
223223
INSTALL( DIRECTORY data/ DESTINATION .
224224
FILES_MATCHING PATTERN "*.css" )
225-
INSTALL( DIRECTORY data/hyph DESTINATION .
226-
FILES_MATCHING PATTERN "*.pdb" )
227-
INSTALL( DIRECTORY data/hyph DESTINATION .
225+
INSTALL( DIRECTORY ../cr3gui/data/hyph DESTINATION .
228226
FILES_MATCHING PATTERN "*.pattern" )
229227
#INSTALL( DIRECTORY data/skins DESTINATION . )
230228
INSTALL( FILES ${QM_FILES} DESTINATION i18n )

cr3wx/src/cr3.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ void cr3Frame::RestoreOptions()
13381338
else if ( _props->getBoolDef(PROP_WINDOW_MINIMIZED) )
13391339
Iconize();
13401340
}
1341-
fontMan->SetAntialiasMode( _props->getIntDef( PROP_FONT_ANTIALIASING, 2 ) );
1341+
fontMan->SetAntialiasMode( (font_antialiasing_t)_props->getIntDef( PROP_FONT_ANTIALIASING, (int)font_aa_all ) );
13421342
_view->getDocView()->setDefaultFontFace( UnicodeToUtf8(_props->getStringDef(PROP_FONT_FACE, "Arial" )) );
13431343
_view->getDocView()->setTextColor( _props->getIntDef(PROP_FONT_COLOR, 0x000060 ) );
13441344
_view->getDocView()->setBackgroundColor( _props->getIntDef(PROP_BACKGROUND_COLOR, 0xFFFFE0 ) );

crengine/src/lvdrawbuf/lvinkmeasurementdrawbuf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class LVInkMeasurementDrawBuf : public LVBaseDrawBuf
5959
virtual void DrawOnTop( LVDrawBuf * __restrict buf, int x, int y) {}
6060
virtual void DrawRescaled(LVDrawBuf * src, int x, int y, int dx, int dy, int options) {}
6161
#if !defined(__SYMBIAN32__) && defined(_WIN32) && !defined(QT_GL)
62-
virtual void DrawTo( HDC dc, int x, int y, int options, const lUInt32 * __restrict palette ) {}
62+
virtual void DrawTo( HDC dc, int x, int y, int options, lUInt32 * palette ) {}
6363
#endif
6464
virtual void Invert() {}
6565
virtual lUInt32 GetPixel( int x, int y ) const { return 0; }

0 commit comments

Comments
 (0)