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