Skip to content

Commit 26b3cbd

Browse files
committed
cmake: Improve Visual Studio 2015 support
Add VS 2015 detection. Add scripts for building libusb with VS2013/2015 (in a Git Shell). Check MS64/dll paths for libusb, following the official binary release file structure.
1 parent 57ee8c4 commit 26b3cbd

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

cmake_modules/FindGLFW3.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ IF(MINGW)
3939
SET(_SUFFIX lib-mingw)
4040
ELSEIF(MSVC11)
4141
SET(_SUFFIX lib-vc2012)
42-
ELSEIF(MSVC)
42+
ELSEIF(MSVC12)
4343
SET(_SUFFIX lib-vc2013)
44+
ELSEIF(MSVC14)
45+
SET(_SUFFIX lib-vc2015)
46+
ELSEIF(MSVC)
47+
SET(_SUFFIX lib-vc2012)
4448
ENDIF()
4549

4650
FIND_LIBRARY(GLFW3_LIBRARIES

cmake_modules/FindLibUSB.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ FIND_PATH(LibUSB_INCLUDE_DIRS
3535
PATH_SUFFIXES
3636
include
3737
libusb
38+
include/libusb-1.0
3839
)
3940

4041
FIND_LIBRARY(LibUSB_LIBRARIES
@@ -49,6 +50,7 @@ FIND_LIBRARY(LibUSB_LIBRARIES
4950
Win32/Release/dll
5051
Win32/Debug/dll
5152
MS64
53+
MS64/dll
5254
)
5355

5456
INCLUDE(FindPackageHandleStandardArgs)

depends/install_libusb_vs2013.cmd

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
rem This can only be run in a Git Shell or similar environments
2+
rem with access to git.exe and msbuild.exe.
3+
4+
rmdir /s /q libusb_src libusb
5+
6+
git clone https://github.com/libusb/libusb.git libusb_src || exit /b
7+
cd libusb_src
8+
9+
git remote add joshblake https://github.com/JoshBlake/libusbx.git
10+
git fetch joshblake || exit /b
11+
git merge joshblake/winiso
12+
13+
set CONFIG=Release
14+
msbuild msvc\libusb_dll_2013.vcxproj /p:Platform=x64 /p:Configuration=%CONFIG% /target:Rebuild
15+
16+
mkdir ..\libusb\include\libusb-1.0
17+
copy libusb\libusb.h ..\libusb\include\libusb-1.0
18+
mkdir ..\libusb\MS64\dll
19+
copy x64\%CONFIG%\dll\libusb-1.0.lib ..\libusb\MS64\dll
20+
copy x64\%CONFIG%\dll\libusb-1.0.dll ..\libusb\MS64\dll
21+
copy x64\%CONFIG%\dll\libusb-1.0.pdb ..\libusb\MS64\dll

depends/install_libusb_vs2015.cmd

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
rem This can only be run in a Git Shell or similar environments
2+
rem with access to git.exe and msbuild.exe.
3+
4+
rmdir /s /q libusb_src libusb
5+
6+
git clone https://github.com/libusb/libusb.git libusb_src || exit /b
7+
cd libusb_src
8+
9+
git remote add joshblake https://github.com/JoshBlake/libusbx.git
10+
git fetch joshblake || exit /b
11+
git merge joshblake/winiso
12+
git fetch origin pull/83/head:pr83 || exit /b
13+
git merge pr83
14+
15+
set CONFIG=Release
16+
msbuild msvc\libusb_dll_2015.vcxproj /p:Platform=x64 /p:Configuration=%CONFIG% /target:Rebuild
17+
18+
mkdir ..\libusb\include\libusb-1.0
19+
copy libusb\libusb.h ..\libusb\include\libusb-1.0
20+
mkdir ..\libusb\MS64\dll
21+
copy x64\%CONFIG%\dll\libusb-1.0.lib ..\libusb\MS64\dll
22+
copy x64\%CONFIG%\dll\libusb-1.0.dll ..\libusb\MS64\dll
23+
copy x64\%CONFIG%\dll\libusb-1.0.pdb ..\libusb\MS64\dll

0 commit comments

Comments
 (0)