summaryrefslogtreecommitdiffhomepage
path: root/video-ps3eye/CMakeLists.txt
blob: 2f0bf50bb2e3c57cb139ed0373c69933a794695b (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
add_compile_definitions(PS3EYE_DEBUG)

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ps3eye-driver/CMakeLists.txt")
    add_subdirectory("ps3eye-driver")

    if(NOT MSVC)
        if(PKG_CONFIG_FOUND)
            pkg_check_modules(libusb "libusb-1.0" QUIET)
        endif()
        if(libusb_FOUND)
            include_directories(SYSTEM ${libusb_INCLUDE_DIRS})
            link_libraries(${libusb_LIBRARIES})
            link_directories(${libusb_LIBRARY_DIRS})
        endif()
    else()
        set(SDK_LIBUSB CACHE PATH "")
        if(SDK_LIBUSB)
            set(libusb_FOUND TRUE)
            link_directories("${SDK_LIBUSB}")
            include_directories(SYSTEM "${SDK_LIBUSB}")
        endif()
    endif()
endif()

if(TARGET ps3eye-sdl AND FALSE)
    install(TARGETS "ps3eye-sdl" DESTINATION "${opentrack-libexec}")
    if(WIN32)
        foreach(k ${SDL2_LIBRARIES})
            get_filename_component(path "${k}" PATH)
            set(lib "${path}/SDL2.dll")
            if(EXISTS "${lib}")
                otr_install_lib("${lib}" "${opentrack-libexec}")
                break()
            endif()
        endforeach()
    endif()
endif()

if(TARGET ps3eye-mode-test)
    install(TARGETS "ps3eye-mode-test" DESTINATION "${opentrack-libexec}")
endif()

if(TARGET ps3eye-driver)
    add_executable(ps3eye-subprocess "wrapper.cxx" "shm.cxx")
    target_link_libraries(ps3eye-subprocess ps3eye-driver)
    if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
        target_link_libraries(ps3eye-subprocess rt)
    endif()
    install(TARGETS "ps3eye-subprocess" DESTINATION "${opentrack-libexec}")
endif()

if(TARGET ps3eye-subprocess)
    otr_module(video-ps3eye)
    target_link_libraries(${self} ps3eye-driver opentrack-video)
    if(WIN32)
        set(path "${SDK_LIBUSB}/libusb-1.0.dll")
        if(EXISTS "${path}")
            otr_install_lib("${path}" "${opentrack-libexec}")
        endif()
    endif()
endif()

if(TARGET ps3eye-frame-test)
    install(TARGETS "ps3eye-frame-test" DESTINATION "${opentrack-libexec}")
endif()