51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
import os
|
|
from distutils.core import setup, Extension
|
|
|
|
user = os.getenv('USER', None)
|
|
|
|
if user == 'pi':
|
|
macros = [('_RASPBERRY_PI3_', None)]
|
|
else:
|
|
macros = None
|
|
|
|
c_compile_flags = ['-std=gnu11']
|
|
|
|
H_RECORDING = 'recording.h'
|
|
H_SAMPLE = 'sample.h'
|
|
H_CHANNEL = 'channel.h'
|
|
|
|
util_recording = Extension('recording',
|
|
define_macros=macros,
|
|
extra_compile_args=c_compile_flags,
|
|
depends=[H_RECORDING, H_CHANNEL],
|
|
sources=['recording.c'])
|
|
|
|
util_message = Extension('message',
|
|
define_macros=macros,
|
|
extra_compile_args=c_compile_flags,
|
|
depends=[H_RECORDING, H_SAMPLE, H_CHANNEL],
|
|
sources=['message.c'])
|
|
|
|
util_export = Extension('export',
|
|
define_macros=macros,
|
|
extra_compile_args=c_compile_flags,
|
|
depends=[H_RECORDING, H_SAMPLE, H_CHANNEL, 'export.h', 'export_txt.h', 'export_csv.h'],
|
|
sources=['export.c'])
|
|
|
|
util_bpsspi = Extension('bpsspi',
|
|
define_macros=macros,
|
|
extra_compile_args=c_compile_flags,
|
|
extra_link_args=['-lwiringPi'] if user == 'pi' else [],
|
|
depends=['wiringPi.h'],
|
|
sources=['bpsspi.c'])
|
|
util_channel = Extension('channel',
|
|
define_macros=macros,
|
|
extra_compile_args=c_compile_flags,
|
|
depends=[H_CHANNEL],
|
|
sources=['channel.c'])
|
|
|
|
setup(name='BPSC',
|
|
version='1.0',
|
|
description='BPS Data Server C Extension',
|
|
ext_modules=[util_recording, util_message, util_export, util_bpsspi, util_channel])
|