setup.py 4.4 KB

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