Makefile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # 编译器和链接器设置
  2. CXX = g++
  3. CXXFLAGS = -std=gnu++11 -g -O0 -Wall -DLINUX -DACTION_SINGLETON -D__STDC_CONSTANT_MACROS -Wno-deprecated -Wno-write-strings \
  4. -I/usr/local/include/opencv4 \
  5. -I/usr/local/cuda-11.8/include \
  6. -I../../include \
  7. -I../../links/common/include \
  8. -I../../links/rapidjson/include \
  9. -I../../mascommon/include \
  10. -I../../detector/detdef/include \
  11. -I../../detector/components/abandobj/include \
  12. -I../../detector/components/deps/detutils/include \
  13. LDFLAGS = -L../../mascommon/source/.libs \
  14. -L../../links/common/libs \
  15. -L../../detector/components/abandobj/source \
  16. -L../../detector/components/deps/detutils/source \
  17. LIBS = -lcommon -lpthread -ldl -ldetutils \
  18. -lopencv_core -lopencv_imgproc -lopencv_imgcodecs \
  19. -lopencv_video -lopencv_videoio -lopencv_highgui \
  20. -labandobjdetector
  21. # 目标文件和目标库设置
  22. TARGET = build/VideoDemo
  23. BUILD_DIR = build
  24. OBJECTS = $(BUILD_DIR)/VideoDemo.o $(BUILD_DIR)/StreamDef.o $(BUILD_DIR)/MemPool.o
  25. # 编译目标
  26. all: $(BUILD_DIR) $(TARGET)
  27. # 创建 build 目录
  28. $(BUILD_DIR):
  29. mkdir -p $(BUILD_DIR)
  30. # 链接最终的可执行文件
  31. $(TARGET): $(OBJECTS)
  32. $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(LIBS)
  33. # 生成目标文件(.o)
  34. $(BUILD_DIR)/VideoDemo.o: VideoDemo.cpp
  35. $(CXX) $(CXXFLAGS) -o $@ -c $<
  36. # 编译 StreamDef.cpp 为目标文件
  37. $(BUILD_DIR)/StreamDef.o: ../../mascommon/source/StreamDef.cpp
  38. $(CXX) $(CXXFLAGS) -o $@ -c $<
  39. # 编译 MemPool.cpp 为目标文件
  40. $(BUILD_DIR)/MemPool.o: ../../mascommon/source/MemPool.cpp
  41. $(CXX) $(CXXFLAGS) -o $@ -c $<
  42. # 清理中间文件和目标文件
  43. clean:
  44. rm -rf $(BUILD_DIR)
  45. # 创建可执行文件时保留详细信息
  46. verbose:
  47. @echo "CXX: $(CXX)"
  48. @echo "CXXFLAGS: $(CXXFLAGS)"
  49. @echo "LDFLAGS: $(LDFLAGS)"
  50. @echo "LIBS: $(LIBS)"
  51. .PHONY: clean verbose