summaryrefslogtreecommitdiff
blob: 1f2eda350a62d591de71d73b7a2939fbc0999c72 (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{6,7} )

CMAKE_MAKEFILE_GENERATOR="emake"
inherit cmake python-any-r1

DESCRIPTION="Cross platform unit testing framework for C and C++"
HOMEPAGE="https://github.com/Snaipe/Criterion"
SRC_URI="https://github.com/Snaipe/Criterion/releases/download/v${PV}/${PN}-v${PV}.tar.bz2"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test"
RESTRICT="!test? ( test )"

RDEPEND="dev-libs/nanomsg:="
DEPEND="${RDEPEND}
	test? (
		$(python_gen_any_dep 'dev-util/cram[${PYTHON_USEDEP}]')
	)"
BDEPEND="virtual/pkgconfig"

PATCHES="${FILESDIR}/${PN}-libdir.patch"
S="${WORKDIR}/${PN}-v${PV}"

QA_EXECSTACK="usr/lib*/libcriterion.so*"

python_check_deps() {
	has_version "dev-util/cram[${PYTHON_USEDEP}]"
}

pkg_setup() {
	use test && python-any-r1_pkg_setup
}

src_configure() {
	local mycmakeargs=(
		-DCTESTS="$(usex test ON OFF)"
	)

	cmake_src_configure
}

src_compile() {
	cmake_src_compile

	if use test; then
		cmake_build criterion_tests
	fi
}