User Tools

Site Tools


Sidebar

The FreeMedForms projectThe project
Presenting the project

FreeMedForms EMRFreeMedForms EMR
The EMR/EHR

FreeDiamsFreeDiams
Pharmaceutical drug prescriber assistant

Autres logicielsOther software
All other softwares of the projet

 Screencasts Screencasts
All our screencasts

 Download center Download center
Download center, all versions

ForumForum
Forum of the project

AidesHelp
Find here all help available for users and devs

 Participer Contribute
Want to contribute?

en:code:buildsystem

Build instructions for FreeMedForms project applications

Introduction

This documentation describes how to build FreeMedForms applications.

The FreeMedForms project is written in C++/Qt. In order to build one of the applications, you will need to install and configure the Qt libraries (please refer to the Qt documentation).

FreeMedForms project applications consist of a very small executable, libs and plugins. When the application starts, the executable is loaded, some libs too The plugin manager then loads all needed plugins and executes them.

Getting the source

We use Git as version control system, and GitHub for code hosting. You can go here and follow the instructions there to fetch a copy of the FreeMedForms source code.

Build dependencies

All systems

  • Be sure to install the correct version of Qt, otherwise you will not be able to compile FreeMedForms:
    • FreeMedForms since git revision eb5da592065d needs Qt 4.8.0 or higher.
    • before that revision at least Qt 4.6.2 is needed.

All new code is compatible with latest Qt5 version.

QtCreator configuration

  • Be sure to uncheck the shadow build checkbox in the projet mode

Remove cached files

  • If you have any strange behavior during the build process, try to start the build from scratch:
    • remove all Makefile: find . -type f -name Makefile -delete
    • remove all qmake cache: find . -type f -name .qmake.cache -delete
    • remove the build dir: rm -rf ./build
    • remove the bin output dir: rm -rf ./bin

Linux needed packages for compilation

  • For Linux users, you need to install the following packages before trying anything with the sources:
    • build-essential
    • all qt4 libs and binaries (libqt4-dev)
    • libxext-dev and libxext6
  • We recommend to use the QtCreator IDE
#in debian/ubuntu
sudo apt-get install build-essential libxext-dev libxext6 libqt4-dev zlib1g-dev zlib1g

MacOs needed applications for compilation

  • Download and install Qt libs
  • We recommend to use the QtCreator IDE

Windows needed applications for compilation

  • Download and install Qt SDK
  • For the Webcam plugin:
    • Download OpenCV lib
    • Install OpenCV libs in the contrib sub-dir
  • We recommend to use the QtCreator IDE

The Quazip case

  • By default all the FreeMedForms apps are built with the quazip 0.5.1 library. This lib is included in the source package.
  • Some linux distros do provide specific package of precompiled libquazip.
  • You can get rid of the bundled QuaZip source by adding
    CONFIG+=dontbuildquazip

    to the qmake command line or by editing the buildspecs/optionalfeatures.pri file.

  • Using the dontbuildquazip config tag will force the compiler to link FreeMedForms code to the system QuaZip library and will only create a freemedforms-quazip-wrapper lib.

Building the additional plugins

  • To build the optional plugins you can use two methods:
  • 1) add to the qmake commande line:
    • CONFIG+=with-plugin
    • where 'plugin' is the config name of the plugin
  • 2) Use buildspecs/optionalplugins.pri file
    • Uncomment required plugins

Using the buildspecs/optionalplugins.pri

  • Uncomment need lines

Using the command line

  • See the following instructions

Accountancy plugin

  • v0.8.4 or upper
  • Manages accountancy
  • By default, the Account plugin is not built. If you want to build it, you need to add
    • with-account tag to the config qmake command to build the new account plugin.
      qmake ... "CONFIG+=with-account" ...
    • with-old-account tag to the config qmake command to build the old account plugin.
      qmake ... "CONFIG+=with-old-account" ...
  • It is not useful to build both plugins.

Agenda plugin

  • Since v0.8.4, the agenda plugin is now an optional plugin
  • Manages multi-user agenda
  • By default, the Agenda plugin is not built. If you want to build it, you need to add
    • with-agenda tag to the config qmake command.
      qmake ... "CONFIG+=with-agenda" ...

Alert plugin

  • v0.7.6 or upper
  • Manages alerts for user, patient and application
  • By default, the Alert plugin is not built. If you want to build it, you need to add
    • with-alerts tag to the config qmake command.
      qmake ... "CONFIG+=with-alerts" ...

