6 from setuptools
import setup
7 from setuptools
import Extension
9 from distutils.core
import setup
10 from distutils.extension
import Extension
12 from Cython.Build
import cythonize
20 from numpy
import get_include
as numpy_get_include
27 win32_build = os.name ==
"nt"
28 linux_build = sys.platform.startswith(
"linux")
30 sha512 = hashlib.sha512()
32 len,
"@CYTHON_BINDINGS_SOURCES@;@CYTHON_BINDINGS_GENERATE_SOURCES@".split(
";")
37 if os.path.isabs(src):
40 return "{}/{}".format(
"@CMAKE_CURRENT_SOURCE_DIR@", src)
43 src_files = map(absolute, src_files)
46 with open(f,
"r")
as fd:
50 sha512.update(data.encode(
"ascii"))
53 version_hash = sha512.hexdigest()[:7]
57 ret = os.path.basename(path)
58 dot_idx = ret.find(
".")
66 compile_args =
"@CYTHON_BINDINGS_COMPILE_DEFINITIONS@"
67 self.
compile_args = [
"-D" + x
for x
in compile_args.split(
";")
if len(x)]
69 include_dirs =
"@CYTHON_BINDINGS_INCLUDE_DIRECTORIES@"
72 self.
include_dirs.append(
"@CMAKE_CURRENT_SOURCE_DIR@/include")
74 library_dirs =
"@CYTHON_BINDINGS_LINK_FLAGS@"
78 for lib
in "@CYTHON_BINDINGS_LIBRARIES@".split(
";")
84 for lib
in "@CYTHON_BINDINGS_TARGET_FILES@".split(
";")
91 self.
link_args += [
"-Wl,--no-as-needed",
"-l{}".format(lib)]
96 for lib
in "@CYTHON_BINDINGS_STATIC_LIBRARIES@".split(
";")
120 map(cxx_standard,
"0;@CYTHON_BINDINGS_CXX_STANDARD@".split(
";")),
121 key=cxx_standard_cmp,
123 if cxx_standard != 0:
125 config.compile_args.append(
"-std=c++{}".format(cxx_standard))
129 if cxx_standard >= 17:
130 config.compile_args.append(
"-Wno-register")
132 if cxx_standard > 17:
133 config.compile_args.append(
"/std:c++latest")
134 elif cxx_standard == 17:
135 config.compile_args.append(
"/std:c++17")
138 config.compile_args.append(
"-DWIN32")
139 if "$<CONFIGURATION>".lower() ==
"debug":
140 config.compile_args += [
"-Zi",
"/Od"]
141 config.link_args += [
"-debug"]
145 pyx_src = name.replace(
".",
"/")
146 pyx_src = pyx_src +
".pyx"
151 extra_compile_args=config.compile_args,
152 include_dirs=config.include_dirs,
153 library_dirs=config.library_dirs,
154 libraries=config.libraries,
155 extra_link_args=config.link_args,
156 extra_objects=config.extra_objects,
160 extensions = [
GenExtension(x)
for x
in "@CYTHON_BINDINGS_MODULES@".split(
";")]
162 extensions = cythonize(extensions)
164 packages = [p.split(
".")[0]
for p
in "@CYTHON_BINDINGS_MODULES@".split(
";")]
168 lambda x: x.replace(p +
"/",
""),
170 lambda x: x.startswith(p +
"/"),
171 "@CYTHON_BINDINGS_EXPORT_SOURCES@".split(
";"),
179 name=
"@CYTHON_BINDINGS_PACKAGE_NAME@",
180 version=
"@CYTHON_BINDINGS_VERSION@+{}".format(version_hash),
181 ext_modules=extensions,
183 package_data=package_data,