Makefile 2.3 KB

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