Skip to content

Commit d53cb98

Browse files
WillForanlncd
authored andcommitted
WIP: comiples on linux
1 parent ef22025 commit d53cb98

File tree

7 files changed

+38
-3
lines changed

7 files changed

+38
-3
lines changed

xid_device_driver/CedrusAssert.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
# define _putenv putenv
1515
#endif // defined(__APPLE__)
1616

17+
#if defined(__linux__)
18+
# include <stdlib.h>
19+
# define _putenv putenv
20+
#endif // defined(__linux__)
21+
1722
namespace Cedrus
1823
{
1924
// break into the debugger
@@ -23,9 +28,11 @@ namespace Cedrus
2328
DebugBreak();
2429
#elif defined(__APPLE__)
2530
raise(SIGTRAP);
31+
#elif defined(__linux__)
32+
raise(SIGTRAP);
2633
#else
27-
// TODO
28-
#endif // Win/Apple
34+
// TODO (TODONE now that linux is included?)
35+
#endif // Win/Apple/linux
2936
}
3037

3138
inline void OptionToContinue
@@ -274,7 +281,11 @@ namespace Cedrus
274281
Cedrus::Ced_Fail_Mac( msg, __FILE__, __LINE__, __func__ )
275282

276283

277-
#else
284+
# elif defined(__linux__)
285+
# undef CEDRUS_DISABLE_ASSERT // UGLY HACK! TODO fix for linux
286+
# define CEDRUS_ASSERT(cond, msg)
287+
# define CEDRUS_FAIL(msg)
288+
#else
278289
// TODO
279290
#endif // Win/Apple
280291

xid_device_driver/Connection.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535

3636
#include "constants.h"
3737

38+
#if defined(__linux__)
39+
#include <cstring>
40+
#endif
41+
3842
Cedrus::Connection::Connection(
3943
const DWORD location,
4044
DWORD port_speed,

xid_device_driver/Connection.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
# include <windows.h>
4141
# define SLEEP_FUNC Sleep
4242
# define SLEEP_INC 1
43+
#elif defined(__linux__)
44+
# include <unistd.h>
45+
# define SLEEP_FUNC usleep
46+
# define SLEEP_INC 1000
4347
#endif
4448

4549
#include <chrono>

xid_device_driver/ResponseManager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
#include "DeviceConfig.h"
77
#include "constants.h"
88

9+
#if defined(__linux__)
10+
#include <cstring>
11+
#endif
12+
913
Cedrus::ResponseManager::ResponseManager(std::shared_ptr<const DeviceConfig> devConfig )
1014
: m_BytesInBuffer(0),
1115
m_XIDPacketIndex(INVALID_PACKET_INDEX),

xid_device_driver/XIDDevice.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
#include <iomanip>
4545
#include <locale>
4646

47+
#if defined(__linux__)
48+
#include <cstring>
49+
#endif
50+
4751

4852
Cedrus::XIDDevice::XIDDevice(std::shared_ptr<Connection> xidCon, std::shared_ptr<const DeviceConfig> devConfig)
4953
: m_linesState(0),

xid_device_driver/XIDDeviceScanner.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636

3737
#include "XIDDevice.h"
3838

39+
#if defined(__linux__)
40+
#include <cstring>
41+
#endif
42+
43+
3944
std::shared_ptr<Cedrus::XIDDevice> CreateDevice
4045
(
4146
const int productID, // d2 value

xid_device_driver/XidDriverImpExpDefs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#elif defined(_WIN32)
77
# define CEDEXP __declspec(dllexport)
88
# define CEDIMP __declspec(dllimport)
9+
#elif defined(__linux__)
10+
# define CEDEXP __attribute__ ((visibility("default")))
11+
# define CEDIMP __attribute__ ((visibility("default")))
912
#endif
1013

1114
#define CEDRUS_XIDDRIVER_IMPORTEXPORT CEDEXP

0 commit comments

Comments
 (0)