File tree 2 files changed +65
-0
lines changed
2 files changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ How to cross-build libfreenect for Windows on e.g. Ubuntu Linux
2
+
3
+ == Compile libusb (v1.0.26 or git) ==
4
+
5
+ Below instructions assume this is built in ~/SRC/libusb
6
+
7
+ cd ~/SRC/libusb
8
+ ./configure --host=x86_64-w64-mingw32
9
+ make -j5
10
+
11
+ == Compile freeglut (v3.2.3 or git) ==
12
+
13
+ Below instructions assume this is built in ~/SRC/freeglut
14
+ Follow the instructions in the README.mingw_cross but with
15
+ the addition of this cmake flag:
16
+ -D FREEGLUT_REPLACE_GLUT=1
17
+ (Note the dll will actually end up in the bin folder)
18
+
19
+ == Compile libfreenect ==
20
+
21
+ This can surely be improved, the system FindGLUT doesn't work well.
22
+ Also the included FindThreads.cmake doesn't seem to help in this case.
23
+
24
+ touch ../cmake_modules/FindGLUT.cmake
25
+
26
+ cmake -D CMAKE_TOOLCHAIN_FILE=mingw.cmake \
27
+ -D LIBUSB_1_INCLUDE_DIR=~/SRC/libusb/libusb \
28
+ -D LIBUSB_1_LIBRARY=~/SRC/libusb/libusb/.libs/libusb-1.0.dll \
29
+ -D THREADS_PTHREADS_WIN32_LIBRARY=/usr/x86_64-w64-mingw32/lib/libpthread.dll.a \
30
+ -D GLUT_FOUND=1 \
31
+ -D GLUT_INCLUDE_DIR=~/SRC/freeglut/freeglut/include \
32
+ -D GLUT_LIBRARY=~/SRC/freeglut/freeglut/bin/libglut.dll \
33
+ -D CMAKE_INSTALL_PREFIX=install-win \
34
+ ..
35
+
36
+ make -j5
37
+ make install
38
+ find install-win
39
+
40
+ This results in dynamically linked executables, so you'd need
41
+ libusb.dll libglut.dll libphreads-1.0.dll on the target computer.
42
+
Original file line number Diff line number Diff line change
1
+ # CMake toolchain file, cf. README.mingw_cross
2
+
3
+ # the name of the target operating system
4
+ set (CMAKE_SYSTEM_NAME Windows)
5
+
6
+ IF ("${GNU_HOST} " STREQUAL "" )
7
+ SET (GNU_HOST x86_64-w64-mingw32)
8
+ ENDIF ()
9
+
10
+ # which compilers to use for C and C++
11
+ set (CMAKE_C_COMPILER ${GNU_HOST} -gcc)
12
+ set (CMAKE_CXX_COMPILER ${GNU_HOST} -g++)
13
+
14
+ # where is the target environment located
15
+ set (CMAKE_FIND_ROOT_PATH /usr/${GNU_HOST} )
16
+
17
+ # adjust the default behavior of the FIND_XXX() commands:
18
+ # do not search programs in the host environment
19
+ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
20
+ # search headers and libraries only in the target environment
21
+ set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
22
+ set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
23
+ set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
You can’t perform that action at this time.
0 commit comments