diff --git a/internal/core/src/index/CMakeLists.txt b/internal/core/src/index/CMakeLists.txt index c0029808e6..c983b640de 100644 --- a/internal/core/src/index/CMakeLists.txt +++ b/internal/core/src/index/CMakeLists.txt @@ -13,9 +13,9 @@ aux_source_directory( ${MILVUS_ENGINE_SRC}/index INDEX_FILES ) add_library( milvus_index SHARED ${INDEX_FILES} ) -# TODO: support compile marisa on windows and mac. +# TODO: support compile marisa on windows. set(PLATFORM_LIBS ) -if ( LINUX ) +if ( LINUX OR APPLE ) set(PLATFORM_LIBS marisa) endif() if (MSYS) diff --git a/internal/core/src/index/IndexFactory-inl.h b/internal/core/src/index/IndexFactory-inl.h index d4a9758d2a..14abc898ea 100644 --- a/internal/core/src/index/IndexFactory-inl.h +++ b/internal/core/src/index/IndexFactory-inl.h @@ -32,7 +32,7 @@ IndexFactory::CreateIndex(const std::string& index_type) { template <> inline ScalarIndexPtr IndexFactory::CreateIndex(const std::string& index_type) { -#ifdef __linux__ +#if defined(__linux__) || defined(__APPLE__) return CreateStringIndexMarisa(); #else throw std::runtime_error("unsupported platform"); diff --git a/internal/core/src/index/StringIndexMarisa.cpp b/internal/core/src/index/StringIndexMarisa.cpp index f29f78d220..416146649c 100644 --- a/internal/core/src/index/StringIndexMarisa.cpp +++ b/internal/core/src/index/StringIndexMarisa.cpp @@ -24,7 +24,7 @@ namespace milvus::scalar { -#ifdef __linux__ +#if defined(__linux__) || defined(__APPLE__) int64_t StringIndexMarisa::Size() { diff --git a/internal/core/src/index/StringIndexMarisa.h b/internal/core/src/index/StringIndexMarisa.h index eb0f175d69..9aa275208d 100644 --- a/internal/core/src/index/StringIndexMarisa.h +++ b/internal/core/src/index/StringIndexMarisa.h @@ -11,7 +11,7 @@ #pragma once -#ifdef __linux__ +#if defined(__linux__) || defined(__APPLE__) #include #include "index/StringIndex.h" diff --git a/internal/core/thirdparty/marisa/CMakeLists.txt b/internal/core/thirdparty/marisa/CMakeLists.txt index 6ead2e94c3..3bea443c0c 100644 --- a/internal/core/thirdparty/marisa/CMakeLists.txt +++ b/internal/core/thirdparty/marisa/CMakeLists.txt @@ -16,7 +16,7 @@ macro(build_marisa) if ( LINUX ) set (MARISA_CONFIGURE_COMMAND cd ${MARISA_DIR} && libtoolize && autoreconf -i && ./configure --prefix=${MARISA_INSTALL_PREFIX}) else() - set (MARISA_CONFIGURE_COMMAND brew install automake && cd ${MARISA_DIR} && glibtoolize && autoreconf -i && ./configure --prefix=${MARISA_INSTALL_PREFIX}) + set (MARISA_CONFIGURE_COMMAND brew install automake libtool && cd ${MARISA_DIR} && glibtoolize && autoreconf -i && ./configure --prefix=${MARISA_INSTALL_PREFIX}) endif() set (MARISA_BUILD_COMMAND make -j) diff --git a/internal/core/unittest/CMakeLists.txt b/internal/core/unittest/CMakeLists.txt index d4b74f268a..42f790f42d 100644 --- a/internal/core/unittest/CMakeLists.txt +++ b/internal/core/unittest/CMakeLists.txt @@ -45,8 +45,7 @@ set(MILVUS_TEST_FILES test_utils.cpp ) -# These 2 cases cannot run in mac because of tbb build error -if (LINUX) +if (LINUX OR APPLE) set(MILVUS_TEST_FILES ${MILVUS_TEST_FILES} test_scalar_index_creator.cpp diff --git a/internal/core/unittest/test_scalar_index_creator.cpp b/internal/core/unittest/test_scalar_index_creator.cpp index f3b4e8cab3..9f98a92479 100644 --- a/internal/core/unittest/test_scalar_index_creator.cpp +++ b/internal/core/unittest/test_scalar_index_creator.cpp @@ -15,11 +15,11 @@ #include #include -#define private public - #include "indexbuilder/index_c.h" #include "test_utils/DataGen.h" #include "test_utils/indexbuilder_test_utils.h" + +#define private public #include "indexbuilder/ScalarIndexCreator.h" #include "indexbuilder/IndexFactory.h" diff --git a/internal/core/unittest/test_string_index.cpp b/internal/core/unittest/test_string_index.cpp index b68bbf552c..78e461fa85 100644 --- a/internal/core/unittest/test_string_index.cpp +++ b/internal/core/unittest/test_string_index.cpp @@ -14,12 +14,13 @@ #include #include -#define private public - #include "index/Index.h" #include "index/ScalarIndex.h" + +#define private public #include "index/StringIndex.h" #include "index/StringIndexMarisa.h" + #include "index/IndexFactory.h" #include "test_utils/indexbuilder_test_utils.h" #include "test_utils/AssertUtils.h"