Feedback plugin

  • v0.8.4 or upper
  • Manages user feedback to the dev team
  • By default, the Feedback plugin is not built. If you want to build it, you need
    • to add with-feedback tag to the config qmake command.
      qmake ... "CONFIG+=with-feedback" ...

PMHx plugin

  • v0.8.4 or upper
  • Manages patient personal & family PMHx
  • By default, the PMHx plugin is not built. If you want to build it, you need
    • to add with-pmh tag to the config qmake command.
      qmake ... "CONFIG+=with-pmh" ...

WebCam plugin

  • v0.8.0 or upper
  • Manages webcam access (patient identity photo for eg)
  • By default, the WebCam plugin is not built. If you want to build it, you need
    • to install the libopencv-dev on your computer
    • to add with-webcam tag to the config qmake command.
      qmake ... "CONFIG+=with-webcam" ...

Building optional features

Building the Qt MySQL plugin

  • For MacOs: there is a specific MacOs script in the scripts dir. You need to install MySQL bin and includes.
  • For Windows: read this useful post
  • For Linux: No compilation is required, just install the plugins with sudo apt-get install libqt4-sql-mysql.

Known issues

  • It seems like with Fedora Linux you need to set the Qt4 path, before trying to build the sources. This issue needs further developments and seems linked to Fedora itself.
export PATH=$PATH:/usr/lib64/qt4/bin/

Build process

  • You can build applications in two modes:
    • debug to test, two type of compilation are available here:
      • “non-install”: allow you to debug the application without the need of installing it
      • “install-exclusive”: allow you to debug the application after its installation
      • the CONFIG flag debug_without_install can be used in the qmake command line to switch to the non-install debugging mode
    • release to use the applications. In this case, you must install it.

Using the automated script for unices builds

  • A generic script is provided to ease the building process under Linux.
  • Please read the help page of the script.
  • Command:
    # get help
    ./build.sh -h
     
    # On Linux, you can use the GUI (you need to have zenity installed on your system)
    ./build.sh

Creating translations

  • Translations are provided as sources. We provide some scripts to help you in that process.
  • Translations must be compiled before starting the make install step.
  • If you want to:
    • update the translations source file use our ./updatetranslations.sh without any commandline params. This step parses all the source files and extracts all translatable strings into *.ts files in global_resources/translations
    • translate use the Qt Linguist to *.ts files, and start translating.
    • compile translations use the Qt tool lrelease.
      cd global_resources/translations
      lrelease *.ts

      or use our lrelease_all.sh script.

The qmake && make processes

  • qmake is a small application from Qt which will translate the Qt project files into Makefile for your preferred compiler. This step requires some attention according to the selected build mode. These requirements are detailed below.
  • You can specify your own spec file to qmake.
  • You can use make in multiple thread (make -j X).
  • make -j4

Debug build

  • The debug mode is suitable for testing purpose. It includes all functionnalities, even those which are not stable or very buggy. All logged messages and errors are printed to the console.
  • There are two debug mode: a “non-install” and an “install” debug mode. See upper.
  • In the debug mode, all processed binaries are postfixed with “_d” on Win32 platforms or “_debug” on unices platforms. You can inhibit this behavior with the CONFIG flag dont_postfixe_binaries on the qmake command line.
  • Here are some paths descriptions :
    • binaries are located in /bin/LOWERED_APPNAME (eg: for FreeMedForms –> /bin/freemedforms/)
    • plugins and libs are located in /bin/LOWERED_APPNAME/plugins (eg: for FreeMedForms –> /bin/freemedforms/plugins)
    • applications resources (pixmaps, sql files etc.) are located in /global_resources
    • users resources are located in your home path (you can modify this behavior using the command line of each FreeMedForms and derivatives : –config=“../../path/to/your/config.ini”).
cd freemedforms
qmake-qt4 freemedforms.pro -r "CONFIG+=debug debug_without_install"
make
cd bin/freemedforms

# for Linux
./freemedforms_debug --config=../../global_resources/config.ini

# for Mac
FreeMedForms_debug.app/Contents/MacOs/FreeMedForms_debug --config=../../../../../global_resources/config.ini

# for Windows
freemedforms_d.exe --config=../../global_resources/config.ini

Building in release mode

  • When you build in release mode, all instable functions are inhibited and there is no logging to the console.
  • You MUST install the application (using the make install command), otherwise application will not work.
  • To facilitate the installation process several parameters can be passed through the command line.

