-
Notifications
You must be signed in to change notification settings - Fork 492
/
Copy pathCMakeLists.txt
41 lines (33 loc) · 1.17 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
cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR)
project(torchrec_dynamic_embedding
VERSION 0.0.1
LANGUAGES CXX C)
option(TDE_TORCH_BASE_DIR "torch python directory" "")
if (NOT TDE_TORCH_BASE_DIR)
message(FATAL_ERROR "TDE_TORCH_BASE_DIR must set."
"Use python -c 'import torch;import os.path;print(os.path.dirname(torch.__file__))'"
" to get this dir.")
else()
find_package(Torch REQUIRED
PATHS "${TDE_TORCH_BASE_DIR}"
NO_DEFAULT_PATH)
endif()
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
set(TDE_IS_TOP_LEVEL_PROJECT ON)
else()
set(TDE_IS_TOP_LEVEL_PROJECT OFF)
endif()
option(TDE_WITH_TESTING "Enable unittest in C++ side" ${TDE_IS_TOP_LEVEL_PROJECT})
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
option(TDE_WITH_CXX11_ABI "GLIBCXX use c++11 ABI or not. libtorch installed by conda is not use it by default" OFF)
if (TDE_WITH_CXX11_ABI)
add_definitions("-D_GLIBCXX_USE_CXX11_ABI=1")
else()
add_definitions("-D_GLIBCXX_USE_CXX11_ABI=0")
endif()
endif()
if (TDE_WITH_TESTING)
enable_testing()
add_subdirectory(tests/memory_io)
endif()
add_subdirectory(src)