2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv
|
2021-01-05 11:10:40 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, hidapi
|
|
|
|
, SDL2
|
|
|
|
, libGL
|
|
|
|
, glew
|
|
|
|
, withExamples ? true
|
2019-02-03 19:57:56 +00:00
|
|
|
}:
|
|
|
|
|
2021-01-05 11:10:40 +00:00
|
|
|
let examplesOnOff = if withExamples then "ON" else "OFF"; in
|
2019-02-03 19:57:56 +00:00
|
|
|
|
2021-01-05 11:10:40 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-02-03 19:57:56 +00:00
|
|
|
pname = "openhmd";
|
2021-01-05 11:10:40 +00:00
|
|
|
version = "0.3.0";
|
2019-02-03 19:57:56 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "OpenHMD";
|
|
|
|
repo = "OpenHMD";
|
2021-01-05 11:10:40 +00:00
|
|
|
rev = version;
|
|
|
|
sha256 = "1hkpdl4zgycag5k8njvqpx01apxmm8m8pvhlsxgxpqiqy9a38ccg";
|
2019-02-03 19:57:56 +00:00
|
|
|
};
|
|
|
|
|
2021-01-05 11:10:40 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2019-02-03 19:57:56 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
hidapi
|
2021-01-21 17:00:13 +00:00
|
|
|
] ++ lib.optionals withExamples [
|
2021-01-05 11:10:40 +00:00
|
|
|
SDL2
|
|
|
|
glew
|
|
|
|
libGL
|
2019-02-03 19:57:56 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_BOTH_STATIC_SHARED_LIBS=ON"
|
2021-01-05 11:10:40 +00:00
|
|
|
"-DOPENHMD_EXAMPLE_SIMPLE=${examplesOnOff}"
|
|
|
|
"-DOPENHMD_EXAMPLE_SDL=${examplesOnOff}"
|
2019-02-03 19:57:56 +00:00
|
|
|
"-DOpenGL_GL_PREFERENCE=GLVND"
|
|
|
|
];
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
postInstall = lib.optionalString withExamples ''
|
2019-02-03 19:57:56 +00:00
|
|
|
mkdir -p $out/bin
|
|
|
|
install -D examples/simple/simple $out/bin/openhmd-example-simple
|
|
|
|
install -D examples/opengl/openglexample $out/bin/openhmd-example-opengl
|
|
|
|
'';
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2021-01-05 11:10:40 +00:00
|
|
|
homepage = "http://www.openhmd.net"; # https does not work
|
2019-02-03 19:57:56 +00:00
|
|
|
description = "Library API and drivers immersive technology";
|
|
|
|
longDescription = ''
|
|
|
|
OpenHMD is a very simple FLOSS C library and a set of drivers
|
|
|
|
for interfacing with Virtual Reality (VR) Headsets aka
|
|
|
|
Head-mounted Displays (HMDs), controllers and trackers like
|
|
|
|
Oculus Rift, HTC Vive, Windows Mixed Reality, and etc.
|
|
|
|
'';
|
|
|
|
license = licenses.boost;
|
2021-01-05 11:10:40 +00:00
|
|
|
maintainers = with maintainers; [ oxij ];
|
2019-02-03 19:57:56 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|