File tree 5 files changed +846
-16
lines changed
5 files changed +846
-16
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,24 @@ set(EXTENSION_NAME ${TARGET_NAME}_extension)
6
6
set (LOADABLE_EXTENSION_NAME ${TARGET_NAME} _loadable_extension)
7
7
8
8
project (${TARGET_NAME} )
9
- include_directories (src/include duckdb/third_party/httplib duckdb/parquet/include )
10
-
11
- set (EXTENSION_SOURCES src/httpserver_extension.cpp)
9
+ include_directories (
10
+ src/include
11
+ ${CMAKE_CURRENT_BINARY_DIR}
12
+ duckdb/third_party/httplib
13
+ duckdb/parquet/include
14
+ )
15
+
16
+ # Embed ./src/assets/index.html as a C++ header
17
+ add_custom_command (
18
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /playground.hpp
19
+ COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR} /embed.cmake ${PROJECT_SOURCE_DIR} /src/assets/index.html ${CMAKE_CURRENT_BINARY_DIR} /playground.hpp playgroundContent
20
+ DEPENDS ${PROJECT_SOURCE_DIR} /src/assets/index.html
21
+ )
22
+
23
+ set (EXTENSION_SOURCES
24
+ src/httpserver_extension.cpp
25
+ ${CMAKE_CURRENT_BINARY_DIR} /playground.hpp
26
+ )
12
27
13
28
if (MINGW)
14
29
set (OPENSSL_USE_STATIC_LIBS TRUE )
Original file line number Diff line number Diff line change
1
+ set (resource_file_name ${CMAKE_ARGV3} )
2
+ set (output_file_name ${CMAKE_ARGV4} )
3
+ set (variable_name ${CMAKE_ARGV5} )
4
+
5
+ file (READ "${resource_file_name} " hex_content HEX)
6
+
7
+ string (REPEAT "[0-9a-f]" 32 pattern)
8
+ string (REGEX REPLACE "(${pattern} )" "\\ 1\n " content "${hex_content} " )
9
+
10
+ string (REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\ 1, " content "${content} " )
11
+
12
+ string (REGEX REPLACE ", $" "" content "${content} " )
13
+
14
+ set (array_definition "static const unsigned char ${variable_name} [] =\n {\n ${content} \n };" )
15
+
16
+ set (output "// Auto generated file.\n ${array_definition} \n " )
17
+
18
+ file (WRITE "${output_file_name} " "${output} " )
You can’t perform that action at this time.
0 commit comments