Skip to content

Commit 4af372f

Browse files
authored
Merge pull request #1043 from lukaszstolarczuk/cmake-updates
Various CMake updates
2 parents 0e2dab2 + 079ecef commit 4af372f

File tree

7 files changed

+113
-125
lines changed

7 files changed

+113
-125
lines changed

.cmake-format

+24-11
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ with section("parse"):
99
"pargs": 0,
1010
"flags": [],
1111
'kwargs': {
12-
'NAME': '*',
13-
'SRCS': '*',
14-
'LIBS': '*' ,
12+
'NAME': '*',
13+
'SRCS': '*',
14+
'LIBS': '*' ,
1515
'LIBDIRS': '*'}},
1616
'add_umf_executable': {
1717
"pargs": 0,
1818
"flags": [],
1919
'kwargs': {
20-
'NAME': '*',
21-
'SRCS': '*',
20+
'NAME': '*',
21+
'SRCS': '*',
2222
'LIBS': '*'}},
2323
'add_umf_test': {
2424
"pargs": 0,
2525
"flags": [],
2626
'kwargs': {
27-
'NAME': '*',
28-
'SRCS': '*',
27+
'NAME': '*',
28+
'SRCS': '*',
2929
'LIBS': '*'}},
3030
'add_umf_library': {
3131
"pargs": 0,
3232
"flags": [],
3333
'kwargs': {
34-
'NAME': '*',
35-
'TYPE': '*',
36-
'SRCS': '*',
34+
'NAME': '*',
35+
'TYPE': '*',
36+
'SRCS': '*',
3737
'LIBS': '*',
3838
'LINUX_MAP_FILE': '*',
3939
'WINDOWS_DEF_FILE': '*'}},
@@ -43,7 +43,20 @@ with section("parse"):
4343
'kwargs': {
4444
'LABELS': '*',
4545
'PASS_REGULAR_EXPRESSION': '*'}},
46-
}
46+
'build_umf_test': {
47+
"pargs": 0,
48+
"flags": [],
49+
'kwargs': {
50+
'NAME': '*',
51+
'SRCS': '*',
52+
'LIBS': '*' }},
53+
'add_umf_ipc_test': {
54+
"pargs": 0,
55+
"flags": [],
56+
'kwargs': {
57+
'TEST': '*',
58+
'SRC_DIR': '*'}},
59+
}
4760

4861
# Override configurations per-command where available
4962
override_spec = {}

CMakeLists.txt

+25-7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ list(APPEND CMAKE_MODULE_PATH "${UMF_CMAKE_SOURCE_DIR}/cmake")
1010
# Use full path of the helpers module (to omit potential conflicts with others)
1111
include(${UMF_CMAKE_SOURCE_DIR}/cmake/helpers.cmake)
1212

13+
# --------------------------------------------------------------------------- #
14+
# Set UMF version variables, define project, and add basic modules
15+
# --------------------------------------------------------------------------- #
16+
1317
# We use semver aligned version, set via git tags. We parse git output to
1418
# establish the version of UMF to be used in CMake, Win dll's, and within the
1519
# code (e.g. in logger). We have 3-component releases (e.g. 1.5.1) plus release
@@ -22,6 +26,12 @@ project(
2226
umf
2327
VERSION ${UMF_CMAKE_VERSION}
2428
LANGUAGES C)
29+
if(UMF_CMAKE_VERSION VERSION_EQUAL "0.0.0")
30+
message(
31+
WARNING
32+
"UMF version is set to 0.0.0, which most likely is not expected! "
33+
"Please checkout the git tags to get a proper version.")
34+
endif()
2535

2636
if(PROJECT_VERSION_PATCH GREATER 0)
2737
# set extra variable for Windows dll metadata
@@ -33,6 +43,10 @@ include(CMakePackageConfigHelpers)
3343
include(GNUInstallDirs)
3444
find_package(PkgConfig)
3545

46+
# --------------------------------------------------------------------------- #
47+
# Set UMF build options (and CACHE variables)
48+
# --------------------------------------------------------------------------- #
49+
3650
# Define a list to store the names of all options
3751
set(UMF_OPTIONS_LIST "")
3852
list(APPEND UMF_OPTIONS_LIST CMAKE_BUILD_TYPE)
@@ -43,7 +57,6 @@ macro(umf_option)
4357
option(${ARGV})
4458
endmacro()
4559

