summaryrefslogtreecommitdiff
path: root/PyGan/src/setup_lcm.py
blob: 79e7891f49f0e8ae95a3448d6de013bc22a338b6 (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
#
# python3 setup_lcm.py install --home=.
#
from sys import version_info
if version_info[0] == 3 and version_info[1] >= 12:
  from setuptools import setup, Extension
elif version_info[0] > 3:
  from setuptools import setup, Extension
else:
  from distutils.core import setup, Extension
import sysconfig
import numpy

def main():
  import os
  incdir = numpy.get_include()
  mach = os.path.basename(os.getcwd())
  Compiler = os.environ.get("COMPILER", None) # Compiler selection
  if Compiler == "NVTOOLS":
    libdir="../../lib/"+mach+"_nvidia"
    libNv=os.environ.get("NVTOOLS", None)+"/../lib"
    extralink=["-lnvc","-lnvcpumath"]
  elif Compiler == "LLVMTOOLS":
    libdir="../../lib/"+mach+"_llvm"
    libNv=" "
    extralink=[ ]
  elif Compiler == "INTELTOOLS":
    libdir="../../lib/"+mach+"_intel"
    libNv=" "
    extralink=[ ]
  else:
    libdir="../../lib/"+mach
    libNv=" "
    extralink=[ ]
  setup(name="Lcm",
          version="5.0",
          description="Python interface for the lcm C library API",
          author="Alain Hebert",
          author_email="alain.hebert@polymtl.ca",
          license="LGPL",
          ext_modules=[Extension("lcm", ["lcmmodule.c"],
                      extra_link_args = extralink,
                      include_dirs=["../../../Ganlib/src",incdir],
                      library_dirs=[libdir,libNv],
                      runtime_library_dirs=[libNv],
                      libraries=["Ganlib"] ) ])

if __name__ == "__main__":
    main()