# $OpenBSD$

# See patches/patch-cmake_platforms_OpenBSD-clang_cmake, which
# configures the compiler with -msse3.  This is probably trivial to fix.

ONLY_FOR_ARCHS =	amd64

COMMENT =		programming library of geometric algorithms

V =			1.7.3
DISTNAME =		geogram_${V}
PKGNAME =		geogram-${V}
CATEGORIES =		math
HOMEPAGE =		http://alice.loria.fr/software/geogram/doc/html/index.html
REVISION =		0

SHARED_LIBS +=		geogram			0.0 # 1.7.3
SHARED_LIBS +=		geogram_gfx		0.0 # 1.7.3
SHARED_LIBS +=		geogram_num_3rdparty	0.0 # 1.7.3

# New BSD License
# A number of internal (bundled) systems have different licenses.
# These are documented here:
# http://alice.loria.fr/software/geogram/doc/html/geogram_license.html
PERMIT_PACKAGE =	Yes

MASTER_SITES =		https://gforge.inria.fr/frs/download.php/file/38229/

# We could do gcc but it'd require another cmake/platforms.
# See patches/patch-cmake_platforms_OpenBSD-clang_cmake for details.

COMPILER =		base-clang

WANTLIB += 		${COMPILER_LIBCXX} GL GLU X11 Xcursor Xi Xinerama Xrandr
WANTLIB += 		Xxf86vm c m glfw

BUILD_DEPENDS =		devel/doxygen \
			graphics/glfw>=3.3 \
			math/graphviz

RUN_DEPENDS =		graphics/glfw>=3.3

MODULES =		devel/cmake

# Required for finding glfw. 

CONFIGURE_ENV +=	CXXFLAGS="-I${LOCALBASE}/include" \
			CFLAGS="-I${LOCALBASE}/include" \
			LDFLAGS="-L${LOCALBASE}/lib"
CONFIGURE_ARGS +=	-DGEOGRAM_SOURCE_DIR="${WRKSRC}" \
			-DVORPALINE_PLATFORM:STRING="OpenBSD" \
			-DGEOGRAM_USE_SYSTEM_GLFW3=ON

NO_TEST =		Yes

# Generate the documentation, too.

post-build:
	cd ${WRKBUILD}; ninja doc-devkit-full

.include <bsd.port.mk>
