Skip to content

Commit 1d560db

Browse files
committed
don't redownload duckdb for every branch
Signed-off-by: Mikhail Kot <to@myrrc.dev>
1 parent 92962a4 commit 1d560db

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,8 @@ use_debug = "deny"
373373

374374
[profile.release]
375375
codegen-units = 1
376-
# Turn LTO off, as it breaks when vortex-duckdb-ext is linked.
376+
# Our general performance should not be dependent on LTO since crates that use
377+
# Vortex may choose not to have LTO.
377378
lto = "off"
378379

379380
[profile.release_debug]

vortex-duckdb/build.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ fn c2rust(crate_dir: &Path, duckdb_include_dir: &Path) {
330330
fn cpp(duckdb_include_dir: &Path) {
331331
cc::Build::new()
332332
.std("c++20")
333-
.flags(["-Wall", "-Wextra", "-Wpedantic"])
333+
.flags(["-Wall", "-Wextra", "-Wpedantic", "-Werror"])
334334
.cpp(true)
335335
.include(duckdb_include_dir)
336336
.include("cpp/include")
@@ -391,8 +391,12 @@ fn main() {
391391

392392
let crate_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
393393
let duckdb_dir = crate_dir.join("duckdb");
394-
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
395-
let library_dir = out_dir.join(format!("duckdb-lib-{version}"));
394+
// Cargo has changed OUT_DIR behaviour so for every branch and build we have
395+
// a different directory e.g.
396+
// ~/vortex/target/release/build/vortex-duckdb-b6bc1fb73230910e/out/duckdb-lib-v1.5.2
397+
// We don't want this since artifacts are the same.
398+
// We can't use CARGO_TARGET_DIR since it's out of tree.
399+
let library_dir = duckdb_dir.join(format!("duckdb-lib-{version}"));
396400

397401
let library_dir_str = library_dir.display();
398402
println!("cargo:rustc-link-search=native={library_dir_str}");
@@ -413,7 +417,7 @@ fn main() {
413417
// Alternatively, set LD_LIBRARY_PATH (Linux) or DYLD_LIBRARY_PATH (macOS) at runtime.
414418
println!("cargo:lib_dir={library_dir_str}");
415419

416-
let source_dir = out_dir.join(format!("duckdb-source-{version}"));
420+
let source_dir = duckdb_dir.join(format!("duckdb-source-{version}"));
417421
let source_archive_url = match &version {
418422
DuckDBVersion::Release(v) => format!("{DUCKDB_SOURCE_RELEASE_URL}/v{v}.zip"),
419423
DuckDBVersion::Commit(c) => format!("{DUCKDB_SOURCE_COMMIT_URL}/{c}.zip"),
@@ -428,10 +432,6 @@ fn main() {
428432
extract(&source_archive_path, &source_dir);
429433
}
430434

431-
drop(fs::remove_file(&duckdb_dir));
432-
drop(fs::remove_dir_all(&duckdb_dir));
433-
std::os::unix::fs::symlink(&source_dir, &duckdb_dir).unwrap();
434-
435435
let has_debug_env =
436436
env::var("VX_DUCKDB_DEBUG").is_ok_and(|v| matches!(v.as_str(), "1" | "true"));
437437
let build_type = match has_debug_env {

vortex-duckdb/cpp/CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33

44
# This CMake project is only used for IDE support (CLion, etc.).
55
# See build.rs for the actual build definition.
6-
#
76
# Prerequisites: Run `cargo build -p vortex-duckdb` first to download DuckDB
8-
# source and create the symlink at ../duckdb.
7+
# source
98
#
109
# If your editor relies on a compilation database to enable LSP functionality,
1110
# you can generate it by running `cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON` or
@@ -23,19 +22,19 @@ if (NOT CMAKE_BUILD_TYPE)
2322
endif()
2423

2524
# Enable compiler warnings (matching build.rs flags).
26-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
25+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror")
26+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -Wextra -Wpedantic -Werror -O3")
2727

28-
# Find DuckDB include directory via the symlink created by build.rs.
29-
# The symlink points to target/duckdb-source-vX.Y.Z which contains duckdb-X.Y.Z/
30-
file(GLOB DUCKDB_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../duckdb/duckdb-*")
28+
# Find DuckDB include directory containing duckdb-source-vX.Y.Z which contains duckdb-X.Y.Z/
29+
file(GLOB DUCKDB_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../duckdb/duckdb-source-*/duckdb-*/")
3130
if(DUCKDB_DIRS)
3231
list(GET DUCKDB_DIRS 0 DUCKDB_DIR)
3332
set(DUCKDB_INCLUDE "${DUCKDB_DIR}/src/include")
3433
message(STATUS "Found DuckDB include: ${DUCKDB_INCLUDE}")
3534
else()
3635
message(FATAL_ERROR
3736
"DuckDB source not found at ../duckdb/duckdb-*\n"
38-
"Run 'cargo build -p vortex-duckdb' first to download DuckDB and create the symlink."
37+
"Run 'cargo build -p vortex-duckdb' first to download DuckDB"
3938
)
4039
endif()
4140

0 commit comments

Comments
 (0)