代码拉取完成,页面将自动刷新
cmake_minimum_required(VERSION 3.6)
# Disable inplace builds to prevent source tree corruption.
IF (" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
MESSAGE (FATAL_ERROR "FATAL: Building inplace are not allowed. You should create a separate directory for Building.")
ENDIF ()
# set cmake_install_prefix path
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory")
endif()
message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
# default budilding type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE release CACHE STRING "Choose the type of build" FORCE)
endif()
# project name
project(tengine-serializer C CXX)
set(CMAKE_CXX_STANDARD 14)
set(CXX_STANDARD_REQUIRED ON)
# building flags
#target_compile_definitions(operator,"--allow-shlib-undefined")
add_definitions(-Wl,-Bsymbolic)
add_definitions(-Wl,-Bsymbolic-functions)
add_definitions(-Wno-unused-command-line-argument)
add_definitions(-funroll-loops)
add_definitions(-Wno-deprecated-register)
add_definitions(-Wno-overloaded-virtual)
add_definitions(-fPIC)
#add_definitions(-g)
add_definitions(-O3)
# paser options
option(BUILD_CAFFE_SERIALIZER "Caffe serializer" ON)
option(BUILD_ONNX_SERIALIZER "ONNX serializer" ON)
option(BUILD_MXNET_SERIALIZER "MXNet serializer" ON)
option(BUILD_DARKNET_SERIALIZER "Darknet serializer" ON)
option(BUILD_TF_SERIALIZER "TensorFlow serializer" ON)
option(BUILD_TFLITE_SERIALIZER "TFLite serializer" ON)
option(BUILD_NCNN_SERIALIZER "NCNN serializer" ON)
option(BUILD_MEGENGINE_SERIALIZER "MegEngine serializer" OFF)
option(BUILD_TENGINE_SERIALIZER "Tengine serializer" ON)
# add all header file folder
include_directories(include)
include_directories(core/include)
include_directories(driver/include)
include_directories(driver/cpu)
include_directories(executor/include)
include_directories(executor/operator/include)
include_directories(operator/include)
include_directories(serializer/include)
include_directories(serializer/include/tengine/v1)
include_directories(serializer/include/tengine/v2)
# add
file(GLOB_RECURSE CORE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/core/lib/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/core/lib/logger/*.cpp")
file(GLOB_RECURSE CPU_DRIVER_SRC "${CMAKE_CURRENT_SOURCE_DIR}/driver/cpu/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/driver/plugin/init.cpp")
file(GLOB_RECURSE COMMON_SRC "${CMAKE_CURRENT_SOURCE_DIR}/executor/engine/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/executor/lib/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/executor/plugin/*.cpp")
file(GLOB_RECURSE OPERATOR_SRC "${CMAKE_CURRENT_SOURCE_DIR}/operator/plugin/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/operator/operator/*.cpp")
file(GLOB_RECURSE SERIALIZER_SRC "${CMAKE_CURRENT_SOURCE_DIR}/serializer/plugin/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/serializer/tengine/*.c" "${CMAKE_CURRENT_SOURCE_DIR}/serializer/tengine/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/serializer/tengine/v1/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/serializer/tengine/v2/*.cpp")
# add exec
add_library(${CMAKE_PROJECT_NAME} STATIC ${CORE_SRC} ${CPU_DRIVER_SRC} ${COMMON_SRC} ${OPERATOR_SRC} ${SERIALIZER_SRC})
# add sub folder
add_subdirectory(tools)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。