forked from mindspore-Ecosystem/mindspore
:support vs build
This commit is contained in:
parent
c6dc35f510
commit
ea93087683
12
build.bat
12
build.bat
|
@ -55,9 +55,15 @@ IF "%1%" == "lite" (
|
|||
echo "======Start building MindSpore Lite %VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%======"
|
||||
rd /s /q "%BASE_PATH%\output"
|
||||
(git log -1 | findstr "^commit") > %BUILD_PATH%\.commit_id
|
||||
cmake -DPLATFORM_X86_64=on -DBUILD_MINDDATA=off -DMSLITE_ENABLE_TRAIN=off ^
|
||||
-DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
|
||||
-DCMAKE_BUILD_TYPE=Release -G "CodeBlocks - MinGW Makefiles" "%BASE_PATH%/mindspore/lite"
|
||||
IF defined VisualStudioVersion (
|
||||
cmake -DBUILD_MINDDATA=off -DMSLITE_ENABLE_TRAIN=off ^
|
||||
-DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
|
||||
-DCMAKE_BUILD_TYPE=Release -G "Ninja" "%BASE_PATH%/mindspore/lite"
|
||||
) ELSE (
|
||||
cmake -DBUILD_MINDDATA=off -DMSLITE_ENABLE_TRAIN=off ^
|
||||
-DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
|
||||
-DCMAKE_BUILD_TYPE=Release -G "CodeBlocks - MinGW Makefiles" "%BASE_PATH%/mindspore/lite"
|
||||
)
|
||||
) ELSE (
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CPU=ON -DENABLE_MINDDATA=ON -DUSE_GLOG=ON -DENABLE_GITEE=%ENABLE_GITEE% ^
|
||||
-G "CodeBlocks - MinGW Makefiles" ../..
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
set(flatbuffers_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
set(flatbuffers_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
if(MSVC)
|
||||
set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(flatbuffers_CFLAGS "${CMAKE_CXX_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")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(flatbuffers_USE_STATIC_LIBS ON)
|
||||
endif()
|
||||
|
@ -30,7 +37,7 @@ else()
|
|||
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)
|
||||
-DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release)
|
||||
endif()
|
||||
|
||||
include_directories(${flatbuffers_INC})
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
set(nlohmann_json_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
set(nlohmann_json_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
if(MSVC)
|
||||
set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(flatbuffers_CFLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
else()
|
||||
set(nlohmann_json_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
set(nlohmann_json_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
endif()
|
||||
|
||||
if(ENABLE_GITEE)
|
||||
set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.6.1.zip")
|
||||
|
|
|
@ -359,13 +359,18 @@ elseif(WIN32)
|
|||
__install_micro_codegen()
|
||||
endif()
|
||||
if(MSLITE_ENABLE_TOOLS)
|
||||
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
if(MSVC)
|
||||
install(FILES ${TOP_DIR}/build/mindspore/tools/benchmark/${BENCHMARK_NAME}.exe
|
||||
DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
else()
|
||||
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
endif()
|
||||
if(SUPPORT_TRAIN)
|
||||
install(TARGETS ${BENCHMARK_TRAIN_NAME} RUNTIME DESTINATION ${BENCHMARK_TRAIN_ROOT_DIR} COMPONENT
|
||||
${RUNTIME_COMPONENT_NAME})
|
||||
endif()
|
||||
endif()
|
||||
install(FILES ${LIB_LIST} DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
if(SUPPORT_TRAIN)
|
||||
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "*registry.h" EXCLUDE)
|
||||
|
@ -384,12 +389,22 @@ elseif(WIN32)
|
|||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(DIRECTORY ${TOP_DIR}/include/api/ DESTINATION ${RUNTIME_INC_DIR}/api
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "ops*" EXCLUDE)
|
||||
install(FILES ${TOP_DIR}/build/mindspore/src/${MINDSPORE_LITE_LIB_NAME}.a DESTINATION ${RUNTIME_LIB_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(FILES ${TOP_DIR}/build/mindspore/src/${MINDSPORE_LITE_LIB_NAME}.dll.a DESTINATION ${RUNTIME_LIB_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(FILES ${TOP_DIR}/build/mindspore/src/${MINDSPORE_LITE_LIB_NAME}.dll DESTINATION ${RUNTIME_LIB_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
if(MSVC)
|
||||
install(FILES ${TOP_DIR}/build/mindspore/src/${MINDSPORE_LITE_LIB_NAME}.lib DESTINATION ${RUNTIME_LIB_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(FILES ${TOP_DIR}/build/mindspore/src/${MINDSPORE_LITE_LIB_NAME}.dll DESTINATION ${RUNTIME_LIB_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(FILES ${TOP_DIR}/build/mindspore/src/${MINDSPORE_LITE_LIB_NAME}.dll.lib DESTINATION ${RUNTIME_LIB_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
else()
|
||||
install(FILES ${TOP_DIR}/build/mindspore/src/${MINDSPORE_LITE_LIB_NAME}.a DESTINATION ${RUNTIME_LIB_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(FILES ${TOP_DIR}/build/mindspore/src/${MINDSPORE_LITE_LIB_NAME}.dll.a DESTINATION ${RUNTIME_LIB_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(FILES ${TOP_DIR}/build/mindspore/src/${MINDSPORE_LITE_LIB_NAME}.dll DESTINATION ${RUNTIME_LIB_DIR}
|
||||
COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
install(FILES ${LIB_LIST} DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||
endif()
|
||||
else()
|
||||
if(SUPPORT_TRAIN)
|
||||
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
||||
|
|
|
@ -13,14 +13,17 @@ if(PLATFORM_ARM32 OR PLATFORM_ARM64)
|
|||
-ffunction-sections -fdata-sections -ffast-math")
|
||||
endif()
|
||||
endif()
|
||||
if("${X86_64_SIMD}" STREQUAL "avx")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1 -mavx -mavx2 -mfma")
|
||||
endif()
|
||||
if("${X86_64_SIMD}" STREQUAL "avx512")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1 -mavx -mavx2 -mfma")
|
||||
endif()
|
||||
if("${X86_64_SIMD}" STREQUAL "sse")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1")
|
||||
|
||||
if(NOT MSVC)
|
||||
if("${X86_64_SIMD}" STREQUAL "avx")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1 -mavx -mavx2 -mfma")
|
||||
endif()
|
||||
if("${X86_64_SIMD}" STREQUAL "avx512")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1 -mavx -mavx2 -mfma")
|
||||
endif()
|
||||
if("${X86_64_SIMD}" STREQUAL "sse")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
########################### files ###########################
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.14)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(Lite)
|
||||
|
||||
set(BUILD_LITE "on")
|
||||
if(TOOLCHAIN_NAME STREQUAL "himix200")
|
||||
set(TARGET_HIMIX200 on)
|
||||
set(ENABLE_MINDRT off)
|
||||
add_compile_definitions(SUPPORT_NNIE)
|
||||
elseif(TOOLCHAIN_NAME STREQUAL "ohos-lite")
|
||||
set(TARGET_OHOS_LITE on)
|
||||
|
@ -39,6 +38,8 @@ 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)
|
||||
set(BUILD_MINDDATA "lite_cv" CACHE STRING "off, lite, lite_cv, wrapper or full")
|
||||
|
||||
if(APPLE)
|
||||
find_package(Patch)
|
||||
if(NOT Patch_FOUND)
|
||||
|
@ -134,6 +135,10 @@ if(MSLITE_ENABLE_NPU)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(TARGET_HIMIX200 OR TARGET_OHOS_LITE)
|
||||
set(ENABLE_MINDRT off)
|
||||
endif()
|
||||
|
||||
message(STATUS "************MindSpore Lite Build Option:************")
|
||||
message(STATUS "\tMSLITE_GPU_BACKEND = \t${MSLITE_GPU_BACKEND}")
|
||||
message(STATUS "\tMSLITE_ENABLE_NPU = \t${MSLITE_ENABLE_NPU}")
|
||||
|
@ -153,8 +158,42 @@ if(ENABLE_ASAN)
|
|||
endif()
|
||||
|
||||
set(PKG_NAME_PREFIX mindspore-lite-${MS_VERSION_MAJOR}.${MS_VERSION_MINOR}.${MS_VERSION_REVISION})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
|
||||
set(BUILD_MINDDATA "lite_cv" CACHE STRING "off, lite, lite_cv, wrapper or full")
|
||||
set(CMAKE_SKIP_RPATH TURE)
|
||||
|
||||
if(MSVC)
|
||||
add_compile_definitions(SUPPORT_MSVC)
|
||||
add_compile_definitions(_ENABLE_ATOMIC_ALIGNMENT_FIX)
|
||||
set(CMAKE_C_FLAGS "/O2 /EHsc /GS /Zi /utf-8")
|
||||
set(CMAKE_CXX_FLAGS "/O2 /EHsc /GS /Zi /utf-8 /std:c++17")
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "/SAFESEH ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "/SAFESEH ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif()
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "/NXCOMPAT /DYNAMICBASE /DEBUG ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "/NXCOMPAT /DYNAMICBASE /DEBUG ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
else()
|
||||
string(REPLACE "-g" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string(REPLACE "-g" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(LITE_COMPILE_FLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -Wall -Werror -fstack-protector-strong -Wno-attributes \
|
||||
-Wno-deprecated-declarations -Wno-missing-braces")
|
||||
set(CMAKE_C_FLAGS "${LITE_COMPILE_FLAGS} ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-DDebug -g -fvisibility=default")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${LITE_COMPILE_FLAGS} -Wno-overloaded-virtual ${CMAKE_CXX_FLAGS} -std=c++17")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-DDebug -g -fvisibility=default")
|
||||
|
||||
if(WIN32)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-seh ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-seh ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif()
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--nxcompat -Wl,--dynamicbase ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--nxcompat -Wl,--dynamicbase ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
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()
|
||||
endif()
|
||||
|
||||
if(SUPPORT_NPU)
|
||||
set(DDK_PATH "$ENV{HWHIAI_DDK}/ddk/ai_ddk_lib")
|
||||
|
@ -170,10 +209,6 @@ endif()
|
|||
add_compile_definitions(NO_DLIB)
|
||||
add_compile_options(-fPIC)
|
||||
|
||||
if(SUPPORT_TRAIN)
|
||||
set(BUILD_MINDDATA "full")
|
||||
endif()
|
||||
|
||||
if(PLATFORM_ARM64)
|
||||
set(RUNTIME_COMPONENT_NAME "android-aarch64")
|
||||
elseif(PLATFORM_ARM32)
|
||||
|
@ -237,32 +272,6 @@ ms_build_flatbuffers_lite(FBS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/schema/ fbs_src
|
|||
ms_build_flatbuffers_lite(FBS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/schema/ fbs_inner_src ${CMAKE_BINARY_DIR}/schema/inner
|
||||
"inner")
|
||||
|
||||
string(REPLACE "-g" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string(REPLACE "-g" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDebug -g")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDebug -g")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=default")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default")
|
||||
else()
|
||||
## enable for binscope for release
|
||||
set(CMAKE_C_FLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -Wall -Werror -fstack-protector-strong -Wno-attributes \
|
||||
-Wno-deprecated-declarations -Wno-missing-braces ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -Wall -Werror -fstack-protector-strong -Wno-attributes \
|
||||
-Wno-deprecated-declarations -Wno-missing-braces -Wno-overloaded-virtual ${CMAKE_CXX_FLAGS}")
|
||||
if(WIN32)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-seh ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-seh ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif()
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--nxcompat -Wl,--dynamicbase ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--nxcompat -Wl,--dynamicbase ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
else()
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,relro,-z,now -Wl,-z,noexecstack ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,-z,now -Wl,-z,noexecstack ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_VERBOSE)
|
||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
endif()
|
||||
|
@ -357,7 +366,7 @@ if(PLATFORM_ARM64)
|
|||
add_compile_definitions(ENABLE_ARM)
|
||||
endif()
|
||||
|
||||
if(NOT PLATFORM_ARM32 AND NOT PLATFORM_ARM64)
|
||||
if(NOT PLATFORM_ARM)
|
||||
if(MSLITE_ENABLE_AVX)
|
||||
set(X86_64_SIMD "avx")
|
||||
add_compile_definitions(ENABLE_SSE)
|
||||
|
@ -367,8 +376,10 @@ if(NOT PLATFORM_ARM32 AND NOT PLATFORM_ARM64)
|
|||
elseif(MSLITE_ENABLE_SSE)
|
||||
set(X86_64_SIMD "sse")
|
||||
add_compile_definitions(ENABLE_SSE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -390,24 +401,21 @@ add_subdirectory(${CCSRC_DIR}/backend/kernel_compiler/cpu/nnacl build)
|
|||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/micro/coder)
|
||||
|
||||
if(NOT APPLE AND MSLITE_ENABLE_TOOLS)
|
||||
if(MSLITE_ENABLE_TOOLS)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark)
|
||||
if(SUPPORT_TRAIN)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark_train)
|
||||
endif()
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark)
|
||||
if(NOT PLATFORM_ARM AND NOT WIN32)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/cropper)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/schema_gen)
|
||||
add_dependencies(fbs_src gen_ops)
|
||||
add_dependencies(fbs_inner_src gen_ops)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
if(MSLITE_ENABLE_TOOLS)
|
||||
if(NOT PLATFORM_ARM32 AND NOT PLATFORM_ARM64)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/cropper)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/schema_gen)
|
||||
add_dependencies(fbs_src gen_ops)
|
||||
add_dependencies(fbs_inner_src gen_ops)
|
||||
endif()
|
||||
endif()
|
||||
if(MSLITE_ENABLE_TESTCASES)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32 AND MSLITE_ENABLE_TESTCASES)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
|
||||
endif()
|
||||
|
||||
if(NOT APPLE)
|
||||
|
|
|
@ -20,7 +20,6 @@ set(CMAKE_CXX_LINK_EXECUTABLE
|
|||
"${CMAKE_CXX_LINKER} ${MY_LINK_FLAGS} <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
set(CMAKE_SYSROOT ${OHOS_SYSROOT_PATH})
|
||||
|
||||
set(ENABLE_MINDRT "off")
|
||||
find_path(GCC_PATH gcc)
|
||||
find_path(GXX_PATH g++)
|
||||
if(NOT ${GCC_PATH} STREQUAL "GCC_PATH-NOTFOUND" AND NOT ${GXX_PATH} STREQUAL "GXX_PATH-NOTFOUND")
|
||||
|
|
|
@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.10)
|
|||
project(Lite-java)
|
||||
|
||||
set(BUILD_LITE "on")
|
||||
set(CMAKE_SKIP_RPATH TURE)
|
||||
|
||||
if(PLATFORM_ARM64 OR PLATFORM_ARM32)
|
||||
set(PLATFORM_ARM "on")
|
||||
|
|
|
@ -15,17 +15,21 @@ endif()
|
|||
#include 3rd
|
||||
include_directories(${3RD_DIR})
|
||||
include_directories(${3RD_DIR}/flatbuffers/include)
|
||||
|
||||
#include ms
|
||||
include_directories(${TOP_DIR}/)
|
||||
include_directories(${TOP_DIR}/mindspore/core/)
|
||||
include_directories(${NNACL_DIR}/../)
|
||||
include_directories(${LITE_DIR})
|
||||
include_directories(${MICRO_DIR})
|
||||
|
||||
#include coder
|
||||
include(${TOP_DIR}/cmake/external_libs/cmsis.cmake)
|
||||
include(${MICRO_DIR}/cmake/file_list.cmake)
|
||||
include(${MICRO_DIR}/cmake/package_wrapper.cmake)
|
||||
add_subdirectory(wrapper)
|
||||
if(NOT MSVC)
|
||||
include(${TOP_DIR}/cmake/external_libs/cmsis.cmake)
|
||||
include(${MICRO_DIR}/cmake/file_list.cmake)
|
||||
include(${MICRO_DIR}/cmake/package_wrapper.cmake)
|
||||
add_subdirectory(wrapper)
|
||||
endif()
|
||||
|
||||
if(MSLITE_ENABLE_CONVERTER)
|
||||
add_executable(codegen main.cc ${FILE_SET})
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "coder/coder.h"
|
||||
#include <getopt.h>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
|
@ -66,10 +66,15 @@ class Generator {
|
|||
int CodeSessionImplement();
|
||||
|
||||
std::string cmake_file_name_{"net.cmake"};
|
||||
#ifdef _MSC_VER
|
||||
unsigned int user_umask_ = 18;
|
||||
unsigned int origin_umask_ = 0;
|
||||
#else
|
||||
// the user's generated file's permission
|
||||
mode_t user_umask_ = 0022;
|
||||
// the origin file's permission
|
||||
mode_t origin_umask_ = 0000;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace mindspore::lite::micro
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "nnacl/fp32/exp_fp32.h"
|
||||
#include "nnacl/fp32/strided_slice_fp32.h"
|
||||
#include "wrapper/fp32/arithmetic_fp32_wrapper.h"
|
||||
|
||||
namespace mindspore::lite::micro::nnacl {
|
||||
|
||||
class NNaclFp32Serializer : public Serializer {
|
||||
|
|
|
@ -21,12 +21,17 @@
|
|||
#endif
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <array>
|
||||
#include "include/errorcode.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
|
||||
namespace mindspore::lite::micro {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#ifdef _MSC_VER
|
||||
constexpr unsigned int kMicroDirMode = 511;
|
||||
#else
|
||||
constexpr _mode_t kMicroDirMode = 0777;
|
||||
#endif
|
||||
#else
|
||||
constexpr __mode_t kMicroDirMode = 0777;
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@ if(PLATFORM_ARM32 OR PLATFORM_ARM64)
|
|||
-fdata-sections -ffast-math -fno-rtti -fno-exceptions -Wno-shorten-64-to-32 \
|
||||
-fno-aligned-allocation -DTARGET_OS_OSX")
|
||||
endif()
|
||||
else()
|
||||
elseif(NOT MSVC)
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffunction-sections \
|
||||
-fdata-sections -ffast-math -fno-rtti")
|
||||
|
@ -195,7 +195,16 @@ endif()
|
|||
set_target_properties(mindspore-lite_static PROPERTIES OUTPUT_NAME "mindspore-lite")
|
||||
set_target_properties(mindspore-lite_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field")
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set_target_properties(mindspore-lite PROPERTIES PREFIX lib)
|
||||
set_target_properties(mindspore-lite PROPERTIES IMPORT_PREFIX lib)
|
||||
set_target_properties(mindspore-lite PROPERTIES IMPORT_SUFFIX .dll.lib)
|
||||
set_target_properties(mindspore-lite_static PROPERTIES PREFIX lib)
|
||||
endif()
|
||||
|
||||
if(ENABLE_MINDRT)
|
||||
target_link_libraries(mindspore-lite mindrt_mid)
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
#include <asm/hwcap.h>
|
||||
#endif
|
||||
#include "src/common/utils.h"
|
||||
#ifdef SUPPORT_MSVC
|
||||
#ifdef _MSC_VER
|
||||
#include <windows.h>
|
||||
#undef ERROR
|
||||
#endif
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,6 +21,8 @@ if((PLATFORM_ARM32 OR PLATFORM_ARM64) AND NOT TARGET_HIMIX200 AND NOT TARGET_OHO
|
|||
else()
|
||||
target_link_libraries(benchmark mindspore-lite mindspore::json)
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
target_link_libraries(benchmark mindspore-lite mindspore::json)
|
||||
else()
|
||||
target_link_libraries(benchmark mindspore-lite mindspore::json pthread)
|
||||
endif()
|
||||
|
|
|
@ -38,8 +38,6 @@ using schema::FusedBatchNormT;
|
|||
using schema::MetaGraphT;
|
||||
using schema::QuantParamT;
|
||||
using schema::TensorT;
|
||||
using schema::Format::Format_NCHW;
|
||||
using schema::Format::Format_NHWC;
|
||||
|
||||
std::unique_ptr<QuantParamT> GetTensorQuantParam(const std::unique_ptr<TensorT> &tensor);
|
||||
|
||||
|
@ -77,7 +75,7 @@ std::unique_ptr<schema::QuantParamT> CopyQuantParamT(const std::unique_ptr<schem
|
|||
std::unique_ptr<schema::QuantParamT> CopyQuantParamArrayT(
|
||||
const std::unique_ptr<schema::QuantParamT> &srcQuantParamArray);
|
||||
|
||||
enum Category { CONST = 0, GRAPH_INPUT = 1, OP_OUTPUT = 2, TF_CONST = 3 };
|
||||
enum Category { CONSTANT = 0, GRAPH_INPUT = 1, OP_OUTPUT = 2, TF_CONST = 3 };
|
||||
|
||||
class TensorCache {
|
||||
public:
|
||||
|
@ -87,7 +85,7 @@ class TensorCache {
|
|||
|
||||
int AddTensor(const std::string &name, TensorT *tensor, int Category) {
|
||||
index++;
|
||||
if (Category == CONST || Category == TF_CONST || Category == GRAPH_INPUT) {
|
||||
if (Category == CONSTANT || Category == TF_CONST || Category == GRAPH_INPUT) {
|
||||
tensor->refCount = 1;
|
||||
tensor->nodeType = NodeType_ValueNode;
|
||||
} else {
|
||||
|
|
|
@ -202,9 +202,12 @@ target_link_libraries(converter_lite PRIVATE
|
|||
mindspore::glog
|
||||
mindspore::protobuf
|
||||
mindspore::flatbuffers
|
||||
pthread
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_link_libraries(converter_lite PRIVATE pthread)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(converter_lite PRIVATE dl)
|
||||
endif()
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
SET(CMAKE_BUILD_TYPE "Debug")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -fPIC -O0 -Wall -Wno-deprecated-declarations -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer -fstack-protector-all")
|
||||
else ()
|
||||
SET(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -Wno-nullability-completeness -fPIC -O0 -Wall -Wno-deprecated-declarations -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer -fstack-protector-all -D_LIBCPP_INLINE_VISIBILITY='' -D'_LIBCPP_EXTERN_TEMPLATE(...)='")
|
||||
endif()
|
||||
SET(CMAKE_C_FLAGS_RELEASE "$ENV{CFLAGS} -fPIC -O3 -Wall -Wno-deprecated-declarations -fstack-protector-all")
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
if(NOT MSVC)
|
||||
SET(CMAKE_BUILD_TYPE "Debug")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -fPIC -O0 -Wall -Wno-deprecated-declarations -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer -fstack-protector-all")
|
||||
else ()
|
||||
SET(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -Wno-nullability-completeness -fPIC -O0 -Wall -Wno-deprecated-declarations -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer -fstack-protector-all -D_LIBCPP_INLINE_VISIBILITY='' -D'_LIBCPP_EXTERN_TEMPLATE(...)='")
|
||||
endif()
|
||||
SET(CMAKE_C_FLAGS_RELEASE "$ENV{CFLAGS} -fPIC -O3 -Wall -Wno-deprecated-declarations -fstack-protector-all")
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
#add flags
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/local/include -Werror")
|
||||
#add flags
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/local/include -Werror")
|
||||
endif()
|
||||
|
||||
include_directories(./include)
|
||||
add_subdirectory(src)
|
||||
|
|
Loading…
Reference in New Issue