Переглянути джерело

Meson (#122)

* Update driver list in CMake build instructions

The list of drivers has grown a bit since 0.2.0, mention them in the CMake
build instructions.

* Add Windows Mixed Reality (wmr) driver to Meson build

The meson build support and WMR driver were added at the same time.
Extend the meson rules to build the WMR driver.

* Add Meson build instructions to README.md

Explain how to build with Meson and Ninja in the README.

* Require Meson version 0.44 or later

This is the version that introduced array config options, which
meson_options.txt uses.
pH5 7 роки тому
батько
коміт
572bea67a3
3 змінених файлів з 28 додано та 4 видалено
  1. 17 3
      README.md
  2. 10 0
      meson.build
  3. 1 1
      meson_options.txt

+ 17 - 3
README.md

@@ -15,8 +15,11 @@ For a full list of supported devices please check https://github.com/OpenHMD/Ope
   * FreeBSD
 
 ## Requirements
-  * Option 1: GNU Autotools (if you're building from the git repository)
-  * Option 2: CMake
+  * Option 1: Meson + Ninja
+    * http://mesonbuild.com
+    * https://ninja-build.org
+  * Option 2: GNU Autotools (if you're building from the git repository)
+  * Option 3: CMake
   * HIDAPI
     * http://www.signal11.us/oss/hidapi/
     * https://github.com/signal11/hidapi/
@@ -37,6 +40,17 @@ For a full list of supported devices please check https://github.com/OpenHMD/Ope
   * libvr - http://hg.sitedethib.com/libvr
 
 ## Compiling and Installing
+Using Meson:
+
+With Meson, you can enable and disable drivers to compile OpenHMD with.
+Current available drivers are: rift, deepon, psvr, vive, nolo, wmr, external, and android.
+These can be enabled or disabled by adding -Ddrivers=... with a comma separated list after the meson command (or using meson configure ./build -Ddrivers=...).
+By default all drivers except android are enabled.
+
+    meson ./build [-Dexamples=simple,opengl]
+    ninja -C ./build
+    sudo ninja -C ./build install
+
 Using make:
 
     ./autogen.sh # (if you're building from the git repository)
@@ -47,7 +61,7 @@ Using make:
 Using CMake:
 
 With CMake, you can enable and disable drivers to compile OpenHMD with.
-Current Available drivers are: OPENHMD_DRIVER_OCULUS_RIFT, OPENHMD_DRIVER_EXTERNAL and OPENHMD_DRIVER_ANDROID.
+Current Available drivers are: OPENHMD_DRIVER_OCULUS_RIFT, OPENHMD_DRIVER_DEEPOON, OPENHMD_DRIVER_WMR, OPENHMD_DRIVER_PSVR, OPENHMD_DRIVER_HTC_VIVE, OPENHMD_DRIVER_NOLO, OPENHMD_DRIVER_EXTERNAL and OPENHMD_DRIVER_ANDROID.
 These can be enabled or disabled adding -DDRIVER_OF_CHOICE=ON after the cmake command (or using cmake-gui).
 
     cmake .

+ 10 - 0
meson.build

@@ -2,6 +2,7 @@ project(
 	'openhmd', 'c',
 	default_options : 'c_std=c99',
 	version : '0.2.0',
+	meson_version : '>= 0.44'
 )
 library_version = '0.0.0'
 
@@ -67,6 +68,15 @@ if _drivers.contains('nolo')
 	deps += dependency('hidapi-libusb')
 endif
 
+if _drivers.contains('wmr')
+	sources += [
+		'src/drv_wmr/wmr.c',
+		'src/drv_wmr/packet.c'
+	]
+	c_args += '-DDRIVER_WMR'
+	deps += dependency('hidapi-libusb')
+endif
+
 if _drivers.contains('external')
 	sources += [
 		'src/drv_external/external.c'

+ 1 - 1
meson_options.txt

@@ -1,2 +1,2 @@
 option('examples', type : 'array', choices : ['simple', 'opengl', ''], value : ['simple'])
-option('drivers', type : 'array', choices : ['rift', 'deepoon', 'psvr', 'vive', 'nolo', 'external', 'android'], value : ['rift', 'deepoon', 'psvr', 'vive', 'nolo', 'external'])
+option('drivers', type : 'array', choices : ['rift', 'deepoon', 'psvr', 'vive', 'nolo', 'wmr', 'external', 'android'], value : ['rift', 'deepoon', 'psvr', 'vive', 'nolo', 'wmr', 'external'])