QtCreator - workflow for Scribus and Git repository under Linux: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Development]]
[[Category:Development]] [[Category:Help]][[Category:Qt]]
== QtCreator - workflow for Scribus and Git repository under Linux ==
==Background==
This article show how to work with Scribus git repository in QtCreator.


You have successful installed Scribus git repository on local storage, eg. in ~/ScribusGIT. You have QtCreator installed as well.<br />
==Assumptions==
This article show how to work with Scribus git repository in QtCreator.<br />
# You have successful installed Scribus git repository on local storage, eg. in ~/ScribusGIT. (explained in page : [[Git]])
<br />
# You have QtCreator installed as well.
First of all I am suggesting to make separate folder where you will work on code and make all builds and installs without messing up local git repository with building files.<br />
So, create new folder eg. ~/ScribusDEV (or any other naming you use).<br />
In this folder create subfolders for building purposes:<br />
* builddir
* debugdir
* install
<br />
Now create here symlink for Scribus source folder (~/ScribusGIT/Scribus)
<source lang="bash">
#ln -s ~/ScribusGIT/Scribus ~/ScribusDEV/Scribus
</source>


Now create here (still in ~/ScribusDEV) two shell scripts, which will be used in QtCreator as your own building steps:
==Where to Start==
* building
# First of all I am suggesting to make separate folder where you will work on code and make all builds and installs without messing up local git repository with building files.
* debug
# Create new folder eg. <code>~/ScribusDEV</code> (or any other naming you use).
# In this folder create subfolders for building purposes:
#* builddir
#* debugdir
#* install
# Now create a symlink for Scribus source folder (<code>~/ScribusGIT/Scribus</code>) like so:
#:<code>ln -s ~/ScribusGIT/Scribus ~/ScribusDEV/Scribus</code>
# Now create (we're still within <code>~/ScribusDEV</code>) 2 shell scripts named 'building' and 'debug'. The scripts will be used in QtCreator as your own building steps for normal scribus and for with-debug-symbols version.


Let see how these scripts look in my case:<br />
Let see how these scripts look in my case:<br />
"building" looks like this:<br />
=====The "building" script=====
<source lang="bash">
<syntaxhighlight lang="bash">
#!/bin/sh -e<br />
#!/bin/sh -e
cd builddir<br />
cd builddir
cmake ../Scribus -DCMAKE_INSTALL_PREFIX:PATH=~/Scribus_install -DWANT_DEBUG=0 -DWANT_GRAPHICSMAGICK=1 -DWANT_VERSIONING=0<br />
cmake ../Scribus -DCMAKE_INSTALL_PREFIX:PATH=~/Scribus_install -DWANT_DEBUG=0 -DWANT_GRAPHICSMAGICK=1 -DWANT_VERSIONING=0
make -j4<br />
make -j4
make install -j4<br />
make install -j4
</source>
</syntaxhighlight>
"debug" looks like this:<br />
 
<source lang="bash">
=====The "debug" script=====
#!/bin/sh -e<br />
<syntaxhighlight lang="bash">
cd debugdir<br />
#!/bin/sh -e
cmake ../Scribus -DCMAKE_INSTALL_PREFIX:PATH=../install -DWANT_DEBUG=1 -DWANT_GRAPHICSMAGICK=1 -DWANT_VERSIONING=0<br />
cd debugdir
make -j4<br />
cmake ../Scribus -DCMAKE_INSTALL_PREFIX:PATH=../install -DWANT_DEBUG=1 -DWANT_GRAPHICSMAGICK=1 -DWANT_VERSIONING=0
make install -j4<br />
make -j4
</source>
make install -j4
In my case I have quad core processor, so I put -j4 switch for faster compilation. Use -jN switch if you have processor with N threads.<br />
</syntaxhighlight>
<br />
 
Now you are ready for set up QtCreator project.<br />
''Note: In my case I have quad core processor, so I put -j4 switch for faster compilation. Use -jN switch if you have processor with N threads.''
# run QtCreator and open project ~/ScribusDEV/Scribus/Scribus.pro
 
