-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MinGW crossbuilding cmake file and README.mingw_cross
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
- Loading branch information
1 parent
5b2a20e
commit 1c3944c
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
How to cross-build libfreenect for Windows on e.g. Ubuntu Linux | ||
|
||
== Compile libusb (v1.0.26 or git) == | ||
|
||
Below instructions assume this is built in ~/SRC/libusb | ||
|
||
cd ~/SRC/libusb | ||
./configure --host=x86_64-w64-mingw32 | ||
make -j5 | ||
|
||
== Compile freeglut (v3.2.2 or git) == | ||
|
||
Below instructions assume this is built in ~/SRC/freeglut | ||
https://github.com/FreeGLUTProject/freeglut/pull/98 must be applied. | ||
Follow the instructions in the README.mingw_cross exactly, only with | ||
the addition of the cmake flag | ||
-D FREEGLUT_REPLACE_GLUT=1 | ||
(Note the dll will actually end up in the bin folder) | ||
|
||
== Compile libfreenect == | ||
|
||
This can surely be improved, the system FindGLUT doesn't work well. | ||
Also the included FindThreads.cmake doesn't seem to help in this case. | ||
|
||
touch ../cmake_modules/FindGLUT.cmake | ||
|
||
cmake -D CMAKE_TOOLCHAIN_FILE=mingw.cmake \ | ||
-D LIBUSB_1_INCLUDE_DIR=~/SRC/libusb/libusb \ | ||
-D LIBUSB_1_LIBRARY=~/SRC/libusb/libusb/.libs/libusb-1.0.dll \ | ||
-D THREADS_PTHREADS_WIN32_LIBRARY=/usr/x86_64-w64-mingw32/lib/libpthread.dll.a \ | ||
-D GLUT_FOUND=1 \ | ||
-D GLUT_INCLUDE_DIR=~/SRC/freeglut/freeglut/include \ | ||
-D GLUT_LIBRARY=~/SRC/freeglut/freeglut/bin/libglut.dll \ | ||
-D CMAKE_INSTALL_PREFIX=install-win \ | ||
.. | ||
|
||
make -j5 | ||
make install | ||
find install-win | ||
|
||
This results in dynamically linked executables, so you'd need | ||
libusb.dll libglut.dll libphreads-1.0.dll on the target computer. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# CMake toolchain file, cf. README.mingw_cross | ||
|
||
# the name of the target operating system | ||
set(CMAKE_SYSTEM_NAME Windows) | ||
|
||
IF("${GNU_HOST}" STREQUAL "") | ||
SET(GNU_HOST x86_64-w64-mingw32) | ||
ENDIF() | ||
|
||
# which compilers to use for C and C++ | ||
set(CMAKE_C_COMPILER ${GNU_HOST}-gcc) | ||
set(CMAKE_CXX_COMPILER ${GNU_HOST}-g++) | ||
|
||
# where is the target environment located | ||
set(CMAKE_FIND_ROOT_PATH /usr/${GNU_HOST}) | ||
|
||
# adjust the default behavior of the FIND_XXX() commands: | ||
# do not search programs in the host environment | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
# search headers and libraries only in the target environment | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) |