Change package name and artefacts
This commit is contained in:
+8
-2
@@ -46,13 +46,19 @@ set(EMCC_LINKER_FLAGS
|
||||
"-s DISABLE_EXCEPTION_CATCHING=0"
|
||||
"-gsource-map"
|
||||
"-g"
|
||||
"--emit-tsd mujoco_wasm.d.ts"
|
||||
"--emit-tsd mujoco.d.ts"
|
||||
)
|
||||
string (REPLACE ";" " " EMCC_LINKER_FLAGS_STR "${EMCC_LINKER_FLAGS}")
|
||||
|
||||
add_executable(mujoco_wasm ${MUJOCO_WASM_FILES})
|
||||
|
||||
set_target_properties(mujoco_wasm PROPERTIES LINK_FLAGS "${EMCC_LINKER_FLAGS_STR}")
|
||||
# Keep the internal target name distinct to avoid colliding with the native
|
||||
# `mujoco` library target, but emit artifacts named `mujoco.*` by setting the
|
||||
# output name. Also apply the emscripten linker flags to the wasm target.
|
||||
set_target_properties(mujoco_wasm PROPERTIES
|
||||
LINK_FLAGS "${EMCC_LINKER_FLAGS_STR}"
|
||||
OUTPUT_NAME "mujoco"
|
||||
)
|
||||
|
||||
target_link_libraries(mujoco_wasm ccd lodepng mujoco tinyxml2 qhullstatic_r)
|
||||
|
||||
|
||||
+3
-4
@@ -6,13 +6,13 @@ Official WebAssembly (WASM) bindings for the MuJoCo physics engine, compiled fro
|
||||
|
||||
## Install
|
||||
```sh
|
||||
npm install mujoco_wasm
|
||||
npm install mujoco
|
||||
```
|
||||
|
||||
## Quick start (ESM / TypeScript)
|
||||
|
||||
```ts
|
||||
import loadMujoco from 'mujoco_wasm';
|
||||
import loadMujoco from 'mujoco';
|
||||
|
||||
const mujoco = await loadMujoco();
|
||||
|
||||
@@ -190,8 +190,7 @@ This will return a javascript array representation of the values in MuJoCo `mjFR
|
||||
## Notes
|
||||
The package is ESM (`type: module`) and ships TypeScript types.
|
||||
|
||||
Ensure your bundler or dev server serves the `.wasm` asset from
|
||||
`node_modules/mujoco_wasm/` at runtime.
|
||||
Ensure your bundler or dev server serves the `.wasm` asset at runtime.
|
||||
|
||||
### Development
|
||||
For detailed build instructions see the repository [README](https://github.com/google-deepmind/mujoco/tree/main/wasm#mujoco-javascript-bindings) (Emscripten toolchain, Embind bindings, producing the .wasm artifact, and targets for Node and browser).
|
||||
|
||||
@@ -26,8 +26,8 @@ def generate_typescript_enum_tests():
|
||||
output = textwrap.dedent("""\
|
||||
import 'jasmine';
|
||||
|
||||
import { MainModule } from "../dist/mujoco_wasm"
|
||||
import loadMujoco from "../dist/mujoco_wasm.js"
|
||||
import { MainModule } from "../dist/mujoco"
|
||||
import loadMujoco from "../dist/mujoco.js"
|
||||
|
||||
let mujoco: MainModule;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
import * as THREE from "three"
|
||||
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"
|
||||
import loadMujoco from "../dist/mujoco_wasm.js"
|
||||
import loadMujoco from "../dist/mujoco.js"
|
||||
|
||||
declare function loadMujoco(): Promise<MainModule>;
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "mujoco_wasm",
|
||||
"name": "mujoco",
|
||||
"version": "1.0.0-alpha.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mujoco_wasm",
|
||||
"name": "mujoco",
|
||||
"version": "1.0.0-alpha.1",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "mujoco_wasm",
|
||||
"name": "mujoco",
|
||||
"version": "1.0.0-alpha.1",
|
||||
"description": "MuJoCo JavaScript Bindings",
|
||||
"directories": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "mujoco_wasm",
|
||||
"name": "mujoco",
|
||||
"version": "0.0.0",
|
||||
"description": "MuJoCo WASM bindings",
|
||||
"repository": {
|
||||
@@ -23,13 +23,13 @@
|
||||
"javascript",
|
||||
"typescript"
|
||||
],
|
||||
"main": "mujoco_wasm.js",
|
||||
"types": "mujoco_wasm.d.ts",
|
||||
"main": "mujoco.js",
|
||||
"types": "mujoco.d.ts",
|
||||
"files": [
|
||||
"mujoco_wasm.js",
|
||||
"mujoco_wasm.d.ts",
|
||||
"mujoco_wasm.wasm",
|
||||
"mujoco_wasm.wasm.map",
|
||||
"mujoco.js",
|
||||
"mujoco.d.ts",
|
||||
"mujoco.wasm",
|
||||
"mujoco.wasm.map",
|
||||
"README.md"
|
||||
],
|
||||
"author": "Google DeepMind",
|
||||
|
||||
@@ -17,9 +17,9 @@ import 'jasmine';
|
||||
import {MainModule, MjContact, MjContactVec, MjData, MjLROpt, MjModel,
|
||||
MjOption, MjsGeom, MjSolverStat, MjSpec, MjStatistic, MjTimerStat, MjvCamera,
|
||||
MjvFigure, MjvGeom, MjvGLCamera, MjvLight, MjvOption, MjvPerturb, MjvScene,
|
||||
MjWarningStat, MjVFS, Uint8Buffer} from '../dist/mujoco_wasm.js';
|
||||
MjWarningStat, MjVFS, Uint8Buffer} from '../dist/mujoco.js';
|
||||
|
||||
import loadMujoco from '../dist/mujoco_wasm.js'
|
||||
import loadMujoco from '../dist/mujoco.js'
|
||||
|
||||
function assertExists<T>(value: T | null | undefined, message?: string):
|
||||
asserts value is T {
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
import 'jasmine';
|
||||
|
||||
import { MainModule } from "../dist/mujoco_wasm"
|
||||
import loadMujoco from "../dist/mujoco_wasm.js"
|
||||
import { MainModule } from "../dist/mujoco"
|
||||
import loadMujoco from "../dist/mujoco.js"
|
||||
|
||||
let mujoco: MainModule;
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { MainModule, MjData, MjModel } from "../../dist/mujoco_wasm"
|
||||
import loadMujoco from "../../dist/mujoco_wasm.js"
|
||||
import { MainModule, MjData, MjModel } from "../../dist/mujoco"
|
||||
import loadMujoco from "../../dist/mujoco.js"
|
||||
|
||||
declare function loadMujoco(): Promise<MainModule>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user