-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
59 lines (51 loc) · 1.89 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
48
49
50
51
52
53
54
55
56
57
58
59
cmake_minimum_required (VERSION 3.21)
project(fast_feedback_indexer
DESCRIPTION "Fast feedback indexer library"
VERSION 1.1.2
LANGUAGES CXX CUDA)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
option(TEST_ALL "Add test targets" OFF)
option(INSTALL_RELOCATABLE "Relocatable installation (especially RPATH)" ON)
enable_testing()
set(fast_feedback_indexer_ENV_SETUP "" CACHE INTERNAL ENV)
set(SOURCE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/source_version.txt")
set(SOURCE_UNKNOWN_VERSION "unknown:non-git-version")
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
find_package(Git)
if (GIT_FOUND)
add_custom_command(
COMMAND ${GIT_EXECUTABLE} describe --tags --always > "${SOURCE_VERSION_FILE}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT "${SOURCE_VERSION_FILE}"
VERBATIM)
else()
file(WRITE "${SOURCE_VERSION_FILE}" "${SOURCE_UNKNOWN_VERSION}")
endif()
else()
file(WRITE "${SOURCE_VERSION_FILE}" "${SOURCE_UNKNOWN_VERSION}")
endif()
add_custom_target(source_version ALL
DEPENDS ${SOURCE_VERSION_FILE})
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/eigen/CMakeLists.txt)
add_subdirectory(eigen EXCLUDE_FROM_ALL)
endif()
add_subdirectory(indexer)
add_subdirectory(data)
add_subdirectory(tests)
add_subdirectory(python)
add_subdirectory(examples/cpp-simple-data-bulk-indexer)
MESSAGE("ENV ${fast_feedback_indexer_ENV_SETUP}")
configure_file(setup-env.sh.in
setup-env.sh
@ONLY)
set(ffbidx_ENV_PATH ${CMAKE_INSTALL_DATADIR}/ffbidx)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/setup-env.sh
DESTINATION ${ffbidx_ENV_PATH}
COMPONENT ffbidx_common)
cmake_path(ABSOLUTE_PATH ffbidx_ENV_PATH
BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX}
NORMALIZE
OUTPUT_VARIABLE ffbidx_ENV_SCRIPT_PATH)
install(CODE "MESSAGE(\"for sh compatible shells use
. ${ffbidx_ENV_SCRIPT_PATH}/setup-env.sh\")")