Makefile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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/clip/include \
  12. -I../../detector/components/abandobj/include \
  13. -I../../detector/components/deps/detutils/include \
  14. -I../../detector/components/deps/onnxruntime/include
  15. LDFLAGS = -L../../mascommon/source/.libs \
  16. -L../../links/common/libs \
  17. -L../../detector/components/clip/source \
  18. -L../../detector/components/deps/detutils/source \
  19. -L../../detector/components/deps/onnxruntime/lib
  20. LIBS = -lcommon -lpthread -ldl -lonnxruntime -ldetutils \
  21. -lopencv_core -lopencv_imgproc -lopencv_imgcodecs \
  22. -lopencv_video -lopencv_videoio -lopencv_highgui \
  23. -lclipdetector
  24. # 目标文件和目标库设置
  25. TARGET = build/ClipDemo
  26. BUILD_DIR = build
  27. OBJECTS = $(BUILD_DIR)/ClipDemo.o $(BUILD_DIR)/StreamDef.o $(BUILD_DIR)/MemPool.o
  28. # 编译目标
  29. all: $(BUILD_DIR) $(TARGET)
  30. # 创建 build 目录
  31. $(BUILD_DIR):
  32. mkdir -p $(BUILD_DIR)
  33. # 链接最终的可执行文件
  34. $(TARGET): $(OBJECTS)
  35. $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(LIBS)
  36. # 生成目标文件(.o)
  37. $(BUILD_DIR)/ClipDemo.o: ClipDemo.cpp
  38. $(CXX) $(CXXFLAGS) -o $@ -c $<
  39. # 编译 StreamDef.cpp 为目标文件
  40. $(BUILD_DIR)/StreamDef.o: ../../mascommon/source/StreamDef.cpp
  41. $(CXX) $(CXXFLAGS) -o $@ -c $<
  42. # 编译 MemPool.cpp 为目标文件
  43. $(BUILD_DIR)/MemPool.o: ../../mascommon/source/MemPool.cpp
  44. $(CXX) $(CXXFLAGS) -o $@ -c $<
  45. # 清理中间文件和目标文件
  46. clean:
  47. rm -rf $(BUILD_DIR)
  48. # 创建可执行文件时保留详细信息
  49. verbose:
  50. @echo "CXX: $(CXX)"
  51. @echo "CXXFLAGS: $(CXXFLAGS)"
  52. @echo "LDFLAGS: $(LDFLAGS)"
  53. @echo "LIBS: $(LIBS)"
  54. .PHONY: clean verbose