Skip to content

Commit

Permalink
Merge branch 'main' into v0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxxen committed Feb 15, 2024
2 parents a5815ae + 38c20f9 commit 35ffb1a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
19 changes: 12 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ all: release
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJ_DIR := $(dir $(MKFILE_PATH))

TEST_PATH="/test/unittest"
DUCKDB_PATH="/duckdb"

# For non-MinGW windows the path is slightly different
ifeq ($(OS),Windows_NT)
ifneq ($(CXX),g++)
TEST_PATH="/test/Release/unittest.exe"
else
TEST_PATH="/test/unittest"
DUCKDB_PATH="/Release/duckdb.exe"
endif
endif

#### OSX config
Expand Down Expand Up @@ -149,26 +154,26 @@ clean:
#cd duckdb && make clean-python

VCPKG_EMSDK_FLAGS=-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$(EMSDK)/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
WASM_COMPILE_TIME_COMMON_FLAGS=-DWASM_LOADABLE_EXTENSIONS=1 -DBUILD_EXTENSIONS_ONLY=1 -DSKIP_EXTENSIONS="parquet;json" $(VCPKG_EMSDK_FLAGS)
WASM_COMPILE_TIME_COMMON_FLAGS=-DWASM_LOADABLE_EXTENSIONS=1 -DBUILD_EXTENSIONS_ONLY=1 -DSKIP_EXTENSIONS="parquet;json" $(VCPKG_EMSDK_FLAGS) -DDUCKDB_EXPLICIT_PLATFORM='${DUCKDB_PLATFORM}'
WASM_CXX_MVP_FLAGS=
WASM_CXX_EH_FLAGS=$(WASM_CXX_MVP_FLAGS) -fwasm-exceptions -DWEBDB_FAST_EXCEPTIONS=1
WASM_CXX_THREADS_FLAGS=$(WASM_COMPILE_TIME_EH_FLAGS) -DWITH_WASM_THREADS=1 -DWITH_WASM_SIMD=1 -DWITH_WASM_BULK_MEMORY=1
WASM_LINK_TIME_FLAGS=../../deps/local/lib/*.a -sSIDE_MODULE=2 -sEXPORTED_FUNCTIONS="_spatial_init,_spatial_version"
WASM_LINK_TIME_FLAGS=../../deps/local/lib/*.a -sSIDE_MODULE=1

wasm_mvp:
mkdir -p build/wasm_mvp
emcmake cmake $(GENERATOR) $(EXTENSION_FLAGS) $(WASM_COMPILE_TIME_COMMON_FLAGS) -Bbuild/wasm_mvp -DCMAKE_CXX_FLAGS="$(WASM_CXX_MVP_FLAGS) -DDUCKDB_CUSTOM_PLATFORM=wasm_mvp" -S duckdb
emmake make -j8 -Cbuild/wasm_mvp
cd build/wasm_mvp/extension/${EXT_NAME} && emcc $f -o ../../${EXT_NAME}.duckdb_extension.wasm -O3 ${EXT_NAME}.duckdb_extension $(WASM_LINK_TIME_FLAGS)
cd build/wasm_mvp/extension/${EXT_NAME} && emcc $f -o ../../${EXT_NAME}.duckdb_extension.wasm -O3 ${EXT_NAME}.duckdb_extension.wasm $(WASM_LINK_TIME_FLAGS)

wasm_eh:
mkdir -p build/wasm_eh
emcmake cmake $(GENERATOR) $(EXTENSION_FLAGS) $(WASM_COMPILE_TIME_COMMON_FLAGS) -Bbuild/wasm_eh -DCMAKE_CXX_FLAGS="$(WASM_CXX_EH_FLAGS) -DDUCKDB_CUSTOM_PLATFORM=wasm_eh" -S duckdb
emmake make -j8 -Cbuild/wasm_eh
cd build/wasm_eh/extension/${EXT_NAME} && emcc $f -o ../../${EXT_NAME}.duckdb_extension.wasm -O3 ${EXT_NAME}.duckdb_extension $(WASM_LINK_TIME_FLAGS)
cd build/wasm_eh/extension/${EXT_NAME} && emcc $f -o ../../${EXT_NAME}.duckdb_extension.wasm -O3 ${EXT_NAME}.duckdb_extension.wasm $(WASM_LINK_TIME_FLAGS)

wasm_threads:
mkdir -p ./build/wasm_threads
emcmake cmake $(GENERATOR) $(EXTENSION_FLAGS) $(WASM_COMPILE_TIME_COMMON_FLAGS) -Bbuild/wasm_threads -DCMAKE_CXX_FLAGS="$(WASM_CXX_THREADS_FLAGS) -DDUCKDB_CUSTOM_PLATFORM=wasm_threads" -S duckdb
emmake make -j8 -Cbuild/wasm_threads
cd build/wasm_threads/extension/${EXT_NAME} && emcc $f -o ../../${EXT_NAME}.duckdb_extension.wasm -O3 ${EXT_NAME}.duckdb_extension $(WASM_LINK_TIME_FLAGS)
cd build/wasm_threads/extension/${EXT_NAME} && emcc $f -o ../../${EXT_NAME}.duckdb_extension.wasm -O3 ${EXT_NAME}.duckdb_extension.wasm $(WASM_LINK_TIME_FLAGS)
6 changes: 6 additions & 0 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ ExternalProject_Add(
-DGDAL_BUILD_OPTIONAL_DRIVERS=OFF
-DOGR_BUILD_OPTIONAL_DRIVERS=OFF

# Special issues
-DCMAKE_DISABLE_FIND_PACKAGE_Arrow=ON
-DCMAKE_DISABLE_FIND_PACKAGE_HDF5=ON
-DGDAL_USE_HDF5=OFF
-DGDAL_USE_LIBKML=OFF

# Build these explicitly
-DOGR_ENABLE_DRIVER_MEM=ON
-DOGR_ENABLE_DRIVER_GEOJSON=ON
Expand Down
7 changes: 3 additions & 4 deletions spatial/src/spatial/core/functions/scalar/st_quadkey.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#include "duckdb/parser/parsed_data/create_scalar_function_info.hpp"
#include "duckdb/common/vector_operations/generic_executor.hpp"
#include "duckdb/common/constants.hpp"
#include "spatial/common.hpp"
#include "spatial/core/functions/scalar.hpp"
#include "spatial/core/functions/common.hpp"
#include "spatial/core/geometry/geometry.hpp"
#include "spatial/core/types.hpp"

#define _USE_MATH_DEFINES
#include <cmath>
#include "math.h"

namespace spatial {

Expand All @@ -19,10 +18,10 @@ static void GetQuadKey(double lon, double lat, int32_t level, char *buffer) {
lat = std::max(-85.05112878, std::min(85.05112878, lat));
lon = std::max(-180.0, std::min(180.0, lon));

double lat_rad = lat * M_PI / 180.0;
double lat_rad = lat * PI / 180.0;
auto x = static_cast<int32_t>((lon + 180.0) / 360.0 * (1 << level));
auto y =
static_cast<int32_t>((1.0 - std::log(std::tan(lat_rad) + 1.0 / std::cos(lat_rad)) / M_PI) / 2.0 * (1 << level));
static_cast<int32_t>((1.0 - std::log(std::tan(lat_rad) + 1.0 / std::cos(lat_rad)) / PI) / 2.0 * (1 << level));

for (int i = level; i > 0; --i) {
char digit = '0';
Expand Down

0 comments on commit 35ffb1a

Please sign in to comment.