Makefile 2.3 KB

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