@@ -36,41 +36,41 @@ target_include_directories(ur_common PUBLIC
3636 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /include >
3737)
3838
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 <lukasz.stolarczuk@intel.com>
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- )
5939
6040if (UR_STATIC_ADAPTER_L0)
6141 if (UMF_BUILD_SHARED_LIBRARY)
6242 message (STATUS "Static adapter is not compatible with shared UMF, switching to fully statically linked UMF" )
6343 set (UMF_BUILD_SHARED_LIBRARY OFF )
6444 endif ()
6545endif ()
46+
47+ set (UR_USE_EXTERNAL_UMF ON CACHE BOOL "Use a pre-built UMF if available" )
6648
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" )
7154 # Add an alias matching the FetchContent case
7255 add_library (umf::headers ALIAS umf::umf_headers)
7356else ()
57+ set (UMF_REPO "https://github.com/oneapi-src/unified-memory-framework.git" )
58+
59+ # commit 1de269c00e46b7cbdbafa2247812c8c4bb4ed4a5
60+ # Author: Łukasz Stolarczuk <lukasz.stolarczuk@intel.com>
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+ )
7474 set (UMF_BUILD_TESTS OFF CACHE INTERNAL "Build UMF tests" )
7575 set (UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "Build UMF examples" )
7676 set (UMF_BUILD_SHARED_LIBRARY ${UMF_BUILD_SHARED_LIBRARY} CACHE INTERNAL "Build UMF shared library" )
@@ -80,6 +80,10 @@ else()
8080endif ()
8181
8282if (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 ()
8387 set (HDR_HISTOGRAM_BUILD_STATIC CACHE INTERNAL ON "" )
8488 set (HDR_HISTOGRAM_BUILD_SHARED CACHE INTERNAL OFF "" )
8589
@@ -91,10 +95,10 @@ if(UR_ENABLE_LATENCY_HISTOGRAM)
9195
9296 FetchContent_MakeAvailable(hdr_histogram)
9397 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)
98102endif ()
99103
100104target_link_libraries (ur_common PUBLIC
0 commit comments