Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libusb build setup #1

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build/
*.user
src/appMain/sdl_preloaded_pt.json
src/3rd_party-static/openssl-1.0.2/
src/3rd_party-static/libusbx-1.0.17/
*.pyc
src/components/utils/src/threads/thread.h
src/components/utils/src/threads/thread_delegate.h
Expand Down
21 changes: 21 additions & 0 deletions cmake/Modules/FindLibUSBx.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# - Try to find libusbx
#
# LIBUSBX_INCLUDE_DIRECTORY - the libusbx include directory
# LIBUSBX_LIBS_DIRECTORY - the libusbx libs directory
# LIBUSBX_LIBRARIES - libusbx libraries to link

if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if (QT_PORT)
set(LIBUSBX_DIR ${CMAKE_SOURCE_DIR}/build/libusbx_win_x86)
else()
set(LIBUSBX_DIR ${CMAKE_SOURCE_DIR}/build/libusbx_win_x64)
endif()

set(LIBUSBX_INCLUDE_DIRECTORY ${LIBUSBX_DIR}/libusb)
set(LIBUSBX_LIBS_DIRECTORY ${LIBUSBX_DIR}/bin)
set(LIBUSBX_LIBRARIES ${LIBUSBX_LIBS_DIRECTORY}/libusb-1.0.lib)
else()
set(LIBUSBX_INCLUDE_DIRECTORY /usr/local/include/libusb-1.0)
set(LIBUSBX_LIBS_DIRECTORY /usr/local/lib)
set(LIBUSBX_LIBRARIES ${LIBUSBX_LIBS_DIRECTORY}/libusb-1.0.a udev)
endif()
46 changes: 46 additions & 0 deletions ms/libusbx_setup.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@echo off
setlocal EnableDelayedExpansion

if [%1]==[] goto usage

set BUILD_TYPE=%1
set LIBS_DIR="%SDL_ROOT%\src\3rd_party-static"
set LIBUSBX_SRC_DIR_NAME=libusbx-1.0.17
set LIBUSBX_SRC_DIR=%LIBS_DIR%\%LIBUSBX_SRC_DIR_NAME%
set LIBUSBX_BUILD_DIR=%BUILD_DIR%\libusbx_win_%BUILD_TYPE%

if not exist %LIBUSBX_SRC_DIR% (
pushd %LIBS_DIR%
@echo Cloning libusbx to the %LIBUSBX_SRC_DIR%

git.exe clone https://github.com/dickens/libusbx-hp.git %LIBUSBX_SRC_DIR_NAME%
popd
)

if not exist %LIBUSBX_BUILD_DIR% (
pushd %LIBUSBX_SRC_DIR%\msvc
call git.exe clean -fxd
call git.exe checkout 6cba5d96767b205fc653e3273fba81b59f1e1492

@echo Build libusbx for VC %BUILD_TYPE%

set LIBUSBX_RELEASE_BUILD_PARAMS=/t:Rebuild /p:OutDir=%LIBUSBX_BUILD_DIR%\bin,Configuration=Release

if %BUILD_TYPE%==x86 (
set LIBUSBX_RELEASE_BUILD_PARAMS=libusb_static_2010.vcxproj !LIBUSBX_RELEASE_BUILD_PARAMS! /p:Platform=Win32
) else if %BUILD_TYPE%==x64 (
set LIBUSBX_RELEASE_BUILD_PARAMS=libusb_static_2012.vcxproj !LIBUSBX_RELEASE_BUILD_PARAMS! /p:Platform=x64,PlatformToolset=v120
) else goto usage

call "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" !LIBUSBX_RELEASE_BUILD_PARAMS!
popd

xcopy %LIBUSBX_SRC_DIR%\libusb %LIBUSBX_BUILD_DIR%\libusb /E /I /H /R /Y
)

goto end

:usage
@echo "Usage: <script> [x86|x64]"

:end
2 changes: 2 additions & 0 deletions setup_Qt_x86.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ if %errorlevel% == 2 exit /b 1

call "%SDL_ROOT%\ms\openssl_setup.cmd" x86

call "%SDL_ROOT%\ms\libusbx_setup.cmd" x86

call "%SDL_ROOT%\ms\cmake_generate.cmd" WinQt_x86
2 changes: 2 additions & 0 deletions setup_VS2013_x64.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ if %errorlevel% == 2 exit /b 1

call "%SDL_ROOT%\ms\openssl_setup.cmd" x64

call "%SDL_ROOT%\ms\libusbx_setup.cmd" x64

call "%SDL_ROOT%\ms\cmake_generate.cmd" WinNative_x64
6 changes: 0 additions & 6 deletions src/3rd_party-static/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ set(MESSAGE_BROKER_INCLUDE_DIRECTORY ${MESSAGE_BROKER_INCLUDE_DIRECTORY} PARENT_
add_subdirectory(./encryption)
set(ENCRYPTION_INCLUDE_DIRECTORY ${ENCRYPTION_INCLUDE_DIRECTORY} PARENT_SCOPE)

if (BUILD_USB_SUPPORT)
add_subdirectory(./libusbx-1.0.16)
set(LIBUSB_INCLUDE_DIRECTORY ${LIBUSB_INCLUDE_DIRECTORY} PARENT_SCOPE)
set(LIBUSB_LIBS_DIRECTORY ${LIBUSB_LIBS_DIRECTORY} PARENT_SCOPE)
endif()

if(BUILD_TESTS)
add_subdirectory(test)
endif()
30 changes: 0 additions & 30 deletions src/3rd_party-static/libusbx-1.0.16/CMakeLists.txt

This file was deleted.

135 changes: 0 additions & 135 deletions src/3rd_party-static/libusbx-1.0.16/config.h

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

68 changes: 0 additions & 68 deletions src/3rd_party-static/libusbx-1.0.16/libusb/Makefile.am

This file was deleted.

Loading