mirror of
https://github.com/trabucayre/openFPGALoader.git
synced 2026-08-22 06:07:36 +02:00
link against winsock system lib rather than implementing ad-hoc ntohs, fix warning about redefined macro on windows
This commit is contained in:
@@ -122,6 +122,11 @@ target_link_libraries(openFPGALoader
|
||||
${LIBFTDI_LIBRARIES}
|
||||
)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
# winsock provides ntohs
|
||||
target_link_libraries(openFPGALoader ws2_32)
|
||||
endif()
|
||||
|
||||
# libusb_attach_kernel_driver is only available on Linux.
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
add_definitions(-DATTACH_KERNEL)
|
||||
|
||||
+2
-6
@@ -5,12 +5,8 @@
|
||||
#ifndef _WIN32
|
||||
#include <arpa/inet.h>
|
||||
#else
|
||||
// WARNING: this will be incorrect on ARM-based windows platforms
|
||||
// that are big-endian, but the rest of this code has not been tested for
|
||||
// those platforms anyway.
|
||||
uint16_t ntohs(uint16_t netshort) {
|
||||
return ((netshort & 0xFF) << 8) | ((netshort & 0xFF00) >> 8);
|
||||
}
|
||||
//for ntohs
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -32,6 +32,11 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifdef STATUS_TIMEOUT
|
||||
// defined in the Windows headers included by libftdi.h
|
||||
#undef STATUS_TIMEOUT
|
||||
#endif
|
||||
|
||||
#define NOOP 0x02
|
||||
#define ERASE_SRAM 0x05
|
||||
#define READ_SRAM 0x03
|
||||
|
||||
Reference in New Issue
Block a user