The DAPHNE project provides a full-fledged build script. After cloning it does everything from dependency setup to generation of the executable.
- Download & build all code dependencies
- Build Daphne
- Clean Project
The first run will take a while, due to long compilation times of the dependencies. But they only have to be compiled once (except updates). Following builds only take a few seconds/minutes.
Contents:
This section shows the possibilities of the build script.
The default command to build the default target daphne.
./build.sh
Print the cli build help page. This also shows all of the following options.
./build.sh --help
Build a specific target.
./build.sh --target "target"
For example the following builds the main test target.
./build.sh --target "run_tests"
Clean all build directories, i.e. the daphne build dir in <project_root>/build
and build directories of the dependencies in
<project_root>/thirdparty/<dep>/<path to build folder>
:
./build.sh --clean
Clean all download and build directories, i.e. <project_root>/build
and <project_root>/thirdparty/*
./build.sh --cleanAll
All possible options for the build script:
Option | Effect |
---|---|
-h, --help | Print the help page |
--clean | Clean build directories |
--cleanAll | Clean build directory and delete all dependency |
--target <target> | Build specific target |
-nf, --no-fancy | Disables colorized output |
-y, --yes | Accept prompt (e.g. when executing the clean command) |
The build script is divided into segments, visualized by
#******************************************************************************
# Segment name
#******************************************************************************
Each segment should only contain functionality, related to the segment name.
The following list contains a rough overview over the segments and the concrete functions or functionality done here.
- Help message
- printHelp() // prints help message
- Build message helper
- daphne_msg( [-t <timeframe>] <message> ) // prints a status message in DAPHNE style; optional timeframe for animated output
- printableTimestamp( <timestamp> ) // converts a unix epoch timestamp into a human readable string (e.g. 5min 20s 100ms)
- printLogo( [-t <timeframe>]) // prints a DAPHNE logo to the console
- Clean build directories
- clean( <array ref dirs> <array ref files> ) // removes all given directories (1. parameter) and all given files (2. parameter) from disk
- cleanBuildDirs() // cleans build dirs (daphne and dependency build dirs)
- cleanAll() // cleans daphne build dir and wipes all dependencies from disk
- Create / Check Indicator-files
- dependency_install_success( <dep> ) // used after successful build of a dependency; creates related indicator file
- dependency_download_success( <dep> ) // used after successful download of a dependency; creates related indicator file
- is_dependency_installed( <dep> ) // checks if dependency is already installed/build successfully
- is_dependency_downloaded( <dep> ) // checks if dependency is already downloaded successfully
- Set some paths
- Definition of project related paths
- Parse arguments
- Parsing
- Updating git submodules
- Download and install third-party material if necessary
- Antlr
- catch2
- OpenBLAS
- gRPC
- MLIR
- Build DAPHNE target
- Compilation of the DAPHNE-target ('daphne' is default)
- Create a new subsegment in segment 7.
- Define needed dependency variables
- DirName
- Version
- Dep-specific paths
- Dep-specific files
- etc.
- Download the dependency, encased by:
dep_dirname="<dep_name>" dep_version="<dep_version>" if ! is_dependency_downloaded "<dep_name>_v${dep_version}"; then # do your stuff here dependency_download_success "<dep_name>_v${dep_version}" fi
- Install the dependency (if necessary), encased by:
if ! is_dependency_installed "<dep_name>_v${dep_version}"; then # do your stuff here dependency_install_success "<dep_name>_v${dep_version}" fi