Skip to content

Commit

Permalink
adjust vecsim build for RediSearch (#105)
Browse files Browse the repository at this point in the history
* added static/dynamic print log

* returned CIP flag

* fixed PR comment

* fixed cpu_features.cmake settings for sanitizer

* renamed BUILD_TESTS to VECSIM_BUILD_TESTS

* fixed build testing
  • Loading branch information
DvirDukhan authored Jan 2, 2022
1 parent 878173b commit bd357a8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
8 changes: 8 additions & 0 deletions cmake/cpu_features.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include(FetchContent)
option(BUILD_TESTING "" OFF)
option(CMAKE_POSITION_INDEPENDENT_CODE "" ON)
FetchContent_Declare(
cpu_features
GIT_REPOSITORY https://github.com/google/cpu_features.git
)
FetchContent_MakeAvailable(cpu_features)
15 changes: 6 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
cmake_minimum_required(VERSION 3.10)

option(BUILD_TESTS "Build tests" ON)
option(VECSIM_BUILD_TESTS "Build tests" ON)

option(VECSIM_STATIC "Build as static library" OFF)

option(USE_ASAN "Use AddressSanitizer (clang)" OFF)
option(USE_MSAN "Use MemorySanitizer (clang)" OFF)

if(NOT DEFINED root)
get_filename_component(root ${CMAKE_CURRENT_LIST_DIR}/.. ABSOLUTE)
endif()
get_filename_component(root ${CMAKE_CURRENT_LIST_DIR}/.. ABSOLUTE)
message("# VectorSimilarity root: " ${root})
if(NOT DEFINED binroot)
get_filename_component(binroot ${CMAKE_CURRENT_BINARY_DIR} ABSOLUTE)
endif()
get_filename_component(binroot ${CMAKE_CURRENT_BINARY_DIR} ABSOLUTE)
message("# VectorSimilarity binroot: " ${binroot})
message("# VectorSimilarity static build: " ${VECSIM_STATIC})

include(${root}/cmake/common.cmake)

if (USE_ASAN OR USE_MSAN)
include(${root}/cmake/clang-sanitizers.cmake)
endif()

if (BUILD_TESTS)
if (VECSIM_BUILD_TESTS)
include(${root}/cmake/gtest.cmake)
option(BUILD_TESTING "" ON)
endif()
Expand Down Expand Up @@ -76,7 +73,7 @@ if(NOT VECSIM_STATIC)
set_target_properties(VectorSimilarity PROPERTIES SUFFIX ".so")
endif()

if(BUILD_TESTS)
if(VECSIM_BUILD_TESTS)
add_subdirectory(${root}/tests/unit unit_tests)
add_subdirectory(${root}/tests/module module_tests)

Expand Down
11 changes: 2 additions & 9 deletions src/VecSim/spaces/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
project(VectorSimilarity_Spaces)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(FetchContent)
option(BUILD_TESTING "" OFF)
FetchContent_Declare(
cpu_features
GIT_REPOSITORY https://github.com/google/cpu_features.git
)
FetchContent_MakeAvailable(cpu_features)
include(${root}/cmake/cpu_features.cmake)

if (VECSIM_MARCH)
add_compile_options(-march=${VECSIM_MARCH})
endif()
Expand Down Expand Up @@ -37,5 +31,4 @@ else()
endif()

add_library(VectorSimilaritySpaces STATIC ${SPACES_SOURCES})

target_link_libraries(VectorSimilaritySpaces cpu_features)

0 comments on commit bd357a8

Please sign in to comment.