This directory contains the code and build system for the GraphAr C++ library.
GraphAr C++ uses CMake as a build configuration system. We recommend building out-of-source. If you are not familiar with this terminology:
cmake is invoked directly from the cpp directory. This can be inflexible when you wish to maintain multiple build environments (e.g. one for debug builds and another for release builds)cmake is invoked from another directory, creating an isolated build environment that does not interact with any other build environment. For example, you could create cpp/build-debug and invoke cmake $CMAKE_ARGS .. from this directoryBuilding requires:
make build utilitiesarrow-dev, arrow-dataset, arrow-acero and parquet modules) for Arrow filesystem support and can use BUILD_ARROW_FROM_SOURCE option to build with GraphAr automatically. You can refer to Apache Arrow Installation to install Arrow directly too.Dependencies for optional features:
Extra dependencies are required by examples:
All the instructions below assume that you have cloned the GraphAr git repository and navigated to the cpp subdirectory:
$ git clone https://github.com/alibaba/GraphAr.git $ cd GraphAr $ git submodule update --init $ cd cpp
Release build:
$ mkdir build-release $ cd build-release $ cmake .. $ make -j8 # if you have 8 CPU cores, otherwise adjust, use -j`nproc` for all cores
Build the Apache Arrow dependency from source:
By default, GraphAr try to find Apache Arrow in the system. This can be configured to build Arrow dependency automatically from source:
$ mkdir build $ cd build $ cmake -DBUILD_ARROW_FROM_SOURCE=ON .. $ make -j8
Debug build with unit tests:
$ export GAR_TEST_DATA=$PWD/../testing/ $ mkdir build-debug $ cd build-debug $ cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON .. $ make -j8 # if you have 8 CPU cores, otherwise adjust, use -j`nproc` for all cores $ make test # to run the tests
Build with examples:
$ export GAR_TEST_DATA=$PWD/../testing/ $ mkdir build-examples $ cd build-examples $ cmake -DBUILD_EXAMPLES=ON .. $ make -j8 # if you have 8 CPU cores, otherwise adjust, use -j`nproc` for all cores $ ./bgl_example # run the BGL example
Build with benchmarks:
$ export GAR_TEST_DATA=$PWD/../testing/ $ mkdir build-benchmarks $ cd build-benchmarks $ cmake -DBUILD_BENCHMARKS=ON .. $ make -j8 # if you have 8 CPU cores, otherwise adjust, use -j`nproc` for all cores $ ./graph_info_benchmark # run the graph info benchmark
After the building, you can install the GraphAr C++ library with:
$ sudo make install # run in directory you build, like build-release, build and so on
Building the API document with Doxygen:
$ cd GraphAr/cpp $ pushd apidoc $ doxgen $ popd
The API document is generated in the directory cpp/apidoc/html.
Please refer to our GraphAr C++ API Reference.