This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new 413e410a build: add basic CMake presets (#1039)
413e410a is described below
commit 413e410a315a10abd199bfd07bbca04a7c891ebb
Author: David Li <[email protected]>
AuthorDate: Thu Sep 7 11:58:06 2023 -0400
build: add basic CMake presets (#1039)
Fixes #680.
---
CONTRIBUTING.md | 15 ++++++++++--
c/CMakePresets.json | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+), 2 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1ce2d018..d8b2fe31 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -65,8 +65,19 @@ _Note:_ unlike the Arrow C++ build system, the CMake
projects will
configure CMake appropriately to find dependencies in system or
package manager locations, if you are not using something like Conda.
-For example, the driver manager and postgres driver may be built
-together as follows:
+You can use CMake presets to build and test:
+
+```shell
+$ mkdir build
+$ cd build
+$ cmake ../c --preset debug
+# ctest reads presets from PWD
+$ cd ../c
+$ ctest --preset debug --test-dir ../build
+```
+
+You can also manually configure CMake. For example, the driver manager and
+postgres driver may be built together as follows:
```shell
$ mkdir build
diff --git a/c/CMakePresets.json b/c/CMakePresets.json
new file mode 100644
index 00000000..fc4fdcb9
--- /dev/null
+++ b/c/CMakePresets.json
@@ -0,0 +1,70 @@
+{
+ "version": 3,
+ "cmakeMinimumRequired": {
+ "major": 3,
+ "minor": 21,
+ "patch": 0
+ },
+ "configurePresets": [
+ {
+ "name": "debug",
+ "displayName": "debug, all drivers, with tests, with ASan/UBSan
(not usable from Python)",
+ "generator": "Ninja",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Debug",
+ "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
+ "ADBC_BUILD_TESTS": "ON",
+ "ADBC_DRIVER_FLIGHTSQL": "ON",
+ "ADBC_DRIVER_MANAGER": "ON",
+ "ADBC_DRIVER_POSTGRESQL": "ON",
+ "ADBC_DRIVER_SNOWFLAKE": "ON",
+ "ADBC_DRIVER_SQLITE": "ON",
+ "ADBC_USE_ASAN": "ON",
+ "ADBC_USE_UBSAN": "ON"
+ }
+ },
+ {
+ "name": "debug-python",
+ "displayName": "debug, all drivers, with tests, without ASan/UBSan
(usable from Python)",
+ "generator": "Ninja",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Debug",
+ "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
+ "ADBC_BUILD_TESTS": "ON",
+ "ADBC_DRIVER_FLIGHTSQL": "ON",
+ "ADBC_DRIVER_MANAGER": "ON",
+ "ADBC_DRIVER_POSTGRESQL": "ON",
+ "ADBC_DRIVER_SNOWFLAKE": "ON",
+ "ADBC_DRIVER_SQLITE": "ON",
+ "ADBC_USE_ASAN": "OFF",
+ "ADBC_USE_UBSAN": "OFF"
+ }
+ }
+ ],
+ "testPresets": [
+ {
+ "name": "debug",
+ "description": "run tests (except Snowflake)",
+ "displayName": "debug, all drivers (except Snowflake)",
+ "configurePreset": "debug",
+ "environment": {
+ "ADBC_DREMIO_FLIGHTSQL_PASS": "dremio123",
+ "ADBC_DREMIO_FLIGHTSQL_URI": "grpc+tcp://localhost:32010",
+ "ADBC_DREMIO_FLIGHTSQL_USER": "dremio",
+ "ADBC_POSTGRESQL_TEST_URI":
"postgresql://localhost:5432/postgres?user=postgres&password=password",
+ "ADBC_SQLITE_FLIGHTSQL_URI": "grpc://localhost:8080"
+ },
+ "execution": {
+ "jobs": 4
+ },
+ "filter": {
+ "exclude": {
+ "label": "driver-snowflake"
+ }
+ },
+ "output": {
+ "outputOnFailure": true
+ }
+ }
+ ]
+}