diff --git a/CMakeLists.txt b/CMakeLists.txt index 837d8e6dd7..1ef9ba7ba3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -521,16 +521,7 @@ endif() install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.TXT DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/") -install( - FILES examples/basic/gpu_shared_memory.c - examples/basic/utils_level_zero.h - examples/basic/basic.c - examples/basic/ipc_level_zero.c - examples/basic/ipc_ipcapi_anon_fd.sh - examples/basic/ipc_ipcapi_consumer.c - examples/basic/ipc_ipcapi_producer.c - examples/basic/ipc_ipcapi_shm.sh - DESTINATION "${CMAKE_INSTALL_DOCDIR}/examples") +install(DIRECTORY examples DESTINATION "${CMAKE_INSTALL_DOCDIR}") # Add the include directory and the headers target to the install. install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index ace1bb5b79..455b9bc061 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -46,7 +46,7 @@ function(add_umf_benchmark) PRIVATE ${UMF_CMAKE_SOURCE_DIR}/include ${UMF_CMAKE_SOURCE_DIR}/src/utils ${UMF_CMAKE_SOURCE_DIR}/test/common - ${UMF_CMAKE_SOURCE_DIR}/examples/basic) + ${UMF_CMAKE_SOURCE_DIR}/examples/common) target_link_directories(${BENCH_NAME} PRIVATE ${ARG_LIBDIRS}) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 032df0c032..ac0b3168ce 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -48,12 +48,14 @@ if(UMF_BUILD_GPU_EXAMPLES add_umf_executable( NAME ${EXAMPLE_NAME} - SRCS basic/gpu_shared_memory.c + SRCS gpu_shared_memory/gpu_shared_memory.c LIBS disjoint_pool ze_loader umf) target_include_directories( - ${EXAMPLE_NAME} PRIVATE ${UMF_CMAKE_SOURCE_DIR}/src/utils - ${UMF_CMAKE_SOURCE_DIR}/include) + ${EXAMPLE_NAME} + PRIVATE ${UMF_CMAKE_SOURCE_DIR}/src/utils + ${UMF_CMAKE_SOURCE_DIR}/include + ${UMF_CMAKE_SOURCE_DIR}/examples/common) target_link_directories(${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS}) @@ -87,13 +89,14 @@ if(UMF_BUILD_GPU_EXAMPLES add_umf_executable( NAME ${EXAMPLE_NAME} - SRCS basic/ipc_level_zero.c + SRCS ipc_level_zero/ipc_level_zero.c LIBS disjoint_pool ze_loader umf) target_include_directories( ${EXAMPLE_NAME} PRIVATE ${LEVEL_ZERO_INCLUDE_DIRS} ${UMF_CMAKE_SOURCE_DIR}/src/utils - ${UMF_CMAKE_SOURCE_DIR}/include) + ${UMF_CMAKE_SOURCE_DIR}/include + ${UMF_CMAKE_SOURCE_DIR}/examples/common) target_link_directories(${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS}) @@ -124,7 +127,7 @@ function(build_umf_ipc_example name) set(EX_NAME ${EXAMPLE_NAME}_${loop_var}) add_umf_executable( NAME ${EX_NAME} - SRCS basic/${BASE_NAME}_${loop_var}.c + SRCS ipc_ipcapi/${BASE_NAME}_${loop_var}.c LIBS umf) target_include_directories( @@ -138,7 +141,7 @@ endfunction() function(add_umf_ipc_example script) set(EXAMPLE_NAME umf_example_${script}) - file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/basic/${script}.sh + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ipc_ipcapi/${script}.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) add_test( diff --git a/examples/basic/utils_level_zero.h b/examples/common/utils_level_zero.h similarity index 100% rename from examples/basic/utils_level_zero.h rename to examples/common/utils_level_zero.h diff --git a/examples/basic/gpu_shared_memory.c b/examples/gpu_shared_memory/gpu_shared_memory.c similarity index 100% rename from examples/basic/gpu_shared_memory.c rename to examples/gpu_shared_memory/gpu_shared_memory.c diff --git a/examples/basic/ipc_ipcapi_anon_fd.sh b/examples/ipc_ipcapi/ipc_ipcapi_anon_fd.sh similarity index 100% rename from examples/basic/ipc_ipcapi_anon_fd.sh rename to examples/ipc_ipcapi/ipc_ipcapi_anon_fd.sh diff --git a/examples/basic/ipc_ipcapi_consumer.c b/examples/ipc_ipcapi/ipc_ipcapi_consumer.c similarity index 100% rename from examples/basic/ipc_ipcapi_consumer.c rename to examples/ipc_ipcapi/ipc_ipcapi_consumer.c diff --git a/examples/basic/ipc_ipcapi_producer.c b/examples/ipc_ipcapi/ipc_ipcapi_producer.c similarity index 100% rename from examples/basic/ipc_ipcapi_producer.c rename to examples/ipc_ipcapi/ipc_ipcapi_producer.c diff --git a/examples/basic/ipc_ipcapi_shm.sh b/examples/ipc_ipcapi/ipc_ipcapi_shm.sh similarity index 100% rename from examples/basic/ipc_ipcapi_shm.sh rename to examples/ipc_ipcapi/ipc_ipcapi_shm.sh diff --git a/examples/basic/ipc_level_zero.c b/examples/ipc_level_zero/ipc_level_zero.c similarity index 100% rename from examples/basic/ipc_level_zero.c rename to examples/ipc_level_zero/ipc_level_zero.c diff --git a/test/test_installation.py b/test/test_installation.py index b7238e69f0..b2a86f4302 100644 --- a/test/test_installation.py +++ b/test/test_installation.py @@ -133,13 +133,15 @@ def _create_match_list(self) -> List[str]: "share/doc", "share/doc/umf", ] + examples_dir = Path(self.workspace_dir, "examples") - examples_dirs = [dir for dir in examples_dir.iterdir() if dir.is_dir()] - examples = [ - f"share/doc/umf/examples/{file_path.name}" - for example_dir in examples_dirs - for file_path in example_dir.iterdir() + examples_files = [ + str(entry.relative_to(self.workspace_dir)) + for entry in sorted( + examples_dir.rglob("*"), key=lambda x: str(x).casefold() + ) ] + examples = [f"share/doc/umf/" + file for file in examples_files] examples = sorted(examples) examples.insert(0, "share/doc/umf/examples") share.extend(examples)