Download the super-build source release or clone the git repository. The downloads page provides links to both source releases and links to the git repositories for both the super-build and the individual C++ components. If you wish to build a specific release, the corresponding source release or git tag is appropriate, but if you wish to build the latest development work, or make changes to the sources, the git repository will be more useful.
Before proceeding, please check the Errata for known problems with certain libraries and platforms.
Custom configuration is needed primarily on Windows, where the needed tools may not be on the search path by default. There are several possible approaches here:
The first will affect all programs running on the system and so may cause problems, particularly if multiple configurations or tool versions are to be used. The last offers the greatest flexibility and safety, and can be sourced automatically when starting a shell if a console replacement such as ConsoleZ is used. This is the approach taken by the author for routine development, since different configurations may be selected for different projects.
OME-Files uses cmake, a generic cross-platform build system which generates build files for a large number of common build systems and IDEs. For example, on BSD, Linux and MacOS X, Unix make Makefile files may be created. On Windows, Visual Studio msbuild .sln solution files and .vcxproj project may be created. However, Eclipse, Sublime Text or several other IDEs or alternative build systems may be used instead, if desired.
Start by creating a temporary build directory. This directory may be in any location inside or outside the source tree. However, the source directory itself cannot be used as the build directory. (This fills the source tree full of autogenerated files.)
Run cmake from the temporary build directory:
% mkdir build
% cd build
% cmake [-G <generator>] [<options>] /path/to/source
Where <generator> is the platform-specific build system to generate files for, and <options> are any additional options to configure the build to your requirements. See below for information about the different generators.
Run cmake -LH to see the configurable project options; use -LAH to see advanced options. The following basic options are supported:
For example, to disable tests, run cmake -Dtest=OFF. Options will typically be enabled by default if the prerequisites are available.
The installation prefix may be set at this point using -DCMAKE_INSTALL_PREFIX=prefix. The build system and compiler to use may also be specified. Please see the cmake documentation for further details of all configurable options, and run cmake --help to list the available generators for your platform.
If using the superbuild, most of the options above will be available, and will be passed to the OME-Files build. In addition, the following options are provided:
The default generator is Unix Makefiles, and the standard CXX, CXXFLAGS and LDFLAGS environment variables may be set to explicitly specify the compiler, compiler flags and linker flags, respectively. These may be useful for adding additional -I and -L include and library search paths, for example.
An alternative generator to consider is Ninja. It is recommended for parallel builds. This is similar to Unix Makefiles but allows building with the ninja tool in place of make. It is, in general, faster than make, and it is also much nicer when building in parallel since it will automatically adjust the number of jobs being run, and will also buffer the output for each job to allow the build log to be readable, rather than interleaving the output from concurrently running jobs.
If you wish to use an IDE such as Eclipse or KDevelop, alternative generators are also available, but are not actively tested by the OME continuous integration system.
On Windows, the generator will require specifying by hand, and this will configure the version of Visual Studio (or other compiler) to use. For example, -G "Visual Studio 14 Win64" will configure for generating Visual Studio 2015 64-bit solution and project files for use with the Visual C++ compiler tool msbuild or for opening in the Visual Studio application.
An alternative generator to consider is Ninja. It is much faster than building the Visual Studio project and solution files with msbuild due to being much more effective at running jobs in parallel, since msbuild only runs project builds in parallel while ninja will run everything in parallel. ninja will also automatically adjust the number of jobs being run, and will also buffer the output for each job to allow the build log to be readable. The build log is also much less verbose than the output from msbuild. However, solution and project files for use within the Visual Studio application are not generated.
Note
There is no need to use the Visual Studio command shell when running cmake with Visual Studio generators since the generator specifies the version of Visual Studio to use. However, the Visual Studio command shell must be used (or a command shell with the appropriate environment set used) when using the Ninja generator, since the same generator is used for all Visual Studio versions and the specific compiler to use must be specified.
For all platforms and generators, it should usually be possible to build using:
% cmake --build
which will invoke the platform- and generator-specific build as appropriate.
To build the API reference documentation, run:
% cmake --build . --target doc
If using Unix Makefiles, simply run:
% make
with any additional options required, for example -j to enable parallel building, or VERBOSE=1 to show the details of every command being executed.
To build the API reference documentation, run:
% make doc
Similarly, if using Ninja, simply run:
% ninja
or to build the API reference, run:
% ninja doc
If using an IDE, open the generated project file and proceed using the IDE to build the project.
If using one of the Visual Studio generators, the generated solution and project files may be opened using the IDE and then built within the IDE. Alternatively, the solution or project files may be built directly using the msbuild command-line tool inside a Visual Studio command prompt (or an appropriately configured command prompt which has run VCVARSALL.BAT or equivalent to configure the environment). Run:
> msbuild <project>.sln /p:Configuration=<configuration>
Where <project> is the specific package being built, and <configuration> is the build type, usually Debug or Release.
If using the Ninja generator, run the ninja command-line tool inside a Visual Studio command prompt (or an appropriately configured command prompt which has run VCVARSALL.BAT or equivalent to configure the environment). Run:
> ninja
The super-build will run unit tests for each component after they are built. It is possible to run tests by hand within the build directory of each component, though this may require environment variables such as PATH, LD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH and OME_HOME to be set, so that the programs, libraries and datafiles in the super-build’s installation staging directory may be found by the tests.
For all platforms and generators, it should usually be possible to run all tests using ctest. Run:
% ctest [-C <configuration>]
or to run verbosely:
% ctest -V [-C <configuration>]
Additional flags allow specification of the build configuration to use, logging, parallel building and other options. Please see the ctest documentation for further details. Running ctest directly is preferred over the methods detailed below since passing options works in all cases, and it is also possible to specify the build configuration (used on Windows).
Individual test programs may be run by hand if required.
To run all tests, run:
% cmake --build . --target test
If using Unix Makefiles, simply run:
% make test
or verbosely:
% make test ARGS=-V
If using Ninja, simply run:
% ninja test
To run all tests, if using a Visual Studio generator, run:
> msbuild RUN_TESTS.vcproj
If using Ninja, simply run:
> ninja test
To install the headers and libraries directly on the system into the configured prefix:
% cmake --build . --target install
Alternatively, to install into a staging directory:
% cmake --build . --target install -- DESTDIR=/path/to/staging/directory install
If using Unix Makefiles, simply run:
% make install
Alternatively, to install into a staging directory:
% make DESTDIR=/path/to/staging/directory install
If using Ninja, simply run:
% ninja install
When using a Visual Studio generator, there should be an INSTALL.vcxproj project which may be run using msbuild, for example:
> msbuild INSTALL.vcxproj /p:platform=x64
The INSTALL project may also be built within the Visual Studio application.
If using Ninja, simply run:
> ninja install
The OME Files C++ API reference is used to document all aspects of the OME-Files API. Likewise there are companion references for the OME Common and OME XML components.
Using the downloaded source release and make. Run:
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/install/dir /path/to/superbuild/sources
make
make install
Using the super-build git repository and Ninja. Run:
mkdir build
cd build
cmake -G Ninja -Dhead:BOOL=ON -DCMAKE_INSTALL_PREFIX=/install/dir /path/to/superbuild/git/repo
make
make install
Using the super-build git repository and Ninja, and also requesting that no third party prerequisites should be built except for gtest. For each component to build, ensure you have a local git clone and that each clone has the branch you wish to build checked out. Run:
mkdir build
cd build
cmake -G Ninja -Dome-common-dir=/path/to/ome-common-cpp -Dome-model-dir=/path/to/ome-model -Dome-files-dir=/path/to/ome-files -Dome-qtwidgets-dir=/path/to/ome-qtwidgets -Dbuild-prerequisites=OFF -Dome-cmake-superbuild_BUILD_gtest=ON -Dbuild-packages=ome-qtwidgets -DCMAKE_INSTALL_PREFIX=/install/dir /path/to/superbuild/git/repo
make
make install
Note that if all the git repositories are in a common location and use their canonical names, then this may be simplified:
cmake -G Ninja -Dgit-dir=/path/to/git/repos -Dbuild-prerequisites=OFF -Dome-cmake-superbuild_BUILD_gtest=ON -Dbuild-packages=ome-qtwidgets -DCMAKE_INSTALL_PREFIX=/install/dir /path/to/superbuild/git/repo
Using the downloaded source release and make. In a suitable Visual Studio command prompt, run:
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/install/dir /path/to/superbuild/sources
ninja
ninja install
Using the super-build git repository and Ninja. Run:
mkdir build
cd build
cmake -G Ninja -Dhead:BOOL=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/install/dir /path/to/superbuild/sources
ninja
ninja install
Using the super-build git repository and Ninja. For each component to build, ensure you have a local git clone and that each clone has the branch you wish to build checked out. Run:
mkdir build
cd build
cmake -G Ninja -Dome-common-dir=/path/to/ome-common-cpp -Dome-model-dir=/path/to/ome-model -Dome-files-dir=/path/to/ome-files -Dome-qtwidgets-dir=/path/to/ome-qtwidgets -Dbuild-packages=ome-qtwidgets -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/install/dir /path/to/superbuild/sources
ninja
ninja install
Note that if all the git repositories are in a common location and use their canonical names, then this may be simplified:
cmake -G Ninja -Dgit-dir=/path/to/git/repos -Dbuild-packages=ome-qtwidgets -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/install/dir /path/to/superbuild/sources