From: Paul Brossier Date: Fri, 2 Dec 2016 12:03:41 +0000 (+0100) Subject: python/lib/moresetuptools.py: also check for HAVE_AUBIO_DOUBLE X-Git-Tag: 0.4.4~104 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=3d148298842da32516a81f05446dda7f1b905c93;p=aubio.git python/lib/moresetuptools.py: also check for HAVE_AUBIO_DOUBLE --- diff --git a/.travis.yml b/.travis.yml index 2ae4548d..2dca23c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,19 +29,19 @@ matrix: - python: 2.7 os: linux compiler: gcc - env: ARCH=x86_64 HAVE_DOUBLE=1 WAFOPTS=--enable-fftw3 + env: ARCH=x86_64 HAVE_AUBIO_DOUBLE=1 WAFOPTS=--enable-fftw3 - python: 2.7 os: linux compiler: gcc - env: ARCH=i386 HAVE_DOUBLE=1 + env: ARCH=i386 HAVE_AUBIO_DOUBLE=1 - python: 3.4 os: linux compiler: gcc - env: ARCH=x86_64 HAVE_DOUBLE=1 + env: ARCH=x86_64 HAVE_AUBIO_DOUBLE=1 - python: 3.4 os: linux compiler: gcc - env: ARCH=i386 HAVE_DOUBLE=1 + env: ARCH=i386 HAVE_AUBIO_DOUBLE=1 - language: C os: osx compiler: clang diff --git a/Makefile b/Makefile index daedae93..8fb72194 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,9 @@ WAFOPTS += --verbose WAFOPTS += --destdir $(DESTDIR) # multiple jobs WAFOPTS += --jobs 4 +# if HAVE_AUBIO_DOUBLE is defined, pass --enable-double to waf +# python/lib/moresetuptools.py also checks for HAVE_AUBIO_DOUBLE +WAFOPTS += $(shell [ -z $(HAVE_AUBIO_DOUBLE) ] || echo --enable-double ) DESTDIR:=$(PWD)/build/dist PYDESTDIR:=$(PWD)/build/pydist @@ -22,7 +25,6 @@ MANDIR?=$(DATAROOTDIR)/man SOX=sox -ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double ) TESTSOUNDS := python/tests/sounds all: build @@ -44,7 +46,7 @@ cleanwaf: rm -rf waf waflib .waf* configure: checkwaf - $(WAFCMD) configure $(WAFOPTS) $(ENABLE_DOUBLE) + $(WAFCMD) configure $(WAFOPTS) build: configure $(WAFCMD) build $(WAFOPTS) @@ -81,7 +83,7 @@ delete_install: build_python: # build python-aubio, using locally built libaubio if found - python ./setup.py build_ext $(ENABLE_DOUBLE) + python ./setup.py build build_python_extlib: # build python-aubio using (locally) installed libaubio @@ -162,7 +164,7 @@ check_distclean: make distclean distcheck: checkwaf - $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE) + $(WAFCMD) distcheck $(WAFOPTS) help: $(WAFCMD) --help diff --git a/python/lib/gen_external.py b/python/lib/gen_external.py index c6a13d4f..bbd7e5db 100644 --- a/python/lib/gen_external.py +++ b/python/lib/gen_external.py @@ -75,10 +75,12 @@ def get_preprocessor(): return cpp_cmd -def get_cpp_objects(header=header): +def get_cpp_objects(header=header, usedouble=False): cpp_cmd = get_preprocessor() macros = [('AUBIO_UNSTABLE', 1)] + if usedouble: + macros += [('HAVE_AUBIO_DOUBLE', 1)] if not os.path.isfile(header): raise Exception("could not find include file " + header) @@ -176,7 +178,7 @@ def generate_external(header=header, output_path=output_path, usedouble=False, o if not os.path.isdir(output_path): os.mkdir(output_path) elif not overwrite: return sorted(glob.glob(os.path.join(output_path, '*.c'))) - cpp_output, cpp_objects = get_cpp_objects(header) + cpp_output, cpp_objects = get_cpp_objects(header, usedouble=usedouble) lib = analyze_cpp_output(cpp_objects, cpp_output) # print_cpp_output_results(lib, cpp_output) diff --git a/python/lib/moresetuptools.py b/python/lib/moresetuptools.py index 519e8aa8..d3567f96 100644 --- a/python/lib/moresetuptools.py +++ b/python/lib/moresetuptools.py @@ -151,8 +151,11 @@ class build_ext(_build_ext): level=distutils.log.INFO) def build_extension(self, extension): - if self.enable_double: + if self.enable_double or 'HAVE_AUBIO_DOUBLE' in os.environ: extension.define_macros += [('HAVE_AUBIO_DOUBLE', 1)] + enable_double = True + else: + enable_double = False # seack for aubio headers and lib in PKG_CONFIG_PATH add_system_aubio(extension) # the lib was not installed on this system @@ -166,10 +169,10 @@ class build_ext(_build_ext): add_local_aubio_lib(extension) else: # check for external dependencies - add_external_deps(extension, usedouble=self.enable_double) + add_external_deps(extension, usedouble=enable_double) # add libaubio sources and look for optional deps with pkg-config - add_local_aubio_sources(extension, usedouble=self.enable_double) + add_local_aubio_sources(extension, usedouble=enable_double) # generate files python/gen/*.c, python/gen/aubio-generated.h extension.sources += generate_external(header, output_path, overwrite = False, - usedouble=self.enable_double) + usedouble=enable_double) return _build_ext.build_extension(self, extension)