| 1 | * How to cross compile libftdi-1.x for Windows? * |
| 2 | 1 - To cross-compile for Win32 with mingw, you need to |
| 3 | have libusb-1.0 for Windows. libusbx is a fork of libusb-1.0 |
| 4 | project which has gained popularity under Windows and Linux. |
| 5 | Therefore the instruction here uses libusbx. The process to |
| 6 | use libusb-1.0 from libusb.org is similar but take note it |
| 7 | does not offer Windows binary as of Jan 09 2013. |
| 8 | |
| 9 | 2 - Get libusbx Windows release binary from Sourceforge. |
| 10 | http://sourceforge.net/projects/libusbx/files/releases/ |
| 11 | |
| 12 | 3 - The release version is libusbx-1.0.14-win.7z (706.2KB) |
| 13 | as of Jan 09, 2013. |
| 14 | |
| 15 | 4 - Alternatively you can also build form the release source tar ball |
| 16 | or the git source tree following standard cross compile process |
| 17 | |
| 18 | 5 - Copy include/libusbx-1.0/libusb.h to the include directory of your |
| 19 | cross compiler, eg., |
| 20 | /opt/cross/i386-mingw32msvc/include/ |
| 21 | |
| 22 | 6 - Copy MinGW32/static/libusb-1.0.a and MinGW32/dll/libusb-1.0.dll.a |
| 23 | to the library directory of your cross compiler, eg., |
| 24 | /opt/cross/i386-mingw32msvc/lib/ |
| 25 | |
| 26 | 7 - Create a build directory like "mkdir build-win32", e.g in ../libftdi/ |
| 27 | |
| 28 | 8 - edit Toolchain-mingw32.cmake to reflect your cross compiler location. |
| 29 | |
| 30 | 9 - cd into the build directory and run |
| 31 | "cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw32.cmake .." |
| 32 | |
| 33 | 10 - Copy src/ftdi.h to the include directory of your cross compiler, |
| 34 | eg., /opt/cross/i386-mingw32msvc/include/ |
| 35 | |
| 36 | 11 - Copy build-win32/src/*.a to the library directory of your cross compiler, |
| 37 | eg., /opt/cross/i386-mingw32msvc/lib/ |
| 38 | |
| 39 | |
| 40 | * How to run libftdi-1.x under Windows * |
| 41 | |
| 42 | libusbx (or libusb-1.0) Windows backend will rely on a proper driver to run. |
| 43 | Please refer to the following wiki page on the instruction of |
| 44 | installation of the proper driver. |
| 45 | https://github.com/libusbx/libusbx/wiki/Windows-Backend#wiki-How_to_use_libusbx_on_Windows |
| 46 | |
| 47 | As of Jan 09 2013, libusb-1.0 Windows backend only supports WinUSB |
| 48 | and libusbx's support of libusb0.sys and libusbk.sys are considered less |
| 49 | mature than WinUSB. Therefore, WinUSB driver installation using Zadig |
| 50 | is recommended. |
| 51 | |
| 52 | Take note once you replace the original FTDI driver with WinUSB driver, |
| 53 | you can no longer use the functionality the original FTDI driver provides |
| 54 | (eg. Virtual Serial Port or D2XX). |