46-
# Build Options
4760
umf_option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
4861
umf_option(UMF_BUILD_LEVEL_ZERO_PROVIDER "Build Level Zero memory provider" ON)
4962
umf_option(UMF_BUILD_CUDA_PROVIDER "Build CUDA memory provider" ON)
@@ -56,9 +69,8 @@ umf_option(UMF_BUILD_GPU_TESTS "Build UMF GPU tests" OFF)
5669
umf_option(UMF_BUILD_BENCHMARKS "Build UMF benchmarks" OFF)
5770
umf_option(UMF_BUILD_BENCHMARKS_MT "Build UMF multithreaded benchmarks" OFF)
5871
umf_option(UMF_BUILD_EXAMPLES "Build UMF examples" ON)
59-
umf_option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF)
6072
umf_option(UMF_BUILD_GPU_EXAMPLES "Build UMF GPU examples" OFF)
61-
umf_option(UMF_DEVELOPER_MODE "Enable additional developer checks" OFF)
73+
umf_option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF)
6274
umf_option(
6375
UMF_DISABLE_HWLOC
6476
"Disable hwloc and UMF features requiring it (OS provider, memtargets, topology discovery)"
@@ -67,9 +79,6 @@ umf_option(
6779
UMF_LINK_HWLOC_STATICALLY
6880
"Link UMF with HWLOC library statically (proxy library will be disabled on Windows+Debug build)"
6981
OFF)
70-
umf_option(
71-
UMF_FORMAT_CODE_STYLE
72-
"Add clang, cmake, and black -format-check and -format-apply targets" OFF)
7382
set(UMF_HWLOC_NAME
7483
"hwloc"
7584
CACHE STRING "Custom name for hwloc library w/o extension")
@@ -81,6 +90,10 @@ set(UMF_INSTALL_RPATH
8190
"Set the runtime search path to the directory with dependencies (e.g. hwloc)"
8291
)
8392

93+
umf_option(UMF_DEVELOPER_MODE "Enable additional developer checks" OFF)
94+
umf_option(
95+
UMF_FORMAT_CODE_STYLE
96+
"Add clang, cmake, and black -format-check and -format-apply targets" OFF)
8497
# Only a part of skips is treated as a failure now. TODO: extend to all tests
8598
umf_option(UMF_TESTS_FAIL_ON_SKIP "Treat skips in tests as fail" OFF)
8699
umf_option(UMF_USE_ASAN "Enable AddressSanitizer checks" OFF)
@@ -100,6 +113,11 @@ set_property(CACHE UMF_PROXY_LIB_BASED_ON_POOL
100113
PROPERTY STRINGS ${KNOWN_PROXY_LIB_POOLS})
101114
list(APPEND UMF_OPTIONS_LIST UMF_PROXY_LIB_BASED_ON_POOL)
102115

116+
# --------------------------------------------------------------------------- #
117+
# Setup required variables, definitions; fetch dependencies; include
118+
# sub_directories based on build options; set flags; etc.
119+
# --------------------------------------------------------------------------- #
120+
103121
if(UMF_BUILD_TESTS
104122
AND DEFINED ENV{CI}
105123
AND NOT UMF_TESTS_FAIL_ON_SKIP)
@@ -711,7 +729,7 @@ if(UMF_FORMAT_CODE_STYLE)
711729
add_custom_target(
712730
cmake-format-apply
713731
COMMAND ${CMAKE_FORMAT} --in-place ${format_cmake_list}
714-
COMMENT "Format Cmake files using cmake-format")
732+
COMMENT "Format CMake files using cmake-format")
715733
endif()
716734

717735
if(BLACK)

benchmark/ubench.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023-2024 Intel Corporation
3+
* Copyright (C) 2023-2025 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -452,7 +452,7 @@ static int create_level_zero_params(ze_context_handle_t *context,
452452

453453
int ret = utils_ze_init_level_zero();
454454
if (ret != 0) {
455-
fprintf(stderr, "Failed to init Level 0!\n");
455+
fprintf(stderr, "Failed to init Level Zero!\n");
456456
return ret;
457457
}
458458

examples/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ if(UMF_BUILD_GPU_EXAMPLES
154154
else()
155155
message(
156156
STATUS
157-
"IPC Level 0 example requires UMF_BUILD_GPU_EXAMPLES, UMF_BUILD_LEVEL_ZERO_PROVIDER and UMF_BUILD_LIBUMF_POOL_DISJOINT to be turned ON - skipping"
157+
"IPC Level Zero example requires UMF_BUILD_GPU_EXAMPLES, UMF_BUILD_LEVEL_ZERO_PROVIDER and UMF_BUILD_LIBUMF_POOL_DISJOINT to be turned ON - skipping"
158158
)
159159
endif()
160160

examples/ipc_level_zero/ipc_level_zero.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2024 Intel Corporation
3+
* Copyright (C) 2024-2025 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -104,7 +104,7 @@ int main(void) {
104104
const size_t BUFFER_PATTERN = 0x42;
105105
int ret = init_level_zero();
106106
if (ret != 0) {
107-
fprintf(stderr, "ERROR: Failed to init Level 0!\n");
107+
fprintf(stderr, "ERROR: Failed to init Level Zero!\n");
108108
return ret;
109109
}
110110

examples/level_zero_shared_memory/level_zero_shared_memory.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2024 Intel Corporation
3+
* Copyright (C) 2024-2025 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -27,7 +27,7 @@ int main(void) {
2727
// Initialize Level Zero
2828
int ret = init_level_zero();
2929
if (ret != 0) {
30-
fprintf(stderr, "Failed to init Level 0!\n");
30+
fprintf(stderr, "Failed to init Level Zero!\n");
3131
return ret;
3232
}
3333

0 commit comments

Comments
 (0)