diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /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.md | 127 |
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 | |||
| 17 | For various reasons, you may need to build HIDAPI on your own. | ||
| 18 | |||
| 19 | It 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 | ||
| 26 | HIDAPI. The most common usage of it is in its separate README: [BUILD.autotools.md](BUILD.autotools.md).<br/> | ||
| 27 | NOTE: for all intentions and purposes the Autotools build scripts for HIDAPI are _deprecated_ and going to be obsolete in the future. | ||
| 28 | HIDAPI 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. | ||
| 31 | HIDAPI is one of the projects which use the power of CMake to its advantage. | ||
| 32 | More 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. | ||
| 35 | It 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> | ||
| 36 | In the Meson script of your project you need a `hidapi = subproject('hidapi')` subproject, and `hidapi.get_variable('hidapi_dep')` as your dependency. | ||
| 37 | There are also backend/platform-specific dependencies available: `hidapi_winapi`, `hidapi_darwin`, `hidapi_hidraw`, `hidapi_libusb`. | ||
| 38 | |||
| 39 | If you don't know where to start to build HIDAPI, we recommend starting with [CMake](BUILD.cmake.md) build. | ||
| 40 | |||
| 41 | ## Prerequisites: | ||
| 42 | |||
| 43 | Regardless of what build system you choose to use, there are specific dependencies for each platform/backend. | ||
| 44 | |||
| 45 | ### Linux: | ||
| 46 | |||
| 47 | Depending on which backend you're going to build, you'll need to install | ||
| 48 | additional development packages. For `linux/hidraw` backend, you need a | ||
| 49 | development package for `libudev`. For `libusb` backend, naturally, you need | ||
| 50 | `libusb` development package. | ||
| 51 | |||
| 52 | On Debian/Ubuntu systems these can be installed by running: | ||
| 53 | ```sh | ||
| 54 | # required only by hidraw backend | ||
| 55 | sudo apt install libudev-dev | ||
| 56 | # required only by libusb backend | ||
| 57 | sudo apt install libusb-1.0-0-dev | ||
| 58 | ``` | ||
| 59 | |||
| 60 | ### FreeBSD: | ||
| 61 | |||
| 62 | On FreeBSD, you will need to install libiconv. This is done by running | ||
| 63 | the following: | ||
| 64 | ```sh | ||
| 65 | pkg_add -r libiconv | ||
| 66 | ``` | ||
| 67 | |||
| 68 | ### Mac: | ||
| 69 | |||
| 70 | Make sure you have XCode installed and its Command Line Tools. | ||
| 71 | |||
| 72 | ### Windows: | ||
| 73 | |||
| 74 | You just need a compiler. You may use Visual Studio or Cygwin/MinGW, | ||
| 75 | depending on which environment is best for your needs. | ||
| 76 | |||
| 77 | ## Embedding HIDAPI directly into your source tree | ||
| 78 | |||
| 79 | Instead of using one of the provided standalone build systems, | ||
| 80 | you may want to integrate HIDAPI directly into your source tree. | ||
| 81 | |||
| 82 | --- | ||
| 83 | If 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 | --- | ||
| 86 | If _the only option_ that works for you is adding HIDAPI sources directly | ||
| 87 | to your project's build system, then you need: | ||
| 88 | - include a _single source file_ into your project's build system, | ||
| 89 | depending 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 | |||
| 97 | NOTE: the above doesn't guarantee that having a copy of `<backend>/hid.c` and `hidapi/hidapi.h` is enough to build HIDAPI. | ||
| 98 | The only guarantee that `<backend>/hid.c` includes all necessary sources to compile it as a single file. | ||
| 99 | |||
| 100 | Check 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 | |||
| 104 | Manual Makefiles are provided mostly to give the user an idea what it takes | ||
| 105 | to build a program which embeds HIDAPI directly inside of it. These should | ||
| 106 | really be used as examples only. If you want to build a system-wide shared | ||
| 107 | library, use one of the build systems mentioned above. | ||
| 108 | |||
| 109 | To build HIDAPI using the manual Makefiles, change the directory | ||
| 110 | of your platform and run make. For example, on Linux run: | ||
| 111 | ```sh | ||
| 112 | cd linux/ | ||
| 113 | make -f Makefile-manual | ||
| 114 | ``` | ||
| 115 | |||
| 116 | ## Building on Windows | ||
| 117 | |||
| 118 | To build the HIDAPI DLL on Windows using Visual Studio, build the `.sln` file | ||
| 119 | in the `windows/` directory. | ||
| 120 | |||
| 121 | To build HIDAPI using MinGW or Cygwin using Autotools, use general Autotools | ||
| 122 | [instruction](BUILD.autotools.md). | ||
| 123 | |||
| 124 | Any windows builds (MSVC or MinGW/Cygwin) are also supported by [CMake](BUILD.cmake.md). | ||
| 125 | |||
| 126 | If 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. | ||
