This commit is contained in:
blueloveTH 2024-01-25 01:09:33 +08:00
parent d9c3f6c146
commit 0a63fcb7b0
3 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@ endif()
if(MSVC) if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /utf-8 /O2") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /utf-8 /O2")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -O2") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -s -O2")
# disable -Wshorten-64-to-32 for apple # disable -Wshorten-64-to-32 for apple
if(APPLE) if(APPLE)

View File

@ -30,7 +30,7 @@ SRC=$(find src/ -name "*.cpp")
echo "> Compiling and linking source files... " echo "> Compiling and linking source files... "
FLAGS="-std=c++17 -O1 -stdlib=libc++ -Wfatal-errors -Iinclude" FLAGS="-std=c++17 -s -O1 -stdlib=libc++ -Wfatal-errors -Iinclude"
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
LIB_EXTENSION=".dylib" LIB_EXTENSION=".dylib"
@ -46,7 +46,7 @@ clang++ $FLAGS -o libpocketpy$LIB_EXTENSION $SRC -fPIC -shared
# compile main.cpp and link to libpocketpy.so # compile main.cpp and link to libpocketpy.so
echo "> Compiling main.cpp and linking to libpocketpy$LIB_EXTENSION..." echo "> Compiling main.cpp and linking to libpocketpy$LIB_EXTENSION..."
clang++ $FLAGS -o main -O1 src2/main.cpp -L. -lpocketpy $LINK_FLAGS clang++ $FLAGS -o main -s -O1 src2/main.cpp -L. -lpocketpy $LINK_FLAGS
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Build completed. Type \"./main\" to enter REPL." echo "Build completed. Type \"./main\" to enter REPL."

View File

@ -4,4 +4,4 @@ rm -rf web/lib
mkdir web/lib mkdir web/lib
SRC=$(find src/ -name "*.cpp") SRC=$(find src/ -name "*.cpp")
em++ $SRC -Iinclude/ -fexceptions -Os -sEXPORTED_FUNCTIONS=_pkpy_new_repl,_pkpy_repl_input,_pkpy_new_vm -sEXPORTED_RUNTIME_METHODS=ccall -o web/lib/pocketpy.js em++ $SRC -Iinclude/ -fexceptions -s -Os -sEXPORTED_FUNCTIONS=_pkpy_new_repl,_pkpy_repl_input,_pkpy_new_vm -sEXPORTED_RUNTIME_METHODS=ccall -o web/lib/pocketpy.js