|
1 | 1 | cmake_minimum_required(VERSION 3.5) |
2 | 2 |
|
3 | 3 | # Set extension name here |
4 | | -set(TARGET_NAME quack) |
| 4 | +set(TARGET_NAME wvlet) |
5 | 5 |
|
6 | 6 | # DuckDB's extension distribution supports vcpkg. As such, dependencies can be added in ./vcpkg.json and then |
7 | 7 | # used in cmake with find_package. Feel free to remove or replace with other dependencies. |
8 | 8 | # Note that it should also be removed from vcpkg.json to prevent needlessly installing it.. |
9 | 9 | find_package(OpenSSL REQUIRED) |
10 | 10 |
|
| 11 | +# Define wvlet library details |
| 12 | +set(WVLET_LIB_URL "https://github.com/quackmagic/wvlet-lib/releases/download/v2024.9.12/libwvlet_linux-x64.so") |
| 13 | +set(WVLET_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third-party/libwvlet_linux-x64.so") |
| 14 | + |
| 15 | +# Download wvlet library if it doesn't exist |
| 16 | +if(NOT EXISTS ${WVLET_LIB_PATH}) |
| 17 | + message(STATUS "Downloading wvlet library from ${WVLET_LIB_URL}") |
| 18 | + # Create third-party directory if it doesn't exist |
| 19 | + file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/third-party") |
| 20 | + # Download the file |
| 21 | + file(DOWNLOAD |
| 22 | + ${WVLET_LIB_URL} |
| 23 | + ${WVLET_LIB_PATH} |
| 24 | + SHOW_PROGRESS |
| 25 | + STATUS DOWNLOAD_STATUS |
| 26 | + TLS_VERIFY ON) |
| 27 | + |
| 28 | + list(GET DOWNLOAD_STATUS 0 STATUS_CODE) |
| 29 | + if(NOT STATUS_CODE EQUAL 0) |
| 30 | + message(FATAL_ERROR "Failed to download wvlet library") |
| 31 | + endif() |
| 32 | + |
| 33 | +endif() |
| 34 | + |
11 | 35 | set(EXTENSION_NAME ${TARGET_NAME}_extension) |
12 | 36 | set(LOADABLE_EXTENSION_NAME ${TARGET_NAME}_loadable_extension) |
13 | 37 |
|
14 | 38 | project(${TARGET_NAME}) |
15 | 39 | include_directories(src/include) |
16 | 40 |
|
17 | | -set(EXTENSION_SOURCES src/quack_extension.cpp) |
| 41 | +set(EXTENSION_SOURCES src/wvlet_extension.cpp) |
18 | 42 |
|
19 | 43 | build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES}) |
20 | 44 | build_loadable_extension(${TARGET_NAME} " " ${EXTENSION_SOURCES}) |
21 | 45 |
|
22 | 46 | # Link OpenSSL in both the static library as the loadable extension |
23 | | -target_link_libraries(${EXTENSION_NAME} OpenSSL::SSL OpenSSL::Crypto) |
24 | | -target_link_libraries(${LOADABLE_EXTENSION_NAME} OpenSSL::SSL OpenSSL::Crypto) |
| 47 | +target_link_libraries(${EXTENSION_NAME} OpenSSL::SSL OpenSSL::Crypto ${WVLET_LIB_PATH}) |
| 48 | +target_link_libraries(${LOADABLE_EXTENSION_NAME} OpenSSL::SSL OpenSSL::Crypto ${WVLET_LIB_PATH}) |
25 | 49 |
|
26 | 50 | install( |
27 | 51 | TARGETS ${EXTENSION_NAME} |
|
0 commit comments