Linux OS integration

  • The “CONFIG+=LINUX_INTEGRATED” can be set for a better integration into the operating system. When set, the built application will then use the Qt libraries installed in your OS. The libs are installed in /usr/lib/BuiltApplication and can not be moved. The binary is installed in /usr/bin. The application resources are installed in /usr/share/BuiltApplication. Of course, this is only available for Linux.
  • The “INSTALL_ROOT_PATH=/home/me/test/” used to tell the installation process where to install the application, libs and resources. If you do not specify a path the application is installed in packages/YourOs/AppName. You can combine Linux integration and root path when building a debian package or a rpm package. Actually only valid for Linux.
  • The “LIBRARY_BASENAME=lib64” is used to tell the installation process where to install plugins and libs. This is only valid in the LINUX_INTEGRATED configuration. The lib path will be: /usr/LIBRARY_BASENAME/FreeMedForms .
# FreeMedForms Sample
# 1. Building a Linux package into a fake root system
cd freemedforms
qmake freemedforms.pro -r -config release "CONFIG+=LINUX_INTEGRATED" "INSTALL_ROOT_PATH=%build__path/usr/"
make
make install

# 2. Fresh compilation and install without aiming to create a package
cd freemedforms
qmake freemedforms.pro -r -config release "CONFIG+=LINUX_INTEGRATED" "INSTALL_ROOT_PATH=/usr/"
make
make install


# FreeDiams Sample
# 1. Building a Linux package into a fake root system
cd freediams
qmake freediams.pro -r -config release "CONFIG+=LINUX_INTEGRATED" "INSTALL_ROOT_PATH=%build__path/usr/"
make
make install

# 2. Fresh compilation and install without aiming to create a package
cd freediams
qmake freediams.pro -r -config release "CONFIG+=LINUX_INTEGRATED" "INSTALL_ROOT_PATH=/usr/"
make
make install

Mac OS integration

  • For MacOs, you need to:
    • compile the application
    • link to Qt franmework
    • create a DMG package
  • A script is available for the whole process scripts/mac/mac_release.sh. It needs only one arg -b AppToBuild.
cd scripts

# Building FreeDiams in release mode and create the DMG package in one step:
./mac_release.sh -b FreeDiams


# Building FreeMedForms in release mode and create the DMG package in one step:
./mac_release.sh -b FreeMedForms

# Building FreeAccount in release mode and create the DMG package in one step:
./mac_release.sh -b FreeAccount

# Building FreePad in release mode and create the DMG package in one step:
./mac_release.sh -b FreePad

# Building FreeToolBox in release mode and create the DMG package in one step:
./mac_release.sh -b FreeToolBox

Building sources packages

  • A specific script is available for the source package creation: scripts/source.sh.

Source building requirements

  • You need to compile and use FreeToolBox to create and install the databases:
    • drugs database
    • drugs interaction database
    • ICD10 database
  • You need to prepare and include the documentation of the application. The documentation is written on this wiki website. There is a site exporter plugin to facilitate the extraction of documentation. Please contact the dev team for any informations freemedforms@googlegroups.com.

Creating the source package

  • The source packager script will prepare a complete source archive:
    • Version numbers are defined in pluginspec, libs version, win32 scripts and others
    • It is a mandatory passage for any source release.
cd scripts
./source.sh

# find output
cd ..
ls freemedformsfullsources.*.tgz

Contributing

Git

We use Git as our VCS. If you want to make yourself familiar with it, look at the many, many tutorials and help pages available in the internet.

Git is available for Mac OSX, Linux, BSD and Windows (and probably for other OS). As starting point look here.

Configuring Git

First tell git who you are - you are advised to use your real name and a valid email addresse, no nicknames please.

git config --global user.name "James T. Kirk"
git config --global user.email "kirk@enterprise.com"

Now checkout the code as described at the Google Code page (link above).

Installing git-hooks

We recommend to install our pre-defined git-hooks to simplify your work when pushing to our server. They run some code quality tests at each commit and automatically correct small issues (remove whitespace at the end of lines etc.):

cd /home/kirk/freemedforms./git/hooks
ln -s ../../githooks/*

Contributions & code modifications

You are more than welcome to contribute code to the project! You can sign up on GitHub.com , fork our repository, modify the code and make a pull request. If you want to become a regular contributor to the project, please read Contribute and introduce yourself on the dev mailing list.

en/code/buildsystem.txt · Last modified: 2014/10/02 14:27 by jerome