Information for programmers

Lines of code

The source code for Daisy is hosted on GitHub and redistributable under the terms of the GPL and the LGPL

The code and build environment is not as friendly is you may be used to from other free software projects; there are not many external users so the needs of internal users are prioritized.

You may instead download a pre-compiled version of Daisy.

Build tools

GNU Make and GCC are used for building Daisy. As of 6.34, the main commands to build are "make native" to make a version of Daisy for just your computer, or "make portable" to make a version of Daisy that can be used on other computers as well.

Daisy have been compiled with various compiler through time, but usually some version of GCC is the main compiler. The implementation language is C++.

LaTeX (and extensions) is used for documentations.

External dependencies

Environment

If you build Daisy yourself (rather than install it through a pre-complied package), you will want to set DAISYHOME to point to your development directory, so Daisy will pick up the right versions of the lib and sample files.

Windows specific instructions (msys2)

Currently, the preferred build environment for Windows is msys2, which provides all the tools needed for for building Daisy.

First, go to https://www.msys2.org/ and follow the instructions under Installation (and don't change the install directory). 

Follow all the step up to and including step 6, which is

pacman -S mingw-w64-ucrt-x86_64-gcc

which will install GCC. Keep the window open to install more msys2 software, as detailed below.

Note that the pacman program will ask you to confirm before installing, which you do by pressing the ENTER key.

Next, you need GNU Make and git, which can be installed with 

pacman -S git
pacman -S make

Boost can be fetched with

  • pacman -S mingw-w64-ucrt-x86_64-boost

CXSparse it part of the SuiteSparse package, fetch it with

  • pacman -S mingw-w64-ucrt-x86_64-suitesparse

With git installed, you can fetch the bleeding edge version of Daisy from github with

git clone https://github.com/perabrahamsen/daisy-model.git
mv daisy-model daisy

Now you can build daisy.exe with

cd daisy
make portable

(or "make native" for extra speed at the cost of a less tested version).

Note that building daisy.exe is quite slow, so this is a good place to take a break. 

Test daisy.exe by typing 

./objp/daisy.exe -v

This should write the Daisy version number.

Now you have build your own Daisy. It can be used from within the msys2 window, but if you want to use it from e.g. TextPad, you need to package it as an installer. To do this, proceed with the following instructions.

You need to fetch the gnuplot and LaTeX packages to build the documentation

pacman -S mingw-w64-ucrt-x86_64-gnuplot
pacman -S mingw-w64-ucrt-x86_64-texlive-core

pacman -S mingw-w64-ucrt-x86_64-texlive-latex-recommended
pacman -S mingw-w64-ucrt-x86_64-texlive-bibtex-extra
pacman -S mingw-w64-ucrt-x86_64-texlive-latex-extra
pacman -S mingw-w64-ucrt-x86_64-texlive-fonts-recommended

as well as the NSIS package to make the installer itself

pacman -S mingw-w64-ucrt-x86_64-nsis

After installing these, you can make an installer with

make TAG="NAME" windows

where you replace "NAME" will a name of your own choice.  The name will then replace the version number in the installed version. This will generate a file named "daisy-NAME-setup-w64.exe" which will install "Daisy NAME" in the start menu.

Note that this step also take significant time, and generates a lot of warnings.

Windows specific instructions (Visual Studio)

If you fetch the Daisy source from github, it contains "Daisy.sln" and "Daisy.vcxproj" filed, both of which can be opened with Visual Studio.  You may sometimes be able to build Daisy that way, but most of the time not.

The NuGet package manager within Visual Studio will help you fetch boost and cxsparse. The later is currently found as part of a larger package called SuiteSparseMetis.

Linux specific instructions

Use the bundled package manager to install all the required packages, then build with "make native" or "make portable".

MacOS specific instructions

MacOS unfortunately don't come with a package manager, but download Homebrew instead. It has the packages you need. MacOS comes with clang instead of GCC, but clang will pretend to be GCC and that usually works fine.

Random acts of documentation

The subpages here document some minor aspects of the code, they may be out of day, and do not cover the main structure or any of most important subcomponents.