summaryrefslogtreecommitdiff
path: root/contrib/SDL-3.2.8/src/hidapi/BUILD.md
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-12-27 12:03:39 -0800
committer3gg <3gg@shellblade.net>2025-12-27 12:03:39 -0800
commit5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch)
tree8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/hidapi/BUILD.md
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/hidapi/BUILD.md')
-rw-r--r--contrib/SDL-3.2.8/src/hidapi/BUILD.md127
1 files changed, 127 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/hidapi/BUILD.md b/contrib/SDL-3.2.8/src/hidapi/BUILD.md
new file mode 100644
index 0000000..d7a3546
--- /dev/null
+++ b/contrib/SDL-3.2.8/src/hidapi/BUILD.md
@@ -0,0 +1,127 @@
1# Building HIDAPI from Source
2
3## Table of content
4
5* [Intro](#intro)
6* [Prerequisites](#prerequisites)
7 * [Linux](#linux)
8 * [FreeBSD](#freebsd)
9 * [Mac](#mac)
10 * [Windows](#windows)
11* [Embedding HIDAPI directly into your source tree](#embedding-hidapi-directly-into-your-source-tree)
12* [Building the manual way on Unix platforms](#building-the-manual-way-on-unix-platforms)
13* [Building on Windows](#building-on-windows)
14
15## Intro
16
17For various reasons, you may need to build HIDAPI on your own.
18
19It can be done in several different ways:
20- using [CMake](BUILD.cmake.md);
21- using [Autotools](BUILD.autotools.md) (deprecated);
22- using [manual makefiles](#building-the-manual-way-on-unix-platforms);
23- using `Meson` (requires CMake);
24
25**Autotools** build system is historically the first mature build system for
26HIDAPI. The most common usage of it is in its separate README: [BUILD.autotools.md](BUILD.autotools.md).<br/>
27NOTE: for all intentions and purposes the Autotools build scripts for HIDAPI are _deprecated_ and going to be obsolete in the future.
28HIDAPI Team recommends using CMake build for HIDAPI.
29
30**CMake** build system is de facto an industry standard for many open-source and proprietary projects and solutions.
31HIDAPI is one of the projects which use the power of CMake to its advantage.
32More documentation is available in its separate README: [BUILD.cmake.md](BUILD.cmake.md).
33
34**Meson** build system for HIDAPI is designed as a [wrapper](https://mesonbuild.com/CMake-module.html) over CMake build script.
35It is present for the convenience of Meson users who need to use HIDAPI and need to be sure HIDAPI is built in accordance with officially supported build scripts.<br>
36In the Meson script of your project you need a `hidapi = subproject('hidapi')` subproject, and `hidapi.get_variable('hidapi_dep')` as your dependency.
37There are also backend/platform-specific dependencies available: `hidapi_winapi`, `hidapi_darwin`, `hidapi_hidraw`, `hidapi_libusb`.
38
39If you don't know where to start to build HIDAPI, we recommend starting with [CMake](BUILD.cmake.md) build.
40
41## Prerequisites:
42
43Regardless of what build system you choose to use, there are specific dependencies for each platform/backend.
44
45### Linux:
46
47Depending on which backend you're going to build, you'll need to install
48additional development packages. For `linux/hidraw` backend, you need a
49development package for `libudev`. For `libusb` backend, naturally, you need
50`libusb` development package.
51
52On Debian/Ubuntu systems these can be installed by running:
53```sh
54# required only by hidraw backend
55sudo apt install libudev-dev
56# required only by libusb backend
57sudo apt install libusb-1.0-0-dev
58```
59
60### FreeBSD:
61
62On FreeBSD, you will need to install libiconv. This is done by running
63the following:
64```sh
65pkg_add -r libiconv
66```
67
68### Mac:
69
70Make sure you have XCode installed and its Command Line Tools.
71
72### Windows:
73
74You just need a compiler. You may use Visual Studio or Cygwin/MinGW,
75depending on which environment is best for your needs.
76
77## Embedding HIDAPI directly into your source tree
78
79Instead of using one of the provided standalone build systems,
80you may want to integrate HIDAPI directly into your source tree.
81
82---
83If your project uses CMake as a build system, it is safe to add HIDAPI as a [subdirectory](BUILD.cmake.md#hidapi-as-a-subdirectory).
84
85---
86If _the only option_ that works for you is adding HIDAPI sources directly
87to your project's build system, then you need:
88- include a _single source file_ into your project's build system,
89depending on your platform and the backend you want to use:
90 - [`windows\hid.c`](windows/hid.c);
91 - [`linux/hid.c`](linux/hid.c);
92 - [`libusb/hid.c`](libusb/hid.c);
93 - [`mac/hid.c`](mac/hid.c);
94- add a [`hidapi`](hidapi) folder to the include path when building `hid.c`;
95- make the platform/backend specific [dependencies](#prerequisites) available during the compilation/linking, when building `hid.c`;
96
97NOTE: the above doesn't guarantee that having a copy of `<backend>/hid.c` and `hidapi/hidapi.h` is enough to build HIDAPI.
98The only guarantee that `<backend>/hid.c` includes all necessary sources to compile it as a single file.
99
100Check the manual makefiles for a simple example/reference of what are the dependencies of each specific backend.
101
102## Building the manual way on Unix platforms
103
104Manual Makefiles are provided mostly to give the user an idea what it takes
105to build a program which embeds HIDAPI directly inside of it. These should
106really be used as examples only. If you want to build a system-wide shared
107library, use one of the build systems mentioned above.
108
109To build HIDAPI using the manual Makefiles, change the directory
110of your platform and run make. For example, on Linux run:
111```sh
112cd linux/
113make -f Makefile-manual
114```
115
116## Building on Windows
117
118To build the HIDAPI DLL on Windows using Visual Studio, build the `.sln` file
119in the `windows/` directory.
120
121To build HIDAPI using MinGW or Cygwin using Autotools, use general Autotools
122 [instruction](BUILD.autotools.md).
123
124Any windows builds (MSVC or MinGW/Cygwin) are also supported by [CMake](BUILD.cmake.md).
125
126If you are looking for information regarding DDK build of HIDAPI:
127- the build has been broken for a while and now the support files are obsolete.