@@ -36,41 +36,41 @@ target_include_directories(ur_common PUBLIC
36
36
$< BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /include>
37
37
)
38
38
39
- message (STATUS "Download Unified Memory Framework from github.com" )
40
- if (NOT DEFINED UMF_REPO )
41
- set (UMF_REPO "https://github.com/oneapi-src/unified-memory-framework.git" )
42
- endif ()
43
-
44
- if (NOT DEFINED UMF_TAG )
45
- # commit 1de269c00e46b7cbdbafa2247812c8c4bb4ed4a5
46
- # Author: Łukasz Stolarczuk <[email protected] >
47
- # Date: Mon Jul 21 15:42:59 2025 +0200
48
- # 1.0.0 release
49
- set (UMF_TAG v1.0.0 )
50
- endif ()
51
-
52
- message (STATUS "Will fetch Unified Memory Framework from ${UMF_REPO} " )
53
-
54
- include (FetchContent )
55
- FetchContent_Declare (unified-memory-framework
56
- GIT_REPOSITORY ${UMF_REPO}
57
- GIT_TAG ${UMF_TAG}
58
- )
59
39
60
40
if (UR_STATIC_ADAPTER_L0 )
61
41
if (UMF_BUILD_SHARED_LIBRARY )
62
42
message (STATUS "Static adapter is not compatible with shared UMF, switching to fully statically linked UMF" )
63
43
set (UMF_BUILD_SHARED_LIBRARY OFF )
64
44
endif ()
65
45
endif ()
46
+
47
+ set (UR_USE_EXTERNAL_UMF ON CACHE BOOL "Use a pre-built UMF if available" )
66
48
67
- set (UR_USE_EXTERNAL_UMF OFF CACHE BOOL "Use a pre-built UMF" )
68
-
69
- if (UR_USE_EXTERNAL_UMF )
70
- find_package (umf REQUIRED )
49
+ if (UR_USE_EXTERNAL_UMF )
50
+ find_package (umf 1.0.0 QUIET )
51
+ endif ()
52
+ if (umf_FOUND )
53
+ message (STATUS "Using preinstalled UMF at ${umf_DIR} , ignoring UMF build related options" )
71
54
# Add an alias matching the FetchContent case
72
55
add_library (umf::headers ALIAS umf::umf_headers )
73
56
else ()
57
+ set (UMF_REPO "https://github.com/oneapi-src/unified-memory-framework.git" )
58
+
59
+ # commit 1de269c00e46b7cbdbafa2247812c8c4bb4ed4a5
60
+ # Author: Łukasz Stolarczuk <[email protected] >
61
+ # Date: Mon Jul 21 15:42:59 2025 +0200
62
+ # 1.0.0 release
63
+ set (UMF_TAG v1.0.0 )
64
+
65
+ if (NOT FETCHCONTENT_SOURCE_DIR_UNIFIED-MEMORY-FRAMEWORK )
66
+ message (STATUS "Will fetch Unified Memory Framework from ${UMF_REPO} " )
67
+ endif ()
68
+
69
+ include (FetchContent )
70
+ FetchContent_Declare (unified-memory-framework
71
+ GIT_REPOSITORY ${UMF_REPO}
72
+ GIT_TAG ${UMF_TAG}
73
+ )
74
74
set (UMF_BUILD_TESTS OFF CACHE INTERNAL "Build UMF tests" )
75
75
set (UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "Build UMF examples" )
76
76
set (UMF_BUILD_SHARED_LIBRARY ${UMF_BUILD_SHARED_LIBRARY} CACHE INTERNAL "Build UMF shared library" )
@@ -80,6 +80,10 @@ else()
80
80
endif ()
81
81
82
82
if (UR_ENABLE_LATENCY_HISTOGRAM )
83
+ find_package (hdr_histogram QUIET )
84
+ if (hdr_histogram_FOUND )
85
+ set (hdr_histogram_SOURCE_DIR "${hdr_histogram_DIR} " )
86
+ else ()
83
87
set (HDR_HISTOGRAM_BUILD_STATIC CACHE INTERNAL ON "" )
84
88
set (HDR_HISTOGRAM_BUILD_SHARED CACHE INTERNAL OFF "" )
85
89
@@ -91,10 +95,10 @@ if(UR_ENABLE_LATENCY_HISTOGRAM)
91
95
92
96
FetchContent_MakeAvailable (hdr_histogram )
93
97
FetchContent_GetProperties (hdr_histogram )
94
-
95
- target_link_libraries (ur_common PUBLIC hdr_histogram_static )
96
- target_include_directories (ur_common PUBLIC $< BUILD_INTERFACE:${hdr_histogram_SOURCE_DIR} /include> )
97
- target_compile_options (ur_common PUBLIC -DUR_ENABLE_LATENCY_HISTOGRAM=1 )
98
+ endif ()
99
+ target_link_libraries (ur_common PUBLIC hdr_histogram_static )
100
+ target_include_directories (ur_common PUBLIC $< BUILD_INTERFACE:${hdr_histogram_SOURCE_DIR} /include> )
101
+ target_compile_options (ur_common PUBLIC -DUR_ENABLE_LATENCY_HISTOGRAM=1 )
98
102
endif ()
99
103
100
104
target_link_libraries (ur_common PUBLIC
0 commit comments