ports/unix/Makefile: Move up "HAVE_LIBUSB" code to be effective.

There is a code that evaluates "HAVE_LIBUSB" and then sets
"MICROPY_BLUETOOTH_BTSTACK_USB" and "MICROPY_BLUETOOTH_BTSTACK_H4"
accordingly.
That code has been moved before "include $(TOP)/extmod/extmod.mk"
to be effective.

Details:
"include $(TOP)/extmod/extmod.mk" will
"include $(TOP)/extmod/btstack/btstack.mk"
and that in turn sets
"MICROPY_BLUETOOTH_BTSTACK_USB ?= 0"
"MICROPY_BLUETOOTH_BTSTACK_H4 ?= 1"

Signed-off-by: Yasmin Bosch <development@yasmin-bosch.de>
pull/14006/head
Yasmin Bosch 2024-03-17 16:23:10 +01:00
rodzic cd8eea2ae9
commit 29f6e663e0
1 zmienionych plików z 19 dodań i 12 usunięć

Wyświetl plik

@ -33,6 +33,25 @@ QSTR_GLOBAL_DEPENDENCIES += $(VARIANT_DIR)/mpconfigvariant.h
# OS name, for simple autoconfig
UNAME_S := $(shell uname -s)
# If the variant enables it, enable modbluetooth.
ifeq ($(MICROPY_PY_BLUETOOTH),1)
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
HAVE_LIBUSB := $(shell (which pkg-config > /dev/null && pkg-config --exists libusb-1.0) 2>/dev/null && echo '1')
# Figure out which BTstack transport to use.
ifeq ($(HAVE_LIBUSB),1)
# Default to btstack-over-usb.
MICROPY_BLUETOOTH_BTSTACK_USB ?= 1
MICROPY_BLUETOOTH_BTSTACK_H4 ?= 0
else
# Fallback to HCI controller via a H4 UART (e.g. Zephyr on nRF) over a /dev/tty serial port.
MICROPY_BLUETOOTH_BTSTACK_USB ?= 0
MICROPY_BLUETOOTH_BTSTACK_H4 ?= 1
endif
endif
endif
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/extmod/extmod.mk
@ -144,20 +163,8 @@ ifeq ($(MICROPY_SSL_AXTLS),1)
endif
endif
# If the variant enables it, enable modbluetooth.
ifeq ($(MICROPY_PY_BLUETOOTH),1)
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
HAVE_LIBUSB := $(shell (which pkg-config > /dev/null && pkg-config --exists libusb-1.0) 2>/dev/null && echo '1')
# Figure out which BTstack transport to use.
ifeq ($(HAVE_LIBUSB),1)
# Default to btstack-over-usb.
MICROPY_BLUETOOTH_BTSTACK_USB ?= 1
else
# Fallback to HCI controller via a H4 UART (e.g. Zephyr on nRF) over a /dev/tty serial port.
MICROPY_BLUETOOTH_BTSTACK_H4 ?= 1
endif
SRC_BTSTACK_C += lib/btstack/platform/embedded/btstack_run_loop_embedded.c
endif
endif