mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
up
Update main.yml Update main.yml Update main.yml up up
This commit is contained in:
parent
c07ae35b8e
commit
970d48f90c
BIN
.github/workflows.rar
vendored
BIN
.github/workflows.rar
vendored
Binary file not shown.
126
.github/workflows/main.yml
vendored
Normal file
126
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
name: build
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
build_win:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Compile
|
||||
shell: bash
|
||||
run: |
|
||||
python3 build.py windows
|
||||
python3 build.py windows -lib
|
||||
mkdir -p output/windows/x86_64
|
||||
cp pocketpy.exe output/windows/x86_64
|
||||
cp pocketpy.dll output/windows/x86_64
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: output
|
||||
- name: Unit Test
|
||||
run: python3 scripts/run_tests.py
|
||||
- name: Benchmark
|
||||
run: python3 scripts/run_tests.py benchmark
|
||||
build_linux:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Clang
|
||||
uses: egor-tensin/setup-clang@v1
|
||||
with:
|
||||
version: 15
|
||||
platform: x64
|
||||
- name: Install libc++
|
||||
run: sudo apt install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15 libclang-rt-15-dev
|
||||
# - name: Coverage Test
|
||||
# run: |
|
||||
# python3 preprocess.py
|
||||
# bash run_tests.sh
|
||||
# - uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: coverage
|
||||
# path: .coverage
|
||||
- name: Compile
|
||||
run: |
|
||||
python3 build.py linux
|
||||
python3 build.py linux -lib
|
||||
mkdir -p output/linux/x86_64
|
||||
cp pocketpy output/linux/x86_64
|
||||
cp pocketpy.so output/linux/x86_64
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: output
|
||||
- name: Unit Test
|
||||
run: python3 scripts/run_tests.py
|
||||
- name: Benchmark
|
||||
run: python3 scripts/run_tests.py benchmark
|
||||
build_macos:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: |
|
||||
python3 amalgamate.py
|
||||
cd plugins/macos/pocketpy
|
||||
mkdir -p output/macos
|
||||
xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
|
||||
cp -r build/Release/pocketpy.bundle output/macos
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: plugins/macos/pocketpy/output
|
||||
build_android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: '3.3.0'
|
||||
channel: 'stable'
|
||||
cache: true
|
||||
- run: flutter --version
|
||||
- name: Compile
|
||||
run: |
|
||||
python3 amalgamate.py
|
||||
cd plugins/flutter/example
|
||||
flutter build apk --split-debug-info=.debug-info --split-per-abi
|
||||
cd build/app/outputs/flutter-apk
|
||||
mkdir -p output/android/arm64-v8a
|
||||
mkdir -p output/android/armeabi-v7a
|
||||
mkdir -p output/android/x86_64
|
||||
unzip -q app-arm64-v8a-release.apk -d tmp
|
||||
mv tmp/lib/arm64-v8a/libpocketpy.so output/android/arm64-v8a/libpocketpy.so
|
||||
rm -rf tmp
|
||||
unzip -q app-armeabi-v7a-release.apk -d tmp
|
||||
mv tmp/lib/armeabi-v7a/libpocketpy.so output/android/armeabi-v7a/libpocketpy.so
|
||||
rm -rf tmp
|
||||
unzip -q app-x86_64-release.apk -d tmp
|
||||
mv tmp/lib/x86_64/libpocketpy.so output/android/x86_64/libpocketpy.so
|
||||
rm -rf tmp
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: plugins/flutter/example/build/app/outputs/flutter-apk/output
|
||||
build_web:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup emsdk
|
||||
uses: mymindstorm/setup-emsdk@v12
|
||||
with:
|
||||
version: 3.1.25
|
||||
actions-cache-folder: 'emsdk-cache'
|
||||
- name: Verify emsdk
|
||||
run: emcc -v
|
||||
- name: Compile
|
||||
run: |
|
||||
mkdir -p output/web/lib
|
||||
python3 build.py web
|
||||
cp web/lib/* output/web/lib
|
||||
- uses: crazy-max/ghaction-github-pages@v3
|
||||
with:
|
||||
target_branch: gh-pages
|
||||
build_dir: web
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: output
|
2
build.py
2
build.py
@ -20,7 +20,7 @@ def lib_pre_build():
|
||||
def lib_post_build():
|
||||
os.remove("src/tmp.cpp")
|
||||
|
||||
windows_common = "clang-cl.exe -std:c++17 /utf-8 -GR- -EHsc -O2 -Wno-deprecated-declarations"
|
||||
windows_common = "CL -std:c++17 /utf-8 -GR- -EHsc -O2"
|
||||
windows_cmd = windows_common + " -Fe:pocketpy src/main.cpp"
|
||||
windows_lib_cmd = windows_common + " -LD -Fe:pocketpy src/tmp.cpp"
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
# THIS SCRIPT IS NOT WORKING
|
||||
clang++ -pg -O2 -std=c++17 -fno-rtti -stdlib=libc++ -Wall -o pocketpy src/main.cpp
|
||||
time ./pocketpy benchmarks/fib.py
|
||||
mv benchmarks/gmon.out .
|
||||
|
10
run_profile_test.sh
Normal file
10
run_profile_test.sh
Normal file
@ -0,0 +1,10 @@
|
||||
clang++ -O2 -std=c++17 -fno-rtti --coverage -stdlib=libc++ -Wall -o pocketpy src/main.cpp
|
||||
time ./pocketpy benchmarks/fib.py
|
||||
rm -rf .coverage
|
||||
mkdir -p .coverage
|
||||
llvm-cov-15 gcov main.gc -r -s src/ >> .coverage/coverage.txt
|
||||
mv *.gcov .coverage
|
||||
rm main.gc*
|
||||
|
||||
# -fprofile-instr-generate -fcoverage-mapping
|
||||
# llvm-cov-15 show main.gc -instr-profile=default.profraw -format=html -output-dir .coverage
|
@ -3,6 +3,7 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable:4267)
|
||||
#pragma warning (disable:4101)
|
||||
#pragma warning (disable:4244)
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE
|
||||
#define strdup _strdup
|
||||
#endif
|
||||
|
10
src/vm.h
10
src/vm.h
@ -204,9 +204,9 @@ public:
|
||||
PyObject* new_type_object(PyObject* mod, StrName name, Type base){
|
||||
PyObject* obj = heap._new<Type>(tp_type, _all_types.size());
|
||||
PyTypeInfo info{
|
||||
.obj = obj,
|
||||
.base = base,
|
||||
.name = (mod!=nullptr && mod!=builtins) ? Str(OBJ_NAME(mod)+"."+name.sv()): name.sv()
|
||||
obj,
|
||||
base,
|
||||
(mod!=nullptr && mod!=builtins) ? Str(OBJ_NAME(mod)+"."+name.sv()): name.sv()
|
||||
};
|
||||
if(mod != nullptr) mod->attr().set(name, obj);
|
||||
_all_types.push_back(info);
|
||||
@ -626,8 +626,8 @@ inline Str VM::disassemble(CodeObject_ co){
|
||||
}
|
||||
|
||||
inline void VM::init_builtin_types(){
|
||||
_all_types.push_back({.obj = heap._new<Type>(Type(1), Type(0)), .base = -1, .name = "object"});
|
||||
_all_types.push_back({.obj = heap._new<Type>(Type(1), Type(1)), .base = 0, .name = "type"});
|
||||
_all_types.push_back({heap._new<Type>(Type(1), Type(0)), -1, "object"});
|
||||
_all_types.push_back({heap._new<Type>(Type(1), Type(1)), 0, "type"});
|
||||
tp_object = 0; tp_type = 1;
|
||||
|
||||
tp_int = _new_type_object("int");
|
||||
|
Loading…
x
Reference in New Issue
Block a user