-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
43 lines (37 loc) · 1.32 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
cmake_minimum_required(VERSION 3.28)
project(TensorLite LANGUAGES CXX CUDA)
# Set the C++ standard and output directories
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CUDA_STANDARD 14)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
# Add library
add_library(TensorLite SHARED
src/vector_add.cu
src/matrix_mul.cu
src/TensorLite.cpp
src/DenseLayer.cu
include/TensorLite.h
)
# Set properties for the library
set_target_properties(TensorLite PROPERTIES
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
CUDA_SEPARABLE_COMPILATION ON
POSITION_INDEPENDENT_CODE ON
CUDA_ARCHITECTURES "60;61;70;75;80;86"
)
# Include directories
target_include_directories(TensorLite PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
# Log CUDA status
if(CMAKE_CUDA_COMPILER)
message(STATUS "CUDA Compiler: ${CMAKE_CUDA_COMPILER}")
else()
message(STATUS "CUDA Compiler not found")
endif()
# Include CUDA Toolkit directories (if found)
if(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
message(STATUS "CUDA Toolkit Include Directories: ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}")
target_include_directories(TensorLite PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
else()
message(WARNING "CUDA Toolkit include directories not found.")
endif()