OpenKinect / libfreenect2

Open source drivers for the Kinect for Windows v2 device
2.05k stars 747 forks source link

README WRONG instruction about " Libusb " installation #1181

Closed alanli2000tw closed 1 year ago

alanli2000tw commented 1 year ago

THIS IS NOT A PROBLEM, ONLY TRY TO HELP THE ONES FINDING THE SAME PROBLEM [WINDOWS 11] can used as well.

Overview Description: I fix the problem of using WINDOWS 11 using Visual Studio 2015 ( I guess 2019 or 2017 can fix as well ) Accroding to readme " Installation " instruction on windows/Visual studio about " libusb " is total a wrong way, wasting me a lot of time, under the folder : depends/ executing install_libusb_vs2013.cmd or install_libusb_vs2015.cmd to construct libusb library, based on the cmd file: the source file should be using the old version of libusb in github not the newest ver. , but the cmd file clone(download) the newest file in github.

To correct the file: step1. prepare the two folders 1-1. create empty folder: depends/libusb 1-2. download tags="v1.0.25" in libusb github (https://github.com/libusb/libusb/tree/v1.0.25) and extract as depends/libusb_src (rename folder libusb-1.x.y to libusb_src if any).

step2. change the install_libusb_vs2015.cmd code for my example (code example using visual studio 2015 , to modify using different Visual studio, simply change the YEAR to your VS version. only support 2013,2015,2017,2019 ) :

rem This can only be run in a Git Shell or similar environments
rem with access to git.exe and msbuild.exe.

rem rmdir /s /q libusb_src libusb

rem git clone https://github.com/libusb/libusb.git libusb_src || exit /b
cd libusb_src

set CONFIG=Release
set YEAR=2015
set MSBUILD="C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"

rem %MSBUILD% msvc\libusb_dll_%YEAR%.vcxproj /p:Platform=x64 /p:Configuration=%CONFIG% /target:Rebuild || exit /b
%MSBUILD% msvc\libusb_dll_%YEAR%.vcxproj /p:Platform=x64 /p:Configuration=%CONFIG% /target:Rebuild || exit /b

mkdir ..\libusb\include\libusb-1.0
copy libusb\libusb.h ..\libusb\include\libusb-1.0
mkdir ..\libusb\MS64\dll
copy x64\%CONFIG%\dll\*.lib ..\libusb\MS64\dll
copy x64\%CONFIG%\dll\*.dll ..\libusb\MS64\dll
copy x64\%CONFIG%\dll\*.pdb ..\libusb\MS64\dll

Step3. execute the code you just change, for my example : install_libusb_vs2015.cmd

Then the libusb library should be construct successfully according to your Visual Studio version.

Other Installation procedure would be the same as the Readme instructions , then you should finally generate Protonect.exe

the orignial instruction about libusb is not doing the right thing. Wish, this can save you a lot of time stucking with the error of LibUSB_LIBRARIES NOT FOUND

Below is mandarin version ____ 我英文可能不好, 簡單說 原作 readme 環境的下載配置有錯 , Libusb 應該下載舊版的版本,而不是最新的。tags="v1.0.25" 才是正常相符的版本,因此要修正 install_libusb_vs2015.cmd code 中的 git clone 位址,後續的指令才會執行正確,我不是很會寫 bash file , 大神一定可以寫得比我好,但我驗證過 上方的指令 是可行且正確的。

env: USB library 我是使用 UsbDk driver . 祝成功~

alanli2000tw commented 1 year ago

Wish Contributors can fix the problem ,thank you~