-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (40 loc) · 1.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required(VERSION 3.0)
project(ObVectorDeps VERSION 1.0 LANGUAGES CXX)
# Set the default build type to Release if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
# introduce 3rd library vsag
include(FetchContent)
include (${CMAKE_BINARY_DIR}/extern/vsag.cmake)
# set path
set(VSAG_BASE_DIR ${CMAKE_BINARY_DIR})
set(VSAG_LIB_DIR ${VSAG_BASE_DIR}/_deps)
set(OPENBLAS_LINK_DIR "${VSAG_LIB_DIR}/vsag-build/openblas/install/lib/")
# Create shared library
link_directories(${OPENBLAS_LINK_DIR})
add_library(ob_vsag SHARED ob_vsag_lib.cpp)
target_compile_options(ob_vsag PRIVATE -std=c++17)
target_include_directories(ob_vsag PRIVATE
${VSAG_LIB_DIR}/vsag-src/include
${VSAG_LIB_DIR}/nlohmann_json-src/include
${VSAG_LIB_DIR}/roaringbitmap-src/include
${VSAG_LIB_DIR}/fmt-src/include)
target_compile_definitions(ob_vsag PRIVATE _GLIBCXX_USE_CXX11_ABI=0)
target_link_libraries(ob_vsag PUBLIC vsag_static gomp -static-libstdc++ -static-libgcc)
add_dependencies(ob_vsag vsag_static)
# Create static library
add_library(ob_vsag_static STATIC ob_vsag_lib.cpp)
target_compile_options(ob_vsag_static PRIVATE -std=c++17)
target_compile_definitions(ob_vsag_static PUBLIC _GLIBCXX_USE_CXX11_ABI=0)
target_include_directories(ob_vsag_static PUBLIC
${VSAG_LIB_DIR}/vsag-src/include
${VSAG_LIB_DIR}/nlohmann_json-src/include
${VSAG_LIB_DIR}/roaringbitmap-src/include
${VSAG_LIB_DIR}/fmt-src/include)
target_link_libraries(ob_vsag PUBLIC vsag_static gomp -static-libstdc++ -static-libgcc)
add_dependencies(ob_vsag vsag_static)
add_subdirectory (example)