# 编译器和链接器设置 CXX = g++ CXXFLAGS = -std=gnu++11 -g -O0 -Wall -DLINUX -DACTION_SINGLETON -D__STDC_CONSTANT_MACROS -Wno-deprecated -Wno-write-strings \ -I/usr/local/include/opencv4 \ -I/usr/local/cuda-11.8/include \ -I../../include \ -I../../links/common/include \ -I../../links/rapidjson/include \ -I../../mascommon/include \ -I../../detector/detdef/include \ -I../../strategy/stradef/include \ -I../../strategy/components/headcount/include \ -I../../detector/components/yolocrowd/include \ -I../../detector/components/deps/detutils/include \ -I../../detector/components/deps/tensorRT_Pro/include/application \ -I../../detector/components/deps/tensorRT_Pro/include/tensorrt LDFLAGS = -L../../mascommon/source/.libs \ -L../../links/common/libs \ -L../../detector/components/yolocrowd/source \ -L../../detector/components/deps/detutils/source \ -L../../detector/components/deps/tensorRT_Pro/source \ -L../../strategy/components/headcount/source LIBS = -lcommon -lpthread -ldl -ltensorrtpro -ldetutils \ -lopencv_core -lopencv_imgproc -lopencv_imgcodecs \ -lyolocrowddetector -lheadcountstrategy # 目标文件和目标库设置 TARGET = build/ImageDemo BUILD_DIR = build OBJECTS = $(BUILD_DIR)/ImageDemo.o $(BUILD_DIR)/StreamDef.o $(BUILD_DIR)/MemPool.o # 编译目标 all: $(BUILD_DIR) $(TARGET) # 创建 build 目录 $(BUILD_DIR): mkdir -p $(BUILD_DIR) # 链接最终的可执行文件 $(TARGET): $(OBJECTS) $(CXX) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(LIBS) # 生成目标文件(.o) $(BUILD_DIR)/ImageDemo.o: ImageDemo.cpp $(CXX) $(CXXFLAGS) -o $@ -c $< # 编译 StreamDef.cpp 为目标文件 $(BUILD_DIR)/StreamDef.o: ../../mascommon/source/StreamDef.cpp $(CXX) $(CXXFLAGS) -o $@ -c $< # 编译 MemPool.cpp 为目标文件 $(BUILD_DIR)/MemPool.o: ../../mascommon/source/MemPool.cpp $(CXX) $(CXXFLAGS) -o $@ -c $< # 清理中间文件和目标文件 clean: rm -rf $(BUILD_DIR) # 创建可执行文件时保留详细信息 verbose: @echo "CXX: $(CXX)" @echo "CXXFLAGS: $(CXXFLAGS)" @echo "LDFLAGS: $(LDFLAGS)" @echo "LIBS: $(LIBS)" .PHONY: clean verbose