-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CMake search path for NVML lib and include
- Loading branch information
Showing
2 changed files
with
23 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Version 1.1 | ||
# Version 1.2 | ||
# Public Domain | ||
# Written by Maxime SCHMITT <[email protected]> | ||
|
||
|
@@ -19,29 +19,30 @@ if (NVML_INCLUDE_DIRS AND NVML_LIBRARIES) | |
endif() | ||
|
||
# Headers | ||
file(GLOB nvml_header_path_hint /usr/local/cuda*/include /opt/cuda*/include) | ||
file(GLOB nvml_header_path_hint /usr/include/nvidia*/include /usr/local/cuda*/include /opt/cuda*/include) | ||
find_path(NVML_INCLUDE_DIRS NAMES nvml.h | ||
HINTS ${nvml_header_path_hint}) | ||
PATHS ${nvml_header_path_hint} ${PROJECT_BINARY_DIR}/include) | ||
|
||
# library | ||
find_library(NVML_LIBRARIES NAMES nvml nvidia-ml) | ||
file(GLOB nvml_lib_path_hint /usr/lib*/nvidia*/) | ||
find_library(NVML_LIBRARIES NAMES nvidia-ml libnvidia-ml.so.1 | ||
PATHS ${nvml_lib_path_hint}) | ||
|
||
# Version | ||
set(filename "${NVML_INCLUDE_DIRS}/nvml.h") | ||
if (NOT EXISTS ${filename} AND NOT quiet) | ||
message(AUTHOR_WARNING "Unable to find ${filename}") | ||
endif() | ||
file(READ "${filename}" nvml_header) | ||
set(nvml_api_version_match "NVML_API_VERSION") | ||
|
||
string(REGEX REPLACE ".*#[ \t]*define[ \t]*${nvml_api_version_match}[ \t]*([0-9]+).*" | ||
"\\1" nvml_api_version "${nvml_header}") | ||
|
||
if (nvml_api_version STREQUAL nvml_header) | ||
message(AUTHOR_WARNING "Unable to find nvml api version") | ||
else() | ||
set(NVML_API_VERSION "${nvml_api_version}") | ||
endif() | ||
if (EXISTS ${filename}) | ||
file(READ "${filename}" nvml_header) | ||
set(nvml_api_version_match "NVML_API_VERSION") | ||
|
||
string(REGEX REPLACE ".*#[ \t]*define[ \t]*${nvml_api_version_match}[ \t]*([0-9]+).*" | ||
"\\1" nvml_api_version "${nvml_header}") | ||
|
||
if (nvml_api_version STREQUAL nvml_header AND NOT quiet) | ||
message(AUTHOR_WARNING "Unable to find nvml api version") | ||
else() | ||
set(NVML_API_VERSION "${nvml_api_version}") | ||
endif() | ||
endif(EXISTS ${filename}) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NVML | ||
|