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

EAPI=7

PYTHON_COMPAT=( python3_{10..11} )

inherit cmake python-r1 virtualx

DESCRIPTION="Abstract, manage and coordinate execution of tasks"
HOMEPAGE="https://www.openchemistry.org/projects/molequeue/"
SRC_URI="https://github.com/OpenChemistry/molequeue/archive/${PV}.tar.gz -> ${P}.tar.gz"

SLOT="0"
LICENSE="BSD"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"

IUSE="+client doc server test +zeromq"
REQUIRED_USE="
	server? ( client )
	test? ( server )
	zeromq? ( ${PYTHON_REQUIRED_USE} )
"
# Some tests still fail
RESTRICT="test !test? ( test )"

BDEPEND="
	doc? ( app-doc/doxygen )
"
RDEPEND="
	dev-qt/qtcore:5
	dev-qt/qtgui:5
	dev-qt/qtnetwork:5
	dev-qt/qtwidgets:5
	zeromq? (
		${PYTHON_DEPS}
		net-libs/cppzmq:0=
	)
"
DEPEND="${RDEPEND}"

src_configure() {
	configuration() {
		local mycmakeargs=(
			-DMoleQueue_USE_EZHPC_UIT=OFF
			-DBUILD_DOCUMENTATION=$(usex doc)
			-DMoleQueue_BUILD_CLIENT=$(usex client)
			-DMoleQueue_BUILD_APPLICATION=$(usex server)
			-DENABLE_TESTING=$(usex test)
			-DUSE_ZERO_MQ=$(usex zeromq)
			-DINSTALL_LIBRARY_DIR=$(get_libdir)
		)
		use zeromq && \
			mycmakeargs+=( "-DZeroMQ_ROOT_DIR=\"${EPREFIX}/usr\"" )

		cmake_src_configure
	}
	if use zeromq; then
		python_foreach_impl run_in_build_dir configuration
	else
		configuration
	fi
}

src_compile() {
	if use zeromq; then
		my_src_compile() {
			run_in_build_dir cmake_src_compile all $(usex doc documentation "")
			use doc && export HTML_DOCS=( "${BUILD_DIR}"/docs/html/. )
		}
		python_foreach_impl my_src_compile
	else
		cmake_src_compile all $(usex doc documentation "")
		use doc && export HTML_DOCS=( "${BUILD_DIR}"/docs/html/. )
	fi
}

src_test() {
	if use zeromq; then
		python_foreach_impl run_in_build_dir virtx cmake_src_test
	else
		virtx cmake_src_test
	fi
}

src_install() {
	if use zeromq; then
		python_foreach_impl run_in_build_dir cmake_src_install
		python_foreach_impl run_in_build_dir python_optimize
	else
		cmake_src_install
	fi
}