forked from Syllo/nvtop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
122 lines (103 loc) · 4.53 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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
cmake_minimum_required(VERSION 3.1)
#///////////////////////////////////////////////////////////////////#
# PROJECT #
#///////////////////////////////////////////////////////////////////#
project(nvtop VERSION 1.2.2
LANGUAGES C)
set(default_build_type "Release")
# Default build type
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#///////////////////////////////////////////////////////////////////#
# DEPENDENCIES #
#///////////////////////////////////////////////////////////////////#
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CURSES_NEED_NCURSES TRUE)
# Try to find ncurses with unicode support first
set(CURSES_NEED_WIDE TRUE)
find_package(Curses QUIET)
if (NOT CURSE_FOUND)
# Fallback to regular ncurses library, which may also support unicode!
set(CURSES_NEED_WIDE FALSE)
find_package(Curses REQUIRED)
endif()
add_library(ncurses INTERFACE IMPORTED)
set_property(TARGET ncurses PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${CURSES_INCLUDE_DIRS})
set_property(TARGET ncurses PROPERTY
INTERFACE_LINK_LIBRARIES ${CURSES_LIBRARIES})
#///////////////////////////////////////////////////////////////////#
# COMPILATION OPTIONS #
#///////////////////////////////////////////////////////////////////#
# Use full RPATH on build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# Do not build with install RPATH
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# Set the RPATH when install
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Only set RPATH if the installation directory is not a system directory
LIST(FIND
CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib"
isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
else()
set(CMAKE_INSTALL_RPATH "")
endif()
add_subdirectory(src)
#///////////////////////////////////////////////////////////////////#
# INSTALL #
#///////////////////////////////////////////////////////////////////#
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/manpage/nvtop.in"
"${CMAKE_CURRENT_BINARY_DIR}/manpage/nvtop"
IMMEDIATE @ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/manpage/nvtop"
DESTINATION share/man/man1/
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
RENAME nvtop.1)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
#///////////////////////////////////////////////////////////////////#
# PACKAGING #
#///////////////////////////////////////////////////////////////////#
#set(CPACK_PACKAGE_NAME "nvtop")
#set(CPACK_PACKAGE_VENDOR "Maxime Schmitt")
#set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NVIDIA GPU monitoring tool")
#set(CPACK_PACKAGE_DESCRIPTION
#"Nvtop is a htop-like monitoring tool for NVIDIA GPUs. It can print GPUs information such as GPU and memory usage, temperature and active processes.")
#set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.markdown")
#set(CPACK_PACKAGE_EXECUTABLES "nvtop")
#set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
#set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
#set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
#set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "x86-64")
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
#set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Maxime Schmitt <maxime.schmitt@gmail.com>")
#set(CPACK_DEBIAN_PACKAGE_SECTION "Utilities")
#set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
#set(CPACK_RPM_PACKAGE_ARCHITECTURE "amd64")
#set(CPACK_RPM_PACKAGE_RELEASE 1)
#set(CPACK_RPM_PACKAGE_LICENSE "GPL3+")
#set(CPACK_RPM_PACKAGE_REQUIRES "")
#set(CPACK_GENERATOR "TGZ;TBZ2")
#list(APPEND CPACK_GENERATOR "DEB") # .deb package build
#list(APPEND CPACK_GENERATOR "RPM") # .rpm package build
#set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2;ZIP")
#set(CPACK_SOURCE_IGNORE_FILES
#.git*
#/.*build.*
#)
#include(CPack)