1
0
blueloveTH 2 жил өмнө
parent
commit
a2e7846662

+ 2 - 2
CMakeLists.txt

@@ -8,11 +8,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
 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 -frtti -O2")
 
     # disable -Wshorten-64-to-32 for apple
     if(APPLE)
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-shorten-64-to-32")
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -frtti -Wno-shorten-64-to-32")
     endif()
 endif()
 

+ 1 - 0
README.md

@@ -58,6 +58,7 @@ It is safe to use `main` branch in production.
 To compile it with your project, these flags must be set:
 
 + `--std=c++17` flag must be set
++ RTTI must be enabled
 + Exception must be enabled
 + For MSVC, `/utf-8` flag must be set
 

+ 1 - 1
amalgamate.py

@@ -82,7 +82,7 @@ with open("amalgamated/main.cpp", "wt", encoding='utf-8', newline='\n') as f:
 	f.write(text)
 
 if sys.platform in ['linux', 'darwin']:
-	ok = os.system("clang++ -o main amalgamated/main.cpp -O1 --std=c++17 -stdlib=libc++")
+	ok = os.system("clang++ -o main amalgamated/main.cpp -O1 --std=c++17 -frtti -stdlib=libc++")
 	if ok == 0:
 		print("Test build success!")
 

+ 1 - 1
build.sh

@@ -22,7 +22,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 -O1 -stdlib=libc++ -frtti -Wfatal-errors -Iinclude"
 
 if [[ "$OSTYPE" == "darwin"* ]]; then
     LIB_EXTENSION=".dylib"

+ 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 -s -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 -frtti -s -Os -sEXPORTED_FUNCTIONS=_pkpy_new_repl,_pkpy_repl_input,_pkpy_new_vm -sEXPORTED_RUNTIME_METHODS=ccall -o web/lib/pocketpy.js

+ 1 - 1
build_with_warnings.sh

@@ -1,5 +1,5 @@
 SRC=$(find src/ -name "*.cpp")
 
-FLAGS="-std=c++17 -O1 -stdlib=libc++ -Iinclude -W -Wno-unused-parameter"
+FLAGS="-std=c++17 -O1 -stdlib=libc++ -Iinclude -frtti -W -Wno-unused-parameter"
 
 clang++ $FLAGS -o main -O1 src2/main.cpp $SRC

+ 1 - 0
docs/quick-start/installation.md

@@ -43,6 +43,7 @@ It is safe to use `main` branch in production.
 To compile it with your project, these flags must be set:
 
 + `--std=c++17` flag must be set
++ RTTI must be enabled
 + Exception must be enabled
 + For MSVC, `/utf-8` flag must be set