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

EAPI=7

PYTHON_COMPAT=( python2_7 )
inherit mercurial cmake cuda flag-o-matic python-any-r1

EHG_REPO_URI="https://bitbucket.org/simoncblyth/${PN}"
EHG_REVISION="a580e704afe9d2c138072835e986542c835c29fc"

DESCRIPTION="GPU Optical Photon Simulation for Particle Physics"
HOMEPAGE="https://simoncblyth.bitbucket.io"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="dev-util/nvidia-cuda-sdk
	dev-libs/optix
	media-gfx/openmesh
	media-libs/DualContouringSample
	media-libs/implicitmesher
	media-libs/assimp
	media-libs/glfw
	media-libs/glew:0
	media-libs/glm
	media-libs/yocto-gl
	media-libs/imgui
	sci-physics/geant[gdml]"
DEPEND="sci-physics/opticks-okconf
	dev-libs/boost
	dev-util/bcm
	dev-util/plog
	${PYTHON_DEPS}
	${RDEPEND}"
PATCHES=( "${FILESDIR}"/opticks-0.0.1_split-cmake.patch
	"${FILESDIR}"/opticks-0.0.1_okconf.patch
	"${FILESDIR}"/opticks-0.0.1_cuda-helper.patch
	"${FILESDIR}"/opticks-0.0.1_extG4-CLHEP.patch
	"${FILESDIR}"/opticks-0.0.1_python-helper.patch )
CMAKE_REMOVE_MODULES_LIST="${CMAKE_REMOVE_MODULES_LIST} FindBoost"

pkg_setup() {
	# opticks combined build is not parallel.
	export MAKEOPTS="-j1"

	python-any-r1_pkg_setup
}

src_prepare() {
	cmake_src_prepare

	# do not add the default '-O2' that results in nvcc error of
	# nvcc fatal   : redefinition of argument 'optimize'
	export NVCCFLAGS=
	cuda_src_prepare

	# do not install the tests
	for f in $(find -path '*/tests/CMakeLists.txt'); do
		ebegin "Removing installation phrase from ${f}"
		sed '/install(TARGETS/d' -i ${f}
		eend $?
	done
	# do not install test scripts
	ebegin "Removing test scripts installation from optixrap/{,tests/}CMakeLists.txt"
	sed -e '/install(PROGRAMS/d' \
		-e '/installcache/d' \
		-i optixrap/CMakeLists.txt \
		-i optixrap/tests/CMakeLists.txt || die
	eend $?
	ebegin "Removing test scripts installation from ggeo/tests/CMakeLists.txt"
	sed -e '/install(FILES/,/)/d' -i ggeo/tests/CMakeLists.txt
	eend $?
	ebegin "Moving glsl into share in oglrap/CMakeLists.txt"
	sed -e "s,gl),share/${PN}/gl)," -i oglrap/CMakeLists.txt
	eend $?

	ebegin "Removing python bindings from sysrap/CMakeLists.txt"
	sed -e "/py\/opticks\/sysrap/d" -i sysrap/CMakeLists.txt
	eend $?

	# integrated build OpticksBuildOptions is included at the top
	for f in */CMakeLists.txt; do
		ebegin "Removing OpticksBuildOptions include from ${f}"
		sed '/OpticksBuildOptions/d' -i ${f}
		eend $?
	done

	# include/Opticks instead of OpticksCore
	sed -e 's,include/OpticksCore,include/Opticks,' -i optickscore/OpticksFlags.cc \
		-i npy/Types.cpp \
		-i ana/base.py \
		-i ana/enum.py
}

src_configure() {
	local mycmakeargs=(
		-DCMAKE_MODULE_PATH="${S}"/cmake/Modules
		-DOptiX_INSTALL_DIR="${EPREFIX}/opt/optix"
		-DCUDA_SDK_ROOT_DIR="${EPREFIX}/opt/cuda/sdk"
		-DCOMPUTE_CAPABILITY=61
		-DCUDA_NVCC_FLAGS="${NVCCFLAGS}"
		-DBoost_NO_BOOST_CMAKE=ON
		--target all
	)
	cmake_src_configure
}