blueloveTH 2 years ago
parent
commit
0a63fcb7b0
3 changed files with 4 additions and 4 deletions
  1. 1 1
      CMakeLists.txt
  2. 2 2
      build.sh
  3. 1 1
      build_web.sh

+ 1 - 1
CMakeLists.txt

@@ -20,7 +20,7 @@ endif()
 if(MSVC)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /utf-8 /O2")
 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
     if(APPLE)

+ 2 - 2
build.sh

@@ -30,7 +30,7 @@ SRC=$(find src/ -name "*.cpp")
 
 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
     LIB_EXTENSION=".dylib"
@@ -46,7 +46,7 @@ clang++ $FLAGS -o libpocketpy$LIB_EXTENSION $SRC -fPIC -shared
 # compile main.cpp and link to libpocketpy.so
 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
     echo "Build completed. Type \"./main\" to enter REPL."

+ 1 - 1
build_web.sh

@@ -4,4 +4,4 @@ rm -rf web/lib
 mkdir web/lib
 
 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