-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
52 lines (40 loc) · 1.7 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set extension name here
set(TARGET_NAME flockmtl)
set(EXTENSION_NAME ${TARGET_NAME}_extension)
set(LOADABLE_EXTENSION_NAME ${TARGET_NAME}_loadable_extension)
project(${TARGET_NAME})
# Include directories
include_directories(src/include)
add_subdirectory(src)
# Find dependencies
find_package(CURL REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
# Build the DuckDB static and loadable extensions
build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES})
build_loadable_extension(${TARGET_NAME} " " ${EXTENSION_SOURCES})
# Check if we're in debug mode and enable AddressSanitizer
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Enabling AddressSanitizer for Debug build")
# Enable AddressSanitizer
target_compile_options(${EXTENSION_NAME} PRIVATE -fsanitize=address
-fno-omit-frame-pointer)
target_link_options(${EXTENSION_NAME} PRIVATE -fsanitize=address)
target_compile_options(${LOADABLE_EXTENSION_NAME}
PRIVATE -fsanitize=address -fno-omit-frame-pointer)
target_link_options(${LOADABLE_EXTENSION_NAME} PRIVATE -fsanitize=address)
endif()
# Link libraries for the static extension
target_link_libraries(${EXTENSION_NAME} CURL::libcurl
nlohmann_json::nlohmann_json)
# Link libraries for the loadable extension
target_link_libraries(${LOADABLE_EXTENSION_NAME} CURL::libcurl
nlohmann_json::nlohmann_json)
# Install the extension
install(
TARGETS ${EXTENSION_NAME}
EXPORT "${DUCKDB_EXPORT_SET}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")