Hacking:Building: Difference between revisions

From Seamly
Content added Content deleted
(Marked this version for translation)
(Update build steps)
 
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages />
<br />
__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 ==
=== From the download section === <!--T:2-->
=== Basic Software Prerequisites: ===
Just download the Valentina sources from the [https://bitbucket.org/dismine/valentina/downloads/ downloads section] and extract it.
*[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: ===
<!--T:3-->
*[https://githubflow.github.io GitHub Flow workflow]
[[File:Download tab tags.png|center]]
*[https://www.conventionalcommits.org/en/v1.0.0/ GibHub commit message style guide]
Use tab '''Tags''' if you want to get code for specific version.
*[https://guides.github.com/features/issues/ GitHub issue description style guide]


=== Build method: ===
<!--T:4-->
*Read more about code styles and other developer items of interest on our [https://github.com/FashionFreedom/Seamly2D/wiki Developer wiki].
[[File:Download tab branches.png|center]]
*Review our [https://github.com/FashionFreedom/Seamly2D/blob/develop/.github/workflows/build-release.yml GitHub Action CI script].
Use tab '''Branches''' if you wan to get code for [[Hacking:Making pull requests|develop branch]].
___________________________________________________
==== 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:
=== With mercurial === <!--T:5-->
To get a copy of Valentina's repository, run:


$ sudo apt install -y libfuse2 qt5-qmake qtbase5-dev libqt5xmlpatterns5-dev libqt5svg5-dev qttools5-dev-tools
<!--T:6-->
<source lang=bash>
hg clone https://bitbucket.org/dismine/valentina
cd $SOURCE_DIRECTORY
</source>


*Install QtCreator https://wiki.qt.io/VendorPackages
<!--T:7-->
*Install Additional libraries
To update that repository, run:
**gnu compiler
**poppler (pdftops)
Example for Ubuntu 18.04:


$ sudo apt install -y build-essential git poppler-tools
<!--T:8-->
<source lang=bash>
hg pull
hg up
</source>


*Build and install:
<!--T:9-->
'''Note.''' By default mercurial makeі active [[Hacking:Making pull requests|branch default]].


$ qmake Seamly2D.pro CONFIG+=noDebugSymbols
<!--T:10-->
$ make -j$(nproc)
Run <code>hg branch</code> to find out which branch is active now.
$ 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:
<!--T:11-->
For example if need to update to 'develop' use command <code>hg update develop</code>.


$ qmake PREFIX=/usr/local Seamly2D.pro CONFIG+=noDebugSymbols
== Dependencies == <!--T:12-->
Common:
* Qt 5.2.1 or later (on Unix development packages needed)
* mercurial (TortoiseHG is recommended.)


*Copy pdftops to Seamly build directory if you need to create post script (.ps and .eps) pattern piece layouts.
<!--T:13-->
___________________________________________________
Mac OS X:
==== Build on MacOSX and Windows 10/11 ====
* Xcode.
'''Step 1: MacOS only'''
* 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.
*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:14-->
*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.
Windows:
**Select:
* MinGW or Visual Studio (both are part of Qt packages)
***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
Note: (Qt Maintenance Tool is always installed with Developer & Designer Tools - this will be highlighted)


'''Step 3: Windows only'''
<!--T:15-->
**Download [http://www.xpdfreader.com/download.html XpdfReader] for Windows. Extract to `C:/Program Files`. Rename folder to `:/Program Files/Xpdf`.
Linux:
*Read about Qt for Windows [https://doc.qt.io/qt-5/windows.html here].
* ccache (on Linux) Recommended for speed up often re-compilations.
*Add Qt and QtCreator directories to the Windows PATH environment variable through Control Panel:
* g++ (at least GCC 4.6 is needed and GCC 4.8 is recommended)

<!--T:16-->
For Windows and Mac OS X you can get Qt from official website: [https://www.qt.io/download/ Download Qt].

== Configuring and building == <!--T:17-->
'''The installed toolchains have to match the one Qt was compiled with.'''

<!--T:18-->
Depend on your purposes You can build Valentina with different keys:

<!--T:19-->
* noTests - disable compiling tests. Use if you don't need tests and what to speed up compilation time.
* noRunPath - disable adding [https://en.wikipedia.org/wiki/Rpath Rpath attribute]. Works only for Linux.
* 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.
* 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.
* debug - Compile the project in debug mode.

<!--T:20-->
By default all keys are disabled.

<!--T:21-->
Usuall way to build sources is described below, however on Windows and Linux you have the opportunity to [[#Deploying|build packages]].
<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, the PATH environment variable needs to be extended:

<!--T:23-->
PATH - to locate qmake, moc and other Qt tools This is done by adding c:\Qt\%VERSION%\bin to the PATH variable.

<!--T:24-->
For newer versions of Windows, PATH can be extended through the Control Panel|System|Advanced|Environment variables menu.

<!--T:25-->
You may also need to ensure that the locations of your compiler and other build tools are listed in the PATH variable. This will depend on your choice of software development environment.

== Deploying == <!--T:26-->
=== Mac OS X ===
All you need is to find Valentina in build directory and move it to Applications folder.

=== Windows === <!--T:27-->
Go to ''scripts'' folder and run make_install.bat script. It will run building and creating an installer. The script create folder build where in the end you will find your installer.

<!--T:28-->
Note. For making installer you will need to install [http://nsis.sourceforge.net/Main_Page NSIS].

=== 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].


'''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 satisfy all dependencies. If this not help, [[Hacking:How To Report Valentina Bugs|create new issue in the issues tracker]] or new topic in the [https://groups.google.com/forum/#!forum/valentina-project-list mailing list]. Add information about your system and full log of compilation. We also need information about what 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-->
Current 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

Other languages:
  • English


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]

___________________________________________________

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

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

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:
    • Read more about jom here.
    • Read more about nmake here.
         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.