Skip to content

Commit

Permalink
Remove embind
Browse files Browse the repository at this point in the history
Signed-off-by: Davis Silverman <[email protected]>
Signed-off-by: Andrew Stein <[email protected]>

# Conflicts:
#	Cargo.lock
  • Loading branch information
sinistersnare authored and texodus committed May 24, 2024
1 parent ca1e82f commit 888d032
Show file tree
Hide file tree
Showing 39 changed files with 989 additions and 3,156 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,6 @@ jobs:
PYTHON_VERSION: ${{ matrix.python-version }}
PSP_PROJECT: python

- name: JavaScript Lint
run: pnpm run lint
env:
PYTHON_VERSION: ${{ matrix.python-version }}
PSP_PROJECT: js

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

Expand Down
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ members = [
"rust/bundle",
"rust/perspective-client",
"rust/perspective-js",
"rust/perspective-server",
]

[profile.dev]
Expand Down
23 changes: 9 additions & 14 deletions cpp/perspective/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ if(PSP_WASM_BUILD)
-O3 \
-g0 \
-flto \
-mnontrapping-fptoint \
-s SUPPORT_LONGJMP=wasm \
-fwasm-exceptions \
")
Expand Down Expand Up @@ -379,10 +380,12 @@ set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Disable rapidjson tests")
set(CMAKE_C_FLAGS " \
-O3 \
-flto \
-mnontrapping-fptoint \
")
set(CMAKE_CXX_FLAGS " \
-O3 \
-flto \
-mnontrapping-fptoint \
")


Expand Down Expand Up @@ -542,32 +545,31 @@ message("${BUILD_MESSAGE}\n")

# Common flags for WASM/JS build and Pyodide
set(PSP_WASM_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \
--bind \
--embind-emit-tsd perspective-server.d.ts \
--source-map-base \"\" \
--memory-init-file 0 \
--pre-js \"${PSP_CPP_SRC}/env.js\" \
--no-entry \
--closure=1 \
-s NO_FILESYSTEM=1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s WASM_BIGINT=1 \
-s INCOMING_MODULE_JS_API=psp_heap_size,psp_stack_trace,HEAPU8,HEAPU32,instantiateWasm \
-s TEXTDECODER=2 \
-s STANDALONE_WASM=1 \
-s DYNAMIC_EXECUTION=0 \
-s BINARYEN_EXTRA_PASSES=--one-caller-inline-max-function-size=19306 \
-s EXPORT_NAME=\"load_perspective\" \
-s MAXIMUM_MEMORY=4gb \
-s ERROR_ON_UNDEFINED_SYMBOLS=1 \
-s ERROR_ON_UNDEFINED_SYMBOLS=0 \
-s NODEJS_CATCH_EXIT=0 \
-s EXCEPTION_STACK_TRACES=1 \
-s NODEJS_CATCH_REJECTION=0 \
-s USE_ES6_IMPORT_META=1 \
-s EXPORT_ES6=1 \
-s EXPORTED_FUNCTIONS=_js_poll,_js_new_server,_js_free,_js_alloc,_js_handle_message \
")

if(PSP_SANITIZE)
set(PSP_SANITIZE_FLAGS
set(PSP_SANITIZE_FLAGS
-sINITIAL_MEMORY=640mb
-sTOTAL_MEMORY=640mb
-sALLOW_MEMORY_GROWTH=1
Expand All @@ -584,13 +586,6 @@ if(PSP_WASM_BUILD)
set_target_properties(psp PROPERTIES COMPILE_FLAGS "")
target_link_libraries(psp PRIVATE arrow re2 protos)

add_executable(perspective_cjs src/cpp/emscripten_api.cpp)
target_link_libraries(perspective_cjs psp protos)
target_compile_definitions(perspective_cjs PRIVATE PSP_ENABLE_WASM=1)
target_link_options(perspective_cjs PUBLIC -sENVIRONMENT="node" ${PSP_SANITIZE_FLAGS})
set_target_properties(perspective_cjs PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./node/")
set_target_properties(perspective_cjs PROPERTIES OUTPUT_NAME "perspective-server")

add_executable(perspective_esm src/cpp/emscripten_api.cpp)
target_link_libraries(perspective_esm psp protos)
target_compile_definitions(perspective_esm PRIVATE PSP_ENABLE_WASM=1)
Expand Down Expand Up @@ -687,7 +682,7 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
endif()
endif()

# TODO this needs to be omitted when built by `cmake-rs`, because
# TODO this needs to be omitted when built by `cmake-rs`, because
#`cargo publish --dry-run` complains when this generate `.clangd` in the Rust
# root dir instead of teh `target` dir.
if(NOT DEFINED ENV{PSP_DISABLE_CLANGD})
Expand Down
1 change: 0 additions & 1 deletion cpp/perspective/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ try {
execSync(`cpy web/**/* ../web`, { cwd, stdio });
execSync(`cpy node/**/* ../node`, { cwd, stdio });
bootstrap(`../../cpp/perspective/dist/web/perspective-server.wasm`);
bootstrap(`../../cpp/perspective/dist/node/perspective-server.wasm`);
} catch (e) {
console.error(e);
process.exit(1);
Expand Down
15 changes: 15 additions & 0 deletions cpp/perspective/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
// ┃ This file is part of the Perspective library, distributed under the terms ┃
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

// this line/hack allows us to bypass the emscripten environment
// so we can run the same JS-file on both web and node.
globalThis.window = {};
18 changes: 9 additions & 9 deletions cpp/perspective/src/cpp/data_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,15 @@ t_data_table::pprint() const {
pprint(size(), &std::cout);
}

void
t_data_table::pprint(const std::string& fname) const {

PSP_TRACE_SENTINEL();
PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
std::ofstream file;
file.open(fname);
pprint(size(), &file);
}
// void
// t_data_table::pprint(const std::string& fname) const {

// PSP_TRACE_SENTINEL();
// PSP_VERBOSE_ASSERT(m_init, "touching uninited object");
// std::ofstream file;
// file.open(fname);
// pprint(size(), &file);
// }

void
t_data_table::pprint(t_uindex nrows, std::ostream* os) const {
Expand Down

0 comments on commit 888d032

Please sign in to comment.