Skip to content

Commit a3f2c1c

Browse files
committed
Make presence of crc32c_config.h optional
This facilitates integration of the library into different build systems. Add `CRC32C_HAVE_CONFIG_H` define set by CMake.
1 parent 675775b commit a3f2c1c

11 files changed

+25
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ target_include_directories(crc32c
290290
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
291291
)
292292

293+
target_compile_definitions(crc32c
294+
PRIVATE
295+
CRC32C_HAVE_CONFIG_H=1
296+
)
297+
293298
set_target_properties(crc32c
294299
PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
295300

src/crc32c_arm64.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
#include <cstdint>
1515

1616
#include "./crc32c_internal.h"
17+
#ifdef CRC32C_HAVE_CONFIG_H
1718
#include "crc32c/crc32c_config.h"
19+
#endif
1820

1921
#if HAVE_ARM64_CRC32C
2022

src/crc32c_arm64.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include <cstddef>
1111
#include <cstdint>
1212

13+
#ifdef CRC32C_HAVE_CONFIG_H
1314
#include "crc32c/crc32c_config.h"
15+
#endif
1416

1517
#if HAVE_ARM64_CRC32C
1618

src/crc32c_arm64_linux_check.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
#include <cstddef>
1313
#include <cstdint>
1414

15+
#ifdef CRC32C_HAVE_CONFIG_H
1516
#include "crc32c/crc32c_config.h"
17+
#endif
1618

1719
#if HAVE_ARM64_CRC32C
1820

src/crc32c_benchmark.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
#include <cstddef>
66
#include <cstdint>
77

8+
#ifdef CRC32C_HAVE_CONFIG_H
89
#include "crc32c/crc32c_config.h"
10+
#endif
911

1012
#include "benchmark/benchmark.h"
1113

src/crc32c_prefetch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include <cstddef>
99
#include <cstdint>
1010

11+
#ifdef CRC32C_HAVE_CONFIG_H
1112
#include "crc32c/crc32c_config.h"
13+
#endif
1214

1315
#if HAVE_MM_PREFETCH
1416

src/crc32c_read_le.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include <cstdint>
99
#include <cstring>
1010

11+
#ifdef CRC32C_HAVE_CONFIG_H
1112
#include "crc32c/crc32c_config.h"
13+
#endif
1214

1315
namespace crc32c {
1416

src/crc32c_sse42.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
#include "./crc32c_prefetch.h"
1818
#include "./crc32c_read_le.h"
1919
#include "./crc32c_round_up.h"
20+
#ifdef CRC32C_HAVE_CONFIG_H
2021
#include "crc32c/crc32c_config.h"
22+
#endif
2123

2224
#if HAVE_SSE42 && (defined(_M_X64) || defined(__x86_64__))
2325

src/crc32c_sse42.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include <cstddef>
1111
#include <cstdint>
1212

13+
#ifdef CRC32C_HAVE_CONFIG_H
1314
#include "crc32c/crc32c_config.h"
15+
#endif
1416

1517
// The hardware-accelerated implementation is only enabled for 64-bit builds,
1618
// because a straightforward 32-bit implementation actually runs slower than the

src/crc32c_sse42_check.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include <cstddef>
1111
#include <cstdint>
1212

13+
#ifdef CRC32C_HAVE_CONFIG_H
1314
#include "crc32c/crc32c_config.h"
15+
#endif
1416

1517
#if HAVE_SSE42 && (defined(_M_X64) || defined(__x86_64__))
1618

0 commit comments

Comments
 (0)