-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
85 lines (70 loc) · 2.08 KB
/
CMakeLists.txt
File metadata and controls
85 lines (70 loc) · 2.08 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Set CMake minimum version and project info
cmake_minimum_required(VERSION 3.21)
project(GPUBenchmarkTool LANGUAGES C CXX CUDA)
# Set C++ standard and CUDA architecture
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CUDA_STANDARD 17)
# Optional: Show all compile commands in the build folder (great for debugging)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Set paths to Vulkan SDK using environment variable
set(VULKAN_SDK $ENV{VULKAN_SDK})
# ------------------------------
# Include GLFW from third_party
# ------------------------------
add_subdirectory(third_party/glfw)
# ------------------------------
# Add ImGui manually
# ------------------------------
file(GLOB IMGUI_SRC
third_party/imgui/*.cpp
third_party/imgui/backends/imgui_impl_glfw.cpp
third_party/imgui/backends/imgui_impl_vulkan.cpp)
add_library(imgui STATIC ${IMGUI_SRC})
target_include_directories(imgui PUBLIC
third_party/imgui
third_party/imgui/backends
)
# ------------------------------
# Set up include directories
# ------------------------------
include_directories(
${VULKAN_SDK}/Include
third_party/glfw/include
third_party/imgui
third_party/imgui/backends
${CMAKE_SOURCE_DIR}/src
)
# ------------------------------
# Link Vulkan and GLFW
# ------------------------------
link_directories(${VULKAN_SDK}/Lib)
# ------------------------------
# Source files
# ------------------------------
file(GLOB_RECURSE SRC_FILES
src/*.cpp
src/*.cu
src/*.h
)
# ------------------------------
# Define main executable
# ------------------------------
add_executable(GPUBenchmarkTool ${SRC_FILES})
# ------------------------------
# Link all dependencies
# ------------------------------
target_link_libraries(GPUBenchmarkTool
glfw
imgui
${VULKAN_SDK}/Lib/vulkan-1.lib
)
# ------------------------------
# Compile options
# ------------------------------
target_compile_definitions(GPUBenchmarkTool PRIVATE IMGUI_IMPL_VULKAN_NO_PROTOTYPES)
# Ensure CUDA code compiles properly
set_target_properties(GPUBenchmarkTool PROPERTIES
CUDA_SEPARABLE_COMPILATION ON
CUDA_STANDARD 17
CUDA_ARCHITECTURES "75;86;89;90"
)