mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
up
Update build_wasm.sh
This commit is contained in:
parent
f227c61f2a
commit
28354b6c43
@ -1,3 +1,3 @@
|
||||
rm -rf web/lib/
|
||||
mkdir -p web/lib/
|
||||
em++ src/main.cpp -fno-rtti -fexceptions -sEXIT_RUNTIME -O3 -sEXPORTED_FUNCTIONS=_repl_input,_repl_start,_pkpy_delete,_pkpy_new_repl,_pkpy_repl_input,_pkpy_new_tvm,_pkpy_tvm_exec_async,_pkpy_tvm_get_state,_pkpy_tvm_read_jsonrpc_request,_pkpy_tvm_reset_state,_pkpy_tvm_terminate,_pkpy_tvm_write_jsonrpc_response,_pkpy_new_vm,_pkpy_vm_add_module,_pkpy_vm_eval,_pkpy_vm_exec,_pkpy_vm_get_global,_pkpy_vm_read_output -sEXPORTED_RUNTIME_METHODS=ccall -o web/lib/pocketpy.js
|
||||
em++ src/main.cpp -fno-rtti -fexceptions -sEXIT_RUNTIME -O3 -sMODULARIZE -sEXPORTED_FUNCTIONS=_repl_input,_repl_start,_pkpy_delete,_pkpy_new_repl,_pkpy_repl_input,_pkpy_new_tvm,_pkpy_tvm_exec_async,_pkpy_tvm_get_state,_pkpy_tvm_read_jsonrpc_request,_pkpy_tvm_reset_state,_pkpy_tvm_terminate,_pkpy_tvm_write_jsonrpc_response,_pkpy_new_vm,_pkpy_vm_add_module,_pkpy_vm_eval,_pkpy_vm_exec,_pkpy_vm_get_global,_pkpy_vm_read_output -sEXPORTED_RUNTIME_METHODS=ccall,cwrap -o web/lib/pocketpy.js
|
@ -1,30 +0,0 @@
|
||||
// This is a basic Flutter widget test.
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:example/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
expect(find.text('1'), findsNothing);
|
||||
|
||||
// Tap the '+' icon and trigger a frame.
|
||||
await tester.tap(find.byIcon(Icons.add));
|
||||
await tester.pump();
|
||||
|
||||
// Verify that our counter has incremented.
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
});
|
||||
}
|
11
src/main.cpp
11
src/main.cpp
@ -26,19 +26,12 @@ struct Timer{
|
||||
|
||||
// these code is for demo use, feel free to modify it
|
||||
REPL* _repl;
|
||||
|
||||
extern "C" {
|
||||
__EXPORT
|
||||
void repl_start(){
|
||||
_repl = pkpy_new_repl(pkpy_new_vm(true));
|
||||
}
|
||||
|
||||
void repl_start(){ _repl = pkpy_new_repl(pkpy_new_vm(true));}
|
||||
__EXPORT
|
||||
bool repl_input(const char* line){
|
||||
return pkpy_repl_input(_repl, line) == NEED_MORE_LINES;
|
||||
}
|
||||
bool repl_input(const char* line){ return pkpy_repl_input(_repl, line) == NEED_MORE_LINES;}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
|
@ -589,6 +589,9 @@ void __initializeBuiltinFunctions(VM* _vm) {
|
||||
#define __EXPORT __declspec(dllexport)
|
||||
#elif __APPLE__
|
||||
#define __EXPORT __attribute__((visibility("default"))) __attribute__((used))
|
||||
#elif defined(__EMSCRIPTEN__) || defined(__wasm__) || defined(__wasm32__) || defined(__wasm64__)
|
||||
#include <emscripten.h>
|
||||
#define __EXPORT EMSCRIPTEN_KEEPALIVE
|
||||
#else
|
||||
#define __EXPORT
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user