Difference between revisions of "Devel:Installation"

From GeopsyWiki
Jump to navigation Jump to search
 
(38 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
== Necessary 3rd party tools ==
 
== Necessary 3rd party tools ==
  
A recent version of [[wikipedia:GNU_Compiler_Collectiong|g++]], [[wikipedia:GNU_Compiler_Collectiong|gfortran]], and [[wikipedia:Qt_(framework)|Qt]] are first required. For code edition, we recommend using [http://qt.nokia.com/products/developer-tools Qt Creator] which is provided in [http://qt.nokia.com/downloads Qt sdk].
+
A recent version of [[wikipedia:GNU_Compiler_Collectiong|g++]], [[wikipedia:GNU_Compiler_Collectiong|gfortran]], [[wikipedia:Git_(software)|git]] and [[wikipedia:Qt_(framework)|Qt]] are first required. For code edition, we recommend using [http://qt.nokia.com/products/developer-tools Qt Creator] which is provided in [http://qt.nokia.com/downloads Qt sdk].
  
 
Some packages may require additional 3rd party libraries. Refer to the usual [[Installation:Linux|installation instructions]] for details.
 
Some packages may require additional 3rd party libraries. Refer to the usual [[Installation:Linux|installation instructions]] for details.
  
 
== Initialization ==
 
== Initialization ==
 +
 +
=== git configuration ===
 +
 +
This is not absolutely required but if you are going to make modifications, it is better to have your authorship properly set up in the repository. If not already done on your system:
 +
 +
git config --global user.name "Your name"
 +
git config --global user.email "your.email@your.domain"
 +
git config --global core.editor vi
 +
 +
=== admin directory ===
  
 
The list of packages is saved in a git repository called '''geopsyprojects'''. Configure it by editing ''option.sub''.
 
The list of packages is saved in a git repository called '''geopsyprojects'''. Configure it by editing ''option.sub''.
  
Currently, the active branch is 2.1, to work on another branch (e.g. master, 2.2, ...) change the argument of ''git fetch'' and ''git checkout''. Switching to another branch afterward is possible.  
+
There are three main branches: "devel", "testing", and "stable". Change the argument of ''git fetch'' and ''git checkout'' to select another branch. Switching to another branch afterward is possible.  
  
 
  mkdir geopsy-dev
 
  mkdir geopsy-dev
 
  cd geopsy-dev
 
  cd geopsy-dev
  git clone git://download.geopsy.org/geopsyprojects
+
  git clone git://geopsy.org/geopsyprojects
 
  mv geopsyprojects admin
 
  mv geopsyprojects admin
 
  cd admin
 
  cd admin
  git fetch git://download.geopsy.org/devpro 2.1:2.1
+
 
  git checkout 2.1
+
Switch to the desired branch ("devel" in this example).
  cp option.sub.example option.sub
+
 
  vi option.sub
+
  git fetch git://geopsy.org/geopsyprojects 3.5:3.5
 +
  git checkout 3.5
 +
 
 +
Configure destination and installation paths. Destination path is the directory where executables and libraries first go after compilation. Installation path points to the directory where files are copied during a 'make install'. Destination directory is written during any compilation ('make'), hence user permissions are required. For development, installation and destination path are usually identical and 'make install' is never run. It avoids multiple copies of the same include files and confusions while editing them (e.g. editing installed files instead of source files).
 +
 
 +
  cp options.sub.example options.sub
 +
  vi options.sub
 +
 
 +
PREFIX is set be default to '/usr/local/Geopsy.org'. If this is fine, make sure that you have enough permissions. To create a new user writable directory:
 +
 
 +
sudo mkdir /usr/local/Geopsy.org
 +
sudo chown yourusername /usr/local/Geopsy.org
 +
 
 +
Configure the list of package to build by default.
 +
 
 
  cp projects.default.example projects.default
 
  cp projects.default.example projects.default
 
  vi projects.default
 
  vi projects.default
 +
cd ..
 +
 +
projects.* files simply set PROJECTS environment variable. It contains a list of paths to projects (relative to the development root directory, geopsy-dev in this example). List 'user' contains the most popular applications and libraries of geopsy packages. Comment all other lists because you might not have sufficient permissions to access their git repository). List 'scripts' contains 'devpro' which bootstrap is explained here below.
 +
 +
=== devpro scripts ===
  
 
A package of multi-purpose scripts to ease coding experience. Bootstrap is a little tricky...
 
A package of multi-purpose scripts to ease coding experience. Bootstrap is a little tricky...
Line 29: Line 58:
 
  git clone git://download.geopsy.org/devpro
 
  git clone git://download.geopsy.org/devpro
 
  cd devpro
 
  cd devpro
git fetch git://download.geopsy.org/devpro 2.1:2.1
+
 
git checkout 2.1
+
Switch to the same branch as above (e.g. "3.5").
 +
 
 +
  git fetch git://geopsy.org/devpro 3.5:3.5
 +
  git checkout 3.5
 +
 
 +
Setup the minimal configuration for devpro scripts:
 +
 
 
  mkdir ~/.devpro
 
  mkdir ~/.devpro
  echo "REF_QT_VERSION=4.5.3" >> ~/.devpro/info
+
  echo "REF_QT_VERSION=5.15.2" >> ~/.devpro/info
  src/dpconfigure
+
 
 +
Create build directory
 +
 
 +
  mkdir -p ../../builds/3.5/Qt-5.15/Debug/devpro
 +
  mkdir -p ../../builds/3.5/Qt-5.15/Release/devpro
 +
 
 +
Bootstrap of devpro project
 +
 
 +
  export BUILD_DIR=../../builds/3.5/Qt-5.15/Debug/devpro
 +
$(pwd)/src/dpconfigure
 
  source ../admin/options.sub
 
  source ../admin/options.sub
  ./configure $CONFIGURE_OPTIONS
+
  ./configure $CONFIGURE_OPTIONS -builddir ../../builds/3.5/Qt-5.15/Debug/devpro
 +
cd ../../builds/3.5/Qt-5.15/Debug/devpro
 
  make
 
  make
  cd ..
+
   
 
 
 
Define path to geopsy-dev/bin (or other DEST_DIR if configured differently in admin/options.sub) in your PATH (e.g. ~/.bashrc).
 
Define path to geopsy-dev/bin (or other DEST_DIR if configured differently in admin/options.sub) in your PATH (e.g. ~/.bashrc).
  
  export $PATH=/path/to/geopsy-dev/bin:$PATH
+
  export PATH=/usr/local/Geopsy.org/bin:$PATH
 
 
== Download all packages ==
 
  
So simple...
+
== Download all packages for a specific branch ==
  
 
  cd geopsy-dev
 
  cd geopsy-dev
  dpsubdo dpcheckout 2.1
+
  dpsubdo dpcheckout 3.5
 
 
  
 
== Configure and compile ==
 
== Configure and compile ==
  
Configure packages forcing the options from admin/options.sub (option '-f').
+
Configure packages with the options from admin/options.sub.
  
 +
rm -rf builds/Qt-5.15/Debug/devpro
 
  cd geopsy-dev
 
  cd geopsy-dev
  dpsubconfig -f
+
  dpsubconfig -d
 +
cd ../builds/3.5/Qt-5.15/Debug
 +
dpsubonfig
  
 
Build the general Makefile
 
Build the general Makefile
Line 62: Line 106:
 
  dpsubpro
 
  dpsubpro
 
  qmake
 
  qmake
 +
 +
Build or update version headers
 +
 +
dpsubdo dpversion f
 +
 +
Under MacOSX, with the Qt binaries, the default QMAKESPEC can be macx-xcode.  To force the generation of makefiles, run qmake this way:
 +
 +
qmake -spec macx-g++
  
 
Compile...
 
Compile...
  
  make debug
+
  make -j 8
  
 
== Qt Creator ==
 
== Qt Creator ==
  
Qt Creator does not like 3rd party and script projects included in the package list, so remove them from the global Makefile once these projects are successfully compiled.
+
Qt Creator does not like 3rd party and script projects included in the package list, so remove them from the global Makefile once these projects are successfully compiled. You will run into errors if you remove these lines before a first successful build.
 +
 
 +
TEMPLATE = subdirs
 +
CONFIG += ordered debug_and_release
 +
SUBDIRS = \
 +
          devpro \
 +
          3rdparty/dfftpack \
 +
          3rdparty/mseed \
 +
          3rdparty/slink \
 +
          lib/QGpCoreTools \
 +
          lib/QGpGuiTools \
 +
          lib/SciFigs \
  
dpsubpro -l qtpro
+
In file ''geopsy-dev.pro'', remove all lines starting with ''3rdparty'' and ''devpro'' corresponding to projects not built with ''qmake''.
qmake
 
  
Start Qt creator and open ''2.1.pro'' file located in ''geopsy-dev''.
+
Start Qt creator and open ''geopsy-dev.pro'' file located in ''geopsy-dev''.

Latest revision as of 12:43, 17 July 2023

Development is preferably achieved under Linux. Other platforms are not documented.

Necessary 3rd party tools

A recent version of g++, gfortran, git and Qt are first required. For code edition, we recommend using Qt Creator which is provided in Qt sdk.

Some packages may require additional 3rd party libraries. Refer to the usual installation instructions for details.

Initialization

git configuration

This is not absolutely required but if you are going to make modifications, it is better to have your authorship properly set up in the repository. If not already done on your system:

git config --global user.name "Your name"
git config --global user.email "your.email@your.domain"
git config --global core.editor vi

admin directory

The list of packages is saved in a git repository called geopsyprojects. Configure it by editing option.sub.

There are three main branches: "devel", "testing", and "stable". Change the argument of git fetch and git checkout to select another branch. Switching to another branch afterward is possible.

mkdir geopsy-dev
cd geopsy-dev
git clone git://geopsy.org/geopsyprojects
mv geopsyprojects admin
cd admin

Switch to the desired branch ("devel" in this example).

git fetch git://geopsy.org/geopsyprojects 3.5:3.5
git checkout 3.5

Configure destination and installation paths. Destination path is the directory where executables and libraries first go after compilation. Installation path points to the directory where files are copied during a 'make install'. Destination directory is written during any compilation ('make'), hence user permissions are required. For development, installation and destination path are usually identical and 'make install' is never run. It avoids multiple copies of the same include files and confusions while editing them (e.g. editing installed files instead of source files).

cp options.sub.example options.sub
vi options.sub

PREFIX is set be default to '/usr/local/Geopsy.org'. If this is fine, make sure that you have enough permissions. To create a new user writable directory:

sudo mkdir /usr/local/Geopsy.org
sudo chown yourusername /usr/local/Geopsy.org

Configure the list of package to build by default.

cp projects.default.example projects.default
vi projects.default
cd ..

projects.* files simply set PROJECTS environment variable. It contains a list of paths to projects (relative to the development root directory, geopsy-dev in this example). List 'user' contains the most popular applications and libraries of geopsy packages. Comment all other lists because you might not have sufficient permissions to access their git repository). List 'scripts' contains 'devpro' which bootstrap is explained here below.

devpro scripts

A package of multi-purpose scripts to ease coding experience. Bootstrap is a little tricky...

git clone git://download.geopsy.org/devpro
cd devpro

Switch to the same branch as above (e.g. "3.5").

 git fetch git://geopsy.org/devpro 3.5:3.5
 git checkout 3.5

Setup the minimal configuration for devpro scripts:

mkdir ~/.devpro
echo "REF_QT_VERSION=5.15.2" >> ~/.devpro/info

Create build directory

 mkdir -p ../../builds/3.5/Qt-5.15/Debug/devpro
 mkdir -p ../../builds/3.5/Qt-5.15/Release/devpro

Bootstrap of devpro project

export BUILD_DIR=../../builds/3.5/Qt-5.15/Debug/devpro
$(pwd)/src/dpconfigure
source ../admin/options.sub
./configure $CONFIGURE_OPTIONS -builddir ../../builds/3.5/Qt-5.15/Debug/devpro
cd ../../builds/3.5/Qt-5.15/Debug/devpro
make

Define path to geopsy-dev/bin (or other DEST_DIR if configured differently in admin/options.sub) in your PATH (e.g. ~/.bashrc).

export PATH=/usr/local/Geopsy.org/bin:$PATH

Download all packages for a specific branch

cd geopsy-dev
dpsubdo dpcheckout 3.5

Configure and compile

Configure packages with the options from admin/options.sub.

rm -rf builds/Qt-5.15/Debug/devpro
cd geopsy-dev
dpsubconfig -d
cd ../builds/3.5/Qt-5.15/Debug
dpsubonfig

Build the general Makefile

dpsubpro
qmake

Build or update version headers

dpsubdo dpversion f

Under MacOSX, with the Qt binaries, the default QMAKESPEC can be macx-xcode. To force the generation of makefiles, run qmake this way:

qmake -spec macx-g++

Compile...

make -j 8

Qt Creator

Qt Creator does not like 3rd party and script projects included in the package list, so remove them from the global Makefile once these projects are successfully compiled. You will run into errors if you remove these lines before a first successful build.

TEMPLATE = subdirs
CONFIG += ordered debug_and_release
SUBDIRS = \
          devpro \
          3rdparty/dfftpack \
          3rdparty/mseed \
          3rdparty/slink \
          lib/QGpCoreTools \
          lib/QGpGuiTools \
          lib/SciFigs \

In file geopsy-dev.pro, remove all lines starting with 3rdparty and devpro corresponding to projects not built with qmake.

Start Qt creator and open geopsy-dev.pro file located in geopsy-dev.