Rename MuJoCo WASM output artifacts to mujoco.*.
This change updates the Emscripten build to output files named `mujoco.js`, `mujoco.wasm`, and `mujoco.d.ts` instead of `mujoco_wasm.*`. The internal CMake target name remains `mujoco_wasm` to avoid conflicts. The package name in `package.json` is also updated to `mujoco`. New enum tests are added. PiperOrigin-RevId: 875140314 Change-Id: Ie03e0d1db2d03dd8582d5bfcb260b3d33549c2c9
This commit is contained in:
committed by
Copybara-Service
parent
757758dd2e
commit
940cab2508
+8
-2
@@ -46,13 +46,19 @@ set(EMCC_LINKER_FLAGS
|
|||||||
"-s DISABLE_EXCEPTION_CATCHING=0"
|
"-s DISABLE_EXCEPTION_CATCHING=0"
|
||||||
"-gsource-map"
|
"-gsource-map"
|
||||||
"-g"
|
"-g"
|
||||||
"--emit-tsd mujoco_wasm.d.ts"
|
"--emit-tsd mujoco.d.ts"
|
||||||
)
|
)
|
||||||
string (REPLACE ";" " " EMCC_LINKER_FLAGS_STR "${EMCC_LINKER_FLAGS}")
|
string (REPLACE ";" " " EMCC_LINKER_FLAGS_STR "${EMCC_LINKER_FLAGS}")
|
||||||
|
|
||||||
add_executable(mujoco_wasm ${MUJOCO_WASM_FILES})
|
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)
|
target_link_libraries(mujoco_wasm ccd lodepng mujoco tinyxml2 qhullstatic_r)
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ def generate_typescript_enum_tests():
|
|||||||
output = textwrap.dedent("""\
|
output = textwrap.dedent("""\
|
||||||
import 'jasmine';
|
import 'jasmine';
|
||||||
|
|
||||||
import { MainModule } from "../dist/mujoco_wasm"
|
import { MainModule } from "../dist/mujoco"
|
||||||
import loadMujoco from "../dist/mujoco_wasm.js"
|
import loadMujoco from "../dist/mujoco.js"
|
||||||
|
|
||||||
let mujoco: MainModule;
|
let mujoco: MainModule;
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import * as THREE from "three"
|
import * as THREE from "three"
|
||||||
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"
|
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>;
|
declare function loadMujoco(): Promise<MainModule>;
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "mujoco_wasm",
|
"name": "mujoco",
|
||||||
"version": "1.0.0-alpha.1",
|
"version": "1.0.0-alpha.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mujoco_wasm",
|
"name": "mujoco",
|
||||||
"version": "1.0.0-alpha.1",
|
"version": "1.0.0-alpha.1",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "mujoco_wasm",
|
"name": "mujoco",
|
||||||
"version": "1.0.0-alpha.1",
|
"version": "1.0.0-alpha.1",
|
||||||
"description": "MuJoCo JavaScript Bindings",
|
"description": "MuJoCo JavaScript Bindings",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ import 'jasmine';
|
|||||||
import {MainModule, MjContact, MjContactVec, MjData, MjLROpt, MjModel,
|
import {MainModule, MjContact, MjContactVec, MjData, MjLROpt, MjModel,
|
||||||
MjOption, MjsGeom, MjSolverStat, MjSpec, MjStatistic, MjTimerStat, MjvCamera,
|
MjOption, MjsGeom, MjSolverStat, MjSpec, MjStatistic, MjTimerStat, MjvCamera,
|
||||||
MjvFigure, MjvGeom, MjvGLCamera, MjvLight, MjvOption, MjvPerturb, MjvScene,
|
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):
|
function assertExists<T>(value: T | null | undefined, message?: string):
|
||||||
asserts value is T {
|
asserts value is T {
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
import 'jasmine';
|
import 'jasmine';
|
||||||
|
|
||||||
import { MainModule } from "../dist/mujoco_wasm"
|
import { MainModule } from "../dist/mujoco"
|
||||||
import loadMujoco from "../dist/mujoco_wasm.js"
|
import loadMujoco from "../dist/mujoco.js"
|
||||||
|
|
||||||
let mujoco: MainModule;
|
let mujoco: MainModule;
|
||||||
|
|
||||||
@@ -40,6 +40,10 @@ describe('Enums', () => {
|
|||||||
expect(mujoco.mjtGeom).toBeDefined();
|
expect(mujoco.mjtGeom).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('mjtProjection should exist', () => {
|
||||||
|
expect(mujoco.mjtProjection).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
it('mjtCamLight should exist', () => {
|
it('mjtCamLight should exist', () => {
|
||||||
expect(mujoco.mjtCamLight).toBeDefined();
|
expect(mujoco.mjtCamLight).toBeDefined();
|
||||||
});
|
});
|
||||||
@@ -120,6 +124,14 @@ describe('Enums', () => {
|
|||||||
expect(mujoco.mjtConDataField).toBeDefined();
|
expect(mujoco.mjtConDataField).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('mjtRayDataField should exist', () => {
|
||||||
|
expect(mujoco.mjtRayDataField).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('mjtCamOutBit should exist', () => {
|
||||||
|
expect(mujoco.mjtCamOutBit).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
it('mjtSameFrame should exist', () => {
|
it('mjtSameFrame should exist', () => {
|
||||||
expect(mujoco.mjtSameFrame).toBeDefined();
|
expect(mujoco.mjtSameFrame).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { MainModule, MjData, MjModel } from "../../dist/mujoco_wasm"
|
import { MainModule, MjData, MjModel } from "../../dist/mujoco"
|
||||||
import loadMujoco from "../../dist/mujoco_wasm.js"
|
import loadMujoco from "../../dist/mujoco.js"
|
||||||
|
|
||||||
declare function loadMujoco(): Promise<MainModule>;
|
declare function loadMujoco(): Promise<MainModule>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user