add get_version() for c_api. (#3688)

Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3688
Looks like our previous changes only modified the cpp API. Not the c_api like the request wanted. This attempts to add faiss_get_version to c_api

Reviewed By: ramilbakhshyiev

Differential Revision: D60207739

fbshipit-source-id: 07184aeae92a154bb3f440279595077f002851f3
This commit is contained in:
Bhavik Sheth
2024-07-25 23:38:46 -07:00
committed by Facebook GitHub Bot
parent 6e1f23f354
commit 4cfa63865f
3 changed files with 44 additions and 0 deletions
+1
View File
@@ -30,6 +30,7 @@ set(FAISS_C_SRC
index_io_c.cpp
impl/AuxIndexStructures_c.cpp
utils/distances_c.cpp
utils/utils_c.cpp
)
add_library(faiss_c ${FAISS_C_SRC})
target_link_libraries(faiss_c PRIVATE faiss)
+16
View File
@@ -0,0 +1,16 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Copyright 2004-present Facebook. All Rights Reserved.
// -*- c++ -*-
#include "utils_c.h"
#include <faiss/Index.h>
const char* faiss_get_version() {
return VERSION_STRING;
}
+27
View File
@@ -0,0 +1,27 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Copyright 2004-present Facebook. All Rights Reserved.
// -*- c -*-
#ifndef FAISS_UTILS_C_H
#define FAISS_UTILS_C_H
#include <stdint.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
const char* faiss_get_version();
#ifdef __cplusplus
}
#endif
#endif