xref: /btstack/3rd-party/lc3-google/test/setup.py (revision 4930cef6e21e6da2d7571b9259c7f0fb8bed3d01)
1*4930cef6SMatthias Ringwald#!/usr/bin/env python3
2*4930cef6SMatthias Ringwald#
3*4930cef6SMatthias Ringwald# Copyright 2022 Google LLC
4*4930cef6SMatthias Ringwald#
5*4930cef6SMatthias Ringwald# Licensed under the Apache License, Version 2.0 (the "License");
6*4930cef6SMatthias Ringwald# you may not use this file except in compliance with the License.
7*4930cef6SMatthias Ringwald# You may obtain a copy of the License at
8*4930cef6SMatthias Ringwald#
9*4930cef6SMatthias Ringwald#     http://www.apache.org/licenses/LICENSE-2.0
10*4930cef6SMatthias Ringwald#
11*4930cef6SMatthias Ringwald# Unless required by applicable law or agreed to in writing, software
12*4930cef6SMatthias Ringwald# distributed under the License is distributed on an "AS IS" BASIS,
13*4930cef6SMatthias Ringwald# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*4930cef6SMatthias Ringwald# See the License for the specific language governing permissions and
15*4930cef6SMatthias Ringwald# limitations under the License.
16*4930cef6SMatthias Ringwald#
17*4930cef6SMatthias Ringwald
18*4930cef6SMatthias Ringwaldfrom distutils.core import setup, Extension
19*4930cef6SMatthias Ringwaldimport os, sys, glob
20*4930cef6SMatthias Ringwald
21*4930cef6SMatthias Ringwaldif len(sys.argv) <= 1:
22*4930cef6SMatthias Ringwald  sys.argv = sys.argv + [
23*4930cef6SMatthias Ringwald    'build', '--build-base', os.getcwd() + os.sep + 'build',
24*4930cef6SMatthias Ringwald    'install', '--install-lib', os.getcwd() + os.sep + 'build' ]
25*4930cef6SMatthias Ringwald
26*4930cef6SMatthias RingwaldINC_DIR = '..' + os.sep + 'include'
27*4930cef6SMatthias RingwaldSRC_DIR = '..' + os.sep + 'src'
28*4930cef6SMatthias Ringwald
29*4930cef6SMatthias Ringwaldsources = glob.glob('*_py.c') + \
30*4930cef6SMatthias Ringwald          [ SRC_DIR + os.sep + 'tables.c',
31*4930cef6SMatthias Ringwald            SRC_DIR + os.sep + 'bits.c',
32*4930cef6SMatthias Ringwald            SRC_DIR + os.sep + 'plc.c' ]
33*4930cef6SMatthias Ringwald
34*4930cef6SMatthias Ringwalddepends = [ 'ctypes.h' ] + \
35*4930cef6SMatthias Ringwald          glob.glob(INC_DIR + os.sep + '*.h') + \
36*4930cef6SMatthias Ringwald          glob.glob(SRC_DIR + os.sep + '*.[c,h]')
37*4930cef6SMatthias Ringwald
38*4930cef6SMatthias Ringwaldincludes = [ SRC_DIR, INC_DIR ]
39*4930cef6SMatthias Ringwald
40*4930cef6SMatthias Ringwaldctiming = Extension('lc3',
41*4930cef6SMatthias Ringwald  extra_compile_args = ['-std=c11'],
42*4930cef6SMatthias Ringwald  define_macros = [ ('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION') ],
43*4930cef6SMatthias Ringwald  sources = sources,
44*4930cef6SMatthias Ringwald  depends = depends,
45*4930cef6SMatthias Ringwald  include_dirs = includes)
46*4930cef6SMatthias Ringwald
47*4930cef6SMatthias Ringwaldsetup(name = 'LC3',
48*4930cef6SMatthias Ringwald      version = '1.0',
49*4930cef6SMatthias Ringwald      description = 'LC3 Test Python Module',
50*4930cef6SMatthias Ringwald      ext_modules = [ctiming])
51