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
160
161
162
163
164
|
#############################################################################
#
# Filename : Makefile
# Content : Makefile for building linux version of: libovr
# Created : 2014
# Authors : Simon Hallam, Peter Giokaris, Chris Taylor
# Copyright : Copyright 2014 OculusVR, Inc. All Rights Reserved
# Instruction : The g++ compiler and stdndard lib packages need to be
# installed on the system. Navigate in a shell to the
# directory where this Makefile is located and enter:
#
# make builds the release version for the
# current architechture
# make clean delete intermediate release object files
# and the library file
# make DEBUG=1 builds the debug version for the current
# architechture
# make clean DEBUG=1 deletes intermediate debug object files
# and the library file
#
# Output : Relative to the directory this Makefile lives in, libraries
# are built at the following locations depending upon the
# architechture of the system you are running:
#
# ./Lib/Linux/Debug/i386/libovr.a
# ./Lib/Linux/Debug/x86_64/libovr.a
# ./Lib/Linux/Release/i386/libovr.a
# ./Lib/Linux/Release/x86_64/libovr.a
#
#############################################################################
####### Detect system architecture
SYSARCH = i386
ifeq ($(shell uname -m),x86_64)
SYSARCH = x86_64
endif
####### Compiler, tools and options
CXX = g++
LINK =
DELETEFILE = rm -f
####### Detect debug or release
COMMONFLAGS = -Wall -Wextra -pipe -fPIC -msse2
DEBUG ?= 0
CXXFLAGS ?=
ifeq ($(DEBUG), 1)
CXXFLAGS += $(COMMONFLAGS) -DDEBUG -DOVR_BUILD_DEBUG -g
RELEASETYPE ?= Debug
else
CXXFLAGS += $(COMMONFLAGS) -O2
RELEASETYPE ?= Release
endif
SINGLE_PROCESS ?= 0
ifeq ($(SINGLE_PROCESS), 1)
CXXFLAGS += -DOVR_SINGLE_PROCESS
endif
####### Paths
LIBOVRPATH = .
3RDPARTYPATH = ../3rdParty
INCPATH = -I. -I.. -I$(LIBOVRPATH)/Include -I$(LIBOVRPATH)/Src
OBJPATH = ./Obj/Linux/$(RELEASETYPE)/$(SYSARCH)
####### Files
STATIC_TARGET = ./Lib/Linux/$(RELEASETYPE)/$(SYSARCH)/libovr.a
SHARED_TARGET = ./Lib/Linux/$(RELEASETYPE)/$(SYSARCH)/libovr.so
SHARED_MAJOR = 0
SHARED_MINOR = 1
SHARED_RELEASE = 1
####### Rules
all: $(STATIC_TARGET) $(SHARED_TARGET)
OTHER_SOURCE = $(3RDPARTYPATH)/EDID/edid.cpp \
$(3RDPARTYPATH)/TinyXml/tinyxml2.cpp
OTHER_OBJECTS = $(OTHER_SOURCE:.cpp=.o)
LIBOVR_SOURCE = $(LIBOVRPATH)/Src/Net/OVR_BitStream.cpp \
$(LIBOVRPATH)/Src/Net/OVR_Unix_Socket.cpp \
$(LIBOVRPATH)/Src/Net/OVR_NetworkPlugin.cpp \
$(LIBOVRPATH)/Src/Net/OVR_PacketizedTCPSocket.cpp \
$(LIBOVRPATH)/Src/Net/OVR_RPC1.cpp \
$(LIBOVRPATH)/Src/Net/OVR_Session.cpp \
$(LIBOVRPATH)/Src/Net/OVR_Socket.cpp \
$(LIBOVRPATH)/Src/Service/Service_NetClient.cpp \
$(LIBOVRPATH)/Src/Service/Service_NetSessionCommon.cpp \
$(LIBOVRPATH)/Src/Tracking/Tracking_SensorStateReader.cpp \
$(LIBOVRPATH)/Src/Displays/OVR_Display.cpp \
$(LIBOVRPATH)/Src/Displays/OVR_Linux_Display.cpp \
$(LIBOVRPATH)/Src/Displays/OVR_Linux_SDKWindow.cpp \
$(LIBOVRPATH)/Src/CAPI/CAPI_DistortionRenderer.cpp \
$(LIBOVRPATH)/Src/CAPI/CAPI_HSWDisplay.cpp \
$(LIBOVRPATH)/Src/CAPI/CAPI_FrameTimeManager.cpp \
$(LIBOVRPATH)/Src/CAPI/CAPI_HMDRenderState.cpp \
$(LIBOVRPATH)/Src/CAPI/CAPI_HMDState.cpp \
$(LIBOVRPATH)/Src/CAPI/CAPI_LatencyStatistics.cpp \
$(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_DistortionRenderer.cpp \
$(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp \
$(LIBOVRPATH)/Src/CAPI/GL/CAPI_GL_Util.cpp \
$(LIBOVRPATH)/Src/CAPI/GL/CAPI_GLE.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_Alg.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_Allocator.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_Atomic.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_CRC32.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_File.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_FileFILE.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_Lockless.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_Log.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_Math.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_RefCount.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_SharedMemory.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_Std.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_String.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_String_FormatUtil.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_String_PathUtil.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_SysFile.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_System.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_ThreadsPthread.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_ThreadCommandQueue.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_Timer.cpp \
$(LIBOVRPATH)/Src/Kernel/OVR_UTF8Util.cpp \
$(LIBOVRPATH)/Src/Util/Util_Interface.cpp \
$(LIBOVRPATH)/Src/Util/Util_LatencyTest2Reader.cpp \
$(LIBOVRPATH)/Src/Util/Util_Render_Stereo.cpp \
$(LIBOVRPATH)/Src/Util/Util_SystemInfo.cpp \
$(LIBOVRPATH)/Src/OVR_CAPI.cpp \
$(LIBOVRPATH)/Src/OVR_SerialFormat.cpp \
$(LIBOVRPATH)/Src/OVR_JSON.cpp \
$(LIBOVRPATH)/Src/OVR_Profile.cpp \
$(LIBOVRPATH)/Src/OVR_Stereo.cpp
LIBOVR_OBJECTS = $(patsubst $(LIBOVRPATH)%.cpp,$(OBJPATH)%.o,$(LIBOVR_SOURCE))
OBJECTS = $(OTHER_OBJECTS) $(LIBOVR_OBJECTS)
$(OBJPATH)/%.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
$(STATIC_TARGET): $(OBJECTS)
@mkdir -p $(@D)
ar rvs $(STATIC_TARGET) $(OBJECTS)
$(SHARED_TARGET): $(OBJECTS)
@mkdir -p $(@D)
g++ -shared -Wl,-soname,$(SHARED_TARGET).$(SHARED_MAJOR) \
-o $(SHARED_TARGET).$(SHARED_MAJOR).$(SHARED_MINOR).$(SHARED_RELEASE) \
$(OBJECTS) -lc
clean:
-$(DELETEFILE) $(OBJECTS)
-$(DELETEFILE) $(STATIC_TARGET)
-$(DELETEFILE) $(SHARED_TARGET)
|