Revision: 38913
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38913
Author:   campbellbarton
Date:     2011-08-02 06:32:53 +0000 (Tue, 02 Aug 2011)
Log Message:
-----------
more cmake/x11 edits
- added includes for spnav
- added FindSpacenav.cmake which allows using spacenav from a nonstandard path.
- remove NDOF_LIBPATH, use a full library path instead.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/build_files/cmake/macros.cmake
    trunk/blender/intern/ghost/CMakeLists.txt

Added Paths:
-----------
    trunk/blender/build_files/cmake/Modules/FindSpacenav.cmake

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt        2011-08-02 05:52:27 UTC (rev 38912)
+++ trunk/blender/CMakeLists.txt        2011-08-02 06:32:53 UTC (rev 38913)
@@ -454,12 +454,16 @@
        endif()
 
        if (WITH_INPUT_NDOF)
-               if(CMAKE_SYSTEM_NAME MATCHES "Linux")
-                       set(NDOF /usr)
-                       set(NDOF_INC ${NDOF}/include)
-                       set(NDOF_LIBRARY spnav)
-                       set(NDOF_LIBPATH ${NDOF}/lib)
+               find_package(Spacenav)
+               if(NOT SPACENAV_FOUND)
+                       set(WITH_INPUT_NDOF OFF)
                endif()
+
+               # use generic names within blenders buildsystem.
+               if(SPACENAV_FOUND)
+                       set(NDOF_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIRS})
+                       set(NDOF_LIBRARIES ${SPACENAV_LIBRARIES})
+               endif()
        endif()
 
        # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using 
--as-needed
@@ -1334,6 +1338,7 @@
        info_cfg_option(WITH_OPENCOLLADA)
        info_cfg_option(WITH_FFTW3)
        info_cfg_option(WITH_INTERNATIONAL)
+       info_cfg_option(WITH_INPUT_NDOF)
 
        info_cfg_text("Compiler Options:")
        info_cfg_option(WITH_BUILDINFO)

Added: trunk/blender/build_files/cmake/Modules/FindSpacenav.cmake
===================================================================
--- trunk/blender/build_files/cmake/Modules/FindSpacenav.cmake                  
        (rev 0)
+++ trunk/blender/build_files/cmake/Modules/FindSpacenav.cmake  2011-08-02 
06:32:53 UTC (rev 38913)
@@ -0,0 +1,70 @@
+# - Find Spacenav library
+# Find the native Spacenav includes and library
+# This module defines
+#  SPACENAV_INCLUDE_DIRS, where to find spnav.h, Set when
+#                        SPACENAV_INCLUDE_DIR is found.
+#  SPACENAV_LIBRARIES, libraries to link against to use Spacenav.
+#  SPACENAV_ROOT_DIR, The base directory to search for Spacenav.
+#                    This can also be an environment variable.
+#  SPACENAV_FOUND, If false, do not try to use Spacenav.
+#
+# also defined, but not for general use are
+#  SPACENAV_LIBRARY, where to find the Spacenav library.
+
+#=============================================================================
+# Copyright 2011 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# 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.
+#=============================================================================
+
+# If SPACENAV_ROOT_DIR was defined in the environment, use it.
+IF(NOT SPACENAV_ROOT_DIR AND NOT $ENV{SPACENAV_ROOT_DIR} STREQUAL "")
+  SET(SPACENAV_ROOT_DIR $ENV{SPACENAV_ROOT_DIR})
+ENDIF()
+
+SET(_spacenav_SEARCH_DIRS
+  ${SPACENAV_ROOT_DIR}
+  /usr/local
+  /sw # Fink
+  /opt/local # DarwinPorts
+  /opt/csw # Blastwave
+)
+
+FIND_PATH(SPACENAV_INCLUDE_DIR
+  NAMES
+    spnav.h
+  HINTS
+    ${_spacenav_SEARCH_DIRS}
+  PATH_SUFFIXES
+    include
+)
+
+FIND_LIBRARY(SPACENAV_LIBRARY
+  NAMES
+    spnav
+  HINTS
+    ${_spacenav_SEARCH_DIRS}
+  PATH_SUFFIXES
+    lib64 lib
+  )
+
+# handle the QUIETLY and REQUIRED arguments and set SPACENAV_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Spacenav DEFAULT_MSG
+    SPACENAV_LIBRARY SPACENAV_INCLUDE_DIR)
+
+IF(SPACENAV_FOUND)
+  SET(SPACENAV_LIBRARIES ${SPACENAV_LIBRARY})
+  SET(SPACENAV_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIR})
+ENDIF(SPACENAV_FOUND)
+
+MARK_AS_ADVANCED(
+  SPACENAV_INCLUDE_DIR
+  SPACENAV_LIBRARY
+)

Modified: trunk/blender/build_files/cmake/macros.cmake
===================================================================
--- trunk/blender/build_files/cmake/macros.cmake        2011-08-02 05:52:27 UTC 
(rev 38912)
+++ trunk/blender/build_files/cmake/macros.cmake        2011-08-02 06:32:53 UTC 
(rev 38913)
@@ -193,9 +193,6 @@
        if(WITH_MEM_JEMALLOC)
                link_directories(${JEMALLOC_LIBPATH})
        endif()
-       if(WITH_INPUT_NDOF)
-               link_directories(${NDOF_LIBPATH})
-       endif()
 
        if(WIN32 AND NOT UNIX)
                link_directories(${PTHREADS_LIBPATH})
@@ -318,7 +315,7 @@
                target_link_libraries(${target} ${JEMALLOC_LIBRARIES})
        endif()
        if(WITH_INPUT_NDOF)
-               target_link_libraries(${target} ${NDOF_LIBRARY})
+               target_link_libraries(${target} ${NDOF_LIBRARIES})
        endif()
 
        if(WIN32 AND NOT UNIX)

Modified: trunk/blender/intern/ghost/CMakeLists.txt
===================================================================
--- trunk/blender/intern/ghost/CMakeLists.txt   2011-08-02 05:52:27 UTC (rev 
38912)
+++ trunk/blender/intern/ghost/CMakeLists.txt   2011-08-02 06:32:53 UTC (rev 
38913)
@@ -99,6 +99,9 @@
 
 if(WITH_INPUT_NDOF)
        add_definitions(-DWITH_INPUT_NDOF)
+       list(APPEND INC_SYS
+               ${NDOF_INCLUDE_DIRS}
+       )
 endif()
 
 if(WITH_HEADLESS OR WITH_GHOST_SDL)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to