-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
27 lines (21 loc) · 857 Bytes
/
Makefile
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
CC=g++ -O3 -std=c++14
SRCS=$(wildcard *.cpp */*.cpp)
OBJS=$(patsubst %.cpp, %.o, $(SRCS))
TYPE = GPU
ifeq ($(TYPE), GPU)
INCLUDE = -I/home/liuguanli/Documents/libtorch_gpu/include -I/home/liuguanli/Documents/libtorch_gpu/include/torch/csrc/api/include
LIB +=-L/home/liuguanli/Documents/libtorch_gpu/lib -ltorch -lc10 -lpthread
FLAG = -Wl,-rpath=/home/liuguanli/Documents/libtorch_gpu/lib
else
INCLUDE = -I/home/liuguanli/Documents/libtorch/include -I/home/liuguanli/Documents/libtorch/include/torch/csrc/api/include
LIB +=-L/home/liuguanli/Documents/libtorch/lib -ltorch -lc10 -lpthread
FLAG = -Wl,-rpath=/home/liuguanli/Documents/libtorch/lib
endif
NAME=$(wildcard *.cpp)
TARGET=$(patsubst %.cpp, %, $(NAME))
$(TARGET):$(OBJS)
$(CC) -o $@ $^ $(INCLUDE) $(LIB) $(FLAG)
%.o:%.cpp
$(CC) -o $@ -c $< -g $(INCLUDE)
clean:
rm -rf $(TARGET) $(OBJS)