forked from Celtoys/Remotery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (45 loc) · 1.6 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
cmake_minimum_required(VERSION 3.1)
project(Remotery)
option(REMOTERY_USE_CUDA "Enable CUDA profiling with Remotery" OFF)
set(Remotery_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(Remotery_HEADERS ${Remotery_SOURCE_DIR}/Remotery.h)
set(Remotery_SOURCES ${Remotery_SOURCE_DIR}/Remotery.c)
if(APPLE)
list(APPEND Remotery_SOURCES ${Remotery_SOURCE_DIR}/RemoteryMetal.mm)
endif()
add_library(remotery ${Remotery_SOURCES})
if(UNIX OR WIN32)
target_compile_definitions(remotery PUBLIC RMT_USE_OPENGL=1)
endif()
if(WIN32)
target_compile_definitions(remotery PUBLIC RMT_USE_D3D11=1)
endif()
if(APPLE)
target_compile_definitions(remotery PUBLIC RMT_USE_METAL=1)
endif()
if(MSVC)
target_link_libraries(remotery ws2_32)
else()
find_package(Threads REQUIRED)
target_link_libraries(remotery Threads::Threads m)
endif()
if(BUILD_SHARED_LIBS)
target_compile_definitions(remotery PUBLIC RMT_DLL)
endif()
if(REMOTERY_USE_CUDA)
if(${CMAKE_VERSION} VERSION_LESS "3.17")
find_package(CUDA REQUIRED)
target_link_libraries(remotery ${CUDA_LIBRARIES})
target_include_directories(remotery PRIVATE ${CUDA_INCLUDE_DIRS})
else()
find_package(CUDAToolkit REQUIRED)
target_link_libraries(remotery CUDA::cudart)
endif()
target_compile_definitions(remotery PUBLIC RMT_USE_CUDA=1)
endif()
include(GNUInstallDirs)
install(TARGETS remotery
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${Remotery_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})