Launching soon!

This commit is contained in:
[ Kristjan Komloši HomePC ]
2017-03-28 13:33:10 +02:00
parent db1ecbddbe
commit 2cdf7fb91c
276 changed files with 19 additions and 113542 deletions

View File

@@ -0,0 +1,46 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libusb.h>
#if WIN32
#include <winbase.h>
typedef const struct libusb_version * (__stdcall * version_fn)(void);
#endif
int main(int argc, char *argv[])
{
int status = 0;
const struct libusb_version *ver;
#if WIN32
if (argc > 1) {
HINSTANCE dll;
version_fn get_version;
dll = LoadLibraryA(argv[1]);
if (!dll) {
fprintf(stderr, "Failed to load %s\n", argv[1]);
return -1;
}
get_version = (version_fn) GetProcAddress(dll, "libusb_get_version");
if (get_version) {
ver = get_version();
printf("%u.%u.%u\n", ver->major, ver->minor, ver->micro);
} else{
fprintf(stderr, "Failed to get address of libusb_get_version()\n");
status = -1;
}
FreeLibrary(dll);
} else {
fprintf(stderr, "Windows usage: %s <libusb.dll>\n", argv[0]);
return -1;
}
#else
ver = libusb_get_version();
printf("%u.%u.%u\n", ver->major, ver->minor, ver->micro);
#endif
return status;
}

View File

@@ -0,0 +1,97 @@
# This is file is based off of the FindLibUSB.cmake file written by Hendrik Sattler,
# from the OpenOBEX project (licensed GPLv2/LGPL). (If this is not correct,
# please contact us so we can attribute the author appropriately.)
#
# https://github.com/zuckschwerdt/openobex/blob/master/CMakeModules/FindLibUSB.cmake
# http://dev.zuckschwerdt.org/openobex/
#
# Find pthreads-win32
#
# This requires the LIBPTHREADSWIN32_PATH variable to be set to the path to the
# a pthreads-win32 release, such as the Pre-built.2 directory from the 2.9.1 release:
# ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip
#
# The following standard variables get defined:
# LIBPTHREADSWIN32_FOUND: true if LibUSB was found
# LIBPTHREADSWIN32_HEADER_FILE: the location of the C header file
# LIBPTHREADSWIN32_INCLUDE_DIRS: the directories that contain headers
# LIBPTHREADSWIN32_LIBRARIES: the library files
# LIBPTHREADSWIN32_LIB_COPYING: the license associated with the library
if(DEFINED __INCLUDED_BLADERF_FINDLIBPTHREADSWIN32_CMAKE)
return()
endif()
set(__INCLUDED_BLADERF_FINDLIBPTHREADSWIN32_CMAKE TRUE)
include ( CheckLibraryExists )
include ( CheckIncludeFile )
set(LIBPTHREADSWIN32_PATH
"C:/Program Files/pthreads-win32"
CACHE
PATH
"Path to win-pthreads files. (This is generally only needed for Windows users who downloaded binary distributions.)"
)
find_file ( LIBPTHREADSWIN32_HEADER_FILE
NAMES
pthread.h
PATHS
${LIBPTHREADSWIN32_PATH}
PATH_SUFFIXES
include include
)
mark_as_advanced ( LIBPTHREADSWIN32_HEADER_FILE )
get_filename_component ( LIBPTHREADSWIN32_INCLUDE_DIRS "${LIBPTHREADSWIN32_HEADER_FILE}" PATH )
if ( WIN32 )
if ( MSVC )
if ( CMAKE_CL_64 )
set ( LIBPTHREADSWIN32_LIBRARY_PATH_SUFFIX x64 )
else ( CMAKE_CL_64 )
set ( LIBPTHREADSWIN32_LIBRARY_PATH_SUFFIX x86 )
endif ( CMAKE_CL_64 )
elseif ( CMAKE_COMPILER_IS_GNUCC )
if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set ( LIBPTHREADSWIN32_LIBRARY_PATH_SUFFIX x64 )
else ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set ( LIBPTHREADSWIN32_LIBRARY_PATH_SUFFIX x86 )
endif ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
endif ( MSVC )
find_library ( PTHREAD_LIBRARY
NAMES
pthreadVC2
PATHS
${LIBPTHREADSWIN32_PATH}
PATH_SUFFIXES
lib/${LIBPTHREADSWIN32_LIBRARY_PATH_SUFFIX}
)
mark_as_advanced ( PTHREAD_LIBRARY )
if ( PTHREAD_LIBRARY )
set ( LIBPTHREADSWIN32_LIBRARIES ${PTHREAD_LIBRARY} )
endif ( PTHREAD_LIBRARY )
else ( WIN32 )
message(FATAL_ERROR "This file only supports Windows")
endif ( WIN32 )
set ( LIBPTHREADSWIN32_LIB_COPYING
"${LIBPTHREADSWIN32_PATH}/COPYING.LIB" )
if ( NOT EXISTS "${LIBPTHREADSWIN32_LIB_COPYING}" )
message(FATAL_ERROR "Unable to find pthread-win32 COPYING.LIB file")
endif ()
if ( LIBPTHREADSWIN32_INCLUDE_DIRS AND LIBPTHREADSWIN32_LIBRARIES )
set ( LIBPTHREADSWIN32_FOUND true )
endif ( LIBPTHREADSWIN32_INCLUDE_DIRS AND LIBPTHREADSWIN32_LIBRARIES )
if ( LIBPTHREADSWIN32_FOUND )
set ( CMAKE_REQUIRED_INCLUDES "${LIBPTHREADSWIN32_INCLUDE_DIRS}" )
check_include_file ( "{LIBPTHREADSWIN32_HEADER_FILE}" LIBPTHREADSWIN32_FOUND )
endif ( LIBPTHREADSWIN32_FOUND )
if ( NOT LIBPTHREADSWIN32_FOUND )
message ( FATAL_ERROR "pthreads-win32 not found. If you're using a binary distribution, try setting -DLIBPTHREADSWIN32_PATH=<path_to_win_pthread_files>." )
endif ( NOT LIBPTHREADSWIN32_FOUND )

View File

@@ -0,0 +1,168 @@
# This is a modified version of the file written by Hedrik Sattler,
# from the OpenOBEX project (licensed GPLv2/LGPL). (If this is not correct,
# please contact us so we can attribute the author appropriately.)
#
# https://github.com/zuckschwerdt/openobex/blob/master/CMakeModules/FindLibUSB.cmake
# http://dev.zuckschwerdt.org/openobex/
#
# Find libusb-1.0
#
# It will use PkgConfig if present and supported, otherwise this
# script searches for binary distribution in the path defined by
# the LIBUSB_PATH variable.
#
# Define LIBUSB_SKIP_VERSION_CHECK=Yes to skip the execution of a program to fetch
# libusb's version number. LIBUSB_VERSION will not be set if this if this is used.
# To check the version number, this script expects CMAKE_HELPERS_SOURCE_DIR to
# be defined with the path to libusb_version.c.
#
# The following standard variables get defined:
# LIBUSB_FOUND: true if LibUSB was found
# LIBUSB_HEADER_FILE: the location of the C header file
# LIBUSB_INCLUDE_DIRS: the directorys that contain headers
# LIBUSB_LIBRARIES: the library files
# LIBUSB_VERSION the detected libusb version
# LIBUSB_HAVE_GET_VERSION True if libusb has libusb_get_version()
if(DEFINED __INCLUDED_BLADERF_FINDLIBUSB_CMAKE)
return()
endif()
set(__INCLUDED_BLADERF_FINDLIBUSB_CMAKE TRUE)
include(CheckLibraryExists)
include(CheckIncludeFile)
# In Linux, folks should generally be able to simply fetch the libusb library and
# development packages from their distros package repository. Windows users will
# likely want to fetch a binary distribution, hence the Windows-oriented default.
#
# See http://www.libusb.org/wiki/windows_backend#LatestBinarySnapshots
if(WIN32)
set(LIBUSB_PATH
"C:/Program Files/libusb-1.0.19"
CACHE
PATH
"Path to libusb files. (This is generally only needed for Windows users who downloaded binary distributions.)"
)
endif()
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PKGCONFIG_LIBUSB libusb-1.0 QUIET)
endif(PKG_CONFIG_FOUND)
if(PKGCONFIG_LIBUSB_FOUND)
set(LIBUSB_INCLUDE_DIRS ${PKGCONFIG_LIBUSB_INCLUDE_DIRS})
foreach(i ${PKGCONFIG_LIBUSB_LIBRARIES})
string(REGEX MATCH "[^-]*" ibase "${i}")
find_library(${ibase}_LIBRARY
NAMES ${i}
PATHS ${PKGCONFIG_LIBUSB_LIBRARY_DIRS}
)
if(${ibase}_LIBRARY)
list(APPEND LIBUSB_LIBRARIES ${${ibase}_LIBRARY})
endif(${ibase}_LIBRARY)
mark_as_advanced(${ibase}_LIBRARY)
endforeach(i)
else(PKGCONFIG_LIBUSB_FOUND)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# The libusbx binary distribution contains several libs.
# Use the lib that got compiled with the same compiler.
if(MSVC)
if(CMAKE_CL_64)
set(LIBUSB_LIBRARY_PATH_SUFFIX MS64/dll)
else(CMAKE_CL_64)
set(LIBUSB_LIBRARY_PATH_SUFFIX MS32/dll)
endif(CMAKE_CL_64)
elseif(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(LIBUSB_LIBRARY_PATH_SUFFIX MinGW32/dll)
else(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(LIBUSB_LIBRARY_PATH_SUFFIX MinGW64/dll)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
endif(MSVC)
else()
set(LIBUSB_LIBRARY_PATH_SUFFIX lib)
set(LIBUSB_EXTRA_PATHS /usr /usr/local /opt/local)
endif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
find_file(LIBUSB_HEADER_FILE
NAMES
libusb.h
PATHS
${LIBUSB_PATH}
${LIBUSB_EXTRA_PATHS}
PATH_SUFFIXES
include include/libusbx-1.0 include/libusb-1.0
)
mark_as_advanced(LIBUSB_HEADER_FILE)
get_filename_component(LIBUSB_INCLUDE_DIRS "${LIBUSB_HEADER_FILE}" PATH)
find_library(usb_LIBRARY
NAMES
libusb-1.0 usb-1.0
PATHS
${LIBUSB_PATH}
${LIBUSB_EXTRA_PATHS}
PATH_SUFFIXES
${LIBUSB_LIBRARY_PATH_SUFFIX}
)
mark_as_advanced(usb_LIBRARY)
if(usb_LIBRARY)
set(LIBUSB_LIBRARIES ${usb_LIBRARY})
endif(usb_LIBRARY)
endif(PKGCONFIG_LIBUSB_FOUND)
if(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES)
set(LIBUSB_FOUND true)
endif(LIBUSB_INCLUDE_DIRS AND LIBUSB_LIBRARIES)
if(LIBUSB_FOUND)
set(CMAKE_REQUIRED_INCLUDES "${LIBUSB_INCLUDE_DIRS}")
check_include_file("{LIBUSB_HEADER_FILE}" LIBUSB_FOUND)
endif(LIBUSB_FOUND)
if(LIBUSB_FOUND AND NOT CMAKE_CROSSCOMPILING)
if(LIBUSB_SKIP_VERSION_CHECK)
message(STATUS "Skipping libusb version number check.")
unset(LIBUSB_VERSION)
else()
message(STATUS "Checking libusb version...")
if(WIN32)
string(REPLACE ".lib" ".dll" LIBUSB_DLL "${LIBUSB_LIBRARIES}")
try_run(LIBUSB_VERCHECK_RUN_RESULT
LIBUSB_VERCHECK_COMPILED
${CMAKE_HELPERS_BINARY_DIR}
${CMAKE_HELPERS_SOURCE_DIR}/libusb_version.c
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LIBUSB_INCLUDE_DIRS}"
RUN_OUTPUT_VARIABLE LIBUSB_VERSION
ARGS "\"${LIBUSB_DLL}\""
)
else()
try_run(LIBUSB_VERCHECK_RUN_RESULT
LIBUSB_VERCHECK_COMPILED
${CMAKE_HELPERS_BINARY_DIR}
${CMAKE_HELPERS_SOURCE_DIR}/libusb_version.c
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LIBUSB_INCLUDE_DIRS}" "-DLINK_LIBRARIES=${LIBUSB_LIBRARIES}"
RUN_OUTPUT_VARIABLE LIBUSB_VERSION
)
endif()
if (NOT LIBUSB_VERCHECK_COMPILED OR NOT LIBUSB_VERCHECK_RUN_RESULT EQUAL 0 )
message(STATUS "${LIBUSB_VERSION}")
set(LIBUSB_VERSION "0.0.0")
message(WARNING "\nFailed to compile (compiled=${LIBUSB_VERCHECK_COMPILED}) or run (retval=${LIBUSB_VERCHECK_RUN_RESULT}) libusb version check.\n"
"This may occur if libusb is earlier than v1.0.10.\n"
"Setting LIBUSB_VERSION to ${LIBUSB_VERSION}.\n")
return()
endif()
message(STATUS "libusb version: ${LIBUSB_VERSION}")
endif()
endif(LIBUSB_FOUND AND NOT CMAKE_CROSSCOMPILING)