aboutsummaryrefslogtreecommitdiff
path: root/misc/mnn/Makefile
blob: 62a3799973016f3680356cdf15e9d742aaf8169c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
PORTNAME=	mnn
DISTVERSION=	2.9.0
PORTREVISION=	2
CATEGORIES=	misc # machine-learning

MAINTAINER=	yuri@FreeBSD.org
COMMENT=	Lightweight deep neural network inference engine
WWW=		https://github.com/alibaba/MNN

LICENSE=	APACHE20

BROKEN_i386=	always_inline function '_mm_set1_ps' requires target feature 'sse', but would be inlined into function 'Vec4' that is compiled without support for 'sse'

BUILD_DEPENDS=	bash:shells/bash

USES=		cmake:testing compiler:c++11-lang localbase shebangfix
USE_LDCONFIG=	yes

USE_GITHUB=	yes
GH_ACCOUNT=	alibaba
GH_PROJECT=	MNN

SHEBANG_GLOB=	*.sh

CMAKE_TESTING_ON=	MNN_BUILD_TEST
CMAKE_TESTING_TARGET=

CXXFLAGS+=	-pthread
LDFLAGS+=	-pthread

CFLAGS+=	-fPIC # workaround for https://github.com/alibaba/MNN/issues/553
CXXFLAGS+=	-fPIC

OPTIONS_DEFINE=		APPS CONVERTER HARD_FP
OPTIONS_DEFAULT=	APPS CONVERTER HARD_FP
OPTIONS_SUB=		yes

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

.include <bsd.port.pre.mk>

.if ${ARCH} != amd64 && ${ARCH} != i386
CMAKE_ARGS+=	-DMNN_USE_AVX:BOOL=OFF \
		-DMNN_USE_SSE:BOOL=OFF
.endif

do-install-APPS-on:
.for f in	extractForInfer fuseTest \
		MNNDump2Json MNNRevert2Buffer MNNV2Basic.out \
		ModuleBasic.out \
		mobilenetTest.out backendTest.out testModel.out getPerformance.out checkInvalidValue.out \
		mobilenetTest.out \
		OnnxClip \
		SequenceModuleTest.out \
		timeProfile.out quantized.out \
		runTrainDemo.out \
		testModel_expr.out testModelWithDescribe.out testTrain.out timeProfile.out transformer winogradExample.out
	${INSTALL_PROGRAM} ${BUILD_WRKSRC}/${f} ${STAGEDIR}${PREFIX}/bin
.endfor

do-install-CONVERTER-on:
	${INSTALL_PROGRAM} ${BUILD_WRKSRC}/MNNConvert ${STAGEDIR}${PREFIX}/bin
	${INSTALL_LIB} ${BUILD_WRKSRC}/tools/converter/libMNNConvertDeps.so ${STAGEDIR}${PREFIX}/lib

post-test:
	@cd ${BUILD_WRKSRC} && \
		cd ${BUILD_WRKSRC} && ./run_test.out

# 5 tests fail, see https://github.com/alibaba/MNN/issues/2358

.include <bsd.port.post.mk>