Statistics
| Branch: | Revision:

root / rgbdslam / external / siftgpu / linux / makefile @ 9240aaa3

History | View | Annotate | Download (6.22 KB)

1
#################################################################
2
#    SiftGPU congiruation:  CUDA, SSE, TIMING  
3
#################################################################
4
#enable siftgpu server
5
siftgpu_enable_server = 0
6
#enable OpenCL-based SiftGPU? not finished yet; testing purpose
7
siftgpu_enable_opencl = 0
8
#------------------------------------------------------------------------------------------------
9
# enable CUDA-based SiftGPU?
10
ifeq (${SIFT_GPU_MODE},1)
11
	siftgpu_enable_cuda = 1
12
else 
13
	siftgpu_enable_cuda = 0
14
endif
15
CUDA_INSTALL_PATH = ${SIFT_GPU_CUDA_PATH}#/usr/local/cuda
16
#CUDA_INSTALL_PATH = /usr/local/cuda
17
#change  additional  settings, like SM version here if it is not 1.0 (eg. -arch sm_13 for GTX280)
18
#siftgpu_cuda_options = -Xopencc -OPT:unroll_size=200000
19
#siftgpu_cuda_options = -arch sm_10
20
#--------------------------------------------------------------------------------------------------
21
# enable SSE optimization for GL-based implementations
22
siftgpu_enable_sse = 1
23
siftgpu_sse_options = -march=native -mfpmath=sse
24
#-------------------------------------------------------------------------------------------------
25
# timing function, 1 for clock, 0 for gettimeofday
26
siftgpu_timing_use_clock = 0
27
#--------------------------------------------------------------------------------------------------
28
# openGL context creation.  1 for glut, 0 for xlib
29
siftgpu_prefer_glut = 0
30
#------------------------------------------------------------------------------------------------
31
#whether SimpleSIFT uses runtime loading of libsiftgpu.so or static linking of libsiftgpu.a
32
simplesift_runtime_load = 1
33
#################################################################
34

    
35

    
36

    
37

    
38
# detect OS
39
OSUPPER = $(shell uname -s 2>/dev/null | tr [:lower:] [:upper:])
40
OSLOWER = $(shell uname -s 2>/dev/null | tr [:upper:] [:lower:])
41
DARWIN = $(strip $(findstring DARWIN, $(OSUPPER)))
42

    
43

    
44
SHELL = /bin/sh
45
INC_DIR = ../include
46
BIN_DIR = ./bin
47
SRC_SIFTGPU = ../src/SiftGPU
48
SRC_DRIVER = ../src/TestWin
49
SRC_SERVER = ../src/ServerSiftGPU
50
CC = g++
51
CFLAGS =  -I$(INC_DIR) -fPIC -L/usr/lib64 -L/usr/lib -L./bin -Wall -Wno-deprecated -pthread  
52

    
53
ifneq ($(siftgpu_enable_sse), 0)
54
	CFLAGS += $(siftgpu_sse_options)
55
endif
56

    
57
ifneq ($(siftgpu_timing_use_clock), 0)
58
	CFLAGS += -DTIMING_BY_CLOCK
59
endif
60

    
61
ifneq ($(siftgpu_prefer_glut), 0)
62
	CFLAGS += -DWINDOW_PREFER_GLUT
63
endif
64

    
65
ifneq ($(siftgpu_enable_opencl), 0)
66
	CFLAGS += -DCL_SIFTGPU_ENABLED
67
endif
68

    
69
ODIR_SIFTGPU = ../../../build/siftgpu
70

    
71

    
72
# external header files
73
_HEADER_EXTERNAL = GL/glew.h GL/glut.h IL/il.h  
74
# siftgpu header files
75
_HEADER_SIFTGPU = FrameBufferObject.h GlobalUtil.h GLTexImage.h ProgramGPU.h ShaderMan.h ProgramGLSL.h SiftGPU.h SiftPyramid.h SiftMatch.h PyramidGL.h LiteWindow.h
76
# siftgpu library header files for drivers
77
_HEADER_SIFTGPU_LIB = SiftGPU.h  
78

    
79
ifneq ($(DARWIN),) 
80
#librarys for SiftGPU
81
LIBS_SIFTGPU = -lGLEW -framework GLUT -lIL -framework OpenGL 
82
CFLAGS +=  -L/opt/local/lib -L/usr/local/lib 
83
else
84
#librarys for SiftGPU
85
LIBS_SIFTGPU = -lGLEW -lglut -lIL -lGL -lX11
86
endif
87
 
88
#Obj files for SiftGPU
89
_OBJ_SIFTGPU = FrameBufferObject.o GlobalUtil.o GLTexImage.o ProgramGLSL.o ProgramGPU.o ShaderMan.o SiftGPU.o SiftPyramid.o PyramidGL.o SiftMatch.o
90

    
91
#add cuda options
92
ifneq ($(siftgpu_enable_cuda), 0)
93
	ifdef CUDA_BIN_PATH
94
		NVCC = $(CUDA_BIN_PATH)/nvcc
95
	else
96
		NVCC = $(CUDA_INSTALL_PATH)/bin/nvcc
97
	endif
98

    
99
	ifndef CUDA_INC_PATH
100
		CUDA_INC_PATH = $(CUDA_INSTALL_PATH)/include
101
	endif
102

    
103
	ifndef CUDA_LIB_PATH
104
		CUDA_LIB_PATH = $(CUDA_INSTALL_PATH)/lib64 -I$(CUDA_INSTALL_PATH)/lib
105
	endif
