Skip to content

Commit

Permalink
python wrapper cross-compilation refinements
Browse files Browse the repository at this point in the history
bugfixes
RPi driver set as preferred
  • Loading branch information
martin-mat committed Mar 24, 2016
1 parent 891becd commit 2c6d28a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
11 changes: 5 additions & 6 deletions configure
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
# set -x

CROSS_CC=arm-linux-gnueabihf-gcc
CROSS_CXX=arm-linux-gnueabihf-g++
Expand Down Expand Up @@ -67,7 +66,7 @@ function detect_machine {
local hardware=$(execute_check "grep Hardware /proc/cpuinfo 2>/dev/null")
local soc="unknown"
local tp="unknown"
hardware=${hardware/*:/}
hardware=$(echo ${hardware/*:/} | sed 's/^ *//g')

if [ -z "$cpu" ]; then
cpu="unknown"
Expand Down Expand Up @@ -149,10 +148,10 @@ function gcc_cpu_flags {
}

function detect_driver {
if [[ $(execute_check 'ls /dev/spidev* 2>/dev/null') ]]; then
result=SPIDEV
elif [[ $(execute_check "cat /proc/cpuinfo | grep Hardware | grep 'BCM2708\|BCM2709'") ]]; then
if [[ $(execute_check "cat /proc/cpuinfo | grep Hardware | grep 'BCM2708\|BCM2709'") ]]; then
result=RPi
elif [[ $(execute_check 'ls /dev/spidev* 2>/dev/null') ]]; then
result=SPIDEV
elif [[ $(execute_check "${REMOTE_LDCONFIG} -p | grep libmraa") ]]; then
result=MRAA
elif [[ $(execute_check "${REMOTE_LDCONFIG} -p | grep liblittlewire-spi") ]]; then
Expand Down Expand Up @@ -341,7 +340,7 @@ if [ -z "${DRIVER}" ]; then
echo "[SECTION] Detecting DRIVER"
DRIVER=$(detect_driver)
if [ -z "${DRIVER}" ]; then
die "No supported driver detected. Run configure with DRIVER=<driver> to set a driver explicitly."
die "No supported driver detected. Run configure with --driver=<driver> to set a driver explicitly."
fi
echo " [OK] DRIVER detected:${DRIVER}."
fi
Expand Down
12 changes: 10 additions & 2 deletions pyRF24/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,25 @@ def process_configparams():
with open('../Makefile.inc') as f:
config_lines = f.readlines()

cflags=os.getenv("CFLAGS", "")
for line in config_lines:
identifier, value = line.split('=', 1)
os.environ[identifier] = value
if identifier == "CPUFLAGS":
cflags += " " + value
elif identifier == "HEADER_DIR":
cflags += " -I" + os.path.dirname(value)
elif identifier == "LIB_DIR":
cflags += " -L" + value

os.environ["CFLAGS"] = cflags


if sys.version_info >= (3,):
BOOST_LIB = 'boost_python3'
else:
BOOST_LIB = 'boost_python'

#process_configparams()
process_configparams()
crossunixccompiler.register()

# module_RF24 = distutils.core.Extension('RF24',
Expand Down

0 comments on commit 2c6d28a

Please sign in to comment.