blob: a860aa76f2a00a1c6d7666dad1e7aab94575ad17 [file] [log] [blame]
Christophe Favergeon53f828f2019-03-25 13:42:44 +01001from distutils.core import setup, Extension
2import glob
3import numpy
4import config
5import sys
6import os
7from config import ROOT
8
Christophe Favergeonaefd2772020-01-08 09:01:17 +01009includes = [os.path.join(ROOT,"Include"),os.path.join(ROOT,"PrivateInclude"),os.path.join("cmsisdsp_pkg","src")]
Christophe Favergeon53f828f2019-03-25 13:42:44 +010010
11if sys.platform == 'win32':
12 cflags = ["-DWIN",config.cflags,"-DUNALIGNED_SUPPORT_DISABLE"]
13 # Custom because a customized arm_math.h is required to build on windows
14 # since the visual compiler and the win platform are
15 # not supported by default in arm_math.h
16else:
Chris Knorowski chris.knorowski@sensiml.com25124162019-08-19 12:37:17 -070017 cflags = ["-Wno-unused-variable","-Wno-implicit-function-declaration",config.cflags,"-D__GNUC_PYTHON__"]
Christophe Favergeon53f828f2019-03-25 13:42:44 +010018
19transform = glob.glob(os.path.join(ROOT,"Source","TransformFunctions","*.c"))
Christophe Favergeon9e284082019-05-23 09:08:30 +020020#transform.remove(os.path.join(ROOT,"Source","TransformFunctions","arm_dct4_init_q15.c"))
21#transform.remove(os.path.join(ROOT,"Source","TransformFunctions","arm_rfft_init_q15.c"))
Christophe Favergeon53f828f2019-03-25 13:42:44 +010022transform.remove(os.path.join(ROOT,"Source","TransformFunctions","TransformFunctions.c"))
Christophe Favergeon2f12ed82020-07-22 09:10:21 +020023transform.remove(os.path.join(ROOT,"Source","TransformFunctions","TransformFunctionsF16.c"))
Christophe Favergeon53f828f2019-03-25 13:42:44 +010024
25support = glob.glob(os.path.join(ROOT,"Source","SupportFunctions","*.c"))
26support.remove(os.path.join(ROOT,"Source","SupportFunctions","SupportFunctions.c"))
27
28fastmath = glob.glob(os.path.join(ROOT,"Source","FastMathFunctions","*.c"))
29fastmath.remove(os.path.join(ROOT,"Source","FastMathFunctions","FastMathFunctions.c"))
30
31filtering = glob.glob(os.path.join(ROOT,"Source","FilteringFunctions","*.c"))
32filtering.remove(os.path.join(ROOT,"Source","FilteringFunctions","FilteringFunctions.c"))
Christophe Favergeon626af7e2020-08-05 07:28:13 +020033filtering.remove(os.path.join(ROOT,"Source","FilteringFunctions","FilteringFunctionsF16.c"))
Christophe Favergeon53f828f2019-03-25 13:42:44 +010034
35matrix = glob.glob(os.path.join(ROOT,"Source","MatrixFunctions","*.c"))
36matrix.remove(os.path.join(ROOT,"Source","MatrixFunctions","MatrixFunctions.c"))
Christophe Favergeon116bc4d2020-08-06 11:00:40 +020037matrix.remove(os.path.join(ROOT,"Source","MatrixFunctions","MatrixFunctionsF16.c"))
Christophe Favergeon53f828f2019-03-25 13:42:44 +010038
39statistics = glob.glob(os.path.join(ROOT,"Source","StatisticsFunctions","*.c"))
40statistics.remove(os.path.join(ROOT,"Source","StatisticsFunctions","StatisticsFunctions.c"))
41
42complexf = glob.glob(os.path.join(ROOT,"Source","ComplexMathFunctions","*.c"))
43complexf.remove(os.path.join(ROOT,"Source","ComplexMathFunctions","ComplexMathFunctions.c"))
Christophe Favergeon626af7e2020-08-05 07:28:13 +020044complexf.remove(os.path.join(ROOT,"Source","ComplexMathFunctions","ComplexMathFunctionsF16.c"))
Christophe Favergeon53f828f2019-03-25 13:42:44 +010045
46basic = glob.glob(os.path.join(ROOT,"Source","BasicMathFunctions","*.c"))
47basic.remove(os.path.join(ROOT,"Source","BasicMathFunctions","BasicMathFunctions.c"))
Christophe Favergeon2f12ed82020-07-22 09:10:21 +020048basic.remove(os.path.join(ROOT,"Source","BasicMathFunctions","BasicMathFunctionsF16.c"))
Christophe Favergeon53f828f2019-03-25 13:42:44 +010049
50controller = glob.glob(os.path.join(ROOT,"Source","ControllerFunctions","*.c"))
51controller.remove(os.path.join(ROOT,"Source","ControllerFunctions","ControllerFunctions.c"))
52
Christophe Favergeon9e284082019-05-23 09:08:30 +020053common = glob.glob(os.path.join(ROOT,"Source","CommonTables","*.c"))
54common.remove(os.path.join(ROOT,"Source","CommonTables","CommonTables.c"))
Christophe Favergeon53f828f2019-03-25 13:42:44 +010055
Christophe Favergeon2f12ed82020-07-22 09:10:21 +020056interpolation = glob.glob(os.path.join(ROOT,"Source","InterpolationFunctions","*.c"))
57interpolation.remove(os.path.join(ROOT,"Source","InterpolationFunctions","InterpolationFunctions.c"))
58
59
Christophe Favergeon9e284082019-05-23 09:08:30 +020060#modulesrc = glob.glob(os.path.join("cmsisdsp_pkg","src","*.c"))
61modulesrc = []
Christophe Favergeon9e284082019-05-23 09:08:30 +020062modulesrc.append(os.path.join("cmsisdsp_pkg","src","cmsismodule.c"))
Christophe Favergeon53f828f2019-03-25 13:42:44 +010063
64module1 = Extension(config.extensionName,
65 sources = (support
66 + fastmath
67 + filtering
68 + matrix
69 + statistics
70 + complexf
71 + basic
72 + controller
73 + transform
74 + modulesrc
Christophe Favergeon9e284082019-05-23 09:08:30 +020075 + common
Christophe Favergeon2f12ed82020-07-22 09:10:21 +020076 + interpolation
Christophe Favergeon53f828f2019-03-25 13:42:44 +010077 )
78 ,
79 include_dirs = includes + [numpy.get_include()],
80 #extra_compile_args = ["-Wno-unused-variable","-Wno-implicit-function-declaration",config.cflags]
81 extra_compile_args = cflags
82 )
83
84setup (name = config.setupName,
85 version = '0.0.1',
86 description = config.setupDescription,
87 ext_modules = [module1],
88 author = 'Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.',
89 url="https://github.com/ARM-software/CMSIS_5",
90 classifiers=[
91 "Programming Language :: Python",
92 "License :: OSI Approved :: Apache Software License",
93 "Operating System :: OS Independent",
Chris Knorowski chris.knorowski@sensiml.com25124162019-08-19 12:37:17 -070094 ])