--- /dev/null
+To crosscompile for Win32 with mingw
+- Get and build libusb-win32-src-x.tar.gz from Sourceforge
+ Version was "libusb-win32-src-0.1.12.1.tar.gz" for April 4, 2009
+- Compile like "make host_prefix=i386-mingw32msvc all". Your prefixes may vary.
+- Copy src/usb.h to /opt/cross/i386-mingw32msvc/include/
+- Copy *.a to /opt/cross/i386-mingw32msvc/lib/
+- Create a build directory like "mkdir build-win32", e.g in ../libftdi/
+- cd in that directory and run
+ "cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw32.cmake .."
+- Copy src/ftdi.h to /opt/cross/i386-mingw32msvc/include/
+- Copy build-win32/src/*.a to /opt/cross/i386-mingw32msvc/lib/
\ No newline at end of file
--- /dev/null
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Windows)
+
+# which compilers to use for C and C++
+SET(CMAKE_C_COMPILER i386-mingw32msvc-gcc)
+SET(CMAKE_CXX_COMPILER i386-mingw32msvc-g++)
+
+# here is the target environment located
+SET(CMAKE_FIND_ROOT_PATH /opt/cross/i386-mingw32msvc )
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#include <stdio.h>
#include <unistd.h>
+#ifdef __WIN32__
+#define sleep(x) Sleep(x)
+#endif
#include <ftdi.h>
int main(int argc, char **argv)
#include <stdio.h>
#include <unistd.h>
+#ifdef __WIN32__
+#define usleep(x) Sleep((x+999)/1000)
+#endif
#include <ftdi.h>
void ftdi_fatal (struct ftdi_context *ftdi, char *str)
#include <stdio.h>
#include <unistd.h>
+#ifdef __WIN32__
+#define sleep(x) _sleep(x)
+#endif
#include <ftdi.h>
int main(int argc, char **argv)