Skip to content

Commit e230a98

Browse files
authored
Merge pull request #369 from lukaszstolarczuk/always-install-examples
Always install examples
2 parents 263aa51 + 62fa283 commit e230a98

File tree

4 files changed

+22
-39
lines changed

4 files changed

+22
-39
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: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,6 @@ target_include_directories(
145145
umf_headers INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
146146
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
147147

148-
# Add the include directory and the headers target to the install.
149-
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
150-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
151-
152-
install(TARGETS umf_headers EXPORT ${PROJECT_NAME}-targets)
153-
154148
if(WINDOWS)
155149
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
156150
# set PATH to DLLs on Windows
@@ -375,10 +369,21 @@ if(UMF_FORMAT_CODE_STYLE)
375369
COMMENT "Format files using clang-format and cmake-format")
376370
endif()
377371

378-
# Add license to the installation path
372+
# --------------------------------------------------------------------------- #
373+
# Configure make install/uninstall and packages
374+
# --------------------------------------------------------------------------- #
379375
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.TXT
380376
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/")
381377

378+
install(FILES examples/basic/basic.c
379+
DESTINATION "${CMAKE_INSTALL_DOCDIR}/examples")
380+
381+
# Add the include directory and the headers target to the install.
382+
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
383+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
384+
385+
install(TARGETS umf_headers EXPORT ${PROJECT_NAME}-targets)
386+
382387
# Add the list of installed targets to the install. This includes the namespace
383388
# which all installed targets will be prefixed with, e.g. for the headers target
384389
# users will depend on ${PROJECT_NAME}::headers.
@@ -405,6 +410,7 @@ install(FILES ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config.cmake
405410
${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}-config-version.cmake
406411
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
407412

413+
# Configure uninstall commands
408414
configure_file("${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
409415
"${PROJECT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
410416

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)