Skip to content

Commit

Permalink
Merge 4c6eb47 into 5a28b64
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteemann committed Jan 24, 2023
2 parents 5a28b64 + 4c6eb47 commit 2833d88
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 59 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
matrix:
include:
# GCC builds
- {os: ubuntu-latest, compiler: gcc, version: '9',
build_type: Release, hash_type: xxhash }
- {os: ubuntu-latest, compiler: gcc, version: '10',
build_type: Release, hash_type: fasthash }
- {os: ubuntu-latest, compiler: gcc, version: '11',
Expand Down Expand Up @@ -74,6 +72,7 @@ jobs:
sudo apt-get update
sudo apt-get install g++-${{ matrix.version }}
echo "CXX=g++-${{ matrix.version }}" >> ${GITHUB_ENV}
echo "CC=gcc-${{ matrix.version }}" >> ${GITHUB_ENV}
- name: Install clang
if: startsWith(matrix.os, 'ubuntu-') && matrix.compiler == 'clang'
run: |
Expand All @@ -88,6 +87,7 @@ jobs:
sudo apt-get install clang-$version lld libc++-$version-dev libc++abi-$version-dev
echo "CC=clang-$version" >> ${GITHUB_ENV}
echo "CXX=clang++-$version" >> ${GITHUB_ENV}
echo "CC=clang-$version" >> ${GITHUB_ENV}
echo "LDFLAGS=-fuse-ld=lld" >> ${GITHUB_ENV}
- name: Initialize MSVC ${{ matrix.version }}
if: startsWith(matrix.os, 'windows-')
Expand All @@ -97,7 +97,7 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DHashType=${{ matrix.hash_type }} -DBuildTests=ON -DBuildLargeTests=OFF -DBuildVelocyPackExamples=ON -DBuildTools=ON -DEnableSSE=OFF -DCMAKE_CXX_STANDARD=${{env.CXX_STANDARD}} -DCMAKE_CXX_FLAGS="${{ matrix.flags }}" -DCMAKE_LINKER_FLAGS="${{ matrix.ld_flags }}"
run: cmake -B${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DHashType=${{ matrix.hash_type }} -DBuildTests=ON -DBuildLargeTests=OFF -DBuildVelocyPackExamples=ON -DBuildTools=ON -DEnableSSE=OFF -DCMAKE_CXX_STANDARD=${{env.CXX_STANDARD}} -DCMAKE_CXX_FLAGS="${{ matrix.flags }}" -DCMAKE_C_FLAGS="${{ matrix.flags }}" -DCMAKE_LINKER_FLAGS="${{ matrix.ld_flags }}"

- name: Build
# Build your program with the given configuration
Expand All @@ -111,7 +111,7 @@ jobs:
if: matrix.coverage == true
run: |
sudo apt-get install lcov
scripts/collect-coverage.sh
CXX=g++-${{ matrix.version }} scripts/collect-coverage.sh
- name: Coveralls Upload
if: matrix.coverage == true
Expand Down
98 changes: 49 additions & 49 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ endif()
option(Maintainer "Build maintainer tools" OFF)
option(BuildSseOpt "Build with SSE optimization instructions" ON)

set(HashType "xxhash" CACHE STRING "Hash type (fasthash, xxhash, wyhash)" )
set(HashType "xxhash" CACHE STRING "Hash type (fasthash, xxhash)" )

# Set Build Type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()

message(STATUS "VelocyPack build mode: ${CMAKE_BUILD_TYPE}")
Expand All @@ -68,64 +68,64 @@ else()
add_definitions("-DVELOCYPACK_ASM_OPTIMIZATIONS=1")
endif()

set(VELOCY_SOURCE
src/velocypack-common.cpp
src/AttributeTranslator.cpp
src/Builder.cpp
src/Collection.cpp
src/Compare.cpp
src/Dumper.cpp
src/Exception.cpp
src/HashedStringRef.cpp
src/HexDump.cpp
src/Iterator.cpp
src/Options.cpp
src/Parser.cpp
src/Serializable.cpp
src/SharedSlice.cpp
src/Slice.cpp
src/Utf8Helper.cpp
src/Validator.cpp
src/Value.cpp
src/ValueType.cpp
src/Version.cpp
src/asm-functions.cpp
src/asm-utf8check.cpp
src/fpconv.cpp
src/string-functions.cpp
add_library(velocypack STATIC
src/velocypack-common.cpp
src/AttributeTranslator.cpp
src/Builder.cpp
src/Collection.cpp
src/Compare.cpp
src/Dumper.cpp
src/Exception.cpp
src/HashedStringRef.cpp
src/HexDump.cpp
src/Iterator.cpp
src/Options.cpp
src/Parser.cpp
src/Serializable.cpp
src/SharedSlice.cpp
src/Slice.cpp
src/Utf8Helper.cpp
src/Validator.cpp
src/Value.cpp
src/ValueType.cpp
src/Version.cpp
src/asm-functions.cpp
src/asm-utf8check.cpp
src/fpconv.cpp
src/string-functions.cpp
)

#Use xxhash, fasthash?
if(HashType STREQUAL "xxhash")
list(APPEND VELOCY_SOURCE src/xxhash.cpp)
add_definitions("-DVELOCYPACK_XXHASH=1")
target_sources(velocypack PRIVATE src/xxhash.c)
target_compile_definitions(velocypack PRIVATE "-DXXH_NAMESPACE=VELOCYPACK_")
add_definitions("-DVELOCYPACK_XXHASH=1")
elseif(HashType STREQUAL "fasthash")
list(APPEND VELOCY_SOURCE src/fasthash.cpp)
add_definitions("-DVELOCYPACK_FASTHASH=1")
target_sources(velocypack PRIVATE src/fasthash.cpp)
add_definitions("-DVELOCYPACK_FASTHASH=1")
else()
message(FATAL_ERROR "VelocyPack invalid HashType value. supported values: xxhash, fasthash")
message(FATAL_ERROR "VelocyPack invalid HashType value. supported values: xxhash, fasthash")
endif()
message(STATUS "VelocyPack Building with hash type: ${HashType}")

add_library(velocypack STATIC ${VELOCY_SOURCE})
target_include_directories(
velocypack
PRIVATE ${PROJECT_SOURCE_DIR}/src
PUBLIC ${PROJECT_SOURCE_DIR}/include
)
velocypack
PRIVATE ${PROJECT_SOURCE_DIR}/src
PUBLIC ${PROJECT_SOURCE_DIR}/include
)

if(IS_ARM)
target_include_directories(velocypack PRIVATE ${PROJECT_SOURCE_DIR}/external/sse2neon)
endif()
if(IS_ARM)
target_include_directories(velocypack PRIVATE ${PROJECT_SOURCE_DIR}/external/sse2neon)
endif()

if(Maintainer)
add_executable(buildVersion scripts/build-version.cpp)
add_custom_target(buildVersionNumber
COMMAND ${PROJECT_BINARY_DIR}/scripts/buildVersion
${PROJECT_SOURCE_DIR}/include/velocypack/velocypack-version-number.h
DEPENDS ${PROJECT_BINARY_DIR}/scripts/buildVersion
VERBATIM
)
add_executable(buildVersion scripts/build-version.cpp)
add_custom_target(buildVersionNumber
COMMAND ${PROJECT_BINARY_DIR}/scripts/buildVersion
${PROJECT_SOURCE_DIR}/include/velocypack/velocypack-version-number.h
DEPENDS ${PROJECT_BINARY_DIR}/scripts/buildVersion
VERBATIM
)
endif()

add_subdirectory(tools)
Expand All @@ -134,7 +134,7 @@ add_subdirectory(tests)

install(TARGETS velocypack DESTINATION lib)
install(
DIRECTORY "include/velocypack"
DESTINATION include
DIRECTORY "include/velocypack"
DESTINATION include
)
include(CPack)
15 changes: 11 additions & 4 deletions include/velocypack/velocypack-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,18 @@
#include "velocypack/velocypack-memory.h"

#ifdef VELOCYPACK_XXHASH
// forward for XXH functions declared elsewhere
#include "velocypack/velocypack-xxhash.h"

#define VELOCYPACK_HASH(mem, size, seed) XXH64(mem, size, seed)
#define VELOCYPACK_HASH32(mem, size, seed) XXH32(mem, size, seed)
#if defined (__cplusplus)
extern "C" {
#endif
uint64_t VELOCYPACK_XXH64(void const*, size_t, uint64_t);
uint32_t VELOCYPACK_XXH32(void const*, size_t, uint32_t);
#if defined (__cplusplus)
}
#endif

#define VELOCYPACK_HASH(mem, size, seed) VELOCYPACK_XXH64(mem, size, seed)
#define VELOCYPACK_HASH32(mem, size, seed) VELOCYPACK_XXH32(mem, size, seed)
#endif

#ifdef VELOCYPACK_FASTHASH
Expand Down
1 change: 0 additions & 1 deletion scripts/collect-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ LCOV=(
"$project_dir"'/examples/*' \
"$project_dir"'/tools/*' \
"$project_dir"'/tests/*' \
"$project_dir"'/include/velocypack/velocypack-xxhash*' \
"$project_dir"'/include/velocypack/velocypack-wyhash*' \
"$project_dir"'/src/xxhash*' \
"$project_dir"'/src/fasthash*' \
Expand Down
2 changes: 1 addition & 1 deletion src/xxhash.cpp → src/xxhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
#define XXH_STATIC_LINKING_ONLY /* access advanced declarations */
#define XXH_IMPLEMENTATION /* access definitions */

#include "velocypack/velocypack-xxhash.h"
#include "xxhash.h"
File renamed without changes.

0 comments on commit 2833d88

Please sign in to comment.