diff --git a/tools/wasm/README.md b/tools/wasm/README.md deleted file mode 100644 index 27157b6df75..00000000000 --- a/tools/wasm/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This folder is related to WebAssembly compilation for DuckDB. - -Main repo for duckdb-wasm is at https://github.com/duckdb/duckdb-wasm, and there is the issue tracker and most of the non-duckdb-core components. diff --git a/tools/wasm/hello_wasm.cpp b/tools/wasm/hello_wasm.cpp deleted file mode 100644 index 2a949d8adf0..00000000000 --- a/tools/wasm/hello_wasm.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "duckdb.hpp" - -#include - -extern "C" { - -int main() { - std::cout << "Hello from WASM" << std::endl; -} - -int32_t HelloWasm() { - duckdb::DBConfig config; - config.options.maximum_threads = 1; - duckdb::DuckDB db(nullptr, &config); - duckdb::Connection con(db); - auto result = con.Query("CREATE TABLE sometable AS SELECT x FROM generate_series(1,10000) AS a(x)"); - if (result->HasError()) { - std::cerr << result->GetError() << std::endl; - return -1; - } - result = con.Query("SELECT sum(x) FROM sometable"); - if (result->HasError()) { - std::cerr << result->GetError() << std::endl; - return -1; - } - return result->GetValue(0, 0).GetValue(); -} -} diff --git a/tools/wasm/hello_wasm_test.js b/tools/wasm/hello_wasm_test.js deleted file mode 100644 index 04624dcb8bd..00000000000 --- a/tools/wasm/hello_wasm_test.js +++ /dev/null @@ -1,19 +0,0 @@ -const DuckDB = require('../../.wasm/build/hello_wasm.js'); - -async function main() { - const db = await DuckDB(); - const HelloWasm = db['_HelloWasm']; - const result = HelloWasm(); - const n = 10000; - const expected = n * (n + 1) / 2; - console.log(`expected ${expected}, received ${result}`); - if (result != expected) { - console.log('result differs'); - process.exit(1); - } else { - console.log('result ok'); - process.exit(0); - } -} - -main(); \ No newline at end of file diff --git a/tools/wasm/scripts/wasm_build_lib.sh b/tools/wasm/scripts/wasm_build_lib.sh deleted file mode 100755 index 92da3cf3577..00000000000 --- a/tools/wasm/scripts/wasm_build_lib.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -source "$(dirname "${BASH_SOURCE[0]}")/wasm_env.sh" - -DUCKDB_CC="${PROJECT_ROOT}/src/amalgamation/duckdb.cpp" -DUCKDB_H="${PROJECT_ROOT}/src/amalgamation/duckdb.hpp" - -test -f "${DUCKDB_CC}" \ - && { echo "[ OK ] Amalgamation Source: ${DUCKDB_CC}"; } \ - || { echo "[ ERR ] Amalgamation Source: ${DUCKDB_CC}"; exit 1; } - -test -f "${DUCKDB_H}" \ - && { echo "[ OK ] Amalgamation Header: ${DUCKDB_H}"; } \ - || { echo "[ ERR ] Amalgamation Header: ${DUCKDB_H}"; exit 1; } - -BUILD_TYPE=${1:-Release} -FLAGS=-O3 -case $BUILD_TYPE in - "Debug") FLAGS=-O0 -g ;; - "RelWithDebInfo") FLAGS=-O2 -g ;; - *) ;; -esac -echo "Build Type: ${BUILD_TYPE}" - -set -x -BUILD_DIR="${PROJECT_ROOT}/.wasm/build" -if [ -d ${BUILD_DIR} ]; then - rm -r "${BUILD_DIR}" -fi -mkdir -p ${BUILD_DIR} - -source "${EMSDK_ENV}" - -${EMCPP} \ - ${FLAGS} \ - -std=gnu++17 \ - -fexceptions \ - -sDISABLE_EXCEPTION_CATCHING=0 \ - -sUSE_PTHREADS=0 \ - -DNDEBUG \ - -DDUCKDB_NO_THREADS=1 \ - -I ${PROJECT_ROOT}/src/include \ - -I ${PROJECT_ROOT}/third_party/concurrentqueue/ \ - -o ${DUCKDB_WASM} \ - -c ${DUCKDB_CC} \ No newline at end of file diff --git a/tools/wasm/scripts/wasm_build_test.sh b/tools/wasm/scripts/wasm_build_test.sh deleted file mode 100755 index b0c148666ef..00000000000 --- a/tools/wasm/scripts/wasm_build_test.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -source "$(dirname "${BASH_SOURCE[0]}")/wasm_env.sh" - -HELLO_WASM_CPP="${PROJECT_ROOT}/tools/wasm/hello_wasm.cpp" - -test -f "${DUCKDB_WASM}" \ - && { echo "[ OK ] DuckDB WASM: ${DUCKDB_WASM}"; } \ - || { echo "[ ERR ] DuckDB WASM: ${DUCKDB_WASM}"; exit 1; } - -BUILD_TYPE=${1:-Release} -FLAGS=-O3 -case $BUILD_TYPE in - "Debug") FLAGS=-O0 -g ;; - "RelWithDebInfo") FLAGS=-O2 -g ;; - *) ;; -esac -echo "Build Type: ${BUILD_TYPE}" - -set -x - -source "${EMSDK_ENV}" - -${EMCPP} \ - ${FLAGS} \ - -std=gnu++17 \ - -fexceptions \ - -D NDEBUG \ - -D DUCKDB_NO_THREADS=1 \ - -s WASM=1 \ - -s LLD_REPORT_UNDEFINED=1 \ - -s WARN_ON_UNDEFINED_SYMBOLS=1 \ - -s ALLOW_MEMORY_GROWTH=1 \ - -s USE_PTHREADS=0 \ - -s DISABLE_EXCEPTION_CATCHING=0 \ - -s MODULARIZE=1 \ - -s EXPORT_NAME='DuckDB' \ - -s EXPORTED_FUNCTIONS='[ _main, _HelloWasm ]' \ - -I ${PROJECT_ROOT}/src/include \ - -I ${PROJECT_ROOT}/third_party/concurrentqueue/ \ - ${DUCKDB_WASM} \ - ${HELLO_WASM_CPP} \ - -o ${BUILD_DIR}/hello_wasm.js \ No newline at end of file diff --git a/tools/wasm/scripts/wasm_configure.sh b/tools/wasm/scripts/wasm_configure.sh deleted file mode 100755 index d66038f0f2c..00000000000 --- a/tools/wasm/scripts/wasm_configure.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -source "$(dirname "${BASH_SOURCE[0]}")/wasm_env.sh" - -curl --version \ - && { echo "[ OK ] Command: curl"; } \ - || { echo "[ ERR ] Command: curl"; exit 1; } - -tar --version \ - && { echo "[ OK ] Command: tar"; } \ - || { echo "[ ERR ] Command: tar"; exit 1; } - -# Get the release archive -mkdir -p ${WASM_WD} -if [ ! -f "${EMSDK_RELEASE_TARBALL}" ]; then - echo "[ RUN ] Download: ${EMSDK_RELEASE_URL}" - curl -Lo "${EMSDK_RELEASE_TARBALL}" "${EMSDK_RELEASE_URL}" -fi -echo "[ OK ] Release Archive: ${EMSDK_RELEASE_TARBALL}" - -# Unpack the release archive -if [ ! -f "${EMSDK_TOOL}" ]; then - set -x - mkdir -p "${EMSDK_REPO_DIR}" - tar -xvzf "${EMSDK_RELEASE_TARBALL}" -C "${EMSDK_REPO_DIR}" --strip-components=1 - set +x -fi -echo "[ OK ] Unpacked Release: ${EMSDK_REPO_DIR}" - -# Install & activate the emscripten version -set +x -${EMSDK_TOOL} install ${EMSCRIPTEN_VERSION} -${EMSDK_TOOL} activate ${EMSCRIPTEN_VERSION} \ No newline at end of file diff --git a/tools/wasm/scripts/wasm_env.sh b/tools/wasm/scripts/wasm_env.sh deleted file mode 100644 index 2034db03867..00000000000 --- a/tools/wasm/scripts/wasm_env.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)" &> /dev/null - -EMSCRIPTEN_VERSION="2.0.14" -EMSDK_VERSION="2.0.14" - -WASM_WD="${PROJECT_ROOT}/.wasm/" -EMSDK_REPO_DIR="${WASM_WD}/emsdk/" -EMSDK_RELEASE_URL="https://github.com/emscripten-core/emsdk/archive/${EMSDK_VERSION}.tar.gz" -EMSDK_RELEASE_TARBALL="${WASM_WD}/${EMSDK_VERSION}.tar.gz" -EMSDK_TOOL="${EMSDK_REPO_DIR}/emsdk" -EMSDK_ENV="${EMSDK_REPO_DIR}/emsdk_env.sh" - -EMSCRIPTEN_DIR="${EMSDK_REPO_DIR}/upstream/emscripten/" -EMCMAKE="${EMSCRIPTEN_DIR}/emcmake" -EMMAKE="${EMSCRIPTEN_DIR}/emmake" -EMCC="${EMSCRIPTEN_DIR}/emcc" -EMCPP="${EMSCRIPTEN_DIR}/em++" - -BUILD_DIR="${PROJECT_ROOT}/.wasm/build" -DUCKDB_WASM="${BUILD_DIR}/duckdb.wasm"