Skip to content

Commit 8437b90

Browse files
[CMake] Minor cleanups in top-level CMake
mostly adding new "section" comments and a misspell fix.
1 parent 76e4f12 commit 8437b90

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

CMakeLists.txt

Lines changed: 19 additions & 7 deletions
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
@@ -33,6 +37,10 @@ include(CMakePackageConfigHelpers)
3337
include(GNUInstallDirs)
3438
find_package(PkgConfig)
3539

40+
# --------------------------------------------------------------------------- #
41+
# Set UMF build options (and CACHE variables)
42+
# --------------------------------------------------------------------------- #
43+
3644
# Define a list to store the names of all options
3745
set(UMF_OPTIONS_LIST "")
3846
list(APPEND UMF_OPTIONS_LIST CMAKE_BUILD_TYPE)
@@ -43,7 +51,6 @@ macro(umf_option)
4351
option(${ARGV})
4452
endmacro()
4553

46-
# Build Options
4754
umf_option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF)
4855
umf_option(UMF_BUILD_LEVEL_ZERO_PROVIDER "Build Level Zero memory provider" ON)
4956
umf_option(UMF_BUILD_CUDA_PROVIDER "Build CUDA memory provider" ON)
@@ -56,9 +63,8 @@ umf_option(UMF_BUILD_GPU_TESTS "Build UMF GPU tests" OFF)
5663
umf_option(UMF_BUILD_BENCHMARKS "Build UMF benchmarks" OFF)
5764
umf_option(UMF_BUILD_BENCHMARKS_MT "Build UMF multithreaded benchmarks" OFF)
5865
umf_option(UMF_BUILD_EXAMPLES "Build UMF examples" ON)
59-
umf_option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF)
6066
umf_option(UMF_BUILD_GPU_EXAMPLES "Build UMF GPU examples" OFF)
61-
umf_option(UMF_DEVELOPER_MODE "Enable additional developer checks" OFF)
67+
umf_option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF)
6268
umf_option(
6369
UMF_DISABLE_HWLOC
6470
"Disable hwloc and UMF features requiring it (OS provider, memtargets, topology discovery)"
@@ -67,9 +73,6 @@ umf_option(
6773
UMF_LINK_HWLOC_STATICALLY
6874
"Link UMF with HWLOC library statically (proxy library will be disabled on Windows+Debug build)"
6975
OFF)
70-
umf_option(
71-
UMF_FORMAT_CODE_STYLE
72-
"Add clang, cmake, and black -format-check and -format-apply targets" OFF)
7376
set(UMF_HWLOC_NAME
7477
"hwloc"
7578
CACHE STRING "Custom name for hwloc library w/o extension")
@@ -81,6 +84,10 @@ set(UMF_INSTALL_RPATH
8184
"Set the runtime search path to the directory with dependencies (e.g. hwloc)"
8285
)
8386

87+
umf_option(UMF_DEVELOPER_MODE "Enable additional developer checks" OFF)
88+
umf_option(
89+
UMF_FORMAT_CODE_STYLE
90+
"Add clang, cmake, and black -format-check and -format-apply targets" OFF)
8491
# Only a part of skips is treated as a failure now. TODO: extend to all tests
8592
umf_option(UMF_TESTS_FAIL_ON_SKIP "Treat skips in tests as fail" OFF)
8693
umf_option(UMF_USE_ASAN "Enable AddressSanitizer checks" OFF)
@@ -100,6 +107,11 @@ set_property(CACHE UMF_PROXY_LIB_BASED_ON_POOL
100107
PROPERTY STRINGS ${KNOWN_PROXY_LIB_POOLS})
101108
list(APPEND UMF_OPTIONS_LIST UMF_PROXY_LIB_BASED_ON_POOL)
102109

110+
# --------------------------------------------------------------------------- #
111+
# Setup required variables, definitions; fetch dependencies; include
112+
# sub_directories based on build options; set flags; etc.
113+
# --------------------------------------------------------------------------- #
114+
103115
if(UMF_BUILD_TESTS
104116
AND DEFINED ENV{CI}
105117
AND NOT UMF_TESTS_FAIL_ON_SKIP)
@@ -711,7 +723,7 @@ if(UMF_FORMAT_CODE_STYLE)
711723
add_custom_target(
712724
cmake-format-apply
713725
COMMAND ${CMAKE_FORMAT} --in-place ${format_cmake_list}
714-
COMMENT "Format Cmake files using cmake-format")
726+
COMMENT "Format CMake files using cmake-format")
715727
endif()
716728

717729
if(BLACK)

0 commit comments

Comments
 (0)