setup.py 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. from distutils.core import setup, Extension
  2. import glob
  3. import numpy
  4. import config
  5. import sys
  6. import os
  7. from config import ROOT
  8. includes = [os.path.join(ROOT,"Include"),os.path.join("cmsisdsp_pkg","src")]
  9. if sys.platform == 'win32':
  10. cflags = ["-DWIN",config.cflags,"-DUNALIGNED_SUPPORT_DISABLE"]
  11. # Custom because a customized arm_math.h is required to build on windows
  12. # since the visual compiler and the win platform are
  13. # not supported by default in arm_math.h
  14. else:
  15. cflags = ["-Wno-unused-variable","-Wno-implicit-function-declaration",config.cflags,"-D__GNUC_PYTHON__"]
  16. transform = glob.glob(os.path.join(ROOT,"Source","TransformFunctions","*.c"))
  17. #transform.remove(os.path.join(ROOT,"Source","TransformFunctions","arm_dct4_init_q15.c"))
  18. #transform.remove(os.path.join(ROOT,"Source","TransformFunctions","arm_rfft_init_q15.c"))
  19. transform.remove(os.path.join(ROOT,"Source","TransformFunctions","TransformFunctions.c"))
  20. support = glob.glob(os.path.join(ROOT,"Source","SupportFunctions","*.c"))
  21. support.remove(os.path.join(ROOT,"Source","SupportFunctions","SupportFunctions.c"))
  22. fastmath = glob.glob(os.path.join(ROOT,"Source","FastMathFunctions","*.c"))
  23. fastmath.remove(os.path.join(ROOT,"Source","FastMathFunctions","FastMathFunctions.c"))
  24. filtering = glob.glob(os.path.join(ROOT,"Source","FilteringFunctions","*.c"))
  25. filtering.remove(os.path.join(ROOT,"Source","FilteringFunctions","FilteringFunctions.c"))
  26. matrix = glob.glob(os.path.join(ROOT,"Source","MatrixFunctions","*.c"))
  27. matrix.remove(os.path.join(ROOT,"Source","MatrixFunctions","MatrixFunctions.c"))
  28. statistics = glob.glob(os.path.join(ROOT,"Source","StatisticsFunctions","*.c"))
  29. statistics.remove(os.path.join(ROOT,"Source","StatisticsFunctions","StatisticsFunctions.c"))
  30. complexf = glob.glob(os.path.join(ROOT,"Source","ComplexMathFunctions","*.c"))
  31. complexf.remove(os.path.join(ROOT,"Source","ComplexMathFunctions","ComplexMathFunctions.c"))
  32. basic = glob.glob(os.path.join(ROOT,"Source","BasicMathFunctions","*.c"))
  33. basic.remove(os.path.join(ROOT,"Source","BasicMathFunctions","BasicMathFunctions.c"))
  34. controller = glob.glob(os.path.join(ROOT,"Source","ControllerFunctions","*.c"))
  35. controller.remove(os.path.join(ROOT,"Source","ControllerFunctions","ControllerFunctions.c"))
  36. common = glob.glob(os.path.join(ROOT,"Source","CommonTables","*.c"))
  37. common.remove(os.path.join(ROOT,"Source","CommonTables","CommonTables.c"))
  38. #modulesrc = glob.glob(os.path.join("cmsisdsp_pkg","src","*.c"))
  39. modulesrc = []
  40. modulesrc.append(os.path.join("cmsisdsp_pkg","src","fftinit.c"))
  41. modulesrc.append(os.path.join("cmsisdsp_pkg","src","cmsismodule.c"))
  42. module1 = Extension(config.extensionName,
  43. sources = (support
  44. + fastmath
  45. + filtering
  46. + matrix
  47. + statistics
  48. + complexf
  49. + basic
  50. + controller
  51. + transform
  52. + modulesrc
  53. + common
  54. )
  55. ,
  56. include_dirs = includes + [numpy.get_include()],
  57. #extra_compile_args = ["-Wno-unused-variable","-Wno-implicit-function-declaration",config.cflags]
  58. extra_compile_args = cflags
  59. )
  60. setup (name = config.setupName,
  61. version = '0.0.1',
  62. description = config.setupDescription,
  63. ext_modules = [module1],
  64. author = 'Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.',
  65. url="https://github.com/ARM-software/CMSIS_5",
  66. classifiers=[
  67. "Programming Language :: Python",
  68. "License :: OSI Approved :: Apache Software License",
  69. "Operating System :: OS Independent",
  70. ])