1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-04 01:48:54 +00:00

misc/mnn: Fix and improve options (installed apps)

This commit is contained in:
Yuri Victorovich 2020-05-23 17:21:00 +00:00
parent 141fa856c9
commit b8b5937d48
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=536321
6 changed files with 61 additions and 41 deletions

View File

@ -2,7 +2,7 @@
PORTNAME= mnn
DISTVERSION= 1.0.0
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= misc # machine-learning
MAINTAINER= yuri@FreeBSD.org
@ -27,26 +27,20 @@ LDFLAGS+= -pthread
CFLAGS+= -fPIC # workaround for https://github.com/alibaba/MNN/issues/553
CXXFLAGS+= -fPIC
OPTIONS_DEFINE= CONVERTER HARD_FP QUANTOOLS TOOLS TRAIN
OPTIONS_DEFAULT= CONVERTER HARD_FP QUANTOOLS TOOLS TRAIN
OPTIONS_DEFINE= APPS CONVERTER HARD_FP
OPTIONS_DEFAULT= CONVERTER HARD_FP
OPTIONS_SUB= yes
CONVERTER_DESC= Build machine learning model converter
APPS_DESC= Build ML training, quantization tools
APPS_CMAKE_BOOL= MNN_BUILD_QUANTOOLS MNN_BUILD_TOOLS MNN_BUILD_TRAIN
CONVERTER_DESC= Build the model converter tool
CONVERTER_CMAKE_BOOL= MNN_BUILD_CONVERTER
CONVERTER_LIB_DEPENDS= libprotobuf.so:devel/protobuf
HARD_FP_DESC= Hard floating point numbers
HARD_FP_CMAKE_BOOL= MNN_BUILD_HARD
QUANTOOLS_DESC= Build quantized tools
QUANTOOLS_CMAKE_BOOL= MNN_BUILD_QUANTOOLS
TOOLS_DESC= Build tools
TOOLS_CMAKE_BOOL= MNN_BUILD_TOOLS
TRAIN_DESC= Build MNN's training framework
TRAIN_CMAKE_BOOL= MNN_BUILD_TRAIN
.include <bsd.port.pre.mk>
.if ${ARCH} != amd64 && ${ARCH} != i386
@ -57,22 +51,15 @@ CMAKE_ARGS+= -DMNN_USE_AVX:BOOL=OFF \
pre-build: # https://github.com/alibaba/MNN/issues/648
@cd ${WRKSRC}/schema && ./generate.sh
do-install-APPS-on:
.for f in MNNConvert MNNV2Basic.out mobilenetTest.out backendTest.out testModel.out testModelWithDescrisbe.out getPerformance.out checkInvalidValue.out timeProfile.out quantized.out \
transformer.out train.out rawDataTransform.out dataTransformer.out runTrainDemo.out
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${f} ${STAGEDIR}${PREFIX}/bin
.endfor
do-install-CONVERTER-on:
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/MNNConvert ${STAGEDIR}${PREFIX}/bin
do-install-QUANTOOLS-on:
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/quantized.out ${STAGEDIR}${PREFIX}/bin
do-install-TOOLS-on:
.for f in MNNV2Basic.out mobilenetTest.out backendTest.out testModel.out testModelWithDescrisbe.out getPerformance.out checkInvalidValue.out timeProfile.out
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${f} ${STAGEDIR}${PREFIX}/bin
.endfor
do-install-TRAIN-on:
.for f in transformer.out train.out rawDataTransform.out dataTransformer.out runTrainDemo.out
${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${f} ${STAGEDIR}${PREFIX}/bin
.endfor
do-test:
@cd ${BUILD_WRKSRC} && \
${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} -DMNN_BUILD_TEST:BOOL=ON ${CMAKE_SOURCE_PATH} && \

View File

@ -0,0 +1,10 @@
--- express/CMakeLists.txt.orig 2020-05-23 09:47:07 UTC
+++ express/CMakeLists.txt
@@ -9,6 +9,7 @@ IF(MNN_SEP_BUILD)
endif()
add_library(MNN_Express SHARED ${MNN_EXPR_SRCS})
target_link_libraries(MNN_Express MNN)
+ install(TARGETS MNN_Express LIBRARY DESTINATION lib)
ELSE()
add_library(MNNExpress OBJECT ${MNN_EXPR_SRCS})
ENDIF()

View File

@ -0,0 +1,10 @@
--- tools/converter/CMakeLists.txt.orig 2020-05-23 09:34:50 UTC
+++ tools/converter/CMakeLists.txt
@@ -40,6 +40,7 @@ IF(MNN_BUILD_CONVERTER)
IF(MNN_BUILD_SHARED_LIBS)
add_library(MNNConvertDeps SHARED ${COMMON_SRC} ${MNN_CONVERTER_BACKENDS_OBJECTS} ${CMAKE_CURRENT_LIST_DIR}/../../3rd_party/flatbuffers/src/util.cpp)
add_dependencies(MNNConvertDeps MNN)
+ install(TARGETS MNNConvertDeps LIBRARY DESTINATION lib)
ELSE()
add_library(MNNConvertDeps STATIC ${COMMON_SRC} ${MNN_CONVERTER_BACKENDS_OBJECTS} ${CMAKE_CURRENT_LIST_DIR}/../../3rd_party/flatbuffers/src/util.cpp)
ENDIF()

View File

@ -0,0 +1,10 @@
--- tools/train/CMakeLists.txt.orig 2020-05-23 09:17:28 UTC
+++ tools/train/CMakeLists.txt
@@ -28,6 +28,7 @@ else()
add_library(MNNTrain ${MNN_LIBARY_TYPE} ${GRAD} ${BASIC_INCLUDE} ${PARAMETER} ${OPTIMIZER} ${MODULES} ${DATALOADER} ${TRANSFORMER} ${MODELS} ${DATASETS})
endif()
target_link_libraries(MNNTrain ${MNN_DEPS})
+install(TARGETS MNNTrain LIBRARY DESTINATION lib)
add_executable(transformer.out ${CMAKE_CURRENT_LIST_DIR}/source/exec/transformerExecution.cpp)
target_link_libraries(transformer.out MNNTrain)

View File

@ -1,4 +1,4 @@
MNN is a lightweight deep neural network inference engine. It loads models and
do inference on devices.
does inference on devices.
WWW: https://github.com/alibaba/MNN

View File

@ -1,18 +1,18 @@
%%CONVERTER%%bin/MNNConvert
%%QUANTOOLS%%bin/quantized.out
%%TOOLS%%bin/MNNV2Basic.out
%%TOOLS%%bin/backendTest.out
%%TOOLS%%bin/checkInvalidValue.out
%%TOOLS%%bin/getPerformance.out
%%TOOLS%%bin/mobilenetTest.out
%%TOOLS%%bin/testModel.out
%%TOOLS%%bin/testModelWithDescrisbe.out
%%TOOLS%%bin/timeProfile.out
%%TRAIN%%bin/dataTransformer.out
%%TRAIN%%bin/rawDataTransform.out
%%TRAIN%%bin/runTrainDemo.out
%%TRAIN%%bin/train.out
%%TRAIN%%bin/transformer.out
%%APPS%%bin/MNNV2Basic.out
%%APPS%%bin/backendTest.out
%%APPS%%bin/checkInvalidValue.out
%%APPS%%bin/dataTransformer.out
%%APPS%%bin/getPerformance.out
%%APPS%%bin/mobilenetTest.out
%%APPS%%bin/quantized.out
%%APPS%%bin/rawDataTransform.out
%%APPS%%bin/runTrainDemo.out
%%APPS%%bin/testModel.out
%%APPS%%bin/testModelWithDescrisbe.out
%%APPS%%bin/timeProfile.out
%%APPS%%bin/train.out
%%APPS%%bin/transformer.out
include/MNN/AutoTime.hpp
include/MNN/ErrorCode.hpp
include/MNN/expr/Executor.hpp
@ -30,3 +30,6 @@ include/MNN/expr/MathOp.hpp
include/MNN/expr/NeuralNetWorkOp.hpp
include/MNN/expr/Optimizer.hpp
lib/libMNN.so
%%APPS%%lib/libMNN_Express.so
%%CONVERTER%%lib/libMNNConvertDeps.so
%%APPS%%lib/libMNNTrain.so