==Setup Qt-Creator Project==
Now you are ready to set up the QtCreator project.
# run QtCreator and open project <code>~/ScribusDEV/Scribus/Scribus.pro</code>
# go to "Projects"
# go to "Projects"
# for release build configuration:
# for release build configuration:
# set "Build directory" to "~/ScribusDEV/builddir"
# set "Build directory" to <code>~/ScribusDEV/builddir</code>
# remove all build steps
# remove all build steps
# in Add Build Step select Custom Process Step, as Command browse to "building" script, as Working directory" set "~/ScribusDEV"
# in Add Build Step select Custom Process Step, as Command browse to "building" script, as Working directory" set <code>~/ScribusDEV</code>
# repeat last steps for Debug configuration with "debugdir" instead "builddir" and "debug" script instead "building"
# repeat last steps for Debug configuration with "debugdir" instead "builddir" and "debug" script instead "building"
<br />
 
Now you can test if your develop environment is working: try to build Scribus in QtCreator.<br />
Now you can test if your develop environment is working: try to build Scribus in QtCreator.
<br />
 
Last thing to do is to exclude "Scribus.pro.user" file created by QtCreator from git repository so it will not be show as untracked file. Edit ~/ScribusGit/.git/info/exclude file and add there "Scribus.pro.user" line.
==Final Note==
Last thing to do is to exclude "Scribus.pro.user" file created by QtCreator from git repository so it will not be show as untracked file.  
: Edit the <code>~/ScribusGit/.git/info/exclude</code> file and add a line entry that contains:
:<code>"Scribus.pro.user"</code>

Latest revision as of 21:31, 20 January 2014

Background

This article show how to work with Scribus git repository in QtCreator.

Assumptions

  1. You have successful installed Scribus git repository on local storage, eg. in ~/ScribusGIT. (explained in page : Git)
  2. You have QtCreator installed as well.

Where to Start

  1. First of all I am suggesting to make separate folder where you will work on code and make all builds and installs without messing up local git repository with building files.
  2. Create new folder eg. ~/ScribusDEV (or any other naming you use).
  3. In this folder create subfolders for building purposes:
    • builddir
    • debugdir
    • install
  4. Now create a symlink for Scribus source folder (~/ScribusGIT/Scribus) like so:
    ln -s ~/ScribusGIT/Scribus ~/ScribusDEV/Scribus
  5. Now create (we're still within ~/ScribusDEV) 2 shell scripts named 'building' and 'debug'. The scripts will be used in QtCreator as your own building steps for normal scribus and for with-debug-symbols version.

Let see how these scripts look in my case:

The "building" script
#!/bin/sh -e
cd builddir
cmake ../Scribus -DCMAKE_INSTALL_PREFIX:PATH=~/Scribus_install -DWANT_DEBUG=0 -DWANT_GRAPHICSMAGICK=1 -DWANT_VERSIONING=0
make -j4
make install -j4
The "debug" script
#!/bin/sh -e
cd debugdir
cmake ../Scribus -DCMAKE_INSTALL_PREFIX:PATH=../install -DWANT_DEBUG=1 -DWANT_GRAPHICSMAGICK=1 -DWANT_VERSIONING=0
make -j4
make install -j4

Note: In my case I have quad core processor, so I put -j4 switch for faster compilation. Use -jN switch if you have processor with N threads.

Setup Qt-Creator Project

Now you are ready to set up the QtCreator project.

  1. run QtCreator and open project ~/ScribusDEV/Scribus/Scribus.pro
  2. go to "Projects"
  3. for release build configuration:
  4. set "Build directory" to ~/ScribusDEV/builddir
  5. remove all build steps
  6. in Add Build Step select Custom Process Step, as Command browse to "building" script, as Working directory" set ~/ScribusDEV
  7. repeat last steps for Debug configuration with "debugdir" instead "builddir" and "debug" script instead "building"

Now you can test if your develop environment is working: try to build Scribus in QtCreator.

Final Note

Last thing to do is to exclude "Scribus.pro.user" file created by QtCreator from git repository so it will not be show as untracked file.

Edit the ~/ScribusGit/.git/info/exclude file and add a line entry that contains:
"Scribus.pro.user"