Skip to content

Commit 775a1ea

Browse files
[CMake] Always install examples
We only install source files, not compiled binaries. So, we don't need to properly build them before we install them. They are just to be read as part of the documentation.
1 parent b415e78 commit 775a1ea

File tree

4 files changed

+15
-32
lines changed

4 files changed

+15
-32
lines changed

.github/workflows/basic.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ jobs:
6363

6464
- name: Test UMF installation and uninstallation
6565
# The '--shared-library' parameter is added to the installation test when the UMF is built as a shared library
66-
# pool tracking and scalable pool (always ON in this job) has to be enabled for the basic example to be built
67-
# The '--examples' parameter is added to the installation test when examples are built
6866
run: >
6967
python3 ${{github.workspace}}/test/test_installation.py
7068
--build-dir ${{env.BUILD_DIR}}
@@ -74,7 +72,6 @@ jobs:
7472
--jemalloc-pool
7573
--scalable-pool
7674
${{ matrix.shared_library == 'ON' && '--shared-library' || ''}}
77-
${{ matrix.pool_tracking == 'ON' && '--examples' || '' }}
7875
7976
ubuntu-build:
8077
name: Ubuntu
@@ -162,8 +159,6 @@ jobs:
162159

163160
- name: Test UMF installation and uninstallation
164161
# The '--shared-library' parameter is added to the installation test when the UMF is built as a shared library
165-
# OS provider, pool tracking and scalable pool (always ON in this job) has to be enabled for the basic example to be built
166-
# The '--examples' parameter is added to the installation test when examples are built
167162
run: >
168163
python3 ${{github.workspace}}/test/test_installation.py
169164
--build-dir ${{env.BUILD_DIR}}
@@ -173,7 +168,6 @@ jobs:
173168
--jemalloc-pool
174169
--scalable-pool
175170
${{ matrix.shared_library == 'ON' && '--shared-library' || '' }}
176-
${{ matrix.pool_tracking == 'ON' && '--examples' || '' }}
177171
178172
windows-build:
179173
name: Windows
@@ -253,8 +247,6 @@ jobs:
253247

254248
- name: Test UMF installation and uninstallation
255249
# The '--shared-library' parameter is added to the installation test when the UMF is built as a shared library
256-
# OS provider, pool tracking and scalable pool (always ON in this job) has to be enabled for the basic example to be built
257-
# The '--examples' parameter is added to the installation test when examples are built
258250
run: >
259251
python3 ${{github.workspace}}/test/test_installation.py
260252
--build-dir ${{env.BUILD_DIR}}
@@ -264,7 +256,6 @@ jobs:
264256
--jemalloc-pool
265257
--scalable-pool
266258
${{ matrix.shared_library == 'ON' && '--shared-library' || ''}}
267-
${{ matrix.pool_tracking == 'ON' && '--examples' || '' }}
268259
269260
macos-build:
270261
name: MacOS
@@ -314,4 +305,3 @@ jobs:
314305
--disjoint-pool
315306
--jemalloc-pool
316307
--scalable-pool
317-
--examples

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,12 @@ endif()
376376
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.TXT
377377
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/")
378378

379+
install(
380+
DIRECTORY examples/
381+
DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples
382+
FILES_MATCHING
383+
PATTERN "*.c")
384+
379385
# Add the list of installed targets to the install. This includes the namespace
380386
# which all installed targets will be prefixed with, e.g. for the headers target
381387
# users will depend on ${PROJECT_NAME}::headers.

examples/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ if(UMF_BUILD_LIBUMF_POOL_SCALABLE AND UMF_ENABLE_POOL_TRACKING)
2828
set_property(TEST ${EXAMPLE_NAME} PROPERTY ENVIRONMENT_MODIFICATION
2929
"${DLL_PATH_LIST}")
3030
endif()
31-
32-
install(FILES basic/basic.c DESTINATION "${CMAKE_INSTALL_DOCDIR}/examples")
33-
3431
else()
3532
message(
3633
STATUS

test/test_installation.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class UmfInstaller:
2525
build_type (str): Debug or Release build type passed to the script
2626
shared_library (bool): Determines if the UMF was built as a shared library
2727
pools (List[str]): A list of enabled pools during the UMF compilation
28-
examples (bool): Determines if the UMF examples were built
2928
match_list (List[str]): A list of relative paths of files that should be installed
3029
"""
3130

@@ -37,15 +36,13 @@ def __init__(
3736
build_type: str,
3837
shared_library: bool,
3938
pools: List[str],
40-
examples: bool,
4139
):
4240
self.workspace_dir = workspace_dir
4341
self.build_dir = build_dir
4442
self.install_dir = install_dir
4543
self.build_type = build_type
4644
self.shared_library = shared_library
4745
self.pools = pools
48-
self.examples = examples
4946
self.match_list = self._create_match_list()
5047

5148
def _create_match_list(self) -> List[str]:
@@ -114,16 +111,15 @@ def _create_match_list(self) -> List[str]:
114111
"share/doc",
115112
"share/doc/unified-memory-framework",
116113
]
117-
if self.examples:
118-
examples_dir = Path(self.workspace_dir, "examples")
119-
examples_dirs = [dir for dir in examples_dir.iterdir() if dir.is_dir()]
120-
examples = [
121-
f"share/doc/unified-memory-framework/examples/{file_path.name}"
122-
for example_dir in examples_dirs
123-
for file_path in example_dir.iterdir()
124-
]
125-
examples.insert(0, "share/doc/unified-memory-framework/examples")
126-
share.extend(examples)
114+
examples_dir = Path(self.workspace_dir, "examples")
115+
examples_dirs = [dir for dir in examples_dir.iterdir() if dir.is_dir()]
116+
examples = [
117+
f"share/doc/unified-memory-framework/examples/{file_path.name}"
118+
for example_dir in examples_dirs
119+
for file_path in example_dir.iterdir()
120+
]
121+
examples.insert(0, "share/doc/unified-memory-framework/examples")
122+
share.extend(examples)
127123
share.append("share/doc/unified-memory-framework/LICENSE.TXT")
128124

129125
all_files = bin + include + lib + share
@@ -260,11 +256,6 @@ def parse_arguments(self) -> argparse.Namespace:
260256
action="store_true",
261257
help="Add this argument if the UMF was built with Scalable Pool enabled",
262258
)
263-
self.parser.add_argument(
264-
"--examples",
265-
action="store_true",
266-
help="Add this argument if the examples were built",
267-
)
268259
return self.parser.parse_args()
269260

270261
def run(self) -> None:
@@ -290,7 +281,6 @@ def run(self) -> None:
290281
self.args.build_type,
291282
self.args.shared_library,
292283
pools,
293-
self.args.examples,
294284
)
295285

296286
print("Installation test - BEGIN", flush=True)

0 commit comments

Comments
 (0)