git-svn-id: svn://db.shs.com.ru/pip@588 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -371,13 +371,17 @@ endif()
|
|||||||
# Check if PIP support OpenCL
|
# Check if PIP support OpenCL
|
||||||
find_package(OpenCL QUIET)
|
find_package(OpenCL QUIET)
|
||||||
if(OpenCL_FOUND)
|
if(OpenCL_FOUND)
|
||||||
message(STATUS "Building with OpenCL support")
|
message(STATUS "Building with OpenCL support)")
|
||||||
|
if(APPLE)
|
||||||
|
include_directories(${OpenCL_INCLUDE_DIRS}/Headers)
|
||||||
|
else()
|
||||||
include_directories(${OpenCL_INCLUDE_DIRS})
|
include_directories(${OpenCL_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
add_definitions(-DPIP_OPENCL)
|
add_definitions(-DPIP_OPENCL)
|
||||||
pip_resources(CL_RES "src_opencl/resources.conf")
|
pip_resources(CL_RES "src_opencl/resources.conf")
|
||||||
add_library(pip_opencl SHARED ${CPP_LIB_OPENCL} ${CL_RES})
|
add_library(pip_opencl SHARED ${CPP_LIB_OPENCL} ${CL_RES})
|
||||||
add_dependencies(pip_opencl pip_rc)
|
add_dependencies(pip_opencl pip_rc)
|
||||||
target_link_libraries(pip_opencl pip ${OpenCL_LIBRARIES})
|
target_link_libraries(pip_opencl pip OpenCL::OpenCL)
|
||||||
list(APPEND LIBS_STATUS OpenCL)
|
list(APPEND LIBS_STATUS OpenCL)
|
||||||
list(APPEND PIP_LIBS_TARGETS pip_opencl)
|
list(APPEND PIP_LIBS_TARGETS pip_opencl)
|
||||||
set(OpenCL_FOUND ${OpenCL_LIBRARIES})
|
set(OpenCL_FOUND ${OpenCL_LIBRARIES})
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#include "pispi.h"
|
#include "pispi.h"
|
||||||
#include "piincludes_p.h"
|
#include "piincludes_p.h"
|
||||||
#ifndef WINDOWS
|
#if !defined(WINDOWS) && !defined(MAC_OS)
|
||||||
|
# define PISPI
|
||||||
|
#endif
|
||||||
|
#ifdef PISPI
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
# include <linux/spi/spidev.h>
|
# include <linux/spi/spidev.h>
|
||||||
@@ -8,7 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
PRIVATE_DEFINITION_START(PISPI)
|
PRIVATE_DEFINITION_START(PISPI)
|
||||||
#ifndef WINDOWS
|
#ifdef PISPI
|
||||||
int fd;
|
int fd;
|
||||||
spi_ioc_transfer spi_ioc_tr;
|
spi_ioc_transfer spi_ioc_tr;
|
||||||
#endif
|
#endif
|
||||||
@@ -26,7 +29,7 @@ PISPI::PISPI(const PIString & path, uint speed, PIIODevice::DeviceMode mode) : P
|
|||||||
spi_mode = 0;
|
spi_mode = 0;
|
||||||
if (mode == ReadOnly)
|
if (mode == ReadOnly)
|
||||||
piCoutObj << "error, SPI can't work in ReadOnly mode";
|
piCoutObj << "error, SPI can't work in ReadOnly mode";
|
||||||
#ifndef WINDOWS
|
#ifdef PISPI
|
||||||
PRIVATE->fd = 0;
|
PRIVATE->fd = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -56,7 +59,7 @@ bool PISPI::isParameterSet(PISPI::Parameters parameter) const {
|
|||||||
|
|
||||||
|
|
||||||
bool PISPI::openDevice() {
|
bool PISPI::openDevice() {
|
||||||
#ifndef WINDOWS
|
#ifdef PISPI
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
//piCoutObj << "open device" << path();
|
//piCoutObj << "open device" << path();
|
||||||
PRIVATE->fd = ::open(path().dataAscii(), O_RDWR);
|
PRIVATE->fd = ::open(path().dataAscii(), O_RDWR);
|
||||||
@@ -83,7 +86,7 @@ bool PISPI::openDevice() {
|
|||||||
|
|
||||||
|
|
||||||
bool PISPI::closeDevice() {
|
bool PISPI::closeDevice() {
|
||||||
#ifndef WINDOWS
|
#ifdef PISPI
|
||||||
if (PRIVATE->fd) ::close(PRIVATE->fd);
|
if (PRIVATE->fd) ::close(PRIVATE->fd);
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
@@ -99,7 +102,7 @@ int PISPI::readDevice(void * read_to, int max_size) {
|
|||||||
|
|
||||||
|
|
||||||
int PISPI::writeDevice(const void * data, int max_size) {
|
int PISPI::writeDevice(const void * data, int max_size) {
|
||||||
#ifndef WINDOWS
|
#ifdef PISPI
|
||||||
if (max_size > 0) {
|
if (max_size > 0) {
|
||||||
if (tx_buf.size_s() != max_size) {
|
if (tx_buf.size_s() != max_size) {
|
||||||
tx_buf.resize(max_size);
|
tx_buf.resize(max_size);
|
||||||
|
|||||||
@@ -28,8 +28,9 @@
|
|||||||
# include <tlhelp32.h>
|
# include <tlhelp32.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef MAC_OS
|
#ifdef MAC_OS
|
||||||
# include <sys/proc_info.h>
|
struct kqueue_id_t;
|
||||||
# include <libproc.h>
|
# include <libproc.h>
|
||||||
|
# include <sys/proc_info.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#include "piopencl.h"
|
#include "piopencl.h"
|
||||||
#include "CL/cl.h"
|
#ifdef MAC_OS
|
||||||
|
# include "cl.h"
|
||||||
|
#else
|
||||||
|
# include "CL/cl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
PRIVATE_DEFINITION_START(PIOpenCL::Context)
|
PRIVATE_DEFINITION_START(PIOpenCL::Context)
|
||||||
|
|||||||
Reference in New Issue
Block a user