setup.py 4.7 KB

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