-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
allow for loading wasm without unsafe wasm execution #1793
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -29,6 +29,12 @@ set(COMPILE_OPTIONS | |||
|
||||
add_compile_options(${COMPILE_OPTIONS}) | ||||
|
||||
link_libraries(embind) | ||||
|
||||
add_library(yogaObjLib OBJECT ${SOURCES}) | ||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/binaries) | ||||
|
||||
add_link_options( | ||||
${COMPILE_OPTIONS} | ||||
"SHELL:--closure 1" | ||||
|
@@ -45,15 +51,27 @@ add_link_options( | |||
"SHELL:-s EXPORT_ES6=1" | ||||
"SHELL:-s WASM=1" | ||||
"SHELL:-s TEXTDECODER=0" | ||||
# SINGLE_FILE=1 combined with ENVIRONMENT='web' creates code that works on | ||||
# both bundlders and Node. | ||||
"SHELL:-s SINGLE_FILE=1" | ||||
"SHELL:-s ENVIRONMENT='web'") | ||||
|
||||
link_libraries(embind) | ||||
add_executable(yoga-wasm-separate-esm $<TARGET_OBJECTS:yogaObjLib>) | ||||
|
||||
add_library(yogaObjLib OBJECT ${SOURCES}) | ||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/binaries) | ||||
add_link_options( | ||||
${COMPILE_OPTIONS} | ||||
"SHELL:--closure 1" | ||||
"SHELL:--memory-init-file 0" | ||||
"SHELL:--no-entry" | ||||
"SHELL:-s ALLOW_MEMORY_GROWTH=1" | ||||
"SHELL:-s ASSERTIONS=0" | ||||
"SHELL:-s DYNAMIC_EXECUTION=0" | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I learned in the other threads, Might be worth removing this argument from the base64 variant, or seeing what happens if we add yoga/javascript/just.config.cjs Line 140 in 1b7d2c8
|
||||
"SHELL:-s EXPORT_NAME='loadYoga'" | ||||
"SHELL:-s FETCH_SUPPORT_INDEXEDDB=0" | ||||
"SHELL:-s FILESYSTEM=0" | ||||
"SHELL:-s MALLOC='emmalloc'" | ||||
"SHELL:-s MODULARIZE=1" | ||||
"SHELL:-s EXPORT_ES6=1" | ||||
"SHELL:-s WASM=1" | ||||
"SHELL:-s TEXTDECODER=0" | ||||
"SHELL:-s SINGLE_FILE=1" | ||||
"SHELL:-s ENVIRONMENT='web'") | ||||
|
||||
add_executable(yoga-wasm-base64-esm $<TARGET_OBJECTS:yogaObjLib>) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
*/ | ||
|
||
// @ts-ignore untyped from Emscripten | ||
import loadYogaImpl from '../binaries/yoga-wasm-separate-esm.js'; | ||
import wrapAssembly from './wrapAssembly.ts'; | ||
|
||
export type { | ||
Config, | ||
DirtiedFunction, | ||
MeasureFunction, | ||
Node, | ||
Yoga, | ||
} from './wrapAssembly.ts'; | ||
|
||
export async function loadYoga() { | ||
return wrapAssembly(await loadYogaImpl()); | ||
} | ||
export * from './generated/YGEnums.ts'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we avoid duplicating the bits here that are not different?