Created
April 17, 2018 22:01
-
-
Save mribbons/2d97545dd3f678a453081a27f260b58b to your computer and use it in GitHub Desktop.
Makefile and package config file file darknet/yolo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GPU=1 | |
| CUDNN=0 | |
| OPENCV=1 | |
| OPENMP=0 | |
| DEBUG=0 | |
| #ARCH= -gencode arch=compute_30,code=sm_30 \ | |
| -gencode arch=compute_35,code=sm_35 \ | |
| -gencode arch=compute_50,code=[sm_50,compute_50] \ | |
| -gencode arch=compute_52,code=[sm_52,compute_52] | |
| # -gencode arch=compute_20,code=[sm_20,sm_21] \ This one is deprecated? | |
| # This is what I use, uncomment if you know your arch and want to specify | |
| ARCH= -gencode arch=compute_52,code=compute_52 | |
| #ARCH= -gencode arch=compute_32,code=compute_32 | |
| VPATH=./src/:./examples | |
| SLIB=libdarknet.so | |
| ALIB=libdarknet.a | |
| EXEC=darknet | |
| OBJDIR=./obj/ | |
| CC=gcc | |
| NVCC=nvcc | |
| NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) | |
| AR=ar | |
| ARFLAGS=rcs | |
| OPTS=-Ofast | |
| LDFLAGS= -lm -pthread | |
| COMMON= -Iinclude/ -Isrc/ | |
| CFLAGS=-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC | |
| ifeq ($(OPENMP), 1) | |
| CFLAGS+= -fopenmp | |
| endif | |
| ifeq ($(DEBUG), 1) | |
| OPTS=-O0 -g | |
| endif | |
| CFLAGS+=$(OPTS) | |
| ifeq ($(OPENCV), 1) | |
| COMMON+= -DOPENCV | |
| CFLAGS+= -DOPENCV | |
| LDFLAGS+= `pkg-config --libs opencv_darknet` | |
| COMMON+= `pkg-config --cflags opencv_darknet` | |
| endif | |
| ifeq ($(GPU), 1) | |
| COMMON+= -DGPU -I/usr/local/cuda/include/ | |
| CFLAGS+= -DGPU | |
| LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand | |
| endif | |
| ifeq ($(CUDNN), 1) | |
| COMMON+= -DCUDNN | |
| CFLAGS+= -DCUDNN | |
| LDFLAGS+= -lcudnn | |
| endif | |
| OBJ=gemm.o utils.o cuda.o deconvolutional_layer.o convolutional_layer.o list.o image.o activations.o im2col.o col2im.o blas.o crop_layer.o dropout_layer.o maxpool_layer.o softmax_layer.o data.o matrix.o network.o connected_layer.o cost_layer.o parser.o option_list.o detection_layer.o route_layer.o upsample_layer.o box.o normalization_layer.o avgpool_layer.o layer.o local_layer.o shortcut_layer.o logistic_layer.o activation_layer.o rnn_layer.o gru_layer.o crnn_layer.o demo.o batchnorm_layer.o region_layer.o reorg_layer.o tree.o lstm_layer.o l2norm_layer.o yolo_layer.o | |
| EXECOBJA=captcha.o lsd.o super.o art.o tag.o cifar.o go.o rnn.o segmenter.o regressor.o classifier.o coco.o yolo.o detector.o nightmare.o darknet.o | |
| ifeq ($(GPU), 1) | |
| LDFLAGS+= -lstdc++ | |
| OBJ+=convolutional_kernels.o deconvolutional_kernels.o activation_kernels.o im2col_kernels.o col2im_kernels.o blas_kernels.o crop_layer_kernels.o dropout_layer_kernels.o maxpool_layer_kernels.o avgpool_layer_kernels.o | |
| endif | |
| EXECOBJ = $(addprefix $(OBJDIR), $(EXECOBJA)) | |
| OBJS = $(addprefix $(OBJDIR), $(OBJ)) | |
| DEPS = $(wildcard src/*.h) Makefile include/darknet.h | |
| #all: obj backup results $(SLIB) $(ALIB) $(EXEC) | |
| all: obj results $(SLIB) $(ALIB) $(EXEC) | |
| $(EXEC): $(EXECOBJ) $(ALIB) | |
| $(CC) $(COMMON) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(ALIB) | |
| $(ALIB): $(OBJS) | |
| $(AR) $(ARFLAGS) $@ $^ | |
| $(SLIB): $(OBJS) | |
| $(CC) $(CFLAGS) -shared $^ -o $@ $(LDFLAGS) | |
| $(OBJDIR)%.o: %.c $(DEPS) | |
| $(CC) $(COMMON) $(CFLAGS) -c $< -o $@ | |
| $(OBJDIR)%.o: %.cu $(DEPS) | |
| $(NVCC) $(NVCCFLAGS) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@ | |
| obj: | |
| mkdir -p obj | |
| backup: | |
| mkdir -p backup | |
| results: | |
| mkdir -p results | |
| .PHONY: clean | |
| clean: | |
| rm -rf $(OBJS) $(SLIB) $(ALIB) $(EXEC) $(EXECOBJ) $(OBJDIR)/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # use export PKG_CONFIG_PATH=~/darknet and put this file in ~/darknet | |
| opencv=/home/myuser/opencv_darknet | |
| Name: opencv_darknet | |
| Description: opencv in home dir | |
| Version: 1.0.0 | |
| Cflags: -I${opencv}/include -I${opencv}/modules/core/include -I${opencv}/modules/imgproc/include -I${opencv}/modules/highgui/include -I${opencv}/modules/videoio/include -I${opencv}/modules/dnn/include -I${opencv}/modules/imgcodecs/include | |
| Libs: -L${opencv}/build/lib -l:libopencv_core.so -l:libopencv_dnn.so -l:libopencv_videoio.so -l:libopencv_imgproc.so -l:libjpeg.so -l:libopencv_highgui.so -l:libopencv_imgcodecs.so |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment