This page shows you how to build QuantumPT application from scratch on Windows 7 using pyqtdeploy.
ALL packages need to be installed for 32-bits, it will work even if you have a 64-bits system.
Make sure that the Qt, PyQt5, Python and Microsoft Visual Studio version match.
This guide supposes you do not have a previous version of softwares installed.
The installation of Python is straight forward however you will need some modification to make task easier.
C:\Python36\
|
Add Python 3.6 to PATH
|
Modify the installation to path
|
You will also need to install Python packages :
Before continuing the tutorial, make sure you are using Python 3.6.x version of python.
To verify, run python command in a terminal and read the output, it should print the used Python version.
python -m pip install "APScheduler>=3.3.1" "geoip2>=2.4.2" "pytz>=2017.2" "requests>=2.13.0" "PyQt5>=5.8.2" "appdirs>=1.4.3" "packaging>=16.8" "pyparsing>=2.2.0" "pyqtdeploy>=1.3.2"
The installation of Qt is straight forward and does not need any particular settings (use the default settings unless you know what you are doing).
C:\Qt\Qt5.8.0\ directory. This should be the default path.The installation of Microsoft Visual Studio 2015 is a little bit different and needs more configuration.
Common Tools C++ for Visual C++ 2015 feature needs to be enabled in order to compile correctly PyQt applications.
When running the installer, make sure the feature is enabled :
|
|
In order to build QuantumPT, we need to compile PyQt5 and sip from sources.
After downloading sources from requirements, extract the archives in the same directory (easy for compilation)
Let’s create an environment to compile PyQt and SIP (in order to compile PyQt, we need first to compile sip)
You should have now :
.
└── compilation
├── sip-4.19.2/
└── PyQt5_gpl-5.8.2/
sip-4.19.2 directorypython configure.py
At this step, you did not install sip, you only configured it (basically its installation dir, etc…)
# Keep the double quotes (Windows does not like spaces)
"C:\Qt\Qt5.8.0\5.8\msvc2015\bin\qtenv2.bat"
After running this command, it automatically change your current directory.
sip-4.19.2 directory and run:# Keep the double quotes (Windows does not like spaces)
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
nmake
nmake install
The steps are almost the same as sip but it will take more time.
PyQt5_gpl-5.8.2 directorypython configure.py --disable QtNfc --confirm-license
Note that this command disable QtNfs because of a compilation problem we could not resolve. It will also automatically accepts the license.
# Keep the double quotes (Windows does not like spaces)
"C:\Qt\Qt5.8.0\5.8\msvc2015\bin\qtenv2.bat"
After running this command, it automatically change your current directory.
PyQt5_gpl-5.8.2 directory and run:# Keep the double quotes (Windows does not like spaces)
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
nmake
Notice that we did not run the nmake install command for PyQt5, if you run the command, it will install the libraries
in C:\Python36 site-packages and replaces the PyQt5 installed by pip so PyQt5 modules will be broken.
QuantumPT repository in a specific foldergit clone https://github.com/QuantumPrayerTimes/quantumpt.git
# Keep the double quotes (Windows does not like spaces)
"C:\Qt\Qt5.8.0\5.8\msvc2015\bin\qtenv2.bat"
After running this command, it automatically change your current directory.
QuantumPT directory that you cloned and run:# Keep the double quotes (Windows does not like spaces)
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
pyqtdeploy build.pdy
pyqtdeploy application will open, navigate to the latest tab Build, check Run qmake and Run makeBuild button
The output will be located in QuantumPT directory under build/release/
We will need to get some files now because the executable generated is not complete, it needs to be linked to some libraries.
Create a custom-release directory that will contain the builded release
In the build/release/ directory, copy the QuantumPT.exe binary to custom-release directory
Navigate to sip-4.19.2 directory
Copy the following sip library to custom-release directory
sip-4.19.2\siplib\sip.pyd
Navigate to PyQt5_gpl-5.8.2 directory
Copy the following Qt libraries to custom-release directory
PyQt5_gpl-5.8.2\Qt\release\Qt.dll
PyQt5_gpl-5.8.2\QtCore\release\QtCore.dll
PyQt5_gpl-5.8.2\QtGui\release\QtGui.dll
PyQt5_gpl-5.8.2\QtWidgets\release\QtWidgets.dll
PyQt5_gpl-5.8.2\QtMultimedia\release\QtMultimedia.dll
PyQt5_gpl-5.8.2\QtNetwork\release\QtNetwork.dll
PyQt5_gpl-5.8.2\QtSql\release\QtSql.dll
Navigate to C:\Python36 directory
Copy the following Python system libraries to custom-release directory
C:\Python36\python3.dll
C:\Python36\python36.dll
Python libraries to custom-release\lib directoryC:\Python36\DLLs\_multiprocessing.pyd
C:\Python36\DLLs\_socket.pyd
C:\Python36\DLLs\pyexpat.pyd
C:\Python36\DLLs\select.pyd
C:\Python36\DLLs\unicodedata.pyd
Navigate to C:\Qt\Qt5.8.0 directory
Copy the following Qt libraries to custom-release directory
C:\Qt\Qt5.8.0\5.8\msvc2015\bin\Qt5Core.dll
C:\Qt\Qt5.8.0\5.8\msvc2015\bin\Qt5Gui.dll
C:\Qt\Qt5.8.0\5.8\msvc2015\bin\Qt5Widgets.dll
C:\Qt\Qt5.8.0\5.8\msvc2015\bin\Qt5Multimedia.dll
C:\Qt\Qt5.8.0\5.8\msvc2015\bin\Qt5Network.dll
C:\Qt\Qt5.8.0\5.8\msvc2015\bin\Qt5Sql.dll
Qt plugins to custom-release directory keeping the folders architectureC:\Qt\Qt5.8.0\5.8\msvc2015\plugins\platforms\qwindows.dll
C:\Qt\Qt5.8.0\5.8\msvc2015\plugins\mediaservice\dsengine.dll
C:\Qt\Qt5.8.0\5.8\msvc2015\plugins\mediaservice\qtmedia_audioengine.dll
C:\Qt\Qt5.8.0\5.8\msvc2015\plugins\mediaservice\wmfengine.dll
C:\Qt\Qt5.8.0\5.8\msvc2015\plugins\sqldrivers\qsqlite.dll
Navigate to QuantumPT directory
Copy the following resources to custom-release directory keeping the folders architecture
resources\database\database.db
resources\database\ip_location.mmdb
resources\multimedia\athans\*
resources\multimedia\duas\*
Navigate to Microsoft Visual Studio 2015 directory
Copy the following Microsoft Visual Studio 2015 libraries to custom-release directory
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x86\Microsoft.VC140.CRT\msvcp140.dll
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x86\Microsoft.VC140.CRT\vcruntime140.dll
Finally, the build is complete and a new release has been generated.
The release architecture should looks like the following :
.
├── lib
| ├── _multiprocessing.pyd
| ├── _socket.pyd
| ├── pyexpat.pyd
| ├── select.pyd
| └── unicodedata.pyd
├── plugins
| ├── mediaservice
| | ├── dsengine.dll
| | ├── qtmedia_audioengine.dll
| | └── wmfengine.dll
| ├── platforms
| | └── qwindows.dll
| └── sqldrivers
| └── qsqlite.dll
├── resources
| ├── database
| | ├── database.db
| | └── ip_location.mmdb
| └── multimedia
| ├── athans
| | ├── athan_1.mp3
| | └── [...]
| └── duas
| ├── doua_001.mp3
| └── [...]
├── msvcp140.dll
├── python3.dll
├── python36.dll
├── Qt.dll
├── Qt5Core.dll
├── Qt5Gui.dll
├── Qt5Multimedia.dll
├── Qt5Network.dll
├── Qt5Sql.dll
├── Qt5Widgets.dll
├── QtCore.dll
├── QtGui.dll
├── QtMultimedia.dll
├── QtNetwork.dll
├── QtSql.dll
├── QtWidgets.dll
├── QuantumPT.exe
├── vcruntime140.dll
└── sip.pyd