mock: mraa with mock platform now works in Windows under MSYS2
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
bcb6adc551
commit
1af737f3d9
@@ -104,6 +104,9 @@ endif()
|
||||
if (MOCKPLAT)
|
||||
add_subdirectory(mock)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMOCKPLAT=1")
|
||||
if (MSYS)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMSYS=1")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (USBPLAT)
|
||||
@@ -228,4 +231,9 @@ set_target_properties(
|
||||
SOVERSION ${mraa_VERSION_MAJOR}
|
||||
VERSION ${mraa_VERSION_STRING}
|
||||
)
|
||||
install(TARGETS mraa DESTINATION ${LIB_INSTALL_DIR})
|
||||
if (MSYS)
|
||||
# Under MSYS we have to put our generated DLL into bin, otherwise it's not picked up
|
||||
install(TARGETS mraa DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
else ()
|
||||
install(TARGETS mraa DESTINATION ${LIB_INSTALL_DIR})
|
||||
endif ()
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/errno.h>
|
||||
#if defined(MSYS)
|
||||
#define __USE_LINUX_IOCTL_DEFS
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#include "linux/i2c-dev.h"
|
||||
#include <errno.h>
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#include "dirent.h"
|
||||
#include <string.h>
|
||||
#include <poll.h>
|
||||
#if defined(MSYS)
|
||||
#define __USE_LINUX_IOCTL_DEFS
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ if (PYTHON2_LIBRARY)
|
||||
COMPILE_FLAGS "${CMAKE_C_FLAGS} -DSWIGPYTHON=${SWIG_FOUND}"
|
||||
)
|
||||
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/_mraa.so
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/_mraa${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mraa.py
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON2_PACKAGES_PATH})
|
||||
endif()
|
||||
|
||||
@@ -18,7 +18,7 @@ if (PYTHON3_LIBRARY)
|
||||
COMPILE_FLAGS "${CMAKE_C_FLAGS} -DSWIGPYTHON=${SWIG_FOUND}"
|
||||
)
|
||||
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/_mraa.so
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/_mraa${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mraa.py
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON3_PACKAGES_PATH})
|
||||
endif ()
|
||||
|
||||
@@ -25,8 +25,17 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(MSYS)
|
||||
#define __USE_LINUX_IOCTL_DEFS
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#if defined(MSYS)
|
||||
// There's no spidev.h on MSYS, so we need to provide our own,
|
||||
// and only *after* including ioctl.h as that one contains prerequisites.
|
||||
#include "linux/spi_kernel_headers.h"
|
||||
#else
|
||||
#include <linux/spi/spidev.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -102,10 +102,12 @@ uint2speed(unsigned int speed)
|
||||
return B2500000;
|
||||
case 3000000:
|
||||
return B3000000;
|
||||
#if !defined(MSYS)
|
||||
case 3500000:
|
||||
return B3500000;
|
||||
case 4000000:
|
||||
return B4000000;
|
||||
#endif
|
||||
default:
|
||||
// if we are here, then an unsupported baudrate was selected.
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user