xref: /btstack/3rd-party/lc3-google/test/setup.py (revision 4c4eb519208b4224604d94b3ed1931841ddd93bb)
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
18*4c4eb519SMatthias Ringwaldfrom setuptools import setup, Extension
194930cef6SMatthias Ringwaldimport os, sys, glob
204930cef6SMatthias Ringwald
214930cef6SMatthias Ringwaldif len(sys.argv) <= 1:
224930cef6SMatthias Ringwald  sys.argv = sys.argv + [
23*4c4eb519SMatthias Ringwald    'build', '--build-platlib', os.getcwd() + os.sep + 'build' ]
244930cef6SMatthias Ringwald
254930cef6SMatthias RingwaldINC_DIR = '..' + os.sep + 'include'
264930cef6SMatthias RingwaldSRC_DIR = '..' + os.sep + 'src'
274930cef6SMatthias Ringwald
284930cef6SMatthias Ringwaldsources = glob.glob('*_py.c') + \
294930cef6SMatthias Ringwald          [ SRC_DIR + os.sep + 'tables.c',
304930cef6SMatthias Ringwald            SRC_DIR + os.sep + 'bits.c',
314930cef6SMatthias Ringwald            SRC_DIR + os.sep + 'plc.c' ]
324930cef6SMatthias Ringwald
334930cef6SMatthias Ringwalddepends = [ 'ctypes.h' ] + \
344930cef6SMatthias Ringwald          glob.glob(INC_DIR + os.sep + '*.h') + \
354930cef6SMatthias Ringwald          glob.glob(SRC_DIR + os.sep + '*.[c,h]')
364930cef6SMatthias Ringwald
374930cef6SMatthias Ringwaldincludes = [ SRC_DIR, INC_DIR ]
384930cef6SMatthias Ringwald
39*4c4eb519SMatthias Ringwaldextension = Extension('lc3',
40*4c4eb519SMatthias Ringwald  extra_compile_args = [ '-std=c11', '-ffast-math' ],
414930cef6SMatthias Ringwald  define_macros = [ ('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION') ],
424930cef6SMatthias Ringwald  sources = sources,
434930cef6SMatthias Ringwald  depends = depends,
444930cef6SMatthias Ringwald  include_dirs = includes)
454930cef6SMatthias Ringwald
464930cef6SMatthias Ringwaldsetup(name = 'LC3',
474930cef6SMatthias Ringwald      version = '1.0',
484930cef6SMatthias Ringwald      description = 'LC3 Test Python Module',
49*4c4eb519SMatthias Ringwald      ext_modules = [ extension ])
50