Skip to content

Commit 2bf3cfb

Browse files
0ax1joseph-isaacs
andauthored
chore: build extension with rust v2 rewrite (#14)
* chore: build extension with rust v2 rewrite * install llvm * vortex latest * libclang path * try libclang via apt get * libclang via apt-get * drop log lines * wip Signed-off-by: Alexander Droste <[email protected]> * bump vortex Signed-off-by: Alexander Droste <[email protected]> * wip Signed-off-by: Alexander Droste <[email protected]> * update --------- Signed-off-by: Alexander Droste <[email protected]> Co-authored-by: Joe Isaacs <[email protected]>
1 parent ad8c0cb commit 2bf3cfb

23 files changed

+78
-1716
lines changed

.github/workflows/MainDistributionPipeline.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ concurrency:
1414
jobs:
1515
duckdb-stable-build:
1616
name: Build extension binaries
17-
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@6a7a4f24c5999355ab36c0a6835baf891fc9d522
17+
uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@v1.3.2
1818
with:
19-
ci_tools_version: 1f00107ca1eaf1691049907296a8aa796d054e6b
20-
duckdb_version: ad1273222186d28b4b351736ed88101044bbe97b
19+
ci_tools_version: v1.3.2
20+
duckdb_version: v1.3.2
2121
extension_name: vortex
2222
exclude_archs: "wasm_mvp;wasm_eh;wasm_threads;windows_amd64_rtools;windows_amd64_mingw;windows_amd64;linux_arm64"
2323
extra_toolchains: "rust"

.gitmodules

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
[submodule "duckdb"]
2+
path = duckdb
3+
url = https://github.com/duckdb/duckdb.git
14
[submodule "extension-ci-tools"]
25
path = extension-ci-tools
36
url = https://github.com/duckdb/extension-ci-tools
47
branch = main
8+
[submodule "vcpkg"]
9+
path = vcpkg
10+
url = https://github.com/microsoft/vcpkg.git
511
[submodule "vortex"]
612
path = vortex
713
url = https://github.com/spiraldb/vortex
814
branch = main
9-
[submodule "duckdb"]
10-
path = duckdb
11-
url = https://github.com/spiraldb/duckdb.git
12-
[submodule "vcpkg"]
13-
path = vcpkg
14-
url = [email protected]:microsoft/vcpkg.git

CMakeLists.txt

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ project(${TARGET_NAME}_project)
66
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
77
set(CMAKE_CXX_STANDARD 17)
88

9-
# Allow C++20 designator syntax in C++17
10-
add_compile_options(-Wno-c++20-designator)
11-
129
include(FetchContent)
1310
FetchContent_Declare(
1411
Corrosion
@@ -18,44 +15,64 @@ FetchContent_Declare(
1815

1916
FetchContent_MakeAvailable(Corrosion)
2017

21-
find_package(Catch2 CONFIG REQUIRED)
22-
find_package(Protobuf CONFIG REQUIRED)
23-
2418
if (APPLE)
2519
find_library(SECURITY_FRAMEWORK Security)
20+
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
2621
endif ()
2722

23+
# Install clang and libclang for Linux Docker builds. macOS has both of these pre-installed.
24+
if(EXISTS "/.dockerenv")
25+
find_program(YUM_EXEC yum)
26+
if(YUM_EXEC AND NOT INSTALL_SUCCESS)
27+
execute_process(
28+
COMMAND yum install -y clang-devel clang
29+
RESULT_VARIABLE YUM_RESULT
30+
)
31+
if(YUM_RESULT EQUAL 0)
32+
set(INSTALL_SUCCESS TRUE)
33+
endif()
34+
endif()
35+
36+
find_program(APK_EXEC apk)
37+
if(APK_EXEC AND NOT INSTALL_SUCCESS)
38+
execute_process(
39+
COMMAND apk add --no-cache clang-dev clang
40+
RESULT_VARIABLE APK_RESULT
41+
)
42+
if(APK_RESULT EQUAL 0)
43+
set(INSTALL_SUCCESS TRUE)
44+
endif()
45+
endif()
46+
endif()
47+
2848
corrosion_import_crate(MANIFEST_PATH vortex/Cargo.toml
2949
CRATES vortex-ffi
30-
FEATURES duckdb mimalloc
50+
FEATURES mimalloc
3151
CRATE_TYPES staticlib
3252
FLAGS --crate-type=staticlib
3353
)
3454

35-
set(EXTENSION_NAME ${TARGET_NAME}_extension)
36-
set(EXTENSION_SOURCES src/vortex_extension.cpp src/vortex_expr.cpp src/vortex_write.cpp src/vortex_scan.cpp)
37-
set(LOADABLE_EXTENSION_NAME ${TARGET_NAME}_loadable_extension)
55+
corrosion_import_crate(MANIFEST_PATH vortex/Cargo.toml
56+
CRATES vortex-duckdb
57+
CRATE_TYPES staticlib
58+
FLAGS --crate-type=staticlib
59+
)
3860

39-
# Generate C++ code from .proto files.
40-
file(GLOB PROTO_FILES "vortex/vortex-proto/proto/*.proto")
41-
set(PROTO_GEN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gen)
42-
file(MAKE_DIRECTORY ${PROTO_GEN_DIR})
43-
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES} PROTOC_OUT_DIR ${PROTO_GEN_DIR})
61+
include_directories(src/include vortex/vortex-duckdb/include)
4462

45-
include_directories(src/include ${PROTO_GEN_DIR} vortex/vortex-ffi/cinclude)
63+
set(EXTENSION_NAME ${TARGET_NAME}_extension)
64+
set(LOADABLE_EXTENSION_NAME ${TARGET_NAME}_loadable_extension)
4665

47-
build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES} ${PROTO_SRCS})
48-
set(PARAMETERS "-warnings")
49-
build_loadable_extension(${TARGET_NAME} ${PARAMETERS} ${EXTENSION_SOURCES} ${PROTO_SRCS})
66+
build_static_extension(${TARGET_NAME} src/vortex_extension.cpp)
67+
build_loadable_extension(${TARGET_NAME} -warnings src/vortex_extension.cpp)
5068

5169
target_link_libraries(${EXTENSION_NAME}
70+
vortex_duckdb-static
5271
vortex_ffi-static
53-
protobuf::libprotobuf
5472
${SECURITY_FRAMEWORK}
73+
${CORE_FOUNDATION_FRAMEWORK}
5574
)
5675

57-
add_subdirectory(test)
58-
5976
install(
6077
TARGETS ${EXTENSION_NAME}
6178
EXPORT "${DUCKDB_EXPORT_SET}"

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ PROJ_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
33
EXT_NAME=vortex_duckdb
44
EXT_CONFIG=${PROJ_DIR}extension_config.cmake
55
EXT_FLAGS=-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0
6-
7-
export OVERRIDE_GIT_DESCRIBE=v1.3.2
86
export MACOSX_DEPLOYMENT_TARGET=12.0
97
export VCPKG_FEATURE_FLAGS=-binarycaching
108
export VCPKG_OSX_DEPLOYMENT_TARGET=12.0

src/include/vortex.hpp

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/include/vortex_common.hpp

Lines changed: 0 additions & 185 deletions
This file was deleted.

src/include/vortex_error.hpp

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/include/vortex_expr.hpp

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)