File tree Expand file tree Collapse file tree 2 files changed +56
-2
lines changed
examples/custom_file_provider Expand file tree Collapse file tree 2 files changed +56
-2
lines changed Original file line number Diff line number Diff line change 1+ # Copyright (C) 2024 Intel Corporation
2+ # Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+ cmake_minimum_required (VERSION 3.14.0 FATAL_ERROR)
6+ project (umf_example_custom_file_provider LANGUAGES C)
7+ enable_testing ()
8+
9+ set (UMF_EXAMPLE_DIR "${CMAKE_SOURCE_DIR} /.." )
10+ list (APPEND CMAKE_MODULE_PATH "${UMF_EXAMPLE_DIR} /cmake" )
11+ message (STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} " )
12+
13+ find_package (PkgConfig)
14+ pkg_check_modules(LIBUMF libumf)
15+ if (NOT LIBUMF_FOUND)
16+ find_package (LIBUMF REQUIRED libumf)
17+ endif ()
18+
19+ pkg_check_modules(LIBHWLOC hwloc>=2.3.0)
20+ if (NOT LIBHWLOC_FOUND)
21+ find_package (LIBHWLOC 2.3.0 REQUIRED hwloc)
22+ endif ()
23+
24+ pkg_check_modules(TBB tbb)
25+ if (NOT TBB_FOUND)
26+ find_package (TBB REQUIRED tbb)
27+ endif ()
28+
29+ # build the example
30+ set (EXAMPLE_NAME umf_example_custom_file_provider)
31+ add_executable (${EXAMPLE_NAME} custom_file_provider.c)
32+ target_include_directories (${EXAMPLE_NAME} PRIVATE ${LIBUMF_INCLUDE_DIRS} )
33+ target_link_directories (${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS} )
34+ target_link_libraries (${EXAMPLE_NAME} PRIVATE ${LIBUMF_LIBRARIES}
35+ ${LIBHWLOC_LIBRARIES} )
36+
37+ add_test (
38+ NAME ${EXAMPLE_NAME}
39+ COMMAND ${EXAMPLE_NAME}
40+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
41+
42+ set_tests_properties (${EXAMPLE_NAME} PROPERTIES LABELS "example-standalone" )
43+
44+ if (LINUX)
45+ # set LD_LIBRARY_PATH
46+ set_property (
47+ TEST ${EXAMPLE_NAME}
48+ PROPERTY
49+ ENVIRONMENT_MODIFICATION
50+ "LD_LIBRARY_PATH=path_list_append:${LIBUMF_LIBRARY_DIRS} ;LD_LIBRARY_PATH=path_list_append:${LIBHWLOC_LIBRARY_DIRS} "
51+ )
52+ endif ()
Original file line number Diff line number Diff line change @@ -494,13 +494,15 @@ if(LINUX
494494 OR UMF_USE_UBSAN
495495 OR UMF_USE_TSAN
496496 OR UMF_USE_MSAN))
497+
497498 set (EXAMPLES "" )
499+
498500 if (UMF_POOL_SCALABLE_ENABLED)
499- set (EXAMPLES ${EXAMPLES} basic)
501+ set (EXAMPLES ${EXAMPLES} basic custom_file_provider )
500502 else ()
501503 message (
502504 STATUS
503- "The basic example requires TBB to be installed and added to the default library search path - skipping"
505+ "The basic and custom_file_provider examples require TBB to be installed and added to the default library search path - skipping"
504506 )
505507 endif ()
506508
You can’t perform that action at this time.
0 commit comments