summaryrefslogtreecommitdiff
path: root/science/chrono/Makefile
blob: a47a587c68ad1275b8526092ea0ccb2d68e84ef6 (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

PORTNAME=	chrono
DISTVERSION=	6.0.0
CATEGORIES=	science devel
PKGNAMESUFFIX=	-physics-simulation-engine

PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
PATCHFILES=	74df5c76d8d475818138a9a16ceccbd6f326247c.patch:-p1 # https://github.com/projectchrono/chrono/pull/295
PATCHFILES+=	926dba0bef3f72fedff75770582df40fd8423258.patch:-p1 # https://github.com/projectchrono/chrono/pull/296

MAINTAINER=	yuri@FreeBSD.org
COMMENT=	C++ library for multi-physics simulation

LICENSE=	BSD3CLAUSE
LICENSE_FILE=	${WRKSRC}/LICENSE

BROKEN_i386=	use of overloaded operator '[]' is ambiguous (with operand types 'chrono::quaternion' and 'int'): https://github.com/projectchrono/chrono/issues/158

BUILD_DEPENDS=	openmpi>0:net/openmpi

USES=		cmake compiler:c++14-lang eigen:3 fortran
USE_GITHUB=	yes
GH_ACCOUNT=	project${PORTNAME}
USE_LDCONFIG=	yes

ALL_MODULES=		Cascade Cosimulation Distributed FSI Irrlicht Multicore MUMPS OpenGL Pardiso_Project Postprocess Sensor SynChrono Vehicle
# module names in a human readable case; for the list of available modules: grep -r "option(ENABLE_MODULE" work

OPTIONS_DEFINE=			HDF5 DEMOS
OPTIONS_GROUP=			MODULES
OPTIONS_GROUP_MODULES=		${ALL_MODULES:tu}
MODULES_DESC=			Enable modules:
OPTIONS_DEFAULT=		HDF5
OPTIONS_SUB=			yes

HDF5_CMAKE_BOOL=		ENABLE_HDF5
HDF5_LIB_DEPENDS=		libhdf5.so:science/hdf5

DEMOS_DESC=			Build and install demo programs
DEMOS_CMAKE_BOOL=		BUILD_DEMOS
DEMOS_BROKEN=			/usr/local/lib/libdmumps.so: undefined reference to `mpi_pack_'

CASCADE_CMAKE_ON=		-DCASCADE_INCLUDE_DIR:STRING=${LOCALBASE}/include/OpenCASCADE -DCASCADE_LIBDIR:STRING=${LOCALBASE}/lib
CASCADE_LIB_DEPENDS=		libTKernel.so:cad/opencascade

DISTRIBUTED_BROKEN=		requires cuda_runtime_api.h in thrust package which is missing for some reason
DISTRIBUTED_IMPLIES=		MULTICORE

FSI_BROKEN=			requires CUDA

IRRLICHT_LIB_DEPENDS=		libIrrlicht.so:x11-toolkits/irrlicht

MULTICORE_BUILD_DEPENDS=	blaze>0:math/blaze \
				thrust>0:devel/thrust

MUMPS_CMAKE_ON=			-DMUMPS_ROOT:STRING=${LOCALBASE}
MUMPS_LIB_DEPENDS=		libdmumps.so:math/mumps \
				libopenblas.so:math/openblas

PARDISO_PROJECT_BROKEN=		Not available for FreeBSD; License is restrictive

SENSOR_BROKEN=			requires CUDA

SYNCHRONO_USES=			localbase
SYNCHRONO_BUILD_DEPENDS=	flatbuffers>0:devel/flatbuffers
SYNCHRONO_LIB_DEPENDS=		libmpi.so:net/mpich
SYNCHRONO_IMPLIES=		VEHICLE

OPENGL_BROKEN=			Illegal instruction

VEHICLE_LIB_DEPENDS=		libsz.so:science/szip \
				libmpi.so:net/openmpi

.for module in ${ALL_MODULES}
${module:tu}_DESC=		Chrono ${module} module
${module:tu}_CMAKE_BOOL=	ENABLE_MODULE_${module:tu}
.if "${${module:tu}_BROKEN}" == ""
OPTIONS_DEFAULT+=	${module:tu}
.endif
.endfor

#.include <bsd.port.options.mk>
.include <bsd.port.pre.mk>

.if ${PORT_OPTIONS:MCASCADE} && ${PORT_OPTIONS:MIRRLICHT}
PLIST_FILES+=	include/chrono_cascade/ChIrrCascadeMeshTools.h
.endif

.if ${PORT_OPTIONS:MVEHICLE} && ${PORT_OPTIONS:MIRRLICHT}
PLIST_FILES+=	lib/libChronoEngine_vehicle_irrlicht.so
.endif

#.include <bsd.port.pre.mk>

.if ${CHOSEN_COMPILER_TYPE} == gcc
CXXFLAGS+=	-Wno-error=narrowing
.endif

post-extract:
	@${RM} ${WRKSRC}/data/opensim/Rajagopal2015.orig

post-patch:
	@${FIND} ${WRKSRC} -name CMakeLists.txt -o -name "*.cmake*" | ${XARGS} ${REINPLACE_CMD} -i '' 's|lib64|lib|'
	@${REINPLACE_CMD} -e 's/ -march=native//' \
		${WRKSRC}/cmake/FindAVX.cmake \
		${WRKSRC}/cmake/FindFMA.cmake \
		${WRKSRC}/cmake/FindSSE.cmake

do-test:
	@cd ${BUILD_WRKSRC} && \
		${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} -DBUILD_TESTING:BOOL=ON ${CMAKE_SOURCE_PATH} && \
		${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${ALL_TARGET} && \
		ctest -C ${CMAKE_BUILD_TYPE} ${_MAKE_JOBS}

.include <bsd.port.post.mk>