setup.in.py
Go to the documentation of this file.
1 #
2 # This file was generated by jrl-cmakemodules, do not modify
3 #
4 
5 try:
6  from setuptools import setup
7  from setuptools import Extension
8 except ImportError:
9  from distutils.core import setup
10  from distutils.extension import Extension
11 
12 from Cython.Build import cythonize
13 
14 import hashlib
15 import os
16 import re
17 
18 try:
19  from numpy import get_include as numpy_get_include
20 except ImportError:
22  return ""
23 
24 win32_build = os.name == 'nt'
25 
26 sha512 = hashlib.sha512()
27 src_files = filter(len, '@CYTHON_BINDINGS_SOURCES@;@CYTHON_BINDINGS_GENERATE_SOURCES@'.split(';'))
28 def absolute(src):
29  if os.path.isabs(src):
30  return src
31  else:
32  return '{}/{}'.format('@CMAKE_CURRENT_SOURCE_DIR@', src)
33 src_files = map(absolute, src_files)
34 for f in src_files:
35  chunk = 2**12
36  with open(f, 'r') as fd:
37  while True:
38  data = fd.read(chunk)
39  if data:
40  sha512.update(data.encode('ascii'))
41  else:
42  break
43 version_hash = sha512.hexdigest()[:7]
44 
45 class pkg_config(object):
46  def __init__(self):
47  compile_args = "@CYTHON_BINDINGS_COMPILE_DEFINITIONS@"
48  self.compile_args = [ "-D" + x for x in compile_args.split(';') if len(x) ]
49  self.compile_args = list(set(self.compile_args))
50  include_dirs = "@CYTHON_BINDINGS_INCLUDE_DIRECTORIES@"
51  include_dirs += ';{}'.format(numpy_get_include())
52  self.include_dirs = [ x for x in include_dirs.split(';') if len(x) ]
53  self.include_dirs.append('@CMAKE_CURRENT_SOURCE_DIR@/include')
54  self.include_dirs = list(set(self.include_dirs))
55  library_dirs = "@CYTHON_BINDINGS_LINK_FLAGS@"
56  self.library_dirs = [ x for x in library_dirs.split(';') if len(x) ]
57  self.libraries = [ re.sub("^lib", "", os.path.splitext(os.path.basename(l))[0]) for l in "@CYTHON_BINDINGS_LIBRARIES@".split(";") if len(l) ]
58  self.libraries = list(set(self.libraries))
59  self.library_dirs += [os.path.dirname(l) for l in "@CYTHON_BINDINGS_TARGET_FILES@".split(';') if len(l) ]
60  self.library_dirs = list(set(self.library_dirs))
61  self.link_args = []
62 
63 config = pkg_config()
64 
65 def cxx_standard(value):
66  try:
67  return int(value)
68  except:
69  return 0
71  if lhs == 98:
72  return 1
73  return lhs
74 cxx_standard = max(map(cxx_standard, "0;@CYTHON_BINDINGS_CXX_STANDARD@".split(';')), key = cxx_standard_cmp)
75 if cxx_standard != 0:
76  config.compile_args.append('-std=c++{}'.format(cxx_standard))
77 
78 if win32_build:
79  config.compile_args.append("-DWIN32")
80  if "$<CONFIGURATION>".lower() == "debug":
81  config.compile_args += ["-Zi", "/Od"]
82  config.link_args += ["-debug"]
83 
84 def GenExtension(name):
85  pyx_src = name.replace('.', '/')
86  pyx_src = pyx_src + '.pyx'
87  ext_src = pyx_src
88  return Extension(name, [ext_src], extra_compile_args = config.compile_args, include_dirs = config.include_dirs, library_dirs = config.library_dirs, libraries = config.libraries, extra_link_args = config.link_args)
89 
90 extensions = [ GenExtension(x) for x in '@CYTHON_BINDINGS_MODULES@'.split(';') ]
91 
92 extensions = cythonize(extensions)
93 
94 packages = [ p.split('.')[0] for p in '@CYTHON_BINDINGS_MODULES@'.split(';') ]
95 package_data = { p : list(map(lambda x: x.replace(p + '/', ''), filter(lambda x: x.startswith(p + '/'), '@CYTHON_BINDINGS_EXPORT_SOURCES@'.split(';')))) for p in packages }
96 
97 setup(
98  name = '@CYTHON_BINDINGS_PACKAGE_NAME@',
99  version='@CYTHON_BINDINGS_VERSION@-{}'.format(version_hash),
100  ext_modules = extensions,
101  packages = packages,
102  package_data = package_data
103 )
Definition: setup.in.py:1
def cxx_standard_cmp(lhs)
Definition: setup.in.py:70
def numpy_get_include()
Definition: setup.in.py:21
def GenExtension(name)
Definition: setup.in.py:84
def absolute(src)
Definition: setup.in.py:28
def __init__(self)
Definition: setup.in.py:46
cxx_standard
Definition: setup.in.py:74


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 17 2021 02:37:59