To build the ODBC driver, it is required to have an ODBC driver manager with headers on your system. On Windows, it comes with your OS. On Unix-like systems, you may need to install one; for example, unixODBC.
The Conan package manager can be obtained from its website.
Currently, we support Conan versions 1.X. The 2.0+ versions are not supported yet.
One way to install Conan is as follows (need Python on your system):
pip install conan==1.59.0
Before use, you might need to configure the default Conan profile:
conan profile new --detect default conan profile update settings.compiler.libcxx=libstdc++11 default
It is possible to build the project without Conan if all the dependencies are installed on the system manually. The project dependencies include:
When the project is configured with -DENABLE_CONAN=OFF, the Conan machinery is turned off, and the dependencies are resolved using the standard means of the build platform. For example, the project can be configured like this:
... cmake .. -DENABLE_CONAN=OFF -DCMAKE_BUILD_TYPE=Release ...
Conan is enabled by default. All the build examples below use Conan.
The CMake project supports multiple configuration options that can be used to define exactly what and how should be built. You can check the list of available CMake options with the cmake -LAH command. Following are the project-specific options:
You should also specify the general (build type) CMake options. There are two types of build available - Release and Debug. The choice depends on how are you going to use the resulting artifacts. If you are going to use them in production, use the Release build type. If you are planning to just submit a patch for the project, use Debug.
You must ALWAYS specify a build type.
There are two options for this:
As an Apache Ignite developer, you would want to configure your project like this:
cmake .. -DENABLE_ODBC=ON -DENABLE_TESTS=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_BUILD_TYPE=Debug
If you want to only compile the client to use in your project, the following configuration is more fitting, considering the default options:
cmake .. -DCMAKE_BUILD_TYPE=Release
If you don't need the client and just want to compile the ODBC driver, add the following options:
cmake .. -DENABLE_CLIENT=OFF -DENABLE_ODBC=ON -DCMAKE_BUILD_TYPE=Release
Don't forget to replace CMAKE_BUILD_TYPE with CMAKE_CONFIGURATION_TYPES if you are using the Visual Studio generator:
cmake .. -DCMAKE_CONFIGURATION_TYPES=Release
In the following sections, you can find more detailed line-by-line instructions and configurations for the different platforms and use cases.
When using Conan on macOS, it is typically required to specify the C++ standard library from the LLVM project:
conan profile update settings.compiler.libcxx=libc++11 default
In this dir:
mkdir cmake-build-debug cd cmake-build-debug cmake .. -DENABLE_TESTS=ON -DENABLE_ODBC=ON -DCMAKE_BUILD_TYPE=Debug cmake --build .
In this dir:
mkdir cmake-build-release cd cmake-build-release cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build .
In this dir:
mkdir cmake-build-release cd cmake-build-release cmake .. -DENABLE_CLIENT=OFF -DENABLE_ODBC=ON -DCMAKE_BUILD_TYPE=Release cmake --build .
In this dir (using Ninja or any other single-config generator):
mkdir cmake-build-debug cd cmake-build-debug cmake .. -DENABLE_TESTS=ON -DENABLE_ODBC=ON -DCMAKE_BUILD_TYPE=Debug -GNinja cmake --build .
In this dir (using Ninja or any other single-config generator):
mkdir cmake-build-release cd cmake-build-release cmake .. -DCMAKE_BUILD_TYPE=Release -GNinja cmake --build .
Run in this dir from, for example, VS developer PowerShell.
We are using Visual Studio 17 2022 in this example, but any other multi-config generator can be used.
mkdir cmake-build cd cmake-build cmake .. -DENABLE_TESTS=ON -DENABLE_ODBC=ON -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -G "Visual Studio 17 2022" cmake --build . --config Debug cmake --build . --config Release
Tests require a running Java node. You don't need to start it explicitly. If there are no running test nodes, a test will start one implicitly. Prior to running tests, you will need to build a Java part of the product. To do that, run the following command from the root of the repo:
./gradlew assemble compileIntegrationTestJava
Alternatively, run a faster variantwww:
./gradlew assemble compileIntegrationTestJava -x check -x assembleDist -x distTar -x distZip --parallel
You can start a test node separately in the root repo. Tests will detect a running node, and will not start another one. This can be useful for debugging. To start a node from the console, use the following command prompt: ./gradlew :ignite-runner:runnerPlatformTest --no-daemon
You can also run the org.apache.ignite.internal.runner.app.PlatformTestNodeRunner class in IDEA with a debugger or profiler, then run the client tests as usual.
In modules/platforms/cpp dir: ./cmake-build-debug/bin/ignite-client-test.exe
To run a specific test: ./cmake-build-debug/bin/ignite-client-test.exe --gtest_filter=Test_Cases1*
In modules/platforms/cpp dir: ./cmake-build-debug/bin/ignite-client-test
To run a specific test: ./cmake-build-debug/bin/ignite-client-test --gtest_filter=Test_Cases1*
To debug or profile the Java side of the tests, run the org.apache.ignite.internal.runner.app.PlatformTestNodeRunner class in IDEA with a debugger or profiler, then run C++ tests as usual, optionally with debugger.