mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
enable rtti
This commit is contained in:
parent
ec044397e6
commit
a2e7846662
@ -8,11 +8,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
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 -frtti -O2")
|
||||||
|
|
||||||
# disable -Wshorten-64-to-32 for apple
|
# disable -Wshorten-64-to-32 for apple
|
||||||
if(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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ It is safe to use `main` branch in production.
|
|||||||
To compile it with your project, these flags must be set:
|
To compile it with your project, these flags must be set:
|
||||||
|
|
||||||
+ `--std=c++17` flag must be set
|
+ `--std=c++17` flag must be set
|
||||||
|
+ RTTI must be enabled
|
||||||
+ Exception must be enabled
|
+ Exception must be enabled
|
||||||
+ For MSVC, `/utf-8` flag must be set
|
+ For MSVC, `/utf-8` flag must be set
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ with open("amalgamated/main.cpp", "wt", encoding='utf-8', newline='\n') as f:
|
|||||||
f.write(text)
|
f.write(text)
|
||||||
|
|
||||||
if sys.platform in ['linux', 'darwin']:
|
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:
|
if ok == 0:
|
||||||
print("Test build success!")
|
print("Test build success!")
|
||||||
|
|
||||||
|
2
build.sh
2
build.sh
@ -22,7 +22,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 -O1 -stdlib=libc++ -frtti -Wfatal-errors -Iinclude"
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
LIB_EXTENSION=".dylib"
|
LIB_EXTENSION=".dylib"
|
||||||
|
@ -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 -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,5 +1,5 @@
|
|||||||
SRC=$(find src/ -name "*.cpp")
|
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
|
clang++ $FLAGS -o main -O1 src2/main.cpp $SRC
|
||||||
|
@ -43,6 +43,7 @@ It is safe to use `main` branch in production.
|
|||||||
To compile it with your project, these flags must be set:
|
To compile it with your project, these flags must be set:
|
||||||
|
|
||||||
+ `--std=c++17` flag must be set
|
+ `--std=c++17` flag must be set
|
||||||
|
+ RTTI must be enabled
|
||||||
+ Exception must be enabled
|
+ Exception must be enabled
|
||||||
+ For MSVC, `/utf-8` flag must be set
|
+ For MSVC, `/utf-8` flag must be set
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user