summaryrefslogtreecommitdiff
path: root/graphics/shaderc/Makefile
blob: fcf4c0cb4ac5332fcec2c0bcfc5fce6586ee146f (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

PORTNAME=	shaderc
DISTVERSIONPREFIX=	v
DISTVERSION=	2020.5
CATEGORIES=	graphics devel

MAINTAINER=	jbeich@FreeBSD.org
COMMENT=	GLSL/HLSL to SPIR-V shader compiler

LICENSE=	APACHE20

BUILD_DEPENDS=	glslang>0:graphics/glslang \
		spirv-tools>0:graphics/spirv-tools

USES=		cmake compiler:c++11-lib localbase:ldflags python:3.4+,build
USE_GITHUB=	yes
USE_LDCONFIG=	yes
GH_ACCOUNT=	google
GH_TUPLE=	KhronosGroup:SPIRV-Headers:1.5.4.raytracing.fixed-32-ga3fdfe8:headers/third_party/spirv-headers
CMAKE_ARGS=	-Dglslang_SOURCE_DIR:PATH="${LOCALBASE}/include/glslang" \
		-DSPIRV-Headers_SOURCE_DIR:PATH="${WRKSRC}/third_party/spirv-headers"
LDFLAGS+=	-Wl,-z,defs # glslang

OPTIONS_DEFINE=	TEST

TEST_BUILD_DEPENDS=	googletest>0:devel/googletest
TEST_TEST_TARGET=	test
TEST_CMAKE_BOOL_OFF=	SHADERC_SKIP_TESTS

post-patch:
# Disable bundled dependencies
	${REINPLACE_CMD} '/third_party/d' ${WRKSRC}/CMakeLists.txt
# Unbreak tests with system spirv-tools
	${REINPLACE_CMD} 's,\$$<TARGET_FILE:\(spirv-dis\)>,\1,' \
		${WRKSRC}/glslc/test/CMakeLists.txt

pre-configure:
# Extract (snapshot) version from the port instead of CHANGES + .git/
	${REINPLACE_CMD} '/build-version/d' ${WRKSRC}/glslc/CMakeLists.txt
	${ECHO_CMD} "\"${PORTNAME} ${DISTVERSIONFULL}\n\"" >> ${WRKSRC}/glslc/src/build-version.inc
	${ECHO_CMD} "\"`${PKG_BIN} query '%n v%v' spirv-tools`\n\"" >> ${WRKSRC}/glslc/src/build-version.inc
	${ECHO_CMD} "\"`${PKG_BIN} query '%n %v' glslang`\n\"" >> ${WRKSRC}/glslc/src/build-version.inc

pre-install-TEST-on:	do-test

.include <bsd.port.mk>