1. Liam Staskawicz
  2. libusbus

Commits

Liam Staskawicz  committed 0ae91cd

platform: give a USBUS namespace to the platform defines to ease including usbus source files in other builds

  • Participants
  • Parent commits 5c969c1
  • Branches master

Comments (0)

Files changed (3)

File premake4.lua

View file
     includedirs { "src" }
 
     if os.is("macosx") then
-        defines { "PLATFORM_OSX" }
+        defines { "USBUS_PLATFORM_OSX" }
         files { "src/platform/iokit.c" }
     elseif os.is("windows") then
-        defines { "PLATFORM_WIN" }
+        defines { "USBUS_PLATFORM_WIN" }
         files { "src/platform/winusb.c" }
     end
 

File src/core.c

View file
 #include <stdlib.h>
 #include <string.h>
 
-#if defined(PLATFORM_OSX)
+#if defined(USBUS_PLATFORM_OSX)
     const struct UsbusPlatform * const gPlatform = &platformIOKit;
-#elif defined(PLATFORM_WIN)
+#elif defined(USBUS_PLATFORM_WIN)
     const struct UsbusPlatform * const gPlatform = &platformWinUSB;
 #else
     #error "Unsupported Platform"

File src/usbus_private.h

View file
 
 #include "usbus.h"
 
-#if defined(PLATFORM_OSX)
+#if defined(USBUS_PLATFORM_OSX)
 #include "platform/iokit.h"
-#elif defined(PLATFORM_WIN)
+#elif defined(USBUS_PLATFORM_WIN)
 #include "platform/winusb.h"
 #endif
 
     UsbusDeviceConnectedCallback connected;
     UsbusDeviceDisconnectedCallback disconnected;
 
-#if defined(PLATFORM_OSX)
+#if defined(USBUS_PLATFORM_OSX)
     struct IOKitContext iokit;
-#elif defined(PLATFORM_WIN)
+#elif defined(USBUS_PLATFORM_WIN)
     struct WinUSBContext winusb;
 #endif
 };
     //    struct list_head list;
     unsigned long session_data;
 
-#if defined(PLATFORM_OSX)
+#if defined(USBUS_PLATFORM_OSX)
     struct IOKitDevice iokit;
-#elif defined(PLATFORM_WIN)
+#elif defined(USBUS_PLATFORM_WIN)
     struct WinUSBDevice winusb;
 #endif
 };