Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV output rewrite (Arrow/C++) #1692

Merged
merged 2 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add CSV renderer from Arrow (c++) for Python and JS
  • Loading branch information
texodus committed Jan 5, 2022
commit 6fb0ffcf519656b4412f85f5bdb779e3cddbc99a
140 changes: 103 additions & 37 deletions cmake/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif()

set(ARROW_SRCS
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/builder.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/pretty_print.cc
# Base
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/array/array_base.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/array/array_binary.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/array/array_decimal.cc
Expand All @@ -39,9 +38,11 @@ set(ARROW_SRCS
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/array/diff.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/array/util.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/array/validate.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/builder.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/buffer.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/chunked_array.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compare.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/config.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/datum.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/device.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/extension_type.cc
Expand All @@ -55,90 +56,155 @@ set(ARROW_SRCS
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/table.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/table_builder.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/tensor.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/tensor/coo_converter.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/tensor/csf_converter.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/tensor/csx_converter.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/type.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/visitor.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/converter.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/chunker.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/column_builder.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/column_decoder.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/options.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/parser.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/reader.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/filesystem/filesystem.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/filesystem/localfs.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/filesystem/mockfs.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/filesystem/path_util.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/filesystem/util_internal.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/json/options.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/json/chunked_builder.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/json/chunker.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/json/converter.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/json/parser.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/json/reader.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/c/bridge.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/io/buffered.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/io/caching.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/io/compressed.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/io/file.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/io/interfaces.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/io/memory.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/testing/util.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/io/slow.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/io/stdio.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/io/transform.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/async_util.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/basic_decimal.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/bit_block_counter.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/bit_run_reader.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/bit_util.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/bitmap.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/bitmap_builders.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/bitmap_ops.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/bpacking.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/cancel.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/compression.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/counting_semaphore.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/cpu_info.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/decimal.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/future.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/formatting.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/delimiting.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/formatting.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/future.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/int_util.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/io_util.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/iterator.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/logging.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/key_value_metadata.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/memory.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/mutex.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/string.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/string_builder.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/task_group.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/tdigest.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/thread_pool.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/time.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/trie.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/unreachable.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/uri.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/utf8.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/value_parsing.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/base64.cpp
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/datetime/tz.cpp
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/bignum.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/double-conversion.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/bignum-dtoa.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/fast-dtoa.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/cached-powers.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/fixed-dtoa.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/diy-fp.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/bignum.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/strtod.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/datetime/tz.cpp
# CSV
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/converter.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/chunker.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/column_builder.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/column_decoder.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/options.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/parser.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/reader.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/csv/writer.cc
# IPC
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/dictionary.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/feather.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/json_integration.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/json_internal.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/json_simple.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/message.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/metadata_internal.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/reader.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/options.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/writer.cc)
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/reader.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/ipc/writer.cc
# Compute
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/api_aggregate.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/api_scalar.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/api_vector.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/cast.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/aggregate_node.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/exec_plan.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/expression.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/filter_node.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/project_node.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/source_node.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/sink_node.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/order_by_impl.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/function.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/function_internal.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernel.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/registry.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/aggregate_basic.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/aggregate_mode.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/aggregate_quantile.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/aggregate_tdigest.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/aggregate_var_std.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/codegen_internal.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/hash_aggregate.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_boolean.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_cast_boolean.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_cast_dictionary.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_cast_internal.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_cast_nested.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_cast_numeric.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_cast_string.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_cast_temporal.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_compare.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_nested.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_set_lookup.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_string.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_temporal_binary.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_validity.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/scalar_if_else.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/util_internal.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/vector_array_sort.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/vector_hash.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/vector_nested.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/vector_replace.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/vector_selection.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/vector_sort.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/kernels/row_encoder.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/union_node.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/key_hash.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/key_map.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/key_compare.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/key_encode.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/util.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/hash_join_dict.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/hash_join.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/hash_join_node.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/compute/exec/task_util.cc
)

if (PSP_PYTHON_BUILD)
set(ARROW_SRCS
${ARROW_SRCS}
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/datum.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/io/file.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/tensor/coo_converter.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/tensor/csf_converter.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/tensor/csx_converter.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/formatting.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/time.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/bignum-dtoa.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/fast-dtoa.cc
${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/fixed-dtoa.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/util/time.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/bignum-dtoa.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/fast-dtoa.cc
# ${CMAKE_BINARY_DIR}/arrow-src/cpp/src/arrow/vendored/double-conversion/fixed-dtoa.cc
)

if(WIN32)
Expand Down
27 changes: 27 additions & 0 deletions cmake/arrow/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,30 @@

/* #undef DOUBLE_CONVERSION_HAS_CASE_INSENSIBILITY */
/* #undef GRPCPP_PP_INCLUDE */

#define ARROW_VERSION_STRING "6000001"

#define ARROW_SO_VERSION ""
#define ARROW_FULL_SO_VERSION ""

#define ARROW_CXX_COMPILER_ID ""
#define ARROW_CXX_COMPILER_VERSION ""
#define ARROW_CXX_COMPILER_FLAGS ""

#define ARROW_GIT_ID ""
#define ARROW_GIT_DESCRIPTION ""

#define ARROW_PACKAGE_KIND ""

// #cmakedefine ARROW_COMPUTE
// #cmakedefine ARROW_CSV
// #cmakedefine ARROW_DATASET
// #cmakedefine ARROW_FILESYSTEM
// #cmakedefine ARROW_FLIGHT
// #cmakedefine ARROW_IPC
// #cmakedefine ARROW_JSON

// #cmakedefine ARROW_S3
// #cmakedefine ARROW_USE_NATIVE_INT128

// #cmakedefine GRPCPP_PP_INCLUDE
23 changes: 16 additions & 7 deletions cpp/perspective/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ endif()
#######################
include_directories("${CMAKE_SOURCE_DIR}/src/include")

if(NOT WIN32)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
endif()
# if(NOT WIN32)
# set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
# set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
# endif()

if (PSP_WASM_BUILD)
####################
Expand Down Expand Up @@ -286,6 +286,7 @@ if (PSP_WASM_BUILD)
set(OPT_FLAGS " \
-O3 \
-g0 \
-flto \
")

# TODO: -flto
Expand Down Expand Up @@ -465,7 +466,13 @@ endif()

#####################

set(CMAKE_C_FLAGS " \
set(CMAKE_C_FLAGS_RELEASE " \
${CMAKE_C_FLAGS} \
${EXTENDED_FLAGS} \
${OPT_FLAGS} \
")

set(CMAKE_CXX_FLAGS_RELEASE " \
${CMAKE_C_FLAGS} \
${EXTENDED_FLAGS} \
${OPT_FLAGS} \
Expand All @@ -476,6 +483,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()

set (SOURCE_FILES
${PSP_CPP_SRC}/src/cpp/vendor/arrow_compute_registry.cpp
${PSP_CPP_SRC}/src/cpp/aggregate.cpp
${PSP_CPP_SRC}/src/cpp/aggspec.cpp
${PSP_CPP_SRC}/src/cpp/arg_sort.cpp
Expand Down Expand Up @@ -595,7 +603,7 @@ message("${BUILD_MESSAGE}\n")
if (PSP_WASM_BUILD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \
--bind \
--source-map-base=\"\" \
--source-map-base \"\" \
--memory-init-file 0 \
-s EXPORT_ES6=1 \
-s NO_EXIT_RUNTIME=1 \
Expand All @@ -606,14 +614,15 @@ if (PSP_WASM_BUILD)
-s MAXIMUM_MEMORY=4gb \
-s USE_ES6_IMPORT_META=0 \
-s EXPORTED_FUNCTIONS=\"['_main']\" \
-s ERROR_ON_UNDEFINED_SYMBOLS=1 \
")

add_library(psp ${WASM_SOURCE_FILES})
target_compile_definitions(psp PRIVATE PSP_ENABLE_WASM=1)
set_target_properties(psp PROPERTIES COMPILE_FLAGS "")
target_link_libraries(psp arrow re2)

# "esm/erspective.cpp.js" from CMAKE_EXECUTABLE_SYNTAX
# "esm/perspective.cpp.js" from CMAKE_EXECUTABLE_SYNTAX
add_executable(perspective_esm src/cpp/emscripten.cpp)
target_link_libraries(perspective_esm psp)
target_link_options(perspective_esm PRIVATE -s ENVIRONMENT=worker)
Expand Down
Loading