godot_openhmd icon indicating copy to clipboard operation
godot_openhmd copied to clipboard

WIP: Meson build

Open BastiaanOlij opened this issue 5 years ago • 5 comments

Working together with @thaytan to move over to using meson to build so we can automatically pull in the latest openhmd or direct to specific branches of this.

BastiaanOlij avatar Apr 05 '20 10:04 BastiaanOlij

Currently stuck on

The Meson build system
Version: 0.54.0
Source dir: D:\Development\xr_plugins\godot_openhmd
Build dir: D:\Development\xr_plugins\godot_openhmd\builddir
Build type: native build
Project name: openhmd_godot
Project version: 0.1.0
C compiler for the host machine: cl (msvc 19.25.28611)
C linker for the host machine: link link 14.25.28611.0
Host machine cpu family: x86_64
Host machine cpu: x86_64

|Executing subproject OpenHMD method meson
|
|Project name: openhmd
|Project version: 0.3.0
|C compiler for the host machine: cl (msvc 19.25.28611)
|C linker for the host machine: link link 14.25.28611.0
|Library m found: NO
|Did not find pkg-config by name 'pkg-config'
|Found Pkg-config: NO
|Found CMake: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE (3.16.19112601-MSVC_2)
|Run-time dependency hidapi found: NO (tried pkgconfig and cmake)
|subprojects\OpenHMD\meson.build:31: WARNING: Dependency hidapi not found but it is available in a sub-subproject.
|To use it in the current project, promote it by going in the project source
|root and issuing the following command:
|meson wrap promote subprojects\OpenHMD\subprojects\hidapi.wrap

subprojects\OpenHMD\meson.build:31:1: ERROR: Subproject directory not found and hidapi.wrap file not found

A full log can be found at D:\Development\xr_plugins\godot_openhmd\builddir\meson-logs\meson-log.txt

hidapi.wrap is there, not sure why it can't run it, possibly because I need to install pkgconfig first?

BastiaanOlij avatar Apr 05 '20 11:04 BastiaanOlij

Ok, the answer was in there: meson wrap promote subprojects\OpenHMD\subprojects\hidapi.wrap

This copies the hidapi.wrap into our subprojects folder and allows us to build it..

Now I need to find out how to tell it to copy the final dll into the right place

BastiaanOlij avatar Apr 05 '20 11:04 BastiaanOlij

Ok, it now works though you need to copy all the files in place and I'm not sure I like the -0 suffix the openhmd and godot_openhmd dlls get. I get why, though its weird hidapi doesn't get the suffix.

I'll be improving the demo a little more and then I will likely merge this.

BastiaanOlij avatar Apr 05 '20 12:04 BastiaanOlij

The -0 suffix on built dlls comes from having a version: library_version line in the meson library() declaration - it's to allow parallel installation of versions with different ABI. Could be avoided with a platform check in the relevant meson builds, like:

library_kwargs = {} if host_machine.system() == 'windows' library_kwargs = {'soversion': false} endif ... library(..., kwargs: library_kwargs)

thaytan avatar Apr 21 '20 13:04 thaytan

For copying the build artifacts into the uninstalled directories for use, one can use a meson custom_target() that runs a script, and you can assign a ninja target name to it with alias_target(). So you can tell people to do ninja prepare or something which will copy the artifacts. However, if you need to copy from multiple builddirs, it's probably best to have a wrapper script that calls meson multiple times for each target platform in separate builddirs and then consolidates it into one.

thaytan avatar Apr 21 '20 13:04 thaytan