setup.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. 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","cmsismodule.c"))
  41. module1 = Extension(config.extensionName,
  42. sources = (support
  43. + fastmath
  44. + filtering
  45. + matrix
  46. + statistics
  47. + complexf
  48. + basic
  49. + controller
  50. + transform
  51. + modulesrc
  52. + common
  53. )
  54. ,
  55. include_dirs = includes + [numpy.get_include()],
  56. #extra_compile_args = ["-Wno-unused-variable","-Wno-implicit-function-declaration",config.cflags]
  57. extra_compile_args = cflags
  58. )
  59. setup (name = config.setupName,
  60. version = '0.0.1',
  61. description = config.setupDescription,
  62. ext_modules = [module1],
  63. author = 'Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.',
  64. url="https://github.com/ARM-software/CMSIS_5",
  65. classifiers=[
  66. "Programming Language :: Python",
  67. "License :: OSI Approved :: Apache Software License",
  68. "Operating System :: OS Independent",
  69. ])