From 7a53982fdd62b5059471d89da25c027cfcb73849 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Tue, 21 Feb 2023 19:31:14 +0100 Subject: [PATCH] Initial commit --- setup.py | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..9f9722a --- /dev/null +++ b/setup.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +import Cython.Build +import setuptools +import sysconfig + +libname = "cnorxz" +author = "Christian Zimmermann" +author_email = "chizeta@f3l.de" + +inc_dirs = list() +#inc_dirs.append( "@INSTALL_PATH@/include" ) +# ^ specify cnorxz path in command line by typing 'pip install --install-option="--library-dirs=..."' + +lib_dirs = list() +lib_dirs.append( "/usr/lib" ) +lib_dirs.append( "/usr/local/lib" ) +#lib_dirs.append( "@INSTALL_PATH@/lib" ) + +extra_compile_args = sysconfig.get_config_var('CFLAGS').split() +extra_compile_args += ["-std=c++17", "-Wall", "-Wextra", "-Wpedantic"] # get this automatically from cnorxz itself?? + +default_extension_args = dict( + language = "c++", + include_dirs = inc_dirs, + libraries = [libname], + library_dirs = lib_dirs, + extra_compile_args = extra_compile_args, +) + +if __name__ == "__main__": + print("Include directories:") + for d in inc_dirs: + print("\t",d) + print("Library directories:") + for d in lib_dirs: + print("\t",d) + + extensions = list() + extensions.append( + setuptools.Extension( + name = libname + ".base", + sources = [ + "base/ranges.pys", + "base/array.pys", + ], + **default_extension_args + ) + ) + # append further extensions (cereal, hdf5, mpi ...) here + + setuptools.setup( + name = libname, + packages = setuptools.find_packages(), + version_format='{tag}.dev{commitcount}+{gitsha}', + setup_requires=['setuptools-git-version'] + include_dirs = inc_dirs, + ext_modules = Cython.Build.cythonize(extensions), + author = author, + author_email = author_email, + )