Hacking:Building: Difference between revisions
Content deleted Content added
No edit summary |
Update build steps |
||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
__TOC__ |
__TOC__ |
||
<translate> |
<translate> |
||
== Getting the sources == <!--T:1--> |
== Getting the sources == <!--T:1--> |
||
Clone from the [https://github.com/FashionFreedom/Seamly2D/ Seamly2D repository] on GitHub. |
|||
Main repository: https://bitbucket.org/dismine/valentina<br /> |
|||
In Git, create a feature branch to hold your changes. |
|||
Mirror on GitHub: https://github.com/dismine/Valentina |
|||
== Build Seamly2D and SeamlyMe == |
|||
<!--T:46--> |
|||
=== Basic Software Prerequisites: === |
|||
'''Note.''' Path to the source code after extraction should not contains spaces. |
|||
*[https://www.qt.io/download-open-source Qt 5.15.2] (includes Qt, QtCreator, QtChooser, and Qt Maintenance Tool) |
|||
*[https://git-scm.com/downloads Git] or [https://desktop.github.com Github Desktop for Windows and MacOS] |
|||
*Compiler - MSVC 2022, gcc, and g++ are included with QtCreator, and you can add or update them using the Qt Maintenance Tool (Maintenance.exe). |
|||
*Pdftops (from XpdfReader or poppler) - Required to create PS or EPS layout files. |
|||
*Check the sections below for your operating system to find additional installation requirements. |
|||
=== Development methods and styles: === |
|||
=== From the download section === <!--T:2--> |
|||
*[https://githubflow.github.io GitHub Flow workflow] |
|||
This method recommended for newbies. Just download the Valentina's source code from the [https://bitbucket.org/dismine/valentina/downloads/ downloads section] and extract it. |
|||
*[https://www.conventionalcommits.org/en/v1.0.0/ GibHub commit message style guide] |
|||
*[https://guides.github.com/features/issues/ GitHub issue description style guide] |
|||
=== Build method: === |
|||
<!--T:3--> |
|||
*Read more about code styles and other developer items of interest on our [https://github.com/FashionFreedom/Seamly2D/wiki Developer wiki]. |
|||
In this case you have two options: |
|||
*Review our [https://github.com/FashionFreedom/Seamly2D/blob/develop/.github/workflows/build-release.yml GitHub Action CI script]. |
|||
* Use tab '''Tags''' if you wanna get code for a specific version. |
|||
___________________________________________________ |
|||
[[File:Download tab tags.png|center]] |
|||
==== Build on Linux ==== |
|||
These instructions apply in general to all distros |
|||
*Install Qt 5.15.2. Example for Ubuntu 18.04: Install the following packages to have Qt5 build environment ready: |
|||
<!--T:4--> |
|||
* Use tab '''Branches''' if you wanna get code for '''develop branch'''. More about our [[Hacking:Making_pull_requests#Branch_model|branching model]]. |
|||
[[File:Download tab branches.png|center]] |
|||
$ sudo apt install -y libfuse2 qt5-qmake qtbase5-dev libqt5xmlpatterns5-dev libqt5svg5-dev qttools5-dev-tools |
|||
=== With Mercurial === <!--T:5--> |
|||
This is more advanced way getting Valentina's source code. Please, visit [[Hacking:Tools#Mercurial]] for more information. |
|||
*Install QtCreator https://wiki.qt.io/VendorPackages |
|||
== Dependencies == <!--T:13--> |
|||
*Install Additional libraries |
|||
=== Mac OS X === |
|||
**gnu compiler |
|||
* Xcode. |
|||
**poppler (pdftops) |
|||
* The last Qt version for OS X from the official website: [https://www.qt.io/download/ Download Qt]. |
|||
Example for Ubuntu 18.04: |
|||
* (''optional'') TortoiseHG. |
|||
* (''optional'') Mercurial that shipped with TortoiseHG can't be reached outside. So, if you want nice tag hash number in dialog About App install mercurial independent for this. |
|||
$ sudo apt install -y build-essential git poppler-tools |
|||
=== Windows === <!--T:14--> |
|||
* The last Qt version for MinGW from the official website: [https://www.qt.io/download/ Download Qt]. |
|||
* (''optional'') TortoiseHG. |
|||
* Valentina doesn't support devices that require supporting the Windows Store App APIs. This includes devices running Windows RT 8.1 and Windows Phone 8.1 and up. |
|||
*Build and install: |
|||
<!--T:47--> |
|||
''Note. Valenina's source code can be compiled with Visual Studio, but without support creating an installer.'' |
|||
$ qmake Seamly2D.pro CONFIG+=noDebugSymbols |
|||
=== Linux === <!--T:15--> |
|||
$ make -j$(nproc) |
|||
* g++ (at least GCC 4.6 is needed and GCC 4.8 is recommended) |
|||
$ sudo make install |
|||
* Qt 5.0.0 and higher required. Qt 5.2.1 and higher recommended. |
|||
* (''optional'') ccache. Recommended for speed up often re-compilations. |
|||
Note: The default prefix for command `make install` is `/usr`. To define another prefix, build with qmake's PREFIX option. This example sets `/usr/local` as the new prefix for Seamly's installation binary files: |
|||
<!--T:48--> |
|||
You can find all our scripts for creating packages in a folder '''<root_source_directory>/dist/'''. |
|||
$ qmake PREFIX=/usr/local Seamly2D.pro CONFIG+=noDebugSymbols |
|||
== Configuring and building == <!--T:17--> |
|||
'''The installed toolchains have to match the one Qt was compiled with.''' |
|||
*Copy pdftops to Seamly build directory if you need to create post script (.ps and .eps) pattern piece layouts. |
|||
=== Build keys === <!--T:18--> |
|||
___________________________________________________ |
|||
Depend on your purposes you can build Valentina with different keys: |
|||
==== Build on MacOSX and Windows 10/11 ==== |
|||
'''Step 1: MacOS only''' |
|||
*Read about Qt for macOS [https://doc.qt.io/qt-5/macos.html here] |
|||
*Install [https://developer.apple.com/download/all/ Xcode 11] |
|||
*Setup/validate build environment. Read more [https://doc.qt.io/qt-5/macos.html#build-environment here]. |
|||
*Switch to Xcode: `sudo xcode-select --switch /Applications/Xcode.app` |
|||
*Validate clang compiler points to Xcode: `xcrun -sdk macosx -find clang` |
|||
*Validate SDK version (macOS 10.15): `xcrun -sdk macosx --show-sdk-path` |
|||
*Install Xpdf: `sudo port install xpdf` |
|||
'''Step 2: Both MacOS and Windows''' |
|||
<!--T:19--> |
|||
*Download & run the [https://www.qt.io/download-qt-installer Qt unified installer]. Create a Qt account for open source Community Edition if you don't have one. |
|||
* noTests - disable compiling tests. Use if you don't need tests and what to speed up compilation time. |
|||
**Select: |
|||
* noRunPath - disable adding [https://en.wikipedia.org/wiki/Rpath Rpath attribute]. Works only for Linux. |
|||
***Custom Installation |
|||
* no_ccache - have sens only on Linux. Disable using ccache for speed up compilation. [https://en.wikipedia.org/wiki/Precompiled_header PCH] will be used instead. |
|||
***Qt - _Minimize your options, otherwise your download size could be in Gs_ |
|||
* noDebugSymbols - By default for release mode debug symbols will be placed outside of binary file. We use them for debugging and sending crash reports on Windows. Have sens only for Linux/Windows with GCC. |
|||
****Qt 5.15.2 |
|||
* debug - Compile the project in debug mode. |
|||
****MSVC 2019 |
|||
****Qt Debug Information Files |
|||
***Developer and Designer Tools |
|||
****Qt Creator |
|||
****Qt Creator CDB Debugger Support |
|||
****Debugging Tools for Windows |
|||
****Qt Creator Debug Symbols |
|||
Note: (Qt Maintenance Tool is always installed with Developer & Designer Tools - this will be highlighted) |
|||
'''Step 3: Windows only''' |
|||
<!--T:20--> |
|||
**Download [http://www.xpdfreader.com/download.html XpdfReader] for Windows. Extract to `C:/Program Files`. Rename folder to `:/Program Files/Xpdf`. |
|||
By default all keys are disabled. |
|||
*Read about Qt for Windows [https://doc.qt.io/qt-5/windows.html here]. |
|||
*Add Qt and QtCreator directories to the Windows PATH environment variable through Control Panel: |
|||
=== Building from command line === <!--T:21--> |
|||
Usual way to build sources is described below, however on Windows and Linux you have the opportunity to [[#Deploying|build packages]]. Mac OS X users will get package automatically. |
|||
<source lang=bash> |
|||
cd $SOURCE_DIRECTORY |
|||
qmake "CONFIG += noTests noRunPath no_ccache noDebugSymbols" Valentina.pro -r |
|||
make (or mingw32-make or nmake or jom, depending on your platform) |
|||
</source> |
|||
<!--T:22--> |
|||
'''Note.''' In order to build and use Valentina on Windows, the PATH environment variable needs to be extended. |
|||
=== Building with Qt Creator === <!--T:49--> |
|||
Some more advanced users may find using IDE more preferable choice. Please, read [[Hacking:Tools#Qt_Creator]]. |
|||
<!--T:50--> |
|||
'''Note.''' Building with Qt Creator on Windows and Linux doesn't support [[#Deploying|creating packages]]. |
|||
== Deploying == <!--T:26--> |
|||
=== Mac OS X === |
|||
All you need is to find Valentina in the build directory and move it to the Applications folder. |
|||
<!--T:51--> |
|||
Usually path is '''<build_folder>/src/app/valentina/bin/Valentina'''. |
|||
=== Windows === <!--T:27--> |
|||
==== Requirements for version 0.4.x and early ==== |
|||
Install NSIS from the [http://nsis.sourceforge.net/Main_Page download page]. |
|||
==== Requirements for version 0.5.x and later ==== |
|||
Install Inno Setup 5 '''unicode''' from the [http://www.jrsoftware.org/isdl.php download page]. |
|||
==== Code signing ==== |
|||
'''Note'''. This option is available only for Inno Setup. |
|||
<!--T:55--> |
|||
In some cases you may want to create a [https://en.wikipedia.org/wiki/Code_signing signed installer]. For this you should: |
|||
* Buy a certificate. |
|||
* Export it to Windows. |
|||
* Install Microsoft signtool.exe. |
|||
* Set path to the binary in the PATH variable. |
|||
* Configure InnoSetup. |
|||
# Open the file /dist/win/inno/valentina.iss with Inno Setup Compiler. |
|||
# Select ''Tools'' > ''Configure Sign Tools''. |
|||
# Select Add button. |
|||
# Enter ''Name of the Sign Tool'' ('''MySign'''). |
|||
# Enter an associated Command (signtool.exe sign /v /a /n $qSeamly, LLC$q /t <nowiki>http://timestamp.comodoca.com/authenticode</nowiki> /d $qPatternmaking program$q $f). |
|||
# Uncomment string '''SignTool=MySign''' |
|||
* Done. |
|||
<!--T:56--> |
|||
'''SignTool.exe options'''<br /> |
|||
/v - Displays verbose output regardless of whether the command runs successfully or fails, and displays warning messages.<br /> |
|||
/a - Automatically selects the best signing certificate. Sign Tool will find all valid certificates that satisfy all specified conditions and select the one that is valid for the longest time. If this option is not present, Sign Tool expects to find only one valid signing certificate.<br /> |
|||
/n ''SubjectName'' - Specifies the name of the subject of the signing certificate. This value can be a substring of the entire subject name.<br /> |
|||
/t ''URL'' - Specifies the URL of the time stamp server. If this option (or /tr) is not present, the signed file will not be time stamped. A warning is generated if time stamping fails. This option cannot be used with the /tr option.<br /> |
|||
/d - Desc specifies a description of the signed content.<br /> |
|||
<!--T:57--> |
|||
'''InnoSetup Constants'''<br /> |
|||
$q is an Inno Setup constant representing a quote.<br /> |
|||
$f is a constant containing the name and path of the setup EXE created by Inno Setup.<br /> |
|||
==== Building ==== <!--T:52--> |
|||
# Open Windows Qt command prompt window.[[File:Qt terminal.png|frameless|center]] |
|||
# Go to '''scripts''' folder. Just find full path to the folder, copy it and run command inside the command prompt window: <code>cd path_to_scripts_folder</code>. |
|||
# Run command <code>make_install.bat</code>. It will run the script for building and creating an installer. Wait until the end of the operation. |
|||
# The script creates folder '''build''' on the same level with '''scripts''', where in the end you will find your installer. |
|||
# Find an installer inside '''build/package''' folder. |
|||
<!--T:53--> |
|||
Please, read information about fixing [[Hacking:Building#Issues_with_build|Issues with build]]. |
|||
=== Linux === <!--T:29--> |
|||
==== Debian package ==== |
|||
* Install tool |
|||
<!--T:30--> |
|||
<source lang=bash> |
|||
sudo apt-get install dh-make |
|||
</source> |
|||
<!--T:31--> |
|||
* Create directory deb_build |
|||
<!--T:32--> |
|||
<source lang=bash> |
|||
mkdir deb_build |
|||
</source> |
|||
* Copy source directory to *deb_build* |
|||
* Copy *debian/* directory from *dist/debian* to root source directory. |
|||
* In root source directory with *debian/* directory run: |
|||
[Control Panel | System And Security | System | Advanced Tab | Environment Variables button] |
|||
If you want sign package |
|||
<source lang=bash> |
|||
dpkg-buildpackage -k<public_key> -rfakeroot |
|||
</source> |
|||
<!--T:33--> |
|||
or |
|||
<!--T:34--> |
|||
<source lang=bash> |
|||
dpkg-buildpackage -rfakeroot |
|||
</source> |
|||
<!--T:35--> |
|||
if not. |
|||
<!--T:36--> |
|||
That's all. In directory deb_build you will find deb package. |
|||
<!--T:37--> |
|||
'''Note.''' If your deb package broken and you can't delete him use these two commands. Run commands below as a root in Debian, preceded by sudo in Ubuntu : |
|||
<!--T:38--> |
|||
<source lang=bash> |
|||
mv /var/lib/dpkg/info/PAQUET.* /tmp/ |
|||
dpkg --remove --force-remove-reinstreq PAQUET |
|||
</source> |
|||
<!--T:39--> |
|||
For example if name of package was **valentina**: |
|||
<!--T:40--> |
|||
<source lang=bash> |
|||
mv /var/lib/dpkg/info/valentina.* /tmp/ |
|||
dpkg --remove --force-remove-reinstreq valentina |
|||
</source> |
|||
==== Gentoo ==== <!--T:41--> |
|||
For Gentoo we provide ebuild scripts. You can find them on [https://bitbucket.org/dismine/valentina/downloads download page]. |
|||
==== Slackware ==== <!--T:54--> |
|||
Find and use our SlackBuild script inside the '''<root_source_folder>/dist/SlackBuild''' folder. |
|||
'''Step 4: Both MacOS and Windows''' |
|||
<!--T:42--> |
|||
*To build with Qt's *QtCreator* IDE: |
|||
Additionaly you can find templates for scripts in folder ''<root>/dist/ebuild''. |
|||
**Create your compiler kit. Read more about adding compilers [https://doc.qt.io/qtcreator/creator-tool-chains.html on the Qt website]. |
|||
**Complete your build settings. Read more about build settings [https://doc.qt.io/qtcreator/creator-build-settings.html here]. |
|||
**Open the Seamly2D project with 'File > Open File or Project'. Navigate to the 'seamly2d/src' directory and select 'Seamly2D.pro'. |
|||
**Open the Configure Project tab and select your compiler kit. Read more [https://doc.qt.io/qtcreator/creator-project-opening.html here]. |
|||
**Build with the 'Build and Run Kit Selector' icon, or use 'Build' and 'Run' from the Tools menu. Read more [https://doc.qt.io/qtcreator/creator-building-targets.html here]. |
|||
*To build with Qt's *qmake* from a terminal window: |
|||
**Read more about jom [https://wiki.qt.io/Jom here]. |
|||
**Read more about nmake [https://learn.microsoft.com/en-us/cpp/build/reference/nmake-reference?view=msvc-170 here]. |
|||
cd $SOURCE_DIRECTORY\build |
|||
== Issues with build == <!--T:43--> |
|||
qmake ..\Seamly2D.pro CONFIG+=noDebugSymbols |
|||
If you have issues with build Valentina check if you satisfied all dependencies. If this not help, [[Hacking:How To Report Valentina Bugs|create new issue in the issues tracker]] or new topic in the [http://forum.valentina-project.org/ forum]. Add information about your system and full log of compilation. We also need information about which branch did you fail try to build. |
|||
nmake # (or jom. Assign multiple CPUs to speed up compilation time but don't use all - leave at least one CPU for your OS.) |
|||
*Copy the `C:\Program Files\Xpdf\bin64\pdftops.exe` (or bin32) file to the Seamly build directory to enable the creation of post script (.ps and .eps) pattern piece layouts. |
|||
<!--T:44--> |
|||
Currently known issue, and solution, on building with QtCreator 3.4.0 based on Qt 5.4.1 on Windows 8 64-bit with Avira AntiVirus Pro version 15.0.10.434 (as of June 11 2015): Build fails with 'file previously exists' errors when writing build files to destination directory. Problem is based on Avira scanning each file causing delay, Qt retries writing the file and generates the error. Other versions of Qt Creator and Avira may exhibit similar behavior. Set Avira Real-Time Protection to 'off' before building. |
|||
<!--T:45--> |
|||
Also look at [[Hacking:Problems_and_solutions]]. |
|||
</translate> |
</translate> |
Latest revision as of 21:12, 14 January 2023
Getting the sources[edit | edit source]
Clone from the Seamly2D repository on GitHub. In Git, create a feature branch to hold your changes.
Build Seamly2D and SeamlyMe[edit | edit source]
Basic Software Prerequisites:[edit | edit source]
- Qt 5.15.2 (includes Qt, QtCreator, QtChooser, and Qt Maintenance Tool)
- Git or Github Desktop for Windows and MacOS
- Compiler - MSVC 2022, gcc, and g++ are included with QtCreator, and you can add or update them using the Qt Maintenance Tool (Maintenance.exe).
- Pdftops (from XpdfReader or poppler) - Required to create PS or EPS layout files.
- Check the sections below for your operating system to find additional installation requirements.
Development methods and styles:[edit | edit source]
Build method:[edit | edit source]
- Read more about code styles and other developer items of interest on our Developer wiki.
- Review our GitHub Action CI script.
___________________________________________________
Build on Linux[edit | edit source]
These instructions apply in general to all distros
- Install Qt 5.15.2. Example for Ubuntu 18.04: Install the following packages to have Qt5 build environment ready:
$ sudo apt install -y libfuse2 qt5-qmake qtbase5-dev libqt5xmlpatterns5-dev libqt5svg5-dev qttools5-dev-tools
- Install QtCreator https://wiki.qt.io/VendorPackages
- Install Additional libraries
- gnu compiler
- poppler (pdftops)
Example for Ubuntu 18.04:
$ sudo apt install -y build-essential git poppler-tools
- Build and install:
$ qmake Seamly2D.pro CONFIG+=noDebugSymbols $ make -j$(nproc) $ sudo make install
Note: The default prefix for command `make install` is `/usr`. To define another prefix, build with qmake's PREFIX option. This example sets `/usr/local` as the new prefix for Seamly's installation binary files:
$ qmake PREFIX=/usr/local Seamly2D.pro CONFIG+=noDebugSymbols
- Copy pdftops to Seamly build directory if you need to create post script (.ps and .eps) pattern piece layouts.
___________________________________________________
Build on MacOSX and Windows 10/11[edit | edit source]
Step 1: MacOS only
- Read about Qt for macOS here
- Install Xcode 11
- Setup/validate build environment. Read more here.
- Switch to Xcode: `sudo xcode-select --switch /Applications/Xcode.app`
- Validate clang compiler points to Xcode: `xcrun -sdk macosx -find clang`
- Validate SDK version (macOS 10.15): `xcrun -sdk macosx --show-sdk-path`
- Install Xpdf: `sudo port install xpdf`
Step 2: Both MacOS and Windows
- Download & run the Qt unified installer. Create a Qt account for open source Community Edition if you don't have one.
- Select:
- Custom Installation
- Qt - _Minimize your options, otherwise your download size could be in Gs_
- Qt 5.15.2
- MSVC 2019
- Qt Debug Information Files
- Developer and Designer Tools
- Qt Creator
- Qt Creator CDB Debugger Support
- Debugging Tools for Windows
- Qt Creator Debug Symbols
- Select:
Note: (Qt Maintenance Tool is always installed with Developer & Designer Tools - this will be highlighted)
Step 3: Windows only
- Download XpdfReader for Windows. Extract to `C:/Program Files`. Rename folder to `:/Program Files/Xpdf`.
- Read about Qt for Windows here.
- Add Qt and QtCreator directories to the Windows PATH environment variable through Control Panel:
[Control Panel | System And Security | System | Advanced Tab | Environment Variables button]
Step 4: Both MacOS and Windows
- To build with Qt's *QtCreator* IDE:
- Create your compiler kit. Read more about adding compilers on the Qt website.
- Complete your build settings. Read more about build settings here.
- Open the Seamly2D project with 'File > Open File or Project'. Navigate to the 'seamly2d/src' directory and select 'Seamly2D.pro'.
- Open the Configure Project tab and select your compiler kit. Read more here.
- Build with the 'Build and Run Kit Selector' icon, or use 'Build' and 'Run' from the Tools menu. Read more here.
- To build with Qt's *qmake* from a terminal window:
cd $SOURCE_DIRECTORY\build qmake ..\Seamly2D.pro CONFIG+=noDebugSymbols nmake # (or jom. Assign multiple CPUs to speed up compilation time but don't use all - leave at least one CPU for your OS.)
- Copy the `C:\Program Files\Xpdf\bin64\pdftops.exe` (or bin32) file to the Seamly build directory to enable the creation of post script (.ps and .eps) pattern piece layouts.