Skip to content

Commit bd357a8

Browse files
author
DvirDukhan
authored
adjust vecsim build for RediSearch (#105)
* 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
1 parent 878173b commit bd357a8

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

cmake/cpu_features.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include(FetchContent)
2+
option(BUILD_TESTING "" OFF)
3+
option(CMAKE_POSITION_INDEPENDENT_CODE "" ON)
4+
FetchContent_Declare(
5+
cpu_features
6+
GIT_REPOSITORY https://github.com/google/cpu_features.git
7+
)
8+
FetchContent_MakeAvailable(cpu_features)

src/CMakeLists.txt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
option(BUILD_TESTS "Build tests" ON)
3+
option(VECSIM_BUILD_TESTS "Build tests" ON)
44

55
option(VECSIM_STATIC "Build as static library" OFF)
66

77
option(USE_ASAN "Use AddressSanitizer (clang)" OFF)
88
option(USE_MSAN "Use MemorySanitizer (clang)" OFF)
99

10-
if(NOT DEFINED root)
11-
get_filename_component(root ${CMAKE_CURRENT_LIST_DIR}/.. ABSOLUTE)
12-
endif()
10+
get_filename_component(root ${CMAKE_CURRENT_LIST_DIR}/.. ABSOLUTE)
1311
message("# VectorSimilarity root: " ${root})
14-
if(NOT DEFINED binroot)
15-
get_filename_component(binroot ${CMAKE_CURRENT_BINARY_DIR} ABSOLUTE)
16-
endif()
12+
get_filename_component(binroot ${CMAKE_CURRENT_BINARY_DIR} ABSOLUTE)
1713
message("# VectorSimilarity binroot: " ${binroot})
14+
message("# VectorSimilarity static build: " ${VECSIM_STATIC})
1815

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

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

25-
if (BUILD_TESTS)
22+
if (VECSIM_BUILD_TESTS)
2623
include(${root}/cmake/gtest.cmake)
2724
option(BUILD_TESTING "" ON)
2825
endif()
@@ -76,7 +73,7 @@ if(NOT VECSIM_STATIC)
7673
set_target_properties(VectorSimilarity PROPERTIES SUFFIX ".so")
7774
endif()
7875

79-
if(BUILD_TESTS)
76+
if(VECSIM_BUILD_TESTS)
8077
add_subdirectory(${root}/tests/unit unit_tests)
8178
add_subdirectory(${root}/tests/module module_tests)
8279

src/VecSim/spaces/CMakeLists.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
project(VectorSimilarity_Spaces)
22

3-
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
4-
include(FetchContent)
5-
option(BUILD_TESTING "" OFF)
6-
FetchContent_Declare(
7-
cpu_features
8-
GIT_REPOSITORY https://github.com/google/cpu_features.git
9-
)
10-
FetchContent_MakeAvailable(cpu_features)
3+
include(${root}/cmake/cpu_features.cmake)
4+
115
if (VECSIM_MARCH)
126
add_compile_options(-march=${VECSIM_MARCH})
137
endif()
@@ -37,5 +31,4 @@ else()
3731
endif()
3832

3933
add_library(VectorSimilaritySpaces STATIC ${SPACES_SOURCES})
40-
4134
target_link_libraries(VectorSimilaritySpaces cpu_features)

0 commit comments

Comments
 (0)