Skip to content

Commit

Permalink
Add definitions for xxhash headers installation (#25)
Browse files Browse the repository at this point in the history
* build: Install bundled xxHash library's headers

Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 authored Nov 21, 2022
1 parent 9c02b29 commit cbe3c23
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ set(CFL_VERSION_PATCH 9)
set(CFL_VERSION_STR "${CFL_VERSION_MAJOR}.${CFL_VERSION_MINOR}.${CFL_VERSION_PATCH}")

# Configuration options
option(CFL_DEV "Enable development mode" No)
option(CFL_TESTS "Enable unit testing" No)
option(CFL_DEV "Enable development mode" No)
option(CFL_TESTS "Enable unit testing" No)
option(CFL_INSTALL_BUNDLED_XXHASH_HEADERS "Enable bundled xxHash headers installation" Yes)

if(CFL_DEV)
set(CMAKE_BUILD_TYPE Debug)
Expand Down Expand Up @@ -135,6 +136,10 @@ else()
set(CFL_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include")
endif()

# Output paths
set(CFL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(CFL_BUILD_DIR "${CFL_ROOT}/build")

# CFL sources
add_subdirectory(include)
add_subdirectory(src)
Expand All @@ -145,10 +150,6 @@ if(CFL_TESTS)
add_subdirectory(tests)
endif()

# Output paths
set(CFL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(CFL_BUILD_DIR "${CFL_ROOT}/build")

# Installer Generation (Cpack)
# ============================

Expand Down
12 changes: 12 additions & 0 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,15 @@ install(FILES ${cflHeaders}
DESTINATION ${CFL_INSTALL_INCLUDEDIR}/cfl
COMPONENT headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)

# xxHash
if(CFL_INSTALL_BUNDLED_XXHASH_HEADERS)
install(FILES ${CFL_ROOT}/lib/xxhash/xxh3.h
DESTINATION ${CFL_INSTALL_INCLUDEDIR}
COMPONENT headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
install(FILES ${CFL_ROOT}/lib/xxhash/xxhash.h
DESTINATION ${CFL_INSTALL_INCLUDEDIR}
COMPONENT headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
endif()
2 changes: 1 addition & 1 deletion include/cfl/cfl_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/* NOTE: this is just a wrapper for naming convention */

#include <stdint.h>
#include "../../lib/xxhash/xxh3.h"
#include "xxh3.h"

#define cfl_hash_state_t XXH3_state_t
#define cfl_hash_64bits_reset XXH3_64bits_reset
Expand Down

0 comments on commit cbe3c23

Please sign in to comment.