fix lite compile

This commit is contained in:
sunsuodong 2021-08-05 16:38:11 +08:00
parent dfd3f92858
commit a6194fe62f
2 changed files with 11 additions and 8 deletions

View File

@ -1,10 +1,10 @@
if(MSVC)
set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_CFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_CFLAGS "${CMAKE_C_FLAGS}")
set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
else()
set(flatbuffers_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(flatbuffers_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(flatbuffers_CXXFLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong")
set(flatbuffers_CFLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong")
endif()
if(WIN32)

View File

@ -209,10 +209,10 @@ else()
else()
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,relro,-z,now -Wl,-z,noexecstack -s ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,-z,now -Wl,-z,noexecstack -s -pie ${CMAKE_EXE_LINKER_FLAGS}")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
string(REPLACE "-s" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REPLACE "-s" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
string(REPLACE "-s" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(REPLACE "-s" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
endif()
endif()
endif()
@ -228,7 +228,10 @@ if(SUPPORT_NPU)
endif()
add_compile_definitions(NO_DLIB)
add_compile_options(-fPIC)
if(NOT MSVC)
add_compile_options(-fPIC)
endif()
if(PLATFORM_ARM64)
set(RUNTIME_COMPONENT_NAME "android-aarch64")