libftdi-git Archives

Subject: A library to talk to FTDI chips branch, master, updated. v0.15-33-g73db4ea

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 6 Apr 2009 14:59:55 +0200 (CEST)
The branch, master has been updated
       via  73db4ea3202d638cd565626ba40bc5f8bbf31a8c (commit)
       via  7b5c56249edb3741ea6748c544a7688ff88ca86f (commit)
      from  6686948ce6be5e7e04e6c482fa7aadd2dd032048 (commit)


- Log -----------------------------------------------------------------
commit 73db4ea3202d638cd565626ba40bc5f8bbf31a8c
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date:   Mon Apr 6 14:59:46 2009 +0200

    Added mingw cross compile support to ChangeLog

commit 7b5c56249edb3741ea6748c544a7688ff88ca86f
Author: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date:   Mon Apr 6 13:59:35 2009 +0200

    Mingw Cross compiling
    
    Hello,
    
    sleep() and usleep(0 are not available on Win32. Provide workarounds and add
    some documentation for crosscompiling. It seems, I didn't send on the first
    attempt. This is my first patch with git, so if things need another form,
    please let me know.
    
    Changelog:
    
    - Make the exampled compile on Win32
    - Some help for crosscompiling with Mingw

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                 |    1 +
 README.mingw              |   11 +++++++++++
 Toolchain-mingw32.cmake   |   16 ++++++++++++++++
 examples/bitbang.c        |    3 +++
 examples/bitbang2.c       |    3 +++
 examples/bitbang_ft2232.c |    3 +++
 6 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 README.mingw
 create mode 100644 Toolchain-mingw32.cmake

diff --git a/ChangeLog b/ChangeLog
index 0470e7c..ba194a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 New in 0.16 - 2009-XX-XX
 ------------------------
+* Support for mingw cross compile (Uwe Bonnes)
 * Minor autoconf cleanup (Tarek Heiland)
 * Code cleanup in various places (Intra2net)
 * Fixed ftdi_read_chipid in some cases (Matthias Richter)
diff --git a/README.mingw b/README.mingw
new file mode 100644
index 0000000..afc02ad
--- /dev/null
+++ b/README.mingw
@@ -0,0 +1,11 @@
+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
diff --git a/Toolchain-mingw32.cmake b/Toolchain-mingw32.cmake
new file mode 100644
index 0000000..bff3cba
--- /dev/null
+++ b/Toolchain-mingw32.cmake
@@ -0,0 +1,16 @@
+# 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)
diff --git a/examples/bitbang.c b/examples/bitbang.c
index 4a3a823..2326605 100644
--- a/examples/bitbang.c
+++ b/examples/bitbang.c
@@ -2,6 +2,9 @@
 
 #include <stdio.h>
 #include <unistd.h>
+#ifdef __WIN32__
+#define sleep(x) Sleep(x)
+#endif
 #include <ftdi.h>
 
 int main(int argc, char **argv)
diff --git a/examples/bitbang2.c b/examples/bitbang2.c
index 81b3963..d9ba439 100644
--- a/examples/bitbang2.c
+++ b/examples/bitbang2.c
@@ -31,6 +31,9 @@
 
 #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)
diff --git a/examples/bitbang_ft2232.c b/examples/bitbang_ft2232.c
index cb09f0d..9d62ac0 100644
--- a/examples/bitbang_ft2232.c
+++ b/examples/bitbang_ft2232.c
@@ -10,6 +10,9 @@
 
 #include <stdio.h>
 #include <unistd.h>
+#ifdef __WIN32__
+#define sleep(x) _sleep(x)
+#endif
 #include <ftdi.h>
 
 int main(int argc, char **argv)


hooks/post-receive
-- 
A library to talk to FTDI chips

--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • A library to talk to FTDI chips branch, master, updated. v0.15-33-g73db4ea, libftdi-git <=