106

    
107
	CFLAGS += -DCUDA_SIFTGPU_ENABLED -I$(CUDA_INC_PATH) -L$(CUDA_LIB_PATH)
108
	LIBS_SIFTGPU += -lcudart
109
	_OBJ_SIFTGPU += CuTexImage.o PyramidCU.o SiftMatchCU.o
110
	_HEADER_SIFTGPU += CuTexImage.h ProgramCU.h PyramidCU.h
111
endif
112
 
113
ifneq ($(siftgpu_enable_opencl), 0)
114
	CFLAGS += -lOpenCL
115
endif
116
 
117
all: makepath siftgpu server  driver 
118
 
119

    
120
#the dependencies of SiftGPU library 
121
DEPS_SIFTGPU = $(patsubst %, $(SRC_SIFTGPU)/%, $(_HEADER_SIFTGPU))
122

    
123

    
124
#rules for the rest of the object files
125
$(ODIR_SIFTGPU)/%.o: $(SRC_SIFTGPU)/%.cpp $(DEPS_SIFTGPU) 
126
	$(CC) -o $@ $< $(CFLAGS) -c 
127

    
128

    
129
ifneq ($(siftgpu_enable_cuda), 0)
130
NVCC_FLAGS = -I$(INC_DIR) -I$(CUDA_INC_PATH) -DCUDA_SIFTGPU_ENABLED -O2 -Xcompiler -fPIC
131
ifdef siftgpu_cuda_options
132
	NVCC_FLAGS += $(siftgpu_cuda_options)
133
endif
134
#build rule for CUDA 
135
$(ODIR_SIFTGPU)/ProgramCU.o: $(SRC_SIFTGPU)/ProgramCU.cu $(DEPS_SIFTGPU)
136
	$(NVCC) $(NVCC_FLAGS) -o $@ $< -c
137
_OBJ_SIFTGPU += ProgramCU.o
138
endif
139

    
140

    
141
ifneq ($(siftgpu_enable_server), 0)
142
$(ODIR_SIFTGPU)/ServerSiftGPU.o: $(SRC_SERVER)/ServerSiftGPU.cpp $(DEPS_SIFTGPU)
143
	$(CC) -o $@ $< $(CFLAGS) -DSERVER_SIFTGPU_ENABLED -c
144
_OBJ_SIFTGPU += ServerSiftGPU.o
145
endif
146

    
147
OBJ_SIFTGPU = $(patsubst %,$(ODIR_SIFTGPU)/%,$(_OBJ_SIFTGPU))
148
LIBS_DRIVER = $(BIN_DIR)/libsiftgpu.a $(LIBS_SIFTGPU) 
149
SRC_TESTWIN = $(SRC_DRIVER)/TestWinGlut.cpp $(SRC_DRIVER)/BasicTestWin.cpp  
150
DEP_TESTWIN = $(SRC_DRIVER)/TestWinGlut.h $(SRC_DRIVER)/BasicTestwin.h $(SRC_DRIVER)/GLTransform.h 
151

    
152

    
153

    
154
ifneq ($(simplesift_runtime_load), 0)
155
LIBS_SIMPLESIFT = -ldl -DSIFTGPU_DLL_RUNTIME
156
else
157
LIBS_SIMPLESIFT = $(LIBS_DRIVER) -DSIFTGPU_STATIC
158
endif
159

    
160
siftgpu: makepath $(OBJ_SIFTGPU)
161
	ar rcs $(BIN_DIR)/libsiftgpu.a $(OBJ_SIFTGPU)
162
	$(CC) -o $(BIN_DIR)/libsiftgpu.so $(OBJ_SIFTGPU) $(LIBS_SIFTGPU) $(CFLAGS) -shared -fPIC
163
 
164
driver: makepath 
165
	$(CC) -o $(BIN_DIR)/TestWinGlut $(SRC_TESTWIN) $(LIBS_DRIVER) $(CFLAGS)
166
	$(CC) -o $(BIN_DIR)/SimpleSIFT $(SRC_DRIVER)/SimpleSIFT.cpp $(LIBS_SIMPLESIFT) $(CFLAGS) 
167
	$(CC) -o $(BIN_DIR)/speed $(SRC_DRIVER)/speed.cpp $(LIBS_DRIVER) $(CFLAGS) 
168
	$(CC) -o $(BIN_DIR)/MultiThreadSIFT $(SRC_DRIVER)/MultiThreadSIFT.cpp $(LIBS_DRIVER) $(CFLAGS)  -pthread
169
	
170
ifneq ($(siftgpu_enable_server), 0)
171
server: makepath
172
	$(CC) -o $(BIN_DIR)/server_siftgpu $(SRC_SERVER)/server.cpp $(LIBS_DRIVER) $(CFLAGS)
173
else
174
server: 
175

    
176
endif	
177
	
178
makepath:
179
	mkdir -p $(ODIR_SIFTGPU)
180
	mkdir -p $(BIN_DIR) 
181
	ln ../data/ -d -s -f
182
 
183
clean:
184
	rm -f $(ODIR_SIFTGPU)/*.o
185
	rm -f $(BIN_DIR)/libsiftgpu.a
186
	rm -f $(BIN_DIR)/libsiftgpu.so
187
	rm -f $(BIN_DIR)/TestWinGlut
188
	rm -f $(BIN_DIR)/SimpleSIFT
189
	rm -f $(BIN_DIR)/speed
190
	rm -f $(BIN_DIR)/server_siftgpu
191
	rm -f $(BIN_DIR)/MultiThreadSIFT
192
	rm -f ProgramCU.linkinfo
193