Skip to content

readme: document most important CMake options #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ Wrapper around ScyllaDB's rust-driver compatible with Datastax cpp-driver.

#### Note: It is work in progress, bug reports and pull requests are welcome!

# CMake options

In this section we will go over most important CMake options and what each of them controls.
- `CASS_BUILD_SHARED` - Build shared driver library (.so). `ON` by default.
- `CASS_BUILD_STATIC` - Build static driver library (.a). `ON` by default.
- `CASS_BUILD_INTEGRATION_TESTS` - Build integration tests (see `Testing` section below) `OFF` by default.
- `CASS_BUILD_EXAMPLES` - Build examples (see `Examples` section below). `OFF` by default.
- `CASS_USE_STATIC_LIBS` - Link against static libraries when building tests/examples. `OFF` by default.
- `CMAKE_BUILD_TYPE` - Controls the cargo profile library is built with. Possible values are: `Debug`, `RelWithDebInfo` and `Release`. Default value is `Debug`. For more information, see the profiles definitions in `scylla-rust-wrapper/Cargo.toml`.

For example, to build a shared driver library (no static library) in release mode and integration tests you can do:
```shell
mkdir build
cd build
cmake -DCASS_BUILD_STATIC=OFF -DCASS_BUILD_INTEGRATION_TESTS=ON -DCMAKE_BUILD_TYPE=Release ..
make
```
Comment on lines +17 to +23
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Can you confirm that the following builds a static driver library (no shared) in release mode and links it against integration tests?

mkdir build
cd build
cmake -DCASS_BUILD_SHARED=OFF -DCASS_BUILD_INTEGRATION_TESTS=ON -DCASS_USE_STATIC_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..
make

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, let's add this as another example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, just by looking at the command I would confirm. However, when I checked by running it - it does not work.. It's because it does not work even with just -DCASS_BUILD_SHARED=OFF in general..

The error:

CMake Error at scylla-rust-wrapper/CMakeLists.txt:16 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:scylla_cpp_driver_shared>

  No target "scylla_cpp_driver_shared"
Call Stack (most recent call first):
  scylla-rust-wrapper/CMakeLists.txt:52 (create_copy)


CMake Error at scylla-rust-wrapper/CMakeLists.txt:16 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:scylla_cpp_driver_shared>

  No target "scylla_cpp_driver_shared"
Call Stack (most recent call first):
  scylla-rust-wrapper/CMakeLists.txt:52 (create_copy)


CMake Error at scylla-rust-wrapper/CMakeLists.txt:16 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:scylla_cpp_driver_shared>

  No target "scylla_cpp_driver_shared"
Call Stack (most recent call first):
  scylla-rust-wrapper/CMakeLists.txt:52 (create_copy)


CMake Error at scylla-rust-wrapper/CMakeLists.txt:16 (add_custom_command):
  Error evaluating generator expression:

    $<TARGET_FILE:scylla_cpp_driver_shared>

  No target "scylla_cpp_driver_shared"
Call Stack (most recent call first):
  scylla-rust-wrapper/CMakeLists.txt:52 (create_copy)

This needs to be investigated. I'll open an issue.

However, if you execute the command you provided while removing -DCASS_BUILD_SHARED_LIBS=OFF, it works as expected - it builds integration tests library linked against static driver library. The only difference is that shared library is still being built.


# Examples
___

Expand Down Expand Up @@ -241,7 +259,7 @@ Now, use `--gtest_filter` to run certain integration tests:
./cassandra-integration-tests --scylla --install-dir=[PATH_TO_SCYLLA] --version=3.0.8 --category=CASSANDRA --verbose=ccm --gtest_filter="ClusterTests.*"
```

##### Note: Tests that pass with ScyllaDB and Cassandra clusters can be found in GitHub Actions [`build.yml`](https://github.com/scylladb/cpp-rust-driver/blob/master/.github/workflows/build.yml) and [`cassandra.yml`](https://github.com/scylladb/cpp-rust-driver/blob/master/.github/workflows/cassandra.yml) workflows.
##### Note: Tests that pass with ScyllaDB and Cassandra clusters can be found in Makefile: `SCYLLA_TEST_FILTER` and `CASSANDRA_TEST_FILTER` env variables.

# Build rpm package
___
Expand Down