From 9db4dfd9631d9c43967c3f3ab400c2d14139ebde Mon Sep 17 00:00:00 2001 From: Christopher Bruns Date: Sun, 28 May 2017 10:28:07 -0400 Subject: [PATCH] Link to platform specific openvr library, and install it, and update license headers. --- src/CMakeLists.txt | 27 ++++++++++++++++-- src/gl/stereo3d/LSMatrix.h | 52 ++++++++++++++--------------------- src/gl/stereo3d/gl_openvr.cpp | 49 ++++++++++++++------------------- src/gl/stereo3d/gl_openvr.h | 51 ++++++++++++++-------------------- 4 files changed, 88 insertions(+), 91 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 448280c14..c6bf7f74e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -489,13 +489,31 @@ if (GZDOOM_USE_OPENVR) ${OPENVR_SDK_PATH}/headers ) include_directories("${OPENVR_INCLUDE_DIRECTORY}") + # Link to correct library for this platform + if(WIN32) + set(OPENVR_PLAT "win") + elseif( APPLE ) + set(OPENVR_PLAT "osx") + else() + set(OPENVR_PLAT "linux") + endif() + if(X64) + set(OPENVR_PLAT ${OPENVR_PLAT}64) + else() + set(OPENVR_PLAT ${OPENVR_PLAT}32) + endif() find_library(OPENVR_LIBRARY NAMES openvr_api - # TODO: Generalize for Mac and Linux and 64-bit Windows - HINTS "${OPENVR_SDK_PATH}/lib/win32/" + HINTS "${OPENVR_SDK_PATH}/lib/${OPENVR_PLAT}/" ) list(APPEND ZDOOM_LIBS ${OPENVR_LIBRARY}) add_definitions("-DUSE_OPENVR") + # Find shared library file needed for package distribution + find_program(OPENVR_SHARED_LIBRARY + NAMES libopenvr_api.so libopenvr_api.dylib openvr_api.dll + PATHS "${OPENVR_SDK_PATH}/bin/${OPENVR_PLAT}/" + NO_DEFAULT_PATH + ) endif() # Start defining source files for ZDoom @@ -1321,6 +1339,11 @@ endif() install(TARGETS zdoom DESTINATION ${INSTALL_PATH} COMPONENT "Game executable") +if(OPENVR_SHARED_LIBRARY) + install(PROGRAMS ${OPENVR_SHARED_LIBRARY} + DESTINATION ${INSTALL_PATH} + COMPONENT "Shared libraries") +endif() source_group("Audio Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/.+") source_group("Audio Files\\OPL Synth" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sound/oplsynth/.+") diff --git a/src/gl/stereo3d/LSMatrix.h b/src/gl/stereo3d/LSMatrix.h index a0e401838..926e4a606 100644 --- a/src/gl/stereo3d/LSMatrix.h +++ b/src/gl/stereo3d/LSMatrix.h @@ -1,39 +1,29 @@ +// +//--------------------------------------------------------------------------- +// +// Copyright(C) 2016-2017 Christopher Bruns +// All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see http://www.gnu.org/licenses/ +// +//-------------------------------------------------------------------------- +// /* ** LSMatrix.h ** less-simple matrix class -** -**--------------------------------------------------------------------------- -** Copyright 2016 Christopher Bruns -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -** */ - #ifndef VR_LS_MATRIX_H_ #define VR_LS_MATRIX_H_ diff --git a/src/gl/stereo3d/gl_openvr.cpp b/src/gl/stereo3d/gl_openvr.cpp index 181f0bee7..bd872dfa1 100644 --- a/src/gl/stereo3d/gl_openvr.cpp +++ b/src/gl/stereo3d/gl_openvr.cpp @@ -1,35 +1,28 @@ +// +//--------------------------------------------------------------------------- +// +// Copyright(C) 2016-2017 Christopher Bruns +// All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see http://www.gnu.org/licenses/ +// +//-------------------------------------------------------------------------- +// /* ** gl_openvr.cpp ** Stereoscopic virtual reality mode for the HTC Vive headset ** -**--------------------------------------------------------------------------- -** Copyright 2016 Christopher Bruns -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** */ #ifdef USE_OPENVR diff --git a/src/gl/stereo3d/gl_openvr.h b/src/gl/stereo3d/gl_openvr.h index 9fc905207..e3091c630 100644 --- a/src/gl/stereo3d/gl_openvr.h +++ b/src/gl/stereo3d/gl_openvr.h @@ -1,36 +1,27 @@ +// +//--------------------------------------------------------------------------- +// +// Copyright(C) 2016-2017 Christopher Bruns +// All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see http://www.gnu.org/licenses/ +// +//-------------------------------------------------------------------------- +// /* ** gl_openvr.h ** Stereoscopic virtual reality mode for the HTC Vive headset -** -**--------------------------------------------------------------------------- -** Copyright 2016 Christopher Bruns -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -** */ #ifndef GL_OPENVR_H_