|
7 | 7 | # debugging but will never allow jemalloc in a release build if not on Linux. |
8 | 8 | # |
9 | 9 | # Usage: include(cmake/duckdb_loader.cmake) # Optionally load extensions |
10 | | -# set(CORE_EXTENSIONS "json;parquet;icu") |
| 10 | +# set(BUILD_EXTENSIONS "json;parquet;icu") |
11 | 11 | # |
12 | 12 | # # set sensible defaults for a debug build: duckdb_configure_for_debug() |
13 | 13 | # |
@@ -35,7 +35,7 @@ _duckdb_set_default(DUCKDB_SOURCE_PATH |
35 | 35 | "${CMAKE_CURRENT_SOURCE_DIR}/external/duckdb") |
36 | 36 |
|
37 | 37 | # Extension list - commonly used extensions for Python |
38 | | -_duckdb_set_default(CORE_EXTENSIONS "core_functions;parquet;icu;json") |
| 38 | +_duckdb_set_default(BUILD_EXTENSIONS "core_functions;parquet;icu;json") |
39 | 39 |
|
40 | 40 | # Core build options - disable unnecessary components for Python builds |
41 | 41 | _duckdb_set_default(BUILD_SHELL OFF) |
@@ -64,8 +64,8 @@ _duckdb_set_default(DEBUG_STACKTRACE OFF) |
64 | 64 | set(DUCKDB_SOURCE_PATH |
65 | 65 | "${DUCKDB_SOURCE_PATH}" |
66 | 66 | CACHE PATH "Path to DuckDB source directory") |
67 | | -set(CORE_EXTENSIONS |
68 | | - "${CORE_EXTENSIONS}" |
| 67 | +set(BUILD_EXTENSIONS |
| 68 | + "${BUILD_EXTENSIONS}" |
69 | 69 | CACHE STRING "Semicolon-separated list of extensions to enable") |
70 | 70 | set(BUILD_SHELL |
71 | 71 | "${BUILD_SHELL}" |
@@ -110,40 +110,35 @@ set(DEBUG_STACKTRACE |
110 | 110 |
|
111 | 111 | function(_duckdb_validate_jemalloc_config) |
112 | 112 | # Check if jemalloc is in the extension list |
113 | | - if(NOT CORE_EXTENSIONS MATCHES "jemalloc") |
| 113 | + if(NOT BUILD_EXTENSIONS MATCHES "jemalloc") |
114 | 114 | return() |
115 | 115 | endif() |
116 | 116 |
|
117 | | - # If we're on Linux then using jemalloc is fine, otherwise we only allow it in |
118 | | - # debug builds |
119 | | - if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") |
120 | | - set(is_debug_build FALSE) |
121 | | - if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
122 | | - set(is_debug_build TRUE) |
123 | | - endif() |
124 | | - if(is_debug_build) |
125 | | - message( |
126 | | - WARNING |
127 | | - "jemalloc extension enabled on ${CMAKE_SYSTEM_NAME} in Debug build.\n" |
128 | | - "This is only recommended for debugging purposes.\n" |
129 | | - "jemalloc is officially supported only on Linux.") |
130 | | - else() |
131 | | - message( |
132 | | - WARNING |
133 | | - "jemalloc extension is only supported on ${CMAKE_SYSTEM_NAME} in Debug builds.\n" |
134 | | - "Removing jemalloc from extension list.\n" |
135 | | - "In non-debug builds, jemalloc is only supported on Linux.") |
136 | | - # Remove jemalloc from the extension list |
137 | | - string(REPLACE "jemalloc" "" CORE_EXTENSIONS_FILTERED |
138 | | - "${CORE_EXTENSIONS}") |
139 | | - string(REGEX REPLACE ";+" ";" CORE_EXTENSIONS_FILTERED |
140 | | - "${CORE_EXTENSIONS_FILTERED}") |
141 | | - string(REGEX REPLACE "^;|;$" "" CORE_EXTENSIONS_FILTERED |
142 | | - "${CORE_EXTENSIONS_FILTERED}") |
143 | | - set(CORE_EXTENSIONS |
144 | | - "${CORE_EXTENSIONS_FILTERED}" |
145 | | - PARENT_SCOPE) |
146 | | - endif() |
| 117 | + # jemalloc is only allowed in linux and osx debug builds |
| 118 | + set(supported_os |
| 119 | + CMAKE_SYSTEM_NAME |
| 120 | + STREQUAL |
| 121 | + "Darwin" |
| 122 | + OR |
| 123 | + CMAKE_SYSTEM_NAME |
| 124 | + STREQUAL |
| 125 | + "Linux") |
| 126 | + set(jemalloc_allowed CMAKE_BUILD_TYPE STREQUAL "Debug" AND supported_os) |
| 127 | + if(NOT jemalloc_allowed) |
| 128 | + message( |
| 129 | + WARNING |
| 130 | + "jemalloc extension is only supported on Linux and OSX in Debug builds.\n" |
| 131 | + "Removing jemalloc from extension list.") |
| 132 | + # Remove jemalloc from the extension list |
| 133 | + string(REPLACE "jemalloc" "" BUILD_EXTENSIONS_FILTERED |
| 134 | + "${BUILD_EXTENSIONS}") |
| 135 | + string(REGEX REPLACE ";+" ";" BUILD_EXTENSIONS_FILTERED |
| 136 | + "${BUILD_EXTENSIONS_FILTERED}") |
| 137 | + string(REGEX REPLACE "^;|;$" "" BUILD_EXTENSIONS_FILTERED |
| 138 | + "${BUILD_EXTENSIONS_FILTERED}") |
| 139 | + set(BUILD_EXTENSIONS |
| 140 | + "${BUILD_EXTENSIONS_FILTERED}" |
| 141 | + PARENT_SCOPE) |
147 | 142 | endif() |
148 | 143 | endfunction() |
149 | 144 |
|
@@ -225,8 +220,8 @@ function(_duckdb_print_summary) |
225 | 220 | message(STATUS " Native Arch: ${NATIVE_ARCH}") |
226 | 221 | message(STATUS " Unity Build Disabled: ${DISABLE_UNITY}") |
227 | 222 |
|
228 | | - if(CORE_EXTENSIONS) |
229 | | - message(STATUS " Extensions: ${CORE_EXTENSIONS}") |
| 223 | + if(BUILD_EXTENSIONS) |
| 224 | + message(STATUS " Extensions: ${BUILD_EXTENSIONS}") |
230 | 225 | endif() |
231 | 226 |
|
232 | 227 | set(debug_opts) |
|
0 commit comments