Move platforms around, most of POSIX will be common implementation

pull/4/head
Paul Hollinsky 2018-09-20 14:40:24 -04:00
parent 8435efb039
commit ef8d764aa6
17 changed files with 43 additions and 27 deletions

View File

@ -34,7 +34,7 @@ if(WIN32)
file(GLOB PLATFORM_SRC_INTERNAL ${CMAKE_SOURCE_DIR}/platform/windows/internal/*.cpp) file(GLOB PLATFORM_SRC_INTERNAL ${CMAKE_SOURCE_DIR}/platform/windows/internal/*.cpp)
set(PLATFORM_SRC ${PLATFORM_SRC_EXTERNAL} ${PLATFORM_SRC_INTERNAL}) set(PLATFORM_SRC ${PLATFORM_SRC_EXTERNAL} ${PLATFORM_SRC_INTERNAL})
else() else()
file(GLOB PLATFORM_SRC ${CMAKE_SOURCE_DIR}/platform/linux/*.cpp) file(GLOB PLATFORM_SRC ${CMAKE_SOURCE_DIR}/platform/posix/*.cpp)
endif() endif()
set(COMMON_SRC set(COMMON_SRC

View File

@ -3,8 +3,8 @@
#if defined _WIN32 #if defined _WIN32
#include "platform/windows/include/devices.h" #include "platform/windows/include/devices.h"
#elif defined __linux__ #elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
#include "platform/linux/include/devices.h" #include "platform/posix/include/devices.h"
#else #else
#error "This platform is not supported by the devices driver, please add a definition!" #error "This platform is not supported by the devices driver, please add a definition!"
#endif #endif

View File

@ -3,8 +3,8 @@
#if defined _WIN32 #if defined _WIN32
#include "platform/windows/include/dynamiclib.h" #include "platform/windows/include/dynamiclib.h"
#elif defined __linux__ #elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
#include "platform/linux/include/dynamiclib.h" #include "platform/posix/include/dynamiclib.h"
#else #else
#warning "This platform is not supported by the dynamic library driver" #warning "This platform is not supported by the dynamic library driver"
#endif #endif

View File

@ -5,8 +5,8 @@
#if defined _WIN32 #if defined _WIN32
#include "platform/windows/include/ftdi.h" #include "platform/windows/include/ftdi.h"
#elif defined __linux__ #elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
#include "platform/linux/include/ftdi.h" #include "platform/posix/include/ftdi.h"
#else #else
#warning "This platform is not supported by the FTDI driver" #warning "This platform is not supported by the FTDI driver"
#endif #endif

View File

@ -3,8 +3,8 @@
#if defined _WIN32 #if defined _WIN32
#include "platform/windows/include/pcap.h" #include "platform/windows/include/pcap.h"
// #elif defined __linux__ // #elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
// #include "platform/linux/include/ftdi.h" // #include "platform/posix/include/ftdi.h"
#else #else
#warning "This platform is not supported by the PCAP driver" #warning "This platform is not supported by the PCAP driver"
#endif #endif

View File

@ -5,8 +5,8 @@
#if defined _WIN32 #if defined _WIN32
#include "platform/windows/include/stm32.h" #include "platform/windows/include/stm32.h"
#elif defined __linux__ #elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
#include "platform/linux/include/stm32.h" #include "platform/posix/include/stm32.h"
#else #else
#warning "This platform is not supported by the STM32 driver" #warning "This platform is not supported by the STM32 driver"
#endif #endif

View File

@ -0,0 +1,6 @@
#ifndef __DYNAMICLIB_DARWIN_H_
#define __DYNAMICLIB_DARWIN_H_
#define icsneoDynamicLibraryLoad() dlopen("/home/paulywog/Code/icsneonext/build/libicsneoc.dylib", RTLD_LAZY)
#endif

View File

@ -1,4 +1,3 @@
#include "platform/linux/include/ftdi.h"
#include "platform/include/ftdi.h" #include "platform/include/ftdi.h"
#include <iostream> #include <iostream>
#include <stdio.h> #include <stdio.h>

View File

@ -1,5 +1,5 @@
#ifndef __DEVICES_LINUX_H_ #ifndef __DEVICES_POSIX_H_
#define __DEVICES_LINUX_H_ #define __DEVICES_POSIX_H_
#include "device/neoobd2pro/include/neoobd2pro.h" #include "device/neoobd2pro/include/neoobd2pro.h"
#include "device/neovifire/include/neovifire.h" #include "device/neovifire/include/neovifire.h"

View File

@ -1,8 +1,14 @@
#ifndef __DYNAMICLIB_H_LINUX_ #ifndef __DYNAMICLIB_POSIX_H_
#define __DYNAMICLIB_H_LINUX_ #define __DYNAMICLIB_POSIX_H_
#include <dlfcn.h> #include <dlfcn.h>
#ifdef __APPLE__
#include "platform/posix/darwin/include/dynamiclib.h"
#else
#include "platform/posix/linux/include/dynamiclib.h"
#endif
// Nothing special is needed to export // Nothing special is needed to export
#define DLLExport #define DLLExport
@ -12,7 +18,6 @@
#define ICSNEO_DESTRUCTOR #define ICSNEO_DESTRUCTOR
// #endif // #endif
#define icsneoDynamicLibraryLoad() dlopen("/media/paulywog/Windows 10/Users/phollinsky/Code/icsneonext/build/libicsneoc.so", RTLD_LAZY)
#define icsneoDynamicLibraryGetFunction(handle, func) dlsym(handle, func) #define icsneoDynamicLibraryGetFunction(handle, func) dlsym(handle, func)
#define icsneoDynamicLibraryClose(handle) (dlclose(handle) == 0) #define icsneoDynamicLibraryClose(handle) (dlclose(handle) == 0)

View File

@ -1,5 +1,5 @@
#ifndef __FTDI_H_LINUX_ #ifndef __FTDI_POSIX_H_
#define __FTDI_H_LINUX_ #define __FTDI_POSIX_H_
#include <vector> #include <vector>
#include <memory> #include <memory>

View File

@ -1,5 +1,5 @@
#ifndef __STM32_LINUX_H_ #ifndef __STM32_POSIX_H_
#define __STM32_LINUX_H_ #define __STM32_POSIX_H_
#include "communication/include/icommunication.h" #include "communication/include/icommunication.h"
#include "device/include/neodevice.h" #include "device/include/neodevice.h"

View File

@ -0,0 +1,6 @@
#ifndef __DYNAMICLIB_LINUX_H_
#define __DYNAMICLIB_LINUX_H_
#define icsneoDynamicLibraryLoad() dlopen("/home/paulywog/Code/icsneonext/build/libicsneoc.so", RTLD_LAZY)
#endif

View File

@ -1,5 +1,5 @@
#ifndef __DYNAMICLIB_H_WINDOWS_ #ifndef __DYNAMICLIB_WINDOWS_H_
#define __DYNAMICLIB_H_WINDOWS_ #define __DYNAMICLIB_WINDOWS_H_
#include <Windows.h> #include <Windows.h>

View File

@ -1,5 +1,5 @@
#ifndef __REGISTRY_H_WINDOWS_ #ifndef __REGISTRY_WINDOWS_H_
#define __REGISTRY_H_WINDOWS_ #define __REGISTRY_WINDOWS_H_
#include <Windows.h> #include <Windows.h>
#include <string> #include <string>

View File

@ -1,5 +1,5 @@
#ifndef __VCP_H_WINDOWS_ #ifndef __VCP_WINDOWS_H_
#define __VCP_H_WINDOWS_ #define __VCP_WINDOWS_H_
#include <vector> #include <vector>
#include <string> #include <string>