summaryrefslogtreecommitdiff
path: root/indra/cmake/NDOF.cmake
blob: f22e2246aa91a4ee1e91615cbab846cb083fcdc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- cmake -*-
include(Prebuilt)

set(NDOF ON CACHE BOOL "Use NDOF space navigator joystick library.")

if ( TARGET ndof::ndof )
  return()
endif()
create_target( ndof::ndof )

if (NDOF)
  if (USESYSTEMLIBS)
    set(NDOF_FIND_REQUIRED ON)
    include(FindNDOF)
  else (USESYSTEMLIBS)
    if (WINDOWS OR DARWIN)
      use_prebuilt_binary(libndofdev)
    elseif (LINUX)
      use_prebuilt_binary(open-libndofdev)
    endif (WINDOWS OR DARWIN)

    if (WINDOWS)
      set_target_libraries( ndof::ndof libndofdev)
    elseif (DARWIN OR LINUX)
      set_target_libraries( ndof::ndof ndofdev)
    endif (WINDOWS)
    set(NDOF_FOUND 1)
  endif (USESYSTEMLIBS)
endif (NDOF)

if (NDOF_FOUND)
  add_definitions(-DLIB_NDOF=1)
else (NDOF_FOUND)
  message(STATUS "Building without N-DoF joystick support")
endif (NDOF_FOUND)