Skip to content

Commit

Permalink
Merge pull request #11 from akumor/support-duckdb-1.1.1
Browse files Browse the repository at this point in the history
Update to work with duckdb 1.1.1
  • Loading branch information
dacort authored Dec 31, 2024
2 parents 7952dd8 + 56ab2ce commit c20de0b
Show file tree
Hide file tree
Showing 44 changed files with 3,427 additions and 833 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaults:
run:
shell: bash

# TODO: Add rust, checkout duckdb-ext/duckdb
# TODO: Add rust, checkout duckdb_athena_rust/duckdb

jobs:
linux:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
run: |
cd duckdb
git checkout ${{ matrix.duckdb_version }}
cd ../duckdb-ext/duckdb
cd ../duckdb_athena_rust/duckdb
git checkout ${{ matrix.duckdb_version }}
- if: ${{ matrix.arch == 'linux_amd64_gcc4' }}
Expand All @@ -124,7 +124,7 @@ jobs:
run: |
make release
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ${{matrix.arch}}-extensions
path: |
Expand Down Expand Up @@ -154,4 +154,4 @@ jobs:
elif [[ "$GITHUB_REF" =~ ^(refs/heads/main)$ ]] ; then
python3 -m pip install pip awscli
./scripts/extension-upload.sh athena `git log -1 --format=%h` $DUCKDB_VERSION ${{matrix.arch}} $BUCKET_NAME false
fi
fi
8 changes: 4 additions & 4 deletions .github/workflows/Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaults:
run:
shell: bash

# TODO: checkout duckdb-ext/duckdb
# TODO: checkout duckdb_athena_rust/duckdb

jobs:
windows:
Expand Down Expand Up @@ -37,12 +37,12 @@ jobs:
run: |
cd duckdb
git checkout ${{ matrix.duckdb_version }}
cd ../duckdb-ext/duckdb
cd ../duckdb_athena_rust/duckdb
git checkout ${{ matrix.duckdb_version }}
- name: Build extension
run: |
dir duckdb-ext/duckdb/src/include
dir duckdb_athena_rust/duckdb/src/include
make release
- uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -74,4 +74,4 @@ jobs:
elif [[ "$GITHUB_REF" =~ ^(refs/heads/main)$ ]] ; then
python -m pip install awscli
./scripts/extension-upload.sh athena `git log -1 --format=%h` $DUCKDB_VERSION windows_amd64 $BUCKET_NAME false
fi
fi
4 changes: 2 additions & 2 deletions .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: |
cd duckdb
git checkout ${{ matrix.duckdb_version }}
cd ../duckdb-ext/duckdb
cd ../duckdb_athena_rust/duckdb
git checkout ${{ matrix.duckdb_version }}
# Build extension
Expand Down Expand Up @@ -79,4 +79,4 @@ jobs:
elif [[ "$GITHUB_REF" =~ ^(refs/heads/main)$ ]] ; then
python -m pip install awscli
./scripts/extension-upload.sh athena `git log -1 --format=%h` $DUCKDB_VERSION osx_${{matrix.arch}} $BUCKET_NAME false
fi
fi
8 changes: 5 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[submodule "duckdb"]
path = duckdb
url = https://github.com/duckdb/duckdb.git
[submodule "duckdb-ext/duckdb"]
path = duckdb-ext/duckdb
url = https://github.com/duckdb/duckdb.git
tag = v1.1.1
[submodule "extension-ci-tools"]
path = extension-ci-tools
url = https://github.com/duckdb/extension-ci-tools
branch = v1.1.3
36 changes: 24 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
# Still need to use cmake to link to duckdb via `build_loadable_extension` macro.
#

cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.5)

if (POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif ()

project(athena_duckdb VERSION 0.3)
set(EXTENSION_NAME athena)
set(TARGET_NAME athena)
project(${TARGET_NAME} VERSION 0.3)
set(EXTENSION_NAME ${TARGET_NAME}_extension)
set(LOADABLE_EXTENSION_NAME ${TARGET_NAME}_loadable_extension)

if (APPLE)
# POLICY CMP0042
Expand All @@ -47,7 +49,7 @@ include(FetchContent)
FetchContent_Declare(
Corrosion
GIT_REPOSITORY https://github.com/corrosion-rs/corrosion.git
GIT_TAG v0.3.2 # Optionally specify a commit hash, version tag or branch here
GIT_TAG v0.5 # Optionally specify a commit hash, version tag or branch here
)
set(BUILD_UNITTESTS FALSE) # Disable unit test build in duckdb

Expand All @@ -57,27 +59,37 @@ FetchContent_MakeAvailable(Corrosion)

corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Cargo.toml)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/duckdb/src/include)
include_directories(src/include)

# Now again for aarch64/arm64
# set(Rust_CARGO_TARGET "aarch64-apple-darwin")
# corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Cargo.toml)

set(ALL_SOURCES src/extension.c src/extension.h)
set(EXTENSION_SOURCES src/athena_extension.cpp src/include/athena_extension.hpp)

SET(EXTENSION_STATIC_BUILD 1)
set(PARAMETERS "-warnings")
build_loadable_extension(${EXTENSION_NAME} ${PARAMETERS} ${ALL_SOURCES})
build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES})
build_loadable_extension(${TARGET_NAME} ${PARAMETERS} ${EXTENSION_SOURCES})

set(LIB_NAME ${EXTENSION_NAME}_loadable_extension)

set_target_properties(${LIB_NAME} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${LIB_NAME}
set_target_properties(${EXTENSION_NAME} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${EXTENSION_NAME}
"${CMAKE_CURRENT_BINARY_DIR}/libduckdb_athena.a"
duckdb_static
)
target_link_libraries(${LOADABLE_EXTENSION_NAME}
"${CMAKE_CURRENT_BINARY_DIR}/libduckdb_athena.a"
duckdb_static
)

if (APPLE)
target_link_libraries(${LIB_NAME}
target_link_libraries(${EXTENSION_NAME}
"-framework CoreFoundation"
"-framework Security")
endif()
endif()

install(
TARGETS ${EXTENSION_NAME}
EXPORT "${DUCKDB_EXPORT_SET}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")
Loading

0 comments on commit c20de0b

Please sign in to comment.