|
1 | 1 | cmake_minimum_required (VERSION 2.6) |
2 | | -project (hnsw_lib) |
| 2 | +project(hnsw_lib |
| 3 | + LANGUAGES CXX) |
3 | 4 |
|
4 | | -include_directories("${PROJECT_BINARY_DIR}") |
| 5 | +add_library(hnswlib INTERFACE) |
| 6 | +target_include_directories(hnswlib INTERFACE .) |
5 | 7 |
|
| 8 | +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) |
| 9 | + set(CMAKE_CXX_STANDARD 11) |
6 | 10 |
|
| 11 | + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
| 12 | + SET( CMAKE_CXX_FLAGS "-Ofast -DNDEBUG -std=c++11 -DHAVE_CXX0X -openmp -march=native -fpic -ftree-vectorize") |
| 13 | + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
| 14 | + SET( CMAKE_CXX_FLAGS "-Ofast -lrt -DNDEBUG -std=c++11 -DHAVE_CXX0X -march=native -fpic -w -fopenmp -ftree-vectorize -ftree-vectorizer-verbose=0" ) |
| 15 | + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") |
| 16 | + SET( CMAKE_CXX_FLAGS "-Ofast -lrt -DNDEBUG -std=c++11 -DHAVE_CXX0X -openmp -march=native -fpic -w -fopenmp -ftree-vectorize" ) |
| 17 | + endif() |
7 | 18 |
|
8 | | -set(SOURCE_EXE main.cpp) |
| 19 | + add_executable(test_updates examples/updates_test.cpp) |
| 20 | + target_link_libraries(test_updates hnswlib) |
9 | 21 |
|
10 | | -set(SOURCE_LIB sift_1b.cpp) |
| 22 | + add_executable(searchKnnCloserFirst_test examples/searchKnnCloserFirst_test.cpp) |
| 23 | + target_link_libraries(searchKnnCloserFirst_test hnswlib) |
11 | 24 |
|
12 | | -add_library(sift_test STATIC ${SOURCE_LIB}) |
13 | | - |
14 | | - |
15 | | -add_executable(main ${SOURCE_EXE}) |
16 | | -if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
17 | | - SET( CMAKE_CXX_FLAGS "-Ofast -DNDEBUG -std=c++11 -DHAVE_CXX0X -openmp -march=native -fpic -ftree-vectorize") |
18 | | -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
19 | | -SET( CMAKE_CXX_FLAGS "-Ofast -lrt -DNDEBUG -std=c++11 -DHAVE_CXX0X -openmp -march=native -fpic -w -fopenmp -ftree-vectorize -ftree-vectorizer-verbose=0" ) |
20 | | -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") |
21 | | - SET( CMAKE_CXX_FLAGS "-Ofast -lrt -DNDEBUG -std=c++11 -DHAVE_CXX0X -openmp -march=native -fpic -w -fopenmp -ftree-vectorize" ) |
| 25 | + add_executable(main main.cpp sift_1b.cpp) |
| 26 | + target_link_libraries(main hnswlib) |
22 | 27 | endif() |
23 | | - |
24 | | -add_executable(test_updates examples/updates_test.cpp) |
25 | | - |
26 | | -add_executable(searchKnnCloserFirst_test examples/searchKnnCloserFirst_test.cpp) |
27 | | - |
28 | | -target_link_libraries(main sift_test) |
0 commit comments