Skip to content

Commit

Permalink
Make presence of crc32c_config.h optional
Browse files Browse the repository at this point in the history
This facilitates integration of the library into different build
systems.

Add `CRC32C_HAVE_CONFIG_H` define set by CMake.
  • Loading branch information
laanwj committed Nov 7, 2019
1 parent 675775b commit a3f2c1c
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ target_include_directories(crc32c
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

target_compile_definitions(crc32c
PRIVATE
CRC32C_HAVE_CONFIG_H=1
)

set_target_properties(crc32c
PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})

Expand Down
2 changes: 2 additions & 0 deletions src/crc32c_arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#include <cstdint>

#include "./crc32c_internal.h"
#ifdef CRC32C_HAVE_CONFIG_H
#include "crc32c/crc32c_config.h"
#endif

#if HAVE_ARM64_CRC32C

Expand Down
2 changes: 2 additions & 0 deletions src/crc32c_arm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include <cstddef>
#include <cstdint>

#ifdef CRC32C_HAVE_CONFIG_H
#include "crc32c/crc32c_config.h"
#endif

#if HAVE_ARM64_CRC32C

Expand Down
2 changes: 2 additions & 0 deletions src/crc32c_arm64_linux_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#include <cstddef>
#include <cstdint>

#ifdef CRC32C_HAVE_CONFIG_H
#include "crc32c/crc32c_config.h"
#endif

#if HAVE_ARM64_CRC32C

Expand Down
2 changes: 2 additions & 0 deletions src/crc32c_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include <cstddef>
#include <cstdint>

#ifdef CRC32C_HAVE_CONFIG_H
#include "crc32c/crc32c_config.h"
#endif

#include "benchmark/benchmark.h"

Expand Down
2 changes: 2 additions & 0 deletions src/crc32c_prefetch.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#include <cstddef>
#include <cstdint>

#ifdef CRC32C_HAVE_CONFIG_H
#include "crc32c/crc32c_config.h"
#endif

#if HAVE_MM_PREFETCH

Expand Down
2 changes: 2 additions & 0 deletions src/crc32c_read_le.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#include <cstdint>
#include <cstring>

#ifdef CRC32C_HAVE_CONFIG_H
#include "crc32c/crc32c_config.h"
#endif

namespace crc32c {

Expand Down
2 changes: 2 additions & 0 deletions src/crc32c_sse42.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include "./crc32c_prefetch.h"
#include "./crc32c_read_le.h"
#include "./crc32c_round_up.h"
#ifdef CRC32C_HAVE_CONFIG_H
#include "crc32c/crc32c_config.h"
#endif

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

Expand Down
2 changes: 2 additions & 0 deletions src/crc32c_sse42.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include <cstddef>
#include <cstdint>

#ifdef CRC32C_HAVE_CONFIG_H
#include "crc32c/crc32c_config.h"
#endif

// The hardware-accelerated implementation is only enabled for 64-bit builds,
// because a straightforward 32-bit implementation actually runs slower than the
Expand Down
2 changes: 2 additions & 0 deletions src/crc32c_sse42_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include <cstddef>
#include <cstdint>

#ifdef CRC32C_HAVE_CONFIG_H
#include "crc32c/crc32c_config.h"
#endif

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

Expand Down
2 changes: 2 additions & 0 deletions src/crc32c_test_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef CRC32C_HAVE_CONFIG_H
#include "crc32c/crc32c_config.h"
#endif

#include "gtest/gtest.h"

Expand Down

0 comments on commit a3f2c1c

Please sign in to comment.