summaryrefslogtreecommitdiff
path: root/msvc
Commit message (Collapse)AuthorAgeFilesLines
* tests/stress_mt: Add Windows threads supportTormod Volden2023-03-122-0/+67
| | | | | | | | Build the test on all platforms. Closes #1128 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
* tests: Add unit test for libusb_set_optionNathan Hjelm2023-03-122-0/+69
| | | | | | | | | | | | | | | | The behavior of libusb_set_option was not matching the documentation when the log level was set in the environment. This has been fixed but a regression test is needed to ensure the behavior does not deviate. This commit adds a set of unit tests to cover some of the functionality of libusb_set_option. Closes #1245 Signed-off-by: Nathan Hjelm <hjelmn@google.com> [Xiaofan: Add Windows setenv/unsetenv wrappers] Signed-off-by: Xiaofan Chen <xiaofanc@gmail.com> [Tormod: Fix test_no_discovery() build on Linux, add msvc build] Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
* msvc: Add configurations with /MT compilation flagSonatique2023-01-185-10/+247
| | | | | | | | | | | | | | | | | | | | Allows statically linking vc++ runtime dependencies inside libusb-1.0 Windows libraries. 'Release' and 'Debug' configurations produce /MD compiled binaries while the new 'Release-MT' and 'Debug-MT" configurations produce /MT compiled binaries. The /MT flag causes the application to include the multithread, static version of the vc++ run-time library, whereas the default flag /MD will cause the vc++ run-time library to be dynamically linked run-time. Using /MT thus builds a standalone libusb DLL that doesn't require a vc++ runtime DLL to be shipped along with it. For the official description of /MT see: https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library Closes #1188
* windows: Define __func__ for vs2015Alexander Mot2023-01-071-2/+2
| | | | | | | | | | | The __func__ macro is defined by the C99 standard (but not C++99/03). The default C compiler in msvc implements C89, plus Microsoft extensions, some of which are part of C99. It appears that both vs2013 and vs2015 don't define __func__. Closes #1170
* msvc: Rework msbuild filesShawn Hoffman2022-06-26119-6917/+612
| | | | | | | | | | | Refactor common settings into .props files. Enables building full PlatformToolset, Platform, Configuration matrix easily. Also update the appveyor file. Technically we no longer need different images (could just have a single vs2022 image which is executed multiple times in parallel, or so) Closes #1116
* core: Refactor initialization and how the default context is handledChris Dickens2021-06-0216-32/+0
| | | | | | | | | | | | | | | | | | | Highlights for this change: - usbi_default_context is only set if libusb_init() is called with NULL. - All hotplug related functionality (e.g. initialization, processing) has been moved to hotplug.c - Backends are simplified by removing initialization mutexes. Mutual exclusion between init()/exit() is provided by default_context_lock. - Make hotplug types and functions part of libusbi.h with the common usbi_ prefixes (removes hotplug.h). Addresses issue highlighted in #855 Closes #856 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com> Signed-off-by: Nathan Hjelm <hjelmn@google.com>
* fix eol of msvc/*.vcxproj and msvc/*.vcxproj.filters filesMikolaj Kucharski2020-11-3024-1446/+1446
| | | | | | | Closes #812 Closes #813 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Support building dpfp and sam3u_benchmark with MSVCChris Dickens2020-11-2728-0/+1638
| | | | | | Closes #151 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Add missing header files to MSVC projectsChris Dickens2020-11-2748-0/+240
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* build: Prepare config.h for inclusion in examples/testsChris Dickens2020-11-2733-16/+52
| | | | | | | | | | | | There are certain games played in the examples and tests source to account for differences in build environments and target platforms. This can be simplified by including config.h and using the definitions there. To that end, move the printf function attribute definition from libusbi.h to config.h and leverage it where it is used in the examples and tests. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* build: Merge events and threads into single platform abstractionChris Dickens2020-09-121-5/+2
| | | | | | | | | | | | | | The split between events and threads abstractions is unnecessary. Simplify the library by merging the two into a "platform" abstraction. The only meaningful change is that Cygwin builds will no longer use the POSIX threads abstraction but will instead use the native Windows one. The downside to doing this is that the dpfp_threaded example program will no longer be available on Cygwin builds. This should be fine, and future work will make dpfp_threaded available for all forms of Windows build systems. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* core: Introduce platform events abstractionChris Dickens2020-08-1217-66/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way in which system handles or resources are represented differs greatly between Unix-like operating systems and Windows. Ever since Windows support was added to libusb, Windows been emulating principles of Unix-like operating systems such as file descriptors and poll(). This commit introduces an abstraction layer that completely removes the need to perform any emulation. Fundamentally there are three things that each platform provides to libusb: 1) A signallable event 2) A timer (not required, but useful) 3) A means to wait for event sources such as the above to be triggered The POSIX abstraction for Unix-like operating systems uses file descriptors as the "handles" to the underlying system resources. The signallable event is implemented using a pipe, the timer as a timerfd (where supported) and the poll() system call is used to wait for events. The Windows abstraction uses native HANDLEs as the "handles" to the underlying system resources. The signallable event is implemented using a manual-reset event, the timer as a manual-reset waitable timer, and the WaitForMultipleObjects() system call is used to wait for events. Closes #252 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* build: Require C11 to build and clean up autoconfig/automake filesChris Dickens2020-03-301-8/+13
| | | | | | | | | | | | | | | | | | | | | | | C11 compiler support has been available for many years now. It is not unreasonable to require this now, and doing so allows some cleanup to the configure script. It is no longer necessary to check for compiler support of the '-fvibility' flag because any compiler that supports C11 will support this flag as well. Fix up the way that compiler and linker flags are passed down to the various makefiles. The compiler flags should be shared by all, but the linker flags and libraries should be separated between the library and the examples/tests. The visibility flag is only relevant for the library and the thread flags are only relevant for sources using thread constructs, so provide them as needed. Rearrange configure.ac to group similar functionality and consolidate where possible. Based on these changes, update the Travis configuration file to include newer versions of test platforms to ensure proper C11 compiler support. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* core: Kill the OS_* definitions and use in the source codeChris Dickens2020-03-271-3/+0
| | | | | | | These symbols are no longer necessary for the source code since commit cad7d0edd9 ("core: Kill usbi_os_backend structure definition madness"). Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* msvc: Update include path for getopt in fxload projectsChris Dickens2020-03-254-4/+4
| | | | | | | | | Commit 07d6d3a2a5 ("msvc: Reorder solution projects and add project filter files") moved the getopt source into the msvc directory but did not include updating the include paths for the project that needs the header files. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* msvc: Reorder solution projects and add project filter filesChris Dickens2020-03-2348-126/+2811
| | | | | | | | | | | | | | Since Visual Studio picks the first project as the default startup project, move the library projects back to the top of the list. This use to be the order but was changed in commit 9843b689df. Add the project filter files to help organize the source files within the Solution Explorer window pane. Additionally move the getopt source underneath the msvc directory since it is only used for Visual Studio builds. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Fix some harmless build warningsChris Dickens2020-03-091-0/+2
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* core: Convert internal macros to static inline functionsChris Dickens2020-01-251-1/+3
| | | | | | | | | | | | Older versions of the Visual Studio compiler are picky about macros constructed with the 'do { ... } while (0)' construct. Convert these internal ones to static inline functions. The result is functionally equivalent but gets us type checking and a bit more readability. Also address some compiler warnings due to some header files that are being included in a different order than before. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Fix msvc 2019 project files (internal linkage)winterrace2020-01-246-7/+7
| | | | | | Closes #683 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* configure.ac: Cleanup and refactoringChris Dickens2020-01-241-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the formatting consistent across the entire file. In particular: - Always quote strings whose values are derived - Use tabs consistently - Wrap all arguments with square brackets Replace the use of '-a' with '&&' to be more portable. Rearrange some of the feature checks to be conditional upon the platform or backend. For example, there is no need to check for nfds_t on Windows because poll() doesn't exist there. Similarly we now only check for timerfd on Linux and Solaris. This translates into slightly faster configure times. Explicitly define tokens for both the poll and thread implementations. This makes the preprocessor conditionals much nicer since it is not necessary to enumerate all possible OS_* tokens. Also replace POLL_NFDS_TYPE with a proper typedef that is based on the availability of the nfds_t type. Migrate to config definition names that are more consistent with autoconf. The check for timerfd actually verifies the presence of the library function instead of just the header definitions, and the token USBI_TIMERFD_AVAILABLE is now HAVE_TIMERFD. Similarly the check for syslog results in a definition of HAVE_SYSLOG. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Trim and consolidate header file usageChris Dickens2020-01-241-12/+7
| | | | | | | | | | | | | Refactor libusbi.h to include the set of common header files needed by every main source file in the library and change these source files to include libusbi.h first, followed by any non-common headers. Including libusbi.h first ensures that the config definitions are pulled in and will eliminate redundant includes in the individual sources files. Also clean up some whitespace errors and remove unnecessary definitions in the manually generated config.h files. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Drop support for Windows XPChris Dickens2020-01-218-8/+8
| | | | | | | | | XP is nearly 20 years old and there are hoops we jump through to keep supporting it. Time to say goodbye and simplify some things. Closes #267 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Add Visual Studio 2019 supportChris Dickens2020-01-2110-0/+1142
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Remove obsolete Windows DDK build filesChris Dickens2020-01-2110-410/+0
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Clean up Visual Studio project filesChris Dickens2020-01-2130-76/+36
| | | | | | | | | | | | | | | | | | | | | | | Commit a9b34d170a ("Adding support for ARM & ARM64 Windows Platform") introduced a dependency on a particular version of the Windows 10 SDK for *all* platforms. This is particularly annoying for most users who will only be building for Windows. Fix this by specifying the SDK dependency only for the ARM/ARM64 platforms and bump to the latest. Commit 77037c4dd6 ("Adds /utf-8 to compile options") added this compiler option to all versions of the Visual Studio project files. This results in a number of warnings with the older versions that don't recognize this option. Fix this by keeping this option only for 2015 and newer. Explicitly specify library dependencies for non-static targets. With a small change in the UsbDk backend we can completely remove all depenencies other than kernel32.lib. Lastly, remove the 'MinimalRebuild' option for 2015 and newer project files as this option is now deprecated and results in a warning for each project. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Remove support for WinCE and Visual Studio older than 2013Chris Dickens2020-01-2078-11645/+51
| | | | | | | | | | | There appears to be no need for the WinCE backend anymore, and it is increasingly difficult to keep healthy as the rest of the library changes. Require at least Visual Studio 2013 to compile. This simplifies matters as there is some semblance of C99 support there. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Adds /utf-8 to compile optionsRipleyTom2019-07-0745-0/+45
| | | | Signed-off-by: Nathan Hjelm <hjelmn@me.com>
* Change all $(SolutionDir) to $(ProjectDir)RipleyTom2019-07-0745-90/+90
| | | | Signed-off-by: Nathan Hjelm <hjelmn@me.com>
* Adding support for ARM & ARM64 Windows PlatformDj Art2019-04-0410-9/+297
| | | | | | Closes #423 Signed-off-by: Nathan Hjelm <hjelmn@me.com>
* Windows: Add back resource and definition files to VS DLL projectsChris Dickens2018-03-205-0/+20
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Restructure DDK/MSVC project filesChris Dickens2018-03-1271-5010/+855
| | | | | | | | | | | For simplicity and to address some build warnings, this commit reworks the project files to eliminate duplication and consolidate common build flags and options. Also adds the stress and testlibusb projects to the DDK build script. Closes #402 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Fix appveyor scripts for Cygwin and MinGW to build as intendedChris Dickens2018-01-081-7/+6
| | | | | | | | | | | | | | | | | | | | The sub-directory created to store the generated files and build objects was not being used as intended, because each invocation of the bash starts in the home directory. Fix this by changing to the intended directory prior to each command invocation. Also replace the invocation of autogen.sh with bootstrap.sh, since using autogen.sh calls ./configure and we weren't using the results of that work. Instead we call configure directly from the sub-directory while enabling the examples and test builds (for Cygwin) as autogen.sh would do. Also fix the invalid value for the --build option provided to the x64 build of MinGW. Finally, propagate errors from each script command so that failures are caught and reported. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Ditch UsbDk build configurationSameeh Jubran2018-01-0811-1093/+1
| | | | | | | Previous patch introduced run-time UsbDk backend activation, therefore separate build configuration is not needed anymore. Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
* Windows: Enable dynamic selection between WinUSB and UsbDk backendsChris Dickens2018-01-0817-22/+145
| | | | | | | | | | | | | This commit unifies the two Windows backends into a single project and enables the user to switch to the UsbDk backend, if available, using the libusb_set_option() function. All contexts will use the WinUSB backend by default for backwards compatibility. With this change, the UsbDk-specific projects are no longer required. Closes #309 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Add TargetName to getopt VS project files to supress warningChris Dickens2018-01-045-0/+20
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Sort projects alphabetically in VS solution filesChris Dickens2018-01-046-273/+266
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Fix references section in fxload VS project filesChris Dickens2018-01-045-15/+20
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Fix linker options in getopt VS project filesChris Dickens2018-01-045-25/+25
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Add missing files to VS2005 projects for libusbChris Dickens2018-01-042-4/+36
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Fix minor discrepancies in WinCE MSVC filesChris Dickens2018-01-043-115/+117
| | | | | | | Add missing header files, fix preprocessor definitions for static library, and sort projects and files by name. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Fix some minor style issuesChris Dickens2018-01-031-1/+1
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Ensure that both WINVER and _WIN32_WINNT are defined for Windows buildsChris Dickens2018-01-031-0/+4
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Add _CRT_SECURE_NO_WARNINGS to testlibusb to suppress warning C4996Chris Dickens2017-12-285-20/+20
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Misc: Fix testlibusb build on VS2013 and earlier and suppress warningsChris Dickens2017-12-261-2/+4
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Add VS 2010/2012/2013/2017 project files for testlibusbChris Dickens2017-12-268-0/+712
| | | | | | | Inspired by PR #201 (commit fa19c152), this commit adds the same project files for the other supported versions of Visual Studio. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: testlibusb example for VS2015Anil Nair2017-12-262-0/+179
| | | | | | Closes #201 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* core: Remove check for and inclusion of signal.hChris Dickens2017-01-121-1/+0
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Fix DDK build's missing filesChris Dickens2017-01-121-4/+4
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Windows: Add Visual Studio 2017 supportChris Dickens2017-01-0611-0/+1788
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* windows: use appropriate version for VS2015 solution filesPete Batard2016-07-221-2/+2
| | | | * Closes #193