Christophe Favergeon | 53f828f | 2019-03-25 13:42:44 +0100 | [diff] [blame] | 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 | |
Christophe Favergeon | 9e28408 | 2019-05-23 09:08:30 +0200 | [diff] [blame^] | 9 | includes = [os.path.join(ROOT,"Include"),os.path.join("cmsisdsp_pkg","src")] |
Christophe Favergeon | 53f828f | 2019-03-25 13:42:44 +0100 | [diff] [blame] | 10 | |
| 11 | if 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 |
| 16 | else: |
| 17 | cflags = ["-Wno-unused-variable","-Wno-implicit-function-declaration",config.cflags] |
| 18 | |
| 19 | transform = glob.glob(os.path.join(ROOT,"Source","TransformFunctions","*.c")) |
Christophe Favergeon | 9e28408 | 2019-05-23 09:08:30 +0200 | [diff] [blame^] | 20 | #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 Favergeon | 53f828f | 2019-03-25 13:42:44 +0100 | [diff] [blame] | 22 | transform.remove(os.path.join(ROOT,"Source","TransformFunctions","TransformFunctions.c")) |
| 23 | |
| 24 | support = glob.glob(os.path.join(ROOT,"Source","SupportFunctions","*.c")) |
| 25 | support.remove(os.path.join(ROOT,"Source","SupportFunctions","SupportFunctions.c")) |
| 26 | |
| 27 | fastmath = glob.glob(os.path.join(ROOT,"Source","FastMathFunctions","*.c")) |
| 28 | fastmath.remove(os.path.join(ROOT,"Source","FastMathFunctions","FastMathFunctions.c")) |
| 29 | |
| 30 | filtering = glob.glob(os.path.join(ROOT,"Source","FilteringFunctions","*.c")) |
| 31 | filtering.remove(os.path.join(ROOT,"Source","FilteringFunctions","FilteringFunctions.c")) |
| 32 | |
| 33 | matrix = glob.glob(os.path.join(ROOT,"Source","MatrixFunctions","*.c")) |
| 34 | matrix.remove(os.path.join(ROOT,"Source","MatrixFunctions","MatrixFunctions.c")) |
| 35 | |
| 36 | statistics = glob.glob(os.path.join(ROOT,"Source","StatisticsFunctions","*.c")) |
| 37 | statistics.remove(os.path.join(ROOT,"Source","StatisticsFunctions","StatisticsFunctions.c")) |
| 38 | |
| 39 | complexf = glob.glob(os.path.join(ROOT,"Source","ComplexMathFunctions","*.c")) |
| 40 | complexf.remove(os.path.join(ROOT,"Source","ComplexMathFunctions","ComplexMathFunctions.c")) |
| 41 | |
| 42 | basic = glob.glob(os.path.join(ROOT,"Source","BasicMathFunctions","*.c")) |
| 43 | basic.remove(os.path.join(ROOT,"Source","BasicMathFunctions","BasicMathFunctions.c")) |
| 44 | |
| 45 | controller = glob.glob(os.path.join(ROOT,"Source","ControllerFunctions","*.c")) |
| 46 | controller.remove(os.path.join(ROOT,"Source","ControllerFunctions","ControllerFunctions.c")) |
| 47 | |
Christophe Favergeon | 9e28408 | 2019-05-23 09:08:30 +0200 | [diff] [blame^] | 48 | common = glob.glob(os.path.join(ROOT,"Source","CommonTables","*.c")) |
| 49 | common.remove(os.path.join(ROOT,"Source","CommonTables","CommonTables.c")) |
Christophe Favergeon | 53f828f | 2019-03-25 13:42:44 +0100 | [diff] [blame] | 50 | |
Christophe Favergeon | 9e28408 | 2019-05-23 09:08:30 +0200 | [diff] [blame^] | 51 | #modulesrc = glob.glob(os.path.join("cmsisdsp_pkg","src","*.c")) |
| 52 | modulesrc = [] |
| 53 | modulesrc.append(os.path.join("cmsisdsp_pkg","src","fftinit.c")) |
| 54 | modulesrc.append(os.path.join("cmsisdsp_pkg","src","cmsismodule.c")) |
Christophe Favergeon | 53f828f | 2019-03-25 13:42:44 +0100 | [diff] [blame] | 55 | |
| 56 | module1 = Extension(config.extensionName, |
| 57 | sources = (support |
| 58 | + fastmath |
| 59 | + filtering |
| 60 | + matrix |
| 61 | + statistics |
| 62 | + complexf |
| 63 | + basic |
| 64 | + controller |
| 65 | + transform |
| 66 | + modulesrc |
Christophe Favergeon | 9e28408 | 2019-05-23 09:08:30 +0200 | [diff] [blame^] | 67 | + common |
Christophe Favergeon | 53f828f | 2019-03-25 13:42:44 +0100 | [diff] [blame] | 68 | ) |
| 69 | , |
| 70 | include_dirs = includes + [numpy.get_include()], |
| 71 | #extra_compile_args = ["-Wno-unused-variable","-Wno-implicit-function-declaration",config.cflags] |
| 72 | extra_compile_args = cflags |
| 73 | ) |
| 74 | |
| 75 | setup (name = config.setupName, |
| 76 | version = '0.0.1', |
| 77 | description = config.setupDescription, |
| 78 | ext_modules = [module1], |
| 79 | author = 'Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.', |
| 80 | url="https://github.com/ARM-software/CMSIS_5", |
| 81 | classifiers=[ |
| 82 | "Programming Language :: Python", |
| 83 | "License :: OSI Approved :: Apache Software License", |
| 84 | "Operating System :: OS Independent", |
| 85 | ]) |