Skip to content

Commit 9528d8a

Browse files
committed
first commit
1 parent 1b41815 commit 9528d8a

File tree

20 files changed

+363
-28
lines changed

20 files changed

+363
-28
lines changed

cmake_modules/toolchain-emscripten.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
167167
# -s DISABLE_EXCEPTION_CATCHING=0: Enable C++ exceptions (required for Tudat)
168168
# -s ALLOW_MEMORY_GROWTH=1: Allow heap to grow dynamically
169169
# Note: MODULARIZE and EXPORT_ES6 are set per-target since they vary by use case
170+
# Note: Add -s ASSERTIONS=1 for debugging if needed
170171
set(CMAKE_EXE_LINKER_FLAGS_INIT "-s WASM=1 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1")
171172

172173
# Force appropriate Tudat build options for WASM

docs/app.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,7 @@ class TudatTestRunner {
499499

500500
async setupCesium() {
501501
// No Ion token needed - we use local imagery files
502-
// Set base URL for local Cesium assets (Workers, etc.)
503-
window.CESIUM_BASE_URL = 'cesium/';
502+
// CESIUM_BASE_URL is set in index.html before Cesium.js loads
504503

505504
// Create Blue Marble imagery provider (day texture)
506505
const blueMarbleProvider = await Cesium.SingleTileImageryProvider.fromUrl(

docs/data/de432s.bsp

10.4 MB
Binary file not shown.

docs/data/spice/de432s.bsp

10.4 MB
Binary file not shown.

docs/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
<title>TUDAT // WASM Embind Test Suite</title>
77
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><circle cx='50' cy='50' r='45' fill='%23050a0f' stroke='%2300f0ff' stroke-width='2'/><ellipse cx='50' cy='50' rx='30' ry='10' fill='none' stroke='%2300f0ff' stroke-width='1.5' transform='rotate(-25 50 50)'/><ellipse cx='50' cy='50' rx='30' ry='10' fill='none' stroke='%238b5cf6' stroke-width='1.5' transform='rotate(35 50 50)'/><circle cx='50' cy='50' r='6' fill='%2300f0ff'/></svg>">
88
<!-- CesiumJS (CDN) -->
9-
<script src="https://cesium.com/downloads/cesiumjs/releases/1.116/Build/Cesium/Cesium.js"></script>
10-
<link href="https://cesium.com/downloads/cesiumjs/releases/1.116/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
9+
<script>window.CESIUM_BASE_URL = 'https://cesium.com/downloads/cesiumjs/releases/1.136/Build/Cesium/';</script>
10+
<script src="https://cesium.com/downloads/cesiumjs/releases/1.136/Build/Cesium/Cesium.js"></script>
11+
<link href="https://cesium.com/downloads/cesiumjs/releases/1.136/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
1112
<!-- D3.js for 3D visualizations -->
1213
<script src="https://d3js.org/d3.v7.min.js"></script>
1314
<style>

docs/testWorker.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
// Web Worker for running WASM tests off the main thread
22
// This keeps the UI responsive while tests execute
33

4+
// Global error handler for uncaught errors
5+
self.onerror = function(message, source, lineno, colno, error) {
6+
const errorMsg = error?.message || message || 'Unknown global error';
7+
console.error('Worker global error:', { message, source, lineno, colno, error });
8+
self.postMessage({ type: 'error', message: `Global: ${errorMsg}` });
9+
return true;
10+
};
11+
12+
self.onunhandledrejection = function(event) {
13+
const errorMsg = event.reason?.message || event.reason?.toString() || String(event.reason) || 'Unhandled rejection';
14+
console.error('Worker unhandled rejection:', event.reason);
15+
self.postMessage({ type: 'error', message: `Rejection: ${errorMsg}` });
16+
};
17+
418
let wasmModule = null;
519
let testCount = 0;
620
let passCount = 0;
@@ -74,13 +88,22 @@ self.onmessage = async function(e) {
7488
},
7589
printErr: function(text) {
7690
processOutput(text);
91+
// Also post as error for visibility
92+
self.postMessage({ type: 'output', text: '[STDERR] ' + text });
93+
},
94+
onAbort: function(what) {
95+
const msg = 'WASM Abort: ' + (what || 'unknown reason');
96+
console.error(msg);
97+
self.postMessage({ type: 'error', message: msg });
7798
}
7899
});
79100

80101
self.postMessage({ type: 'status', message: 'WASM runtime initialized' });
81102
self.postMessage({ type: 'loaded' });
82103
} catch (error) {
83-
self.postMessage({ type: 'error', message: error.message });
104+
const errorMsg = error?.message || error?.toString() || String(error) || 'Unknown error';
105+
console.error('Worker load error:', error);
106+
self.postMessage({ type: 'error', message: errorMsg });
84107
}
85108
} else if (type === 'run') {
86109
if (!wasmModule) {
@@ -116,7 +139,9 @@ self.onmessage = async function(e) {
116139
failed: failCount
117140
});
118141
} catch (error) {
119-
self.postMessage({ type: 'error', message: error.message });
142+
const errorMsg = error?.message || error?.toString() || String(error) || 'Unknown error';
143+
console.error('Worker run error:', error);
144+
self.postMessage({ type: 'error', message: errorMsg });
120145
}
121146
}
122147
};

docs/tudat_wasm_test.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/tudat_wasm_test.wasm

219 KB
Binary file not shown.

docs/tudatpy_wasm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/tudatpy_wasm.wasm

387 KB
Binary file not shown.

0 commit comments

Comments
 (0)