Skip to content

Commit 5f8afe0

Browse files
committed
[build] Add spack package
1 parent cb41aac commit 5f8afe0

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

spack/include_path.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git i/userproject/include/generateRun.h w/userproject/include/generateRun.h
2+
index 84fd3525a..14994563c 100644
3+
--- i/userproject/include/generateRun.h
4+
+++ w/userproject/include/generateRun.h
5+
@@ -17,7 +17,7 @@
6+
#endif
7+
8+
// CLI11 includes
9+
-#include "../../include/genn/third_party/CLI11.hpp"
10+
+#include "genn/third_party/CLI11.hpp"
11+
12+
//------------------------------------------------------------------------
13+
// GenerateRunBase

spack/package.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
2+
# Spack Project Developers. See the top-level COPYRIGHT file for details.
3+
#
4+
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
5+
6+
from spack import *
7+
8+
9+
class Genn(PythonPackage):
10+
"""GeNN is a GPU-enhanced Neuronal Network simulation environment based on
11+
code generation for Nvidia CUDA."""
12+
13+
homepage = "https://genn-team.github.io/genn/"
14+
url = "https://github.com/genn-team/genn/archive/refs/tags/4.6.0.tar.gz"
15+
16+
version('4.6.0', sha256='5e5ca94fd3a56b5b963a4911ea1b2130df6fa7dcdde3b025bd8cb85d4c2d3236')
17+
18+
conflicts('%gcc@:4.9.3')
19+
depends_on('gmake', type='build')
20+
21+
variant('cuda', default=True, description='Enable CUDA support')
22+
depends_on('cuda', when='+cuda')
23+
24+
variant('python', default=True, description='Enable PyGeNN')
25+
extends('python', when='+python')
26+
depends_on('[email protected]:', when='+python')
27+
depends_on('[email protected]:', when='+python')
28+
depends_on('py-six', when='+python')
29+
depends_on('py-deprecated', when='+python')
30+
depends_on('py-psutil', when='+python')
31+
depends_on('[email protected]:', when='+python')
32+
depends_on('swig', when='+python')
33+
34+
patch('include_path.patch')
35+
36+
def build(self, spec, prefix):
37+
make('PREFIX={}'.format(prefix), 'install')
38+
if '+python' in self.spec:
39+
make('DYNAMIC=1', 'LIBRARY_DIRECTORY={}/pygenn/genn_wrapper/'.format(self.stage.source_path))
40+
super(Genn, self).build(spec, prefix)
41+
42+
def install(self, spec, prefix):
43+
install_tree('bin', prefix.bin)
44+
install_tree('include', prefix.include)
45+
mkdirp(prefix.src.genn)
46+
install_tree('src/genn', prefix.src.genn)
47+
if '+python' in self.spec:
48+
super(Genn, self).install(spec, prefix)
49+
50+
def setup_run_environment(self, env):
51+
env.append_path('CPLUS_INCLUDE_PATH', self.prefix.include)
52+
if '+cuda' in self.spec:
53+
env.append_path('CUDA_PATH', self.spec['cuda'].prefix)
54+
if '+python' in self.spec:
55+
super(Genn, self).setup_run_environment(env)

0 commit comments

Comments
 (0)