Skip to content

Commit 645f285

Browse files
Add vcpkg triplets for RelWithDebInfo. (#4669)
[SC-39876](https://app.shortcut.com/tiledb-inc/story/39876/make-relwithdebinfo-builds-readily-available-to-core-developers) --- TYPE: BUILD DESC: Add vcpkg triplets for RelWithDebInfo.
1 parent 47b3eb8 commit 645f285

File tree

8 files changed

+79
-24
lines changed

8 files changed

+79
-24
lines changed

.github/workflows/ci-linux_mac.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ env:
6363
CC: ${{ inputs.matrix_compiler_cc }}
6464
CFLAGS: ${{ inputs.matrix_compiler_cflags }}
6565
CXXFLAGS: ${{ inputs.matrix_compiler_cxxflags }}
66-
bootstrap_args: "--enable-ccache ${{ inputs.bootstrap_args }} ${{ inputs.asan && '--enable-sanitizer=address' || '' }}"
66+
bootstrap_args: "--enable-ccache --vcpkg-base-triplet=x64-${{ startsWith(inputs.matrix_image, 'ubuntu-') && 'linux' || 'osx' }} ${{ inputs.bootstrap_args }} ${{ inputs.asan && '--enable-sanitizer=address' || '' }}"
6767
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
6868
SCCACHE_GHA_ENABLED: "true"
6969

.github/workflows/full-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
matrix_compiler_cc: 'gcc-10'
102102
matrix_compiler_cxx: 'g++-10'
103103
timeout: 120
104-
bootstrap_args: '--enable-serialization --vcpkg-base-triplet=x64-linux'
104+
bootstrap_args: '--enable-serialization'
105105
asan: true
106106

107107
ci10:

CONTRIBUTING.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,6 @@ Formatting conventions:
6161
- comments are good, TileDB uses [doxygen](http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html) for class doc strings.
6262
- format code using [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
6363

64-
### Building with sanitizers
65-
66-
TileDB can be built with [clang sanitizers](https://clang.llvm.org/docs/AddressSanitizer.html) enabled. To enable them, you have to bootstrap with the `--enable-sanitizer` flag, as well as the vcpkg base triplet corresponding to your platform. The following platforms support sanitizers:
67-
68-
* `arm64-osx`
69-
* `x64-linux`
70-
* `x64-osx`
71-
* `x64-windows`
72-
73-
> [!NOTE]
74-
> Currently only the `address` sanitizer is supported.
75-
76-
```bash
77-
cd TileDB && mkdir build-asan && cd build-asan
78-
../bootstrap --enable-sanitizer=address --vcpkg-base-triplet=x64-linux
79-
make && make check
80-
```
81-
82-
> [!IMPORTANT]
83-
> To avoid errors, building with sanitizers must be done in a separate build directory.
84-
8564
### Pull Requests:
8665

8766
- `dev` is the development branch, all PR’s should be rebased on top of the latest `dev` commit.

cmake/Options/TileDBToolchain.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ if(TILEDB_SANITIZER STREQUAL "address")
6565
set(VCPKG_TARGET_TRIPLET "${TILEDB_VCPKG_BASE_TRIPLET}-asan")
6666
endif()
6767

68+
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
69+
# On Windows vcpkg always builds dependencies with symbols.
70+
# https://github.com/microsoft/vcpkg/blob/master/scripts/toolchains/windows.cmake
71+
if(NOT WIN32 AND NOT is_multi_config AND CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND NOT VCPKG_TARGET_TRIPLET)
72+
if(TILEDB_SANITIZER STREQUAL "address")
73+
message(FATAL_ERROR "Cannot enable both RelWithDebInfo and ASAN at the same time.")
74+
endif()
75+
if(TILEDB_VCPKG_BASE_TRIPLET)
76+
message(STATUS "Overriding vcpkg triplet to ${TILEDB_VCPKG_BASE_TRIPLET}-relwithdebinfo")
77+
set(VCPKG_TARGET_TRIPLET "${TILEDB_VCPKG_BASE_TRIPLET}-relwithdebinfo")
78+
else()
79+
message(WARNING "Dependencies will be built without symbols. You have to set either VCPKG_TARGET_TRIPLET or TILEDB_VCPKG_BASE_TRIPLET.")
80+
endif()
81+
endif()
82+
6883
set(VCPKG_INSTALL_OPTIONS "--no-print-usage")
6984

7085
macro(tiledb_vcpkg_enable_if tiledb_feature vcpkg_feature)

doc/dev/BUILD.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ The following are the most common configuration options:
6666
|macOS/Linux flag|Windows flag|CMake variable|Description|
6767
|----------------|------------|--------------|-----------|
6868
|`--prefix=PREFIX`|`-Prefix=PREFIX`|`CMAKE_INSTALL_PREFIX=<PREFIX>`|Install files in tree rooted at `PREFIX` (defaults to `TileDB/dist`)|
69+
|`--vcpkg-base-triplet=TRIPLET`|`-VcpkgBaseTriplet=TRIPLET`|`TILEDB_VCPKG_BASE_TRIPLET=TRIPLET`|Vcpkg base triplet, needed for features like ASAN and RelWithDebInfo|
6970
|`--linkage=shared/static`|`-Linkage=shared/static`|`BUILD_SHARED_LIBS=ON/OFF`|Linkage of the compiled TileDB library (defaults to `shared`) |
7071
|`--remove-deprecations`|`-RemoveDeprecations`|`TILEDB_REMOVE_DEPRECATIONS=ON`|Build TileDB without deprecated APIs|
7172
|`--enable-debug`|`-EnableDebug`|`CMAKE_BUILD_TYPE=Debug`|Enables debug build|
@@ -84,6 +85,13 @@ The following are the most common configuration options:
8485
|`--disable-stats`|`-DisableStats`|`TILEDB_STATS=OFF`|Disables internal TileDB statistics|
8586
|`--disable-tests`|`-DisableTests`|`TILEDB_TESTS=OFF`|Disables building the TileDB test suite|
8687

88+
The supported vcpkg base triplet values are:
89+
90+
* `arm64-osx`
91+
* `x64-linux`
92+
* `x64-osx`
93+
* `x64-windows`
94+
8795
> [!TIP]
8896
> You can see all TileDB-specific CMake variables in [BuildOptions.cmake](../../cmake/Options/BuildOptions.cmake).
8997
@@ -125,4 +133,29 @@ Vcpkg will not be automatically downloaded if:
125133
* The `TILEDB_DISABLE_AUTO_VCPKG` environment variable has been defined.
126134
* The build tree has been configured by directly calling CMake and the `CMAKE_TOOLCHAIN_FILE` variable has been set by the user.
127135

128-
In these cases no dependencies CMake will find the dependencies based on the rules of the [`find_package`](https://cmake.org/cmake/help/latest/command/find_package.html#command:find_package) command. The user is responsible for providing them.
136+
In these cases CMake will find the dependencies based on the rules of the [`find_package`](https://cmake.org/cmake/help/latest/command/find_package.html) command. The user is responsible for providing the dependencies.
137+
138+
### Building with sanitizers
139+
140+
TileDB can be built with [clang sanitizers](https://clang.llvm.org/docs/AddressSanitizer.html) enabled. To enable them, you have to bootstrap with the `--enable-sanitizer` flag, as well as the [vcpkg base triplet](#configuration-options) corresponding to your platform:
141+
142+
> [!NOTE]
143+
> Currently only the `address` sanitizer is supported.
144+
145+
```bash
146+
cd TileDB && mkdir build-asan && cd build-asan
147+
../bootstrap --enable-sanitizer=address --vcpkg-base-triplet=x64-linux
148+
make && make check
149+
```
150+
151+
> [!IMPORTANT]
152+
> To avoid errors, building with sanitizers must be done in a separate build directory.
153+
154+
### Building with optimizations and debug symbols
155+
156+
TileDB supports configuring in `RelWithDebInfo` mode, which compiles code with optimizations while also emitting debug symbols. However on non-Windows platforms the dependencies built by vcpkg do not build by default with symbols. To enable that you have to do either of the following:
157+
158+
* [Specify a vcpkg base triplet](#configuration-options).
159+
* Configure by directly calling CMake and setting a vcpkg triplet with the `VCPKG_DEFAULT_TRIPLET` variable. In this case you are responsible to ensure the appropriate options are passed to the triplet file.
160+
161+
Configuring in `RelWithDebInfo` mode and enabling ASAN at the same time is not supported.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set(VCPKG_TARGET_ARCHITECTURE arm64)
2+
set(VCPKG_CRT_LINKAGE dynamic)
3+
set(VCPKG_LIBRARY_LINKAGE static)
4+
5+
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
6+
set(VCPKG_OSX_ARCHITECTURES arm64)
7+
set(VCPKG_OSX_DEPLOYMENT_TARGET 11)
8+
9+
set(VCPKG_CXX_FLAGS "-g")
10+
set(VCPKG_C_FLAGS "-g")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
set(VCPKG_TARGET_ARCHITECTURE x64)
2+
set(VCPKG_CRT_LINKAGE dynamic)
3+
set(VCPKG_LIBRARY_LINKAGE static)
4+
5+
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
6+
7+
set(VCPKG_CXX_FLAGS "-g")
8+
set(VCPKG_C_FLAGS "-g")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set(VCPKG_TARGET_ARCHITECTURE x64)
2+
set(VCPKG_CRT_LINKAGE dynamic)
3+
set(VCPKG_LIBRARY_LINKAGE static)
4+
5+
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
6+
set(VCPKG_OSX_ARCHITECTURES x86_64)
7+
set(VCPKG_OSX_DEPLOYMENT_TARGET 11)
8+
9+
set(VCPKG_CXX_FLAGS "-g")
10+
set(VCPKG_C_FLAGS "-g")

0 commit comments

Comments
 (0)