Comments (18)
once its in-tree, maintenance of it would be simple enough
I'd say this statement is true for any modern build system. It is more about the fact that a developer have to remember to go into yet another build script/configuration file and get it updated, e.g. when one more source file is added, etc.
For example: aaf5f3d
There is two trivial changes to libusb/CMakeLists.txt
and libusb/Makefile.am
. With meson it will become 3 places. Tomorrow someone else will say that "oh, you already have 3, lets make it 4, because I like/need X<BUILD SYSTEM> better".
My point is: if it is possible to wrap around CMake (instead of copying it) - lets rather have a wrap.
from hidapi.
The question here is - what does it take on HIDAPI side to make it possible?
You'll have to port its build system to meson, either in upstream repository or as a patch overlay in Meson's wrapdb.
from hidapi.
on another note, meson also has a dist
target which produces sensibly named tarballs
(hidapi-ver.tar.* instead of hidapi-hidapi-ver.tar.*).
I'm relatively skilled at writing meson buildscripts, so if you're interested in that I can whip
one up and pr it.
from hidapi.
I imagine having possible "meson wrap install hidapi
" would be very convenient for Meson users.
The question here is - what does it take on HIDAPI side to make it possible?
Recently we've developed a CMake build system, which happened to be slightly less trivial than I have originally imagined it would (extra complexity for usage convenience). And we're deprecating support of the Autotools in favor of CMake on this matter.
So do we need to make a whole new (Mason) build script for HIDAPI?
Because that would mean we need to support two (three as Autotools is not obsolete yet) build systems at the same time, which would be unfortunate.
Can we have Mason re-use CMake scripts for its build?
As an alternative: can we have CMake generate Mason "import files" (is that even a thing?), similarly as we generate pkg-config import files? I.e. build HIDAPI with CMake and then publish the artifacts somewhere where meson wrap ...
could get it from.
from hidapi.
meson can consume FindFoo.cmake files, I know that much, not sure about wrapdb integration. However, its a pretty simple 'scripting language' (not right term but close enough for gov't work), so once its in-tree, maintenance of it would be simple enough, unless the project decides to add some truly insane steps to the build.
from hidapi.
My point is: if it is possible to wrap around CMake (instead of copying it) - lets rather have a wrap.
No, as far as I can see the way a wrapdb works is you have pkgname.wrap file, which defines what deps
it provides, where to get the raw source, and if pkgname isn't already meson, provide a 'patch' which
converts it over.
You can see it here https://github.com/mesonbuild/wrapdb, under the subprojects directory. If you go a directory deeper under pkgfiles you'll find the files used to create the 'patch'.
from hidapi.
A project that uses hidapi could uses Meson's cmake module to build hidapi: https://mesonbuild.com/CMake-module.html#cmake-subprojects. But that has many limitations and bugs.
from hidapi.
As an alternative: can we have CMake generate Mason "import files" (is that even a thing?), similarly as we generate pkg-config import files? I.e. build HIDAPI with CMake and then publish the artifacts somewhere where
meson wrap ...
could get it from.
meson natively uses pkg-config. Projects depending on hidapi do e.g. hidapi_dep = dependency('hidapi')
and this will look up hidapi.pc via pkg-config.
meson wrap is an additional dependency lookup method. By passing a meson option, the build system can be told to prefer local (vendored) private versions of dependencies, which relies on having hidapi build using meson -- then hidapi would get imported into the other project and built from scratch. This has some advantages, if users might not have hidapi installed or their distro doesn't provide a new enough version. Or if they use Windows where dependency management is complicated.
from hidapi.
A project that uses hidapi could uses Meson's cmake module to build hidapi
I would give it a shot.
But that has many limitations and bugs.
Let see if we hit any of those.
from hidapi.
So yes, we do hit some limitation here (e.g. cannot re-use CMake alias targets), but there is a straight-forward workaround and so far I came up with this:
https://github.com/libusb/hidapi/tree/meson_support
I guess it can be greatly improved (add version info for starters), but I'd be more than happy to accept such change into master.
I also not sure how my current implementation would fit with already existing pkg-config method on linux (e.g. compatibility over target names and so on).
But other than that - I don't see any "limitations and bugs" that would make such approach unfeasible.
Thoughts?
from hidapi.
@eli-schwartz your comments on https://github.com/libusb/hidapi/tree/meson_support are welcome
from hidapi.
Lets make it even better: #410
from hidapi.
I tried to build it, but whatever magic incantations the auto-translation attempted to do seem to have failed because the libraries don't have any source files as far as Meson is aware.
from hidapi.
Update: it works successfully if I move the hidapi source tree into subprojects/hidapi_build_cmake/ rather than using that shim file which I don't quite understand the workings of.
from hidapi.
move the hidapi source tree into subprojects/hidapi_build_cmake/
That shouldn't be required. Can you share failure logs when running on the original branch?
from hidapi.
Ah, I see:
hidapi_build_cmake| WARNING: CMake: path C:/projects/hidapi/hidapi is inside the root project but not inside the subproject.
hidapi_build_cmake| WARNING: --> Ignoring. This can lead to build errors.
hidapi_build_cmake| WARNING: CMake: path C:/projects/hidapi/windows/hid.c is inside the root project but not inside the subproject.
hidapi_build_cmake| WARNING: --> Ignoring. This can lead to build errors.
hidapi_build_cmake| WARNING: CMake: path C:/projects/hidapi/hidapi/hidapi.h is inside the root project but not inside the subproject.
hidapi_build_cmake| WARNING: --> Ignoring. This can lead to build errors.
hidapi_build_cmake| WARNING: CMake: path C:/projects/hidapi/windows/hidapi_winapi.h is inside the root project but not inside the subproject.
hidapi_build_cmake| WARNING: --> Ignoring. This can lead to build errors.
hidapi_build_cmake| WARNING: CMake: path C:/projects/hidapi/windows/hidapi_cfgmgr32.h is inside the root project but not inside the subproject.
hidapi_build_cmake| WARNING: --> Ignoring. This can lead to build errors.
hidapi_build_cmake| WARNING: CMake: path C:/projects/hidapi/windows/hidapi_hidclass.h is inside the root project but not inside the subproject.
hidapi_build_cmake| WARNING: --> Ignoring. This can lead to build errors.
hidapi_build_cmake| WARNING: CMake: path C:/projects/hidapi/windows/hidapi_hidpi.h is inside the root project but not inside the subproject.
hidapi_build_cmake| WARNING: --> Ignoring. This can lead to build errors.
hidapi_build_cmake| WARNING: CMake: path C:/projects/hidapi/windows/hidapi_hidsdi.h is inside the root project but not inside the subproject.
hidapi_build_cmake| WARNING: --> Ignoring. This can lead to build errors.
hidapi_build_cmake| WARNING: CMake: path C:/projects/hidapi/hidapi is inside the root project but not inside the subproject.
hidapi_build_cmake| WARNING: --> Ignoring. This can lead to build errors.
hidapi_build_cmake| CMake project Project has 2 build targets.
I haven't tried to build hidapi directly. Instead I used a different project, where hidapi is a subproject on its own - that way it works.
from hidapi.
Updated the implementation.
Added CI scripts.
from hidapi.
As much as will be done in scope of this repo - already done in scope of #410
from hidapi.
Related Issues (20)
- `hidapi` is not available via pkg-config on BSD systems when built with CMake
- Too old CMake version warning HOT 2
- macOS: pthread_barrier_wait impropper wait condition
- HIDRAW backend support for Android HOT 3
- win32: Hangs forever in hid_read_timeout() when calling hid_close() HOT 6
- win32: hang forever in hid_read_timeout() when calling hid_close(). HOT 6
- Call to `hid_read_timeout` sometimes never returns on Windows HOT 1
- ImportError of usblib libraries HOT 3
- Why need sudo for libhidapi-libusb and not for libhidapi-hidraw? HOT 4
- Linux / hidraw flock support? HOT 1
- Meson build system cannot be used for cross builds HOT 4
- spacemouse
- [MacOS] Potential issues reported by clang (low to medium priority)
- Getting undefined reference to 'hid_get_report descriptor' and 'hid_get_device_info' when compiling/linking test.c HOT 1
- Potential solution to MacOS hid_init/hid_exit issue HOT 4
- Cannot compile hidapi 1.5.0 on macos HOT 3
- need longer timeout with send_feature_report() for libusb under Windows HOT 3
- Warnings HOT 3
- Consern regarding Hotplug callbacks implementation HOT 1
- warning: [email protected]: cc1: fatal error: etc/hidapi/linux/hid.c: No such file or directory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hidapi.