xref: /btstack/3rd-party/lc3-google/test/setup.py (revision 6897da5c53aac5b1f90f41b5b15d0bd43d61dfff)
14930cef6SMatthias Ringwald#!/usr/bin/env python3
24930cef6SMatthias Ringwald#
34930cef6SMatthias Ringwald# Copyright 2022 Google LLC
44930cef6SMatthias Ringwald#
54930cef6SMatthias Ringwald# Licensed under the Apache License, Version 2.0 (the "License");
64930cef6SMatthias Ringwald# you may not use this file except in compliance with the License.
74930cef6SMatthias Ringwald# You may obtain a copy of the License at
84930cef6SMatthias Ringwald#
94930cef6SMatthias Ringwald#     http://www.apache.org/licenses/LICENSE-2.0
104930cef6SMatthias Ringwald#
114930cef6SMatthias Ringwald# Unless required by applicable law or agreed to in writing, software
124930cef6SMatthias Ringwald# distributed under the License is distributed on an "AS IS" BASIS,
134930cef6SMatthias Ringwald# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
144930cef6SMatthias Ringwald# See the License for the specific language governing permissions and
154930cef6SMatthias Ringwald# limitations under the License.
164930cef6SMatthias Ringwald#
174930cef6SMatthias Ringwald
184c4eb519SMatthias Ringwaldfrom setuptools import setup, Extension
194930cef6SMatthias Ringwaldimport os, sys, glob
20*6897da5cSDirk Helbigimport numpy
214930cef6SMatthias Ringwald
224930cef6SMatthias Ringwaldif len(sys.argv) <= 1:
234930cef6SMatthias Ringwald  sys.argv = sys.argv + [
244c4eb519SMatthias Ringwald    'build', '--build-platlib', os.getcwd() + os.sep + 'build' ]
254930cef6SMatthias Ringwald
264930cef6SMatthias RingwaldINC_DIR = '..' + os.sep + 'include'
274930cef6SMatthias RingwaldSRC_DIR = '..' + os.sep + 'src'
284930cef6SMatthias Ringwald
294930cef6SMatthias Ringwaldsources = glob.glob('*_py.c') + \
304930cef6SMatthias Ringwald          [ SRC_DIR + os.sep + 'tables.c',
314930cef6SMatthias Ringwald            SRC_DIR + os.sep + 'bits.c',
324930cef6SMatthias Ringwald            SRC_DIR + os.sep + 'plc.c' ]
334930cef6SMatthias Ringwald
344930cef6SMatthias Ringwalddepends = [ 'ctypes.h' ] + \
354930cef6SMatthias Ringwald          glob.glob(INC_DIR + os.sep + '*.h') + \
364930cef6SMatthias Ringwald          glob.glob(SRC_DIR + os.sep + '*.[c,h]')
374930cef6SMatthias Ringwald
38*6897da5cSDirk Helbigincludes = [ SRC_DIR, INC_DIR, numpy.get_include() ]
394930cef6SMatthias Ringwald
404c4eb519SMatthias Ringwaldextension = Extension('lc3',
414c4eb519SMatthias Ringwald  extra_compile_args = [ '-std=c11', '-ffast-math' ],
424930cef6SMatthias Ringwald  define_macros = [ ('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION') ],
434930cef6SMatthias Ringwald  sources = sources,
444930cef6SMatthias Ringwald  depends = depends,
454930cef6SMatthias Ringwald  include_dirs = includes)
464930cef6SMatthias Ringwald
474930cef6SMatthias Ringwaldsetup(name = 'LC3',
484930cef6SMatthias Ringwald      version = '1.0',
494930cef6SMatthias Ringwald      description = 'LC3 Test Python Module',
504c4eb519SMatthias Ringwald      ext_modules = [ extension ])
51