Skip to content

Commit f9c8d0d

Browse files
authored
Merge pull request #589 from ldorau/Move_examples_to_own_subdirectories
Move examples to their own subdirectories
2 parents 26fe3ee + 94d8d53 commit f9c8d0d

11 files changed

+19
-23
lines changed

CMakeLists.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -521,16 +521,7 @@ endif()
521521
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.TXT
522522
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/")
523523

524-
install(
525-
FILES examples/basic/gpu_shared_memory.c
526-
examples/basic/utils_level_zero.h
527-
examples/basic/basic.c
528-
examples/basic/ipc_level_zero.c
529-
examples/basic/ipc_ipcapi_anon_fd.sh
530-
examples/basic/ipc_ipcapi_consumer.c
531-
examples/basic/ipc_ipcapi_producer.c
532-
examples/basic/ipc_ipcapi_shm.sh
533-
DESTINATION "${CMAKE_INSTALL_DOCDIR}/examples")
524+
install(DIRECTORY examples DESTINATION "${CMAKE_INSTALL_DOCDIR}")
534525

535526
# Add the include directory and the headers target to the install.
536527
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"

benchmark/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function(add_umf_benchmark)
4646
PRIVATE ${UMF_CMAKE_SOURCE_DIR}/include
4747
${UMF_CMAKE_SOURCE_DIR}/src/utils
4848
${UMF_CMAKE_SOURCE_DIR}/test/common
49-
${UMF_CMAKE_SOURCE_DIR}/examples/basic)
49+
${UMF_CMAKE_SOURCE_DIR}/examples/common)
5050

5151
target_link_directories(${BENCH_NAME} PRIVATE ${ARG_LIBDIRS})
5252

examples/CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,14 @@ if(UMF_BUILD_GPU_EXAMPLES
4848

4949
add_umf_executable(
5050
NAME ${EXAMPLE_NAME}
51-
SRCS basic/gpu_shared_memory.c
51+
SRCS gpu_shared_memory/gpu_shared_memory.c
5252
LIBS disjoint_pool ze_loader umf)
5353

5454
target_include_directories(
55-
${EXAMPLE_NAME} PRIVATE ${UMF_CMAKE_SOURCE_DIR}/src/utils
56-
${UMF_CMAKE_SOURCE_DIR}/include)
55+
${EXAMPLE_NAME}
56+
PRIVATE ${UMF_CMAKE_SOURCE_DIR}/src/utils
57+
${UMF_CMAKE_SOURCE_DIR}/include
58+
${UMF_CMAKE_SOURCE_DIR}/examples/common)
5759

5860
target_link_directories(${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS})
5961

@@ -87,13 +89,14 @@ if(UMF_BUILD_GPU_EXAMPLES
8789

8890
add_umf_executable(
8991
NAME ${EXAMPLE_NAME}
90-
SRCS basic/ipc_level_zero.c
92+
SRCS ipc_level_zero/ipc_level_zero.c
9193
LIBS disjoint_pool ze_loader umf)
9294

9395
target_include_directories(
9496
${EXAMPLE_NAME}
9597
PRIVATE ${LEVEL_ZERO_INCLUDE_DIRS} ${UMF_CMAKE_SOURCE_DIR}/src/utils
96-
${UMF_CMAKE_SOURCE_DIR}/include)
98+
${UMF_CMAKE_SOURCE_DIR}/include
99+
${UMF_CMAKE_SOURCE_DIR}/examples/common)
97100

98101
target_link_directories(${EXAMPLE_NAME} PRIVATE ${LIBHWLOC_LIBRARY_DIRS})
99102

@@ -124,7 +127,7 @@ function(build_umf_ipc_example name)
124127
set(EX_NAME ${EXAMPLE_NAME}_${loop_var})
125128
add_umf_executable(
126129
NAME ${EX_NAME}
127-
SRCS basic/${BASE_NAME}_${loop_var}.c
130+
SRCS ipc_ipcapi/${BASE_NAME}_${loop_var}.c
128131
LIBS umf)
129132

130133
target_include_directories(
@@ -138,7 +141,7 @@ endfunction()
138141
function(add_umf_ipc_example script)
139142
set(EXAMPLE_NAME umf_example_${script})
140143

141-
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/basic/${script}.sh
144+
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/ipc_ipcapi/${script}.sh
142145
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
143146

144147
add_test(

test/test_installation.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,15 @@ def _create_match_list(self) -> List[str]:
133133
"share/doc",
134134
"share/doc/umf",
135135
]
136+
136137
examples_dir = Path(self.workspace_dir, "examples")
137-
examples_dirs = [dir for dir in examples_dir.iterdir() if dir.is_dir()]
138-
examples = [
139-
f"share/doc/umf/examples/{file_path.name}"
140-
for example_dir in examples_dirs
141-
for file_path in example_dir.iterdir()
138+
examples_files = [
139+
str(entry.relative_to(self.workspace_dir))
140+
for entry in sorted(
141+
examples_dir.rglob("*"), key=lambda x: str(x).casefold()
142+
)
142143
]
144+
examples = [f"share/doc/umf/" + file for file in examples_files]
143145
examples = sorted(examples)
144146
examples.insert(0, "share/doc/umf/examples")
145147
share.extend(examples)

0 commit comments

Comments
 (0)