summaryrefslogtreecommitdiffstats
path: root/LibOVR/CMakeLists.txt
blob: 549589b9f85727fdd6f3bad31fa06af1c1d9e774 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
project (LibOVR)

include_directories(Include Src Src/Kernel Src/Util)

set(SOURCE_FILES
    Src/Kernel/OVR_Alg.cpp
    Src/Kernel/OVR_Allocator.cpp
    Src/Kernel/OVR_Atomic.cpp
    Src/Kernel/OVR_File.cpp
    Src/Kernel/OVR_FileFILE.cpp
    Src/Kernel/OVR_Log.cpp
    Src/Kernel/OVR_Math.cpp
    Src/Kernel/OVR_RefCount.cpp
    Src/Kernel/OVR_Std.cpp
    Src/Kernel/OVR_String.cpp
    Src/Kernel/OVR_String_FormatUtil.cpp
    Src/Kernel/OVR_String_PathUtil.cpp
    Src/Kernel/OVR_SysFile.cpp
    Src/Kernel/OVR_System.cpp
    Src/Kernel/OVR_Timer.cpp
    Src/Kernel/OVR_UTF8Util.cpp
    Src/OVR_DeviceHandle.cpp
    Src/OVR_DeviceImpl.cpp
    Src/OVR_JSON.cpp
    Src/OVR_LatencyTestImpl.cpp
    Src/OVR_Profile.cpp
    Src/OVR_SensorFilter.cpp
    Src/OVR_SensorFusion.cpp
    Src/OVR_SensorImpl.cpp
    Src/OVR_ThreadCommandQueue.cpp
    Src/Util/Util_LatencyTest.cpp
    Src/Util/Util_Render_Stereo.cpp
)

set(HEADER_FILES
    Include/OVR.h
    Include/OVRVersion.h 
    Src/Kernel/OVR_Alg.h
    Src/Kernel/OVR_Allocator.h
    Src/Kernel/OVR_Array.h
    Src/Kernel/OVR_Atomic.h
    Src/Kernel/OVR_Color.h
    Src/Kernel/OVR_ContainerAllocator.h
    Src/Kernel/OVR_File.h
    Src/Kernel/OVR_Hash.h
    Src/Kernel/OVR_KeyCodes.h
    Src/Kernel/OVR_List.h
    Src/Kernel/OVR_Log.h
    Src/Kernel/OVR_Math.h
    Src/Kernel/OVR_RefCount.h
    Src/Kernel/OVR_Std.h
    Src/Kernel/OVR_String.h
    Src/Kernel/OVR_SysFile.h
    Src/Kernel/OVR_System.h
    Src/Kernel/OVR_Timer.h
    Src/Kernel/OVR_Threads.h
    Src/Kernel/OVR_Types.h
    Src/Kernel/OVR_UTF8Util.h
    Src/OVR_Device.h
    Src/OVR_DeviceConstants.h
    Src/OVR_DeviceHandle.h
    Src/OVR_DeviceImpl.h
    Src/OVR_DeviceMessages.h
    Src/OVR_HIDDevice.h
    Src/OVR_HIDDeviceBase.h
    Src/OVR_HIDDeviceImpl.h
    Src/OVR_JSON.h
    Src/OVR_LatencyTestImpl.h
    Src/OVR_Profile.h
    Src/OVR_SensorFilter.h
    Src/OVR_SensorFusion.h
    Src/OVR_SensorImpl.h
    Src/OVR_ThreadCommandQueue.h
    Src/Util/Util_LatencyTest.h
    Src/Util/Util_Render_Stereo.h
)

if(WIN32)
    list(APPEND SOURCE_FILES 
        Src/Kernel/OVR_ThreadsWinAPI.cpp
        Src/OVR_Win32_DeviceManager.cpp
        Src/OVR_Win32_DeviceStatus.cpp
        Src/OVR_Win32_HIDDevice.cpp
        Src/OVR_Win32_HMDDevice.cpp
        Src/OVR_Win32_SensorDevice.cpp
    )
    list(APPEND HEADER_FILES
        Src/OVR_Win32_DeviceManager.h
        Src/OVR_Win32_DeviceStatus.h
        Src/OVR_Win32_HIDDevice.h
        Src/OVR_Win32_HMDDevice.h
        Src/OVR_Win32_SensorDevice.h
    )
elseif(APPLE)
    list(APPEND SOURCE_FILES 
        Src/Kernel/OVR_ThreadsPthread.cpp
        Src/OVR_OSX_DeviceManager.cpp
        Src/OVR_OSX_HIDDevice.cpp
        Src/OVR_OSX_HMDDevice.cpp
        Src/OVR_OSX_SensorDevice.cpp
    )
    list(APPEND HEADER_FILES
        Src/OVR_OSX_DeviceManager.h
        Src/OVR_OSX_HIDDevice.h
        Src/OVR_OSX_HMDDevice.h
    )
else()
    list(APPEND SOURCE_FILES 
        Src/Kernel/OVR_ThreadsPthread.cpp
        Src/OVR_Linux_DeviceManager.cpp
        Src/OVR_Linux_HIDDevice.cpp
        Src/OVR_Linux_HMDDevice.cpp
        Src/OVR_Linux_SensorDevice.cpp
    )
    list(APPEND HEADER_FILES
        Src/OVR_Linux_DeviceManager.h
        Src/OVR_Linux_HIDDevice.h
        Src/OVR_Linux_HMDDevice.h
    )
    list(APPEND EXTRA_LIBS
        edid
    )
    include_directories(${LibEDID_SOURCE_DIR})
endif()

if(WIN32)

    SET(OculusVR_EXTRA_LIBS setupapi winmm)

elseif(APPLE)

    find_library(COCOA_LIBRARY Cocoa)
    find_library(IOKIT_LIBRARY IOKit)
    set(OculusVR_EXTRA_LIBS ${COCOA_LIBRARY} ${IOKIT_LIBRARY})

else()

    find_package(X11 REQUIRED)

    # Set up library and include paths
    list(APPEND OculusVR_EXTRA_LIBS ${X11_X11_LIB})

    # Check for XRandR (modern resolution switching and gamma control)
    if (NOT X11_Xrandr_FOUND)
        message(FATAL_ERROR "The RandR library and headers were not found")
    endif()

    list(APPEND OculusVR_EXTRA_LIBS ${X11_Xrandr_LIB})

    find_package (Threads REQUIRED)
    list(APPEND OculusVR_EXTRA_LIBS ${CMAKE_THREAD_LIBS_INIT})

    list(APPEND OculusVR_EXTRA_LIBS edid udev )
endif()


add_library(OculusVR STATIC ${SOURCE_FILES} ${HEADER_FILES})
set(OVR_LIBRARIES ${OculusVR_EXTRA_LIBS} CACHE STRING "Dependencies of OculusVR")
target_link_libraries(OculusVR ${OculusVR_EXTRA_LIBS})