link against winsock system lib rather than implementing ad-hoc ntohs, fix warning about redefined macro on windows
This commit is contained in:
parent
4bdf8a0dd5
commit
c86dae6b62
|
|
@ -122,6 +122,11 @@ target_link_libraries(openFPGALoader
|
||||||
${LIBFTDI_LIBRARIES}
|
${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.
|
# libusb_attach_kernel_driver is only available on Linux.
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
add_definitions(-DATTACH_KERNEL)
|
add_definitions(-DATTACH_KERNEL)
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,8 @@
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#else
|
#else
|
||||||
// WARNING: this will be incorrect on ARM-based windows platforms
|
//for ntohs
|
||||||
// that are big-endian, but the rest of this code has not been tested for
|
#include <winsock2.h>
|
||||||
// those platforms anyway.
|
|
||||||
uint16_t ntohs(uint16_t netshort) {
|
|
||||||
return ((netshort & 0xFF) << 8) | ((netshort & 0xFF00) >> 8);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,11 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef STATUS_TIMEOUT
|
||||||
|
// defined in the Windows headers included by libftdi.h
|
||||||
|
#undef STATUS_TIMEOUT
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NOOP 0x02
|
#define NOOP 0x02
|
||||||
#define ERASE_SRAM 0x05
|
#define ERASE_SRAM 0x05
|
||||||
#define READ_SRAM 0x03
|
#define READ_SRAM 0x03
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue