setup.py 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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(ROOT,"PrivateInclude"),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. transform.remove(os.path.join(ROOT,"Source","TransformFunctions","TransformFunctionsF16.c"))
  21. support = glob.glob(os.path.join(ROOT,"Source","SupportFunctions","*.c"))
  22. support.remove(os.path.join(ROOT,"Source","SupportFunctions","SupportFunctions.c"))
  23. fastmath = glob.glob(os.path.join(ROOT,"Source","FastMathFunctions","*.c"))
  24. fastmath.remove(os.path.join(ROOT,"Source","FastMathFunctions","FastMathFunctions.c"))
  25. filtering = glob.glob(os.path.join(ROOT,"Source","FilteringFunctions","*.c"))
  26. filtering.remove(os.path.join(ROOT,"Source","FilteringFunctions","FilteringFunctions.c"))
  27. matrix = glob.glob(os.path.join(ROOT,"Source","MatrixFunctions","*.c"))
  28. matrix.remove(os.path.join(ROOT,"Source","MatrixFunctions","MatrixFunctions.c"))
  29. statistics = glob.glob(os.path.join(ROOT,"Source","StatisticsFunctions","*.c"))
  30. statistics.remove(os.path.join(ROOT,"Source","StatisticsFunctions","StatisticsFunctions.c"))
  31. complexf = glob.glob(os.path.join(ROOT,"Source","ComplexMathFunctions","*.c"))
  32. complexf.remove(os.path.join(ROOT,"Source","ComplexMathFunctions","ComplexMathFunctions.c"))
  33. basic = glob.glob(os.path.join(ROOT,"Source","BasicMathFunctions","*.c"))
  34. basic.remove(os.path.join(ROOT,"Source","BasicMathFunctions","BasicMathFunctions.c"))
  35. basic.remove(os.path.join(ROOT,"Source","BasicMathFunctions","BasicMathFunctionsF16.c"))
  36. controller = glob.glob(os.path.join(ROOT,"Source","ControllerFunctions","*.c"))
  37. controller.remove(os.path.join(ROOT,"Source","ControllerFunctions","ControllerFunctions.c"))
  38. common = glob.glob(os.path.join(ROOT,"Source","CommonTables","*.c"))
  39. common.remove(os.path.join(ROOT,"Source","CommonTables","CommonTables.c"))
  40. interpolation = glob.glob(os.path.join(ROOT,"Source","InterpolationFunctions","*.c"))
  41. interpolation.remove(os.path.join(ROOT,"Source","InterpolationFunctions","InterpolationFunctions.c"))
  42. #modulesrc = glob.glob(os.path.join("cmsisdsp_pkg","src","*.c"))
  43. modulesrc = []
  44. modulesrc.append(os.path.join("cmsisdsp_pkg","src","cmsismodule.c"))
  45. module1 = Extension(config.extensionName,
  46. sources = (support
  47. + fastmath
  48. + filtering
  49. + matrix
  50. + statistics
  51. + complexf
  52. + basic
  53. + controller
  54. + transform
  55. + modulesrc
  56. + common
  57. + interpolation
  58. )
  59. ,
  60. include_dirs = includes + [numpy.get_include()],
  61. #extra_compile_args = ["-Wno-unused-variable","-Wno-implicit-function-declaration",config.cflags]
  62. extra_compile_args = cflags
  63. )
  64. setup (name = config.setupName,
  65. version = '0.0.1',
  66. description = config.setupDescription,
  67. ext_modules = [module1],
  68. author = 'Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.',
  69. url="https://github.com/ARM-software/CMSIS_5",
  70. classifiers=[
  71. "Programming Language :: Python",
  72. "License :: OSI Approved :: Apache Software License",
  73. "Operating System :: OS Independent",
  74. ])