setup.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from glob import glob
  2. from os import path
  3. from setuptools import Extension, setup
  4. ROOT_DIR = path.dirname(path.realpath(__file__))
  5. MOD_DIR = path.join(ROOT_DIR, 'cpython')
  6. SRC_DIR = path.join(ROOT_DIR, 'src')
  7. INCL_DIR = path.join(ROOT_DIR, 'include')
  8. EXT_DIR = path.join(ROOT_DIR, 'ext')
  9. sources = (
  10. glob(path.join(SRC_DIR, '*.c')) +
  11. glob(path.join(MOD_DIR, '*.c')) +
  12. [
  13. path.join(EXT_DIR, 'openldap', 'libraries', 'liblmdb', 'mdb.c'),
  14. path.join(EXT_DIR, 'openldap', 'libraries', 'liblmdb', 'midl.c'),
  15. path.join(EXT_DIR, 'xxHash', 'xxhash.c'),
  16. ]
  17. )
  18. debug = True
  19. compile_args = [
  20. '-std=c99',
  21. ]
  22. if debug:
  23. compile_args.extend(['-DDEBUG', '-g3', '-O0'])
  24. else:
  25. compile_args.extend(['-g0', '-O3'])
  26. setup(
  27. name="lsup_rdf",
  28. version="1.0a1",
  29. description='Ultra-compact RDF library.',
  30. author='Stefano Cossu <https://notabug.org/scossu>',
  31. url='https://notabug.org/scossu/lsup_rdf',
  32. license='https://notabug.org/scossu/lsup_rdf/src/master/LICENSE',
  33. package_dir={'lsup_rdf': path.join(MOD_DIR, 'lsup_rdf')},
  34. packages=['lsup_rdf'],
  35. ext_modules=[
  36. Extension(
  37. "_lsup_rdf",
  38. sources,
  39. include_dirs=[
  40. INCL_DIR,
  41. path.join(EXT_DIR, 'uthash', 'src'),
  42. ],
  43. libraries=['uuid'],
  44. extra_compile_args=compile_args,
  45. ),
  46. ],
  47. )