This is a folder for production code. Only code that is meant to be shipped should be placed here.
We have three main sets of targets we build:
- Core - this includes the core platform components: catalog, database (client and server), rules engine, direct access classes, and associated tools.
- SDK - this includes everything in core plus: LLVM libraries, rules translation engine (gaiat), and definitions for building SDK deb and rpm packages.
- LLVMTests - this includes the LLVM test infrastructure for testing ruleset files as well as ruleset compilation tests.
Because building LLVM takes much longer than just building Core, we do not build it by default. However, the SDK does have dependencies on core headers. If you are changing headers for the catalog, database, or Direct Access components, it is wise to build the entire SDK to verify that you haven't broken the SDK build.
We have two ways to build the configurations listed above:
- Using docker and our
gdev
tool: this is what our TeamCity Continuous Integration servers use to build and run tests in a consistent "approved" environment. - Using your own local environment: this enables you to build outside of docker using your own environment and tools.
The remainder of this document will focus on #2: building in your own local environment outside of a docker container. For instructions on how to use gdev
on your local machine, please see: gdev docker build CLI README.
For instructions on how to setup your environment, please see our New Hire Guidelines document on our GaiaPlatform wiki.
Create a subfolder GaiaPlatform/production/build
and then execute the following commands in it depending upon which set of targets you want to build:
cmake ..
make -j<number of CPUs>
If CMAKE_BUILD_TYPE
is not specified on the command line, then by default we add compile and link flags to include debugging information.
cmake -DCMAKE_MODULE_PATH=/usr/local/lib/cmake/CPackDebHelper -DBUILD_GAIA_SDK=ON ..
make -j<number of CPUs>
To install CPackDebHelper, you can follow the steps in the CPackDebHelper gdev.cfg file. Note that you can specify your own path to the CPackDebHelper cmake
module depending upon where you install it.
If BUILD_GAIA_SDK
is set to ON
then CMAKE_BUILD_TYPE
will be set to Release
. This is done by default because debug builds of LLVM take much longer than retail builds. We've also seen some of our local dev machines run out of memory when attempting to do debug LLVM builds.
After building the SDK, it becomes possible to also build the distribution packages. To do this, execute the following command in the GaiaPlatform/production/build
folder:
make package
After generating the packages, the Debian package can be installed by executing the following command, after making sure to update the referenced package version to match what was produced by the build:
sudo apt install ./gaia-0.1.0_amd64.deb
For uninstalling the package, execute:
sudo apt remove gaia
cmake -DBUILD_GAIA_LLVM_TESTS=ON ..
make -j<number of CPUs> check-all
If BUILD_GAIA_LLVM_TESTS
is set to ON
then CMAKE_BUILD_TYPE
will be set to Release
as well.
Other CMake variables we use but are not required:
# Override the build type to Debug or Release.
# If explicitly set to Debug, then address sanitizer will be enabled.
-DCMAKE_BUILD_TYPE=Debug|Release
# Get more info on CMake messages.
--log-level=VERBOSE
# Suppress CMake dev warnings.
-Wno-dev