Project Setup with Ark

Ark is typically used as a submodule, and we prefer to build static binaries linked against our third party dependencies. Contact us for more information on a more traditional shared-object build.

Ark Dependencies

Please make sure that you have all of the dependencies listed here before following this guide.

Setup

Ark is delivered as a compressed software bundle of source code or a set of libraries and header files.
Ark is configured as a cmake project and can be referenced in your projects’s cmake system.
Ark should be configured as a dependency in your project. An example project directory layout would look something like this:

YourProject
├── <third party submodules>
│   └── ark  <-- unpack Ark to this location
└── <your source code>
    ├── project1
    └── algorithm

Let’s add ark into your project’s 3rd party library folder.

Enter the subdirectory and unpack the ark software bundle:

$ cd ${THIRD_PARTY_SUBMODULES}
$ tar -xf <ARK_V2022.12.0.tar.xz>

The release will have a versioned folder, such as ark-v2022.12.0. It’s recommended to rename that to ark.

At this point, your tree should look something like this:

YourProject
└── <third party submodules>
    └── ark

The next step is to configure some additional scripts and tools needed for the Ark system.

Make and other scripts

Incorporate the Ark scripts and tools to your project. (For additional references on the top level tools can be found in compiler documentation) Add the scripts as symbolic links to your top level directory:

cd <project dir>
ln -s ./${THIRD_PARTY_SUBMODULES}/ark/make.sh make.sh
ln -s ./${THIRD_PARTY_SUBMODULES}/ark/lint.sh lint.sh
ln -s ./${THIRD_PARTY_SUBMODULES}/ark/env.sh env.sh
ln -s ./${THIRD_PARTY_SUBMODULES}/ark/.clang-format .clang-format
ln -s ./${THIRD_PARTY_SUBMODULES}/ark/.clang-tidy .clang-tidy
ln -s ./${THIRD_PARTY_SUBMODULES}/ark/.cmake-format.json .cmake-format.json
  • make.sh : Script to build the software, a wrapper afor ninja (more details)
  • env.sh : Define Ark environment variables, which is referenced by the other scripts
  • lint.sh : Runs linting

In your top level directory, create a cmake file to reference the directory structure.

Create CMakeLists.txt in the top directory that looks something like this:

#
# Root build file for the your project.
#

cmake_minimum_required(VERSION 3.20)
project(MyArkProject LANGUAGES C CXX)

#
# Include the ark build system configuration.
#

include(${CMAKE_CURRENT_LIST_DIR}/${THIRD_PARTY_SUBMODULES}/ark/cmake/build.cmake)

#
# Build the submodules.
#

add_subdirectory(${THIRD_PARTY_SUBMODULES})

#
# Include the source itself.
#

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

At this point, you can simply type ./make.sh to build all of the Ark components. You may want to take advantage of ccache support. Build artifacts will be generated in a build subdirectory and unit tests in a subfolder under that.

YourProject
├── build
|   └──tests
└── ${THIRD_PARTY_SUBMODULES}
   └── ark

Referencing Ark components

Simply include Ark components in your project as you would normally would. Here’s a very simple example for src/test_program.cc program

#include "ark/debuglog/log.hh"

int main(int argc, const char **argv)
{
   LINFO("Using Ark Debuglog");
   return 0;
}

The associated CMakeLists.txt:

add_executable(
    test_program
    test_program.cc)

target_link_libraries(
    test_program
    PRIVATE ark::debuglog)
cd <YourProject>
./make.sh test_program
./build/test_program  

For a tutorial on how to use the components of Ark, walkthrough the Ark Tutorial which will create stages, serializable messages, pipelines, and interact with data on a user interface.