[Bf-blender-cvs] [b811750] HMD_viewport: HMD: Quick and dirty way to make sort of portable builds on Linux

Sergey Sharybin noreply at git.blender.org
Thu Mar 24 20:01:09 CET 2016


Commit: b811750153030a45ed74b475330e6257c81951c5
Author: Sergey Sharybin
Date:   Thu Mar 24 20:00:25 2016 +0100
Branches: HMD_viewport
https://developer.blender.org/rBb811750153030a45ed74b475330e6257c81951c5

HMD: Quick and dirty way to make sort of portable builds on Linux

It will require having libudev.so.1 which isn't ideal but should work for
most distros for now.

Will be worked around later with udev wrangler.

===================================================================

M	build_files/buildbot/config/blender_linux.cmake
M	build_files/cmake/Modules/FindHIDAPI.cmake

===================================================================

diff --git a/build_files/buildbot/config/blender_linux.cmake b/build_files/buildbot/config/blender_linux.cmake
index ed5417c..81c7ff0 100644
--- a/build_files/buildbot/config/blender_linux.cmake
+++ b/build_files/buildbot/config/blender_linux.cmake
@@ -139,5 +139,14 @@ set(OPENVDB_LIBRARY
 	CACHE BOOL "" FORCE
 )
 
+# HMD
+if(GLIBC EQUAL "2.19")
+	set(HIDAPI_LIBRARY
+		/usr/lib${MULTILIB}/libhidapi-hidraw.a
+		/usr/lib/x86_64-linux-gnu/libudev.so
+		CACHE STRING "" FORCE
+	)
+endif()
+
 # Additional linking libraries
 set(CMAKE_EXE_LINKER_FLAGS   "-lrt -static-libstdc++"  CACHE STRING "" FORCE)
diff --git a/build_files/cmake/Modules/FindHIDAPI.cmake b/build_files/cmake/Modules/FindHIDAPI.cmake
index 86243fb..a009772 100644
--- a/build_files/cmake/Modules/FindHIDAPI.cmake
+++ b/build_files/cmake/Modules/FindHIDAPI.cmake
@@ -1,47 +1,71 @@
-# - try to find HIDAPI library
-# from http://www.signal11.us/oss/hidapi/
+# - Find HIDAPI library from http://www.signal11.us/oss/hidapi/
+# Find the native HIDAPI includes and library
+# This module defines
+#  HIDAPI_INCLUDE_DIRS, where to find hidapi.h, Set when
+#                       HIDAPI_INCLUDE_DIR is found.
+#  HIDAPI_LIBRARIES, libraries to link against to use HIDAPI.
+#  HIDAPI_ROOT_DIR, The base directory to search for HIDAPI.
+#                   This can also be an environment variable.
+#  HIDAPI_FOUND, If false, do not try to use HIDAPI.
 #
-# Cache Variables: (probably not for direct use in your scripts)
-#  HIDAPI_INCLUDE_DIR
-#  HIDAPI_LIBRARY
-#
-# Non-cache variables you might use in your CMakeLists.txt:
-#  HIDAPI_FOUND
-#  HIDAPI_INCLUDE_DIRS
-#  HIDAPI_LIBRARIES
-#
-# Requires these CMake modules:
-#  FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
+# also defined, but not for general use are
+#  HIDAPI_LIBRARY, where to find the HIDAPI library.
+
+#=============================================================================
+# Copyright 2016 Blender Foundation.
 #
-# Original Author:
-# 2009-2010 Ryan Pavlik <rpavlik at iastate.edu> <abiryan at ryand.net>
-# http://academic.cleardefinition.com
-# Iowa State University HCI Graduate Program/VRAC
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
 #
-# Copyright Iowa State University 2009-2010.
-# Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt or copy at
-# http://www.boost.org/LICENSE_1_0.txt)
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
 
-find_library(HIDAPI_LIBRARY
-	NAMES hidapi hidapi-libusb)
+# If HIDAPI_ROOT_DIR was defined in the environment, use it.
+IF(NOT HIDAPI_ROOT_DIR AND NOT $ENV{HIDAPI_ROOT_DIR} STREQUAL "")
+  SET(HIDAPI_ROOT_DIR $ENV{HIDAPI_ROOT_DIR})
+ENDIF()
 
-find_path(HIDAPI_INCLUDE_DIR
-	NAMES hidapi.h
-	PATH_SUFFIXES
-	hidapi)
+SET(_hidapi_SEARCH_DIRS
+  ${HIDAPI_ROOT_DIR}
+  /usr/local
+  /sw # Fink
+  /opt/local # DarwinPorts
+  /opt/csw # Blastwave
+  /opt/lib/hidapi
+)
 
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(HIDAPI
-	DEFAULT_MSG
-	HIDAPI_LIBRARY
-	HIDAPI_INCLUDE_DIR)
+FIND_PATH(HIDAPI_INCLUDE_DIR
+  NAMES
+    hidapi.h
+  HINTS
+    ${_hidapi_SEARCH_DIRS}
+  PATH_SUFFIXES
+    include/hidapi
+)
 
-if(HIDAPI_FOUND)
-	set(HIDAPI_LIBRARIES "${HIDAPI_LIBRARY}")
+FIND_LIBRARY(HIDAPI_LIBRARY
+  NAMES
+    hidapi hidapi-libusb
+  HINTS
+    ${_hidapi_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
 
-	set(HIDAPI_INCLUDE_DIRS "${HIDAPI_INCLUDE_DIR}")
-endif()
+# Handle the QUIETLY and REQUIRED arguments and set HIDAPI_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(HIDAPI DEFAULT_MSG
+    HIDAPI_LIBRARY HIDAPI_INCLUDE_DIR)
 
-mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBRARY)
+IF(HIDAPI_FOUND)
+  SET(HIDAPI_LIBRARIES ${HIDAPI_LIBRARY})
+  SET(HIDAPI_INCLUDE_DIRS ${HIDAPI_INCLUDE_DIR})
+ENDIF(HIDAPI_FOUND)
 
+MARK_AS_ADVANCED(
+  HIDAPI_INCLUDE_DIR
+  HIDAPI_LIBRARY
+)




More information about the Bf-blender-cvs mailing list