-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
41 lines (31 loc) · 883 Bytes
/
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.17)
project(dmabuf LANGUAGES C CXX)
set(MODULE_NAME dmabuf)
file(GLOB MODULE_SOURCES
module.c
*.h
)
# `uname --kernel-release`
#set(KMODULE_KERNEL_RELEASE ...)
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(kmodule REQUIRED)
add_kmodule(${PROJECT_NAME}
NAME ${MODULE_NAME}
${MODULE_SOURCES}
)
add_dependencies(${PROJECT_NAME}-insmod ${PROJECT_NAME}-rmmod)
get_directory_property(parent_dir PARENT_DIRECTORY)
if(NOT parent_dir)
add_custom_target(insmod
COMMAND sudo chmod a+rw /dev/${MODULE_NAME}0
VERBATIM
DEPENDS ${PROJECT_NAME}-insmod
)
endif()
add_executable(test_mmap test_mmap.cpp test.h)
find_package(CUDAToolkit)
if(CUDAToolkit_FOUND)
enable_language(CUDA)
set(CMAKE_CUDA_ARCHITECTURES 61)
add_executable(test_cuda test_cuda.cu test.h)
endif()