Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion python/tvm/contrib/emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.
"""Util to invoke emscripten compilers in the system."""
# pylint: disable=invalid-name
import os
import subprocess
from tvm._ffi.base import py_str
from tvm._ffi.libinfo import find_lib_path
Expand Down Expand Up @@ -78,7 +79,8 @@ def create_tvmjs_wasm(output, objects, options=None, cc="emcc"):
if options:
cmd += options

proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
is_windows = os.name == "nt"
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=is_windows)
(out, _) = proc.communicate()

if proc.returncode != 0:
Expand Down
2 changes: 1 addition & 1 deletion web/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

TVM_ROOT=$(shell cd ..; pwd)
TVM_ROOT=$(realpath $(shell dirname $(firstword $(MAKEFILE_LIST))))/../

INCLUDE_FLAGS = -I$(TVM_ROOT) -I$(TVM_ROOT)/include\
-I$(TVM_ROOT)/3rdparty/dlpack/include -I$(TVM_ROOT)/3rdparty/dmlc-core/include\
Expand Down
4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"prepwasm": "make && python3 tests/python/prepare_test_libs.py",
"prepwasm": "make && python tests/python/prepare_test_libs.py",
"build": "rollup -c",
"lint": "eslint -c .eslintrc.json .",
"typedoc": "typedoc src/index.ts --plugin typedoc-plugin-missing-exports",
"test": "node --experimental-wasm-eh node_modules/.bin/jest",
"test": "python run_jest.py",
"bundle": "npm run build && cp lib/index.js dist/index.js && cp lib/index.js dist/tvmjs.bundle.js",
"example": "npm run bundle && node apps/node/example.js",
"example:wasi": "npm run bundle && node --experimental-wasi-unstable-preview1 --experimental-wasm-bigint apps/node/wasi_example.js",
Expand Down
24 changes: 24 additions & 0 deletions web/run_jest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Run jest based on current OS

import os

if os.name == "nt":
os.system("node_modules\\.bin\\jest")
else:
os.system("node node_modules/.bin/jest")
2 changes: 1 addition & 1 deletion web/tests/python/websock_rpc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_rpc():
temp = utils.tempdir()

wasm_path = temp.relpath("addone.wasm")
fadd.export_library(wasm_path, fcompile=emcc.create_tvmjs_wasm)
fadd.export_library(wasm_path, fcompile=tvmjs.create_tvmjs_wasm)

wasm_binary = open(wasm_path, "rb").read()

Expand Down