This commit is contained in:
blueloveTH 2023-07-09 03:02:10 +08:00
parent 48da917caf
commit e6c5ace927
6 changed files with 10 additions and 11 deletions

View File

@ -61,8 +61,11 @@ jobs:
path: output
- name: Benchmark
run: python3 scripts/run_tests.py benchmark
# - name: GCC Build Test
# run: g++ -o pocketpy --std=c++17 src/main.cpp
- name: GCC Build Test
run: |
SRC=$(find src/ -name "*.cpp")
g++ -o main --std=c++17 src/main.cpp $SRC
python3 scripts/run_tests.py
- name: C Binding Test
run: bash run_c_binding_test.sh
build_macos:

View File

@ -43,10 +43,6 @@ To compile it with your project, these flags must be set:
+ RTTI is not required
+ If clang is used, `-stdlib=libc++` must be set
!!!
For maximum performance, we recommend to use `clang++` with `-O2` flag.
!!!
### Example
```cpp

View File

@ -81,10 +81,10 @@ with open("amalgamated/main.cpp", "wt", encoding='utf-8') as f:
f.write(text)
if sys.platform in ['linux', 'darwin']:
ok = os.system("clang++ -o pocketpy amalgamated/main.cpp --std=c++17 -stdlib=libc++ -ldl")
ok = os.system("clang++ -o main amalgamated/main.cpp --std=c++17 -stdlib=libc++ -ldl")
if ok == 0:
print("Test build success!")
os.remove("pocketpy")
os.remove("main")
print("amalgamated/pocketpy.h")

View File

@ -1,3 +1,3 @@
python3 prebuild.py
SRC=$(find src/ -name "*.cpp")
clang++ -std=c++17 -fno-rtti -O2 -stdlib=libc++ -Wfatal-errors -o pocketpy src2/main.cpp $SRC -Iinclude -ldl
clang++ -std=c++17 -fno-rtti -O2 -stdlib=libc++ -Wfatal-errors -o main src2/main.cpp $SRC -Iinclude -ldl

View File

@ -1,6 +1,6 @@
python3 prebuild.py
SRC=$(find src/ -name "*.cpp")
clang++ -pg -O1 -std=c++17 -fno-rtti -stdlib=libc++ -Wfatal-errors -o pocketpy $SRC -Iinclude
clang++ -pg -O1 -std=c++17 -fno-rtti -stdlib=libc++ -Wfatal-errors -o main $SRC -Iinclude
time ./main benchmarks/fib.py
mv benchmarks/gmon.out .
gprof pocketpy gmon.out > gprof.txt

View File

@ -1,6 +1,6 @@
python3 prebuild.py
SRC=$(find src/ -name "*.cpp")
clang++ -std=c++17 -fno-rtti --coverage -O1 -stdlib=libc++ -Wfatal-errors -o pocketpy src2/main.cpp $SRC -Iinclude
clang++ -std=c++17 -fno-rtti --coverage -O1 -stdlib=libc++ -Wfatal-errors -o main src2/main.cpp $SRC -Iinclude
python3 scripts/run_tests.py
rm -rf .coverage
mkdir .coverage