-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add webassembly compilation" (#12)
* feat: working wasm emission * feat: output companion .js file * wip: better interfacing * feat: working listing of devices for a driver * feat: add bytecode loader class * wip: call bytecode * wip * merge * feat: first working draft of wasm execution * wip * fix: return typed arrays * fix: double-free on context * chore: cleanup comments * refactor: modularize cmakelists * feat: compile fewer things for wasm host tools
- Loading branch information
1 parent
a30e664
commit 18b9b5b
Showing
23 changed files
with
930 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
set(IREE_HAL_DRIVER_DEFAULTS ON) | ||
set(IREE_HAL_DRIVER_LOCAL_SYNC ON) | ||
set(IREE_HAL_EXECUTABLE_LOADER_DEFAULTS OFF) | ||
set(IREE_HAL_EXECUTABLE_LOADER_EMBEDDED_ELF ON) | ||
|
||
list(REMOVE_ITEM iree_runtime_sources | ||
"${CMAKE_SOURCE_DIR}/src/emscripten_api.cc" | ||
"${CMAKE_SOURCE_DIR}/src/emscripten_api.h" | ||
) | ||
|
||
add_library(${_NAME} SHARED ${iree_runtime_sources}) | ||
|
||
set_target_properties(${_NAME} PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" | ||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" | ||
SUFFIX ".so" | ||
) | ||
|
||
install( | ||
TARGETS ${_NAME} | ||
DESTINATION "." | ||
) | ||
|
||
target_link_libraries(${_NAME} iree_runtime_runtime) | ||
target_link_libraries(${_NAME} iree_tooling_context_util) | ||
|
||
# Install the header files - this will make it easier to copy them over | ||
# to the final bundle. | ||
install(DIRECTORY "${IREE_RUNTIME_INCLUDE_PATH}" | ||
DESTINATION "include" | ||
FILES_MATCHING PATTERN "*.h") | ||
|
||
file(GLOB HEADER_FILES "${CMAKE_SOURCE_DIR}/src/*.h") | ||
|
||
install(FILES ${HEADER_FILES} | ||
DESTINATION "include/nx_iree") | ||
|
||
if(APPLE) | ||
# Although the compiler complains about not using these, | ||
# things only work with them set | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -undefined dynamic_lookup -fvisibility=default") | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export_dynamic") | ||
check_c_compiler_flag("-arch arm64" ARM64_SUPPORTED) | ||
if(ARM64_SUPPORTED) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_ARM64") | ||
endif() | ||
else() | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -shared -fvisibility=default") | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-dynamic") | ||
endif() |
Oops, something went wrong.