Skip to content

Commit

Permalink
Merge commit '6efa1a06c6d5058dc08b1b7947bb9751fa731cd6'
Browse files Browse the repository at this point in the history
  • Loading branch information
bensuperpc committed Nov 17, 2021
2 parents fb20efe + 6efa1a0 commit 124b183
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,12 @@ docs_early_return()
include(cmake/project-is-top-level.cmake)
include(cmake/variables.cmake)

# ---- Library variable ----
# ---- Library options ----

option(CRC32_USE_LOOKUP_TABLE_BYTE "Enable 1 byte crc32 function" ON)
if(CRC32_USE_LOOKUP_TABLE_BYTE)
add_compile_definitions(CRC32_USE_LOOKUP_TABLE_BYTE)
endif()

option(CRC32_USE_LOOKUP_TABLE_SLICING_BY_4 "Enable 4 byte crc32 function" ON)
if(CRC32_USE_LOOKUP_TABLE_SLICING_BY_4)
add_compile_definitions(CRC32_USE_LOOKUP_TABLE_SLICING_BY_4)
endif()

option(CRC32_USE_LOOKUP_TABLE_SLICING_BY_8 "Enable 8 byte crc32 function" ON)
if(CRC32_USE_LOOKUP_TABLE_SLICING_BY_8)
add_compile_definitions(CRC32_USE_LOOKUP_TABLE_SLICING_BY_8)
endif()

option(CRC32_USE_LOOKUP_TABLE_SLICING_BY_16 "Enable 16 byte crc32 function" ON)
if(CRC32_USE_LOOKUP_TABLE_SLICING_BY_16)
add_compile_definitions(CRC32_USE_LOOKUP_TABLE_SLICING_BY_16)
endif()

# ---- Declare library ----

Expand All @@ -55,10 +40,38 @@ generate_export_header(
CUSTOM_CONTENT_FROM_VARIABLE pragma_suppress_c4251
)

# ---- Library variables ----

if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(crc32_crc32 PUBLIC CRC32_STATIC_DEFINE)
endif()

if(CRC32_USE_LOOKUP_TABLE_BYTE)
target_compile_definitions(crc32_crc32 PUBLIC CRC32_USE_LOOKUP_TABLE_BYTE)
else()
message(STATUS "CRC32_USE_LOOKUP_TABLE_BYTE is disable")
endif()

if(CRC32_USE_LOOKUP_TABLE_SLICING_BY_4)
target_compile_definitions(crc32_crc32 PUBLIC CRC32_USE_LOOKUP_TABLE_SLICING_BY_4)
else()
message(STATUS "DCRC32_USE_LOOKUP_TABLE_SLICING_BY_4 is disable")
endif()

if(CRC32_USE_LOOKUP_TABLE_SLICING_BY_8)
target_compile_definitions(crc32_crc32 PUBLIC CRC32_USE_LOOKUP_TABLE_SLICING_BY_8)
else()
message(STATUS "DCRC32_USE_LOOKUP_TABLE_SLICING_BY_8 is disable")
endif()

if(CRC32_USE_LOOKUP_TABLE_SLICING_BY_16)
target_compile_definitions(crc32_crc32 PUBLIC CRC32_USE_LOOKUP_TABLE_SLICING_BY_16)
else()
message(STATUS "DCRC32_USE_LOOKUP_TABLE_SLICING_BY_16 is disable")
endif()

# ---- Library properties ----

set_target_properties(
crc32_crc32 PROPERTIES
CXX_VISIBILITY_PRESET hidden
Expand Down

0 comments on commit 124b183

Please sign in to comment.