Skip to content

Commit a34527a

Browse files
committed
create macros.h for yolov5
1 parent 55ad625 commit a34527a

File tree

6 files changed

+34
-40
lines changed

6 files changed

+34
-40
lines changed

yolov5/API.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

yolov5/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set(CMAKE_BUILD_TYPE Debug)
1111
find_package(CUDA REQUIRED)
1212

1313
if(WIN32)
14-
enable_language(CUDA)
14+
enable_language(CUDA)
1515
endif(WIN32)
1616

1717
include_directories(${PROJECT_SOURCE_DIR}/include)

yolov5/calibrator.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
#ifndef ENTROPY_CALIBRATOR_H
22
#define ENTROPY_CALIBRATOR_H
33

4-
#include "NvInfer.h"
4+
#include <NvInfer.h>
55
#include <string>
66
#include <vector>
7-
8-
#if NV_TENSORRT_MAJOR >= 8
9-
#define TRT_NOEXCEPT noexcept
10-
#else
11-
#define TRT_NOEXCEPT
12-
#endif
7+
#include "macros.h"
138

149
//! \class Int8EntropyCalibrator2
1510
//!

yolov5/logging.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@
2525
#include <ostream>
2626
#include <sstream>
2727
#include <string>
28-
29-
#if NV_TENSORRT_MAJOR >= 8
30-
#define TRT_NOEXCEPT noexcept
31-
#else
32-
#define TRT_NOEXCEPT
33-
#endif
28+
#include "macros.h"
3429

3530
using Severity = nvinfer1::ILogger::Severity;
3631

yolov5/macros.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef __MACROS_H
2+
#define __MACROS_H
3+
4+
#ifdef API_EXPORTS
5+
#if defined(_MSC_VER)
6+
#define API __declspec(dllexport)
7+
#else
8+
#define API __attribute__((visibility("default")))
9+
#endif
10+
#else
11+
12+
#if defined(_MSC_VER)
13+
#define API __declspec(dllimport)
14+
#else
15+
#define API
16+
#endif
17+
#endif // API_EXPORTS
18+
19+
#if NV_TENSORRT_MAJOR >= 8
20+
#define TRT_NOEXCEPT noexcept
21+
#define TRT_CONST_ENQUEUE const
22+
#else
23+
#define TRT_NOEXCEPT
24+
#define TRT_CONST_ENQUEUE
25+
#endif
26+
27+
#endif // __MACROS_H

yolov5/yololayer.h

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
#ifndef _YOLO_LAYER_H
22
#define _YOLO_LAYER_H
33

4-
#include "API.h"
54
#include <vector>
65
#include <string>
7-
#include "NvInfer.h"
8-
9-
10-
#if NV_TENSORRT_MAJOR >= 8
11-
#define TRT_NOEXCEPT noexcept
12-
#define TRT_CONST_ENQUEUE const
13-
#else
14-
#define TRT_NOEXCEPT
15-
#define TRT_CONST_ENQUEUE
16-
#endif
6+
#include <NvInfer.h>
7+
#include "macros.h"
178

189
namespace Yolo
1910
{
@@ -144,4 +135,4 @@ namespace nvinfer1
144135
REGISTER_TENSORRT_PLUGIN(YoloPluginCreator);
145136
};
146137

147-
#endif
138+
#endif // _YOLO_LAYER_H

0 commit comments

Comments
 (0)