!18925 [LITE][IOS] fix ios compile for new xcode

Merge pull request !18925 from yefeng/127-fix_ios_new_xcode
This commit is contained in:
i-robot 2021-07-01 01:11:56 +00:00 committed by Gitee
commit c2ed88dc4c
9 changed files with 54 additions and 21 deletions

View File

View File

@ -12,14 +12,26 @@ else()
set(MD5 "02c64880acb89dbd57eebacfd67200d8")
endif()
mindspore_add_pkg(flatbuffers
VER 1.11.0
LIBS flatbuffers
EXE flatc
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_C_COMPILER=${FLATC_GCC_COMPILER} -DCMAKE_CXX_COMPILER=${FLATC_GXX_COMPILER}
-DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_INSTALL_LIBDIR=lib)
if(APPLE)
set(FLATBUFFERS_PATCH ${TOP_DIR}/third_party/patch/flatbuffers/flatbuffers.patch001)
mindspore_add_pkg(flatbuffers
VER 1.11.0
LIBS flatbuffers
EXE flatc
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${FLATBUFFERS_PATCH}
CMAKE_OPTION -DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_INSTALL_LIBDIR=lib)
else()
mindspore_add_pkg(flatbuffers
VER 1.11.0
LIBS flatbuffers
EXE flatc
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_C_COMPILER=${FLATC_GCC_COMPILER} -DCMAKE_CXX_COMPILER=${FLATC_GXX_COMPILER}
-DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_INSTALL_LIBDIR=lib)
endif()
include_directories(${flatbuffers_INC})
add_library(mindspore::flatbuffers ALIAS flatbuffers::flatbuffers)

View File

@ -7,7 +7,7 @@ file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/output)
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/output)
# cpack variables
file(READ ${CMAKE_SOURCE_DIR}/VERSION VERSION_NUMBER)
file(READ ${CMAKE_SOURCE_DIR}/MS_VERSION VERSION_NUMBER)
string(TOLOWER linux_${CMAKE_HOST_SYSTEM_PROCESSOR} PLATFORM_NAME)
set(CPACK_PACKAGE_FILE_NAME mindspore_ascend-${VERSION_NUMBER}-${PLATFORM_NAME})
set(CPACK_GENERATOR "TGZ")

View File

@ -352,16 +352,18 @@ function(mindspore_add_pkg pkg_name)
set(${pkg_name}_CMAKE_LDFLAGS "-DCMAKE_SHARED_LINKER_FLAGS=${${pkg_name}_LDFLAGS}")
endif()
endif()
__exec_cmd(COMMAND ${CMAKE_COMMAND} ${PKG_CMAKE_OPTION} -G ${CMAKE_GENERATOR}
${${pkg_name}_CMAKE_CFLAGS} ${${pkg_name}_CMAKE_CXXFLAGS} ${${pkg_name}_CMAKE_LDFLAGS}
-DCMAKE_INSTALL_PREFIX=${${pkg_name}_BASE_DIR} ${${pkg_name}_SOURCE_DIR}/${PKG_CMAKE_PATH}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
if(APPLE)
__exec_cmd(COMMAND ${CMAKE_COMMAND} ${PKG_CMAKE_OPTION}
${${pkg_name}_CMAKE_CFLAGS} ${${pkg_name}_CMAKE_CXXFLAGS} ${${pkg_name}_CMAKE_LDFLAGS}
-DCMAKE_INSTALL_PREFIX=${${pkg_name}_BASE_DIR} ${${pkg_name}_SOURCE_DIR}/${PKG_CMAKE_PATH}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
__exec_cmd(COMMAND ${CMAKE_COMMAND} --build . --target install --
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
else()
__exec_cmd(COMMAND ${CMAKE_COMMAND} ${PKG_CMAKE_OPTION} -G ${CMAKE_GENERATOR}
${${pkg_name}_CMAKE_CFLAGS} ${${pkg_name}_CMAKE_CXXFLAGS} ${${pkg_name}_CMAKE_LDFLAGS}
-DCMAKE_INSTALL_PREFIX=${${pkg_name}_BASE_DIR} ${${pkg_name}_SOURCE_DIR}/${PKG_CMAKE_PATH}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
__exec_cmd(COMMAND ${CMAKE_COMMAND} --build . --target install -- -j${THNUM}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
endif()

View File

@ -34,7 +34,14 @@ option(ENABLE_VERBOSE "" off)
option(ENABLE_MINDRT "if support mindrt" on)
option(ENABLE_MODEL_OBF "if support model obfuscation" off)
option(ENABLE_V0 "support v0 schema" on)
if(APPLE)
find_package(Patch)
if(NOT Patch_FOUND)
message(FATAL_ERROR "Patch not found, "
"please set environment variable MS_PATCH_PATH to path where Patch is located,"
"usually found in GIT_PATH/usr/bin on Windows")
endif()
endif()
if(DEFINED ENV{MSLITE_GPU_BACKEND})
set(MSLITE_GPU_BACKEND $ENV{MSLITE_GPU_BACKEND})
endif()

View File

@ -23,18 +23,18 @@
namespace mindspore::lite {
/// \brief CpuDeviceInfo defined for CPU's configuration information.
typedef struct {
typedef struct CpuDeviceInfo {
bool enable_float16_ = false; /**< prior enable float16 inference */
CpuBindMode cpu_bind_mode_ = MID_CPU;
} CpuDeviceInfo;
/// \brief GpuDeviceInfo defined for GPU's configuration information.
typedef struct {
typedef struct GpuDeviceInfo {
bool enable_float16_ = false; /**< prior enable float16 inference */
} GpuDeviceInfo;
/// \brief NpuDeviceInfo defined for NPU's configuration information.
typedef struct {
typedef struct NpuDeviceInfo {
int frequency_ = 3; /**< npu frequency inference, low 1, medium 2, high 3, extreme 4, other values will be set to 3 */
} NpuDeviceInfo;

View File

@ -28,7 +28,7 @@
namespace mindspore {
namespace lite {
typedef struct {
typedef struct StringPack {
int len = 0;
const char *data = nullptr;
} StringPack;

View File

@ -37,7 +37,7 @@ def _read_file(filename):
return f.read()
version = _read_file('VERSION').replace("\n", "")
version = _read_file('MS_VERSION').replace("\n", "")
readme = _read_file('README.md')

View File

@ -0,0 +1,12 @@
diff -Npur flatbuffers-src/CMakeLists.txt flatbuffers-src_patch/CMakeLists.txt
--- flatbuffers-src/CMakeLists.txt 2019-04-25 02:34:53.000000000 +0800
+++ flatbuffers-src_patch/CMakeLists.txt 2021-06-28 11:37:12.922988687 +0800
@@ -161,7 +161,7 @@
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
elseif(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Wno-unused-parameter")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Wno-unused-parameter -Wno-deprecated")
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
elseif(CMAKE_COMPILER_IS_GNUCXX)
if(CYGWIN)