@@ -10,6 +10,10 @@ list(APPEND CMAKE_MODULE_PATH "${UMF_CMAKE_SOURCE_DIR}/cmake")
10
10
# Use full path of the helpers module (to omit potential conflicts with others)
11
11
include (${UMF_CMAKE_SOURCE_DIR} /cmake/helpers.cmake)
12
12
13
+ # --------------------------------------------------------------------------- #
14
+ # Set UMF version variables, define project, and add basic modules
15
+ # --------------------------------------------------------------------------- #
16
+
13
17
# We use semver aligned version, set via git tags. We parse git output to
14
18
# establish the version of UMF to be used in CMake, Win dll's, and within the
15
19
# code (e.g. in logger). We have 3-component releases (e.g. 1.5.1) plus release
@@ -22,6 +26,12 @@ project(
22
26
umf
23
27
VERSION ${UMF_CMAKE_VERSION}
24
28
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 ()
25
35
26
36
if (PROJECT_VERSION_PATCH GREATER 0)
27
37
# set extra variable for Windows dll metadata
@@ -33,6 +43,10 @@ include(CMakePackageConfigHelpers)
33
43
include (GNUInstallDirs)
34
44
find_package (PkgConfig)
35
45
46
+ # --------------------------------------------------------------------------- #
47
+ # Set UMF build options (and CACHE variables)
48
+ # --------------------------------------------------------------------------- #
49
+
36
50
# Define a list to store the names of all options
37
51
set (UMF_OPTIONS_LIST "" )
38
52
list (APPEND UMF_OPTIONS_LIST CMAKE_BUILD_TYPE )
@@ -43,7 +57,6 @@ macro(umf_option)
43
57
option (${ARGV} )
44
58
endmacro ()
45
59
46
- # Build Options
47
60
umf_option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF )
48
61
umf_option(UMF_BUILD_LEVEL_ZERO_PROVIDER "Build Level Zero memory provider" ON )
49
62
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)
56
69
umf_option(UMF_BUILD_BENCHMARKS "Build UMF benchmarks" OFF )
57
70
umf_option(UMF_BUILD_BENCHMARKS_MT "Build UMF multithreaded benchmarks" OFF )
58
71
umf_option(UMF_BUILD_EXAMPLES "Build UMF examples" ON )
59
- umf_option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF )
60
72
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 )
62
74
umf_option(
63
75
UMF_DISABLE_HWLOC
64
76
"Disable hwloc and UMF features requiring it (OS provider, memtargets, topology discovery)"
@@ -67,9 +79,6 @@ umf_option(
67
79
UMF_LINK_HWLOC_STATICALLY
68
80
"Link UMF with HWLOC library statically (proxy library will be disabled on Windows+Debug build)"
69
81
OFF )
70
- umf_option(
71
- UMF_FORMAT_CODE_STYLE
72
- "Add clang, cmake, and black -format-check and -format-apply targets" OFF )
73
82
set (UMF_HWLOC_NAME
74
83
"hwloc"
75
84
CACHE STRING "Custom name for hwloc library w/o extension" )
@@ -81,6 +90,10 @@ set(UMF_INSTALL_RPATH
81
90
"Set the runtime search path to the directory with dependencies (e.g. hwloc)"
82
91
)
83
92
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 )
84
97
# Only a part of skips is treated as a failure now. TODO: extend to all tests
85
98
umf_option(UMF_TESTS_FAIL_ON_SKIP "Treat skips in tests as fail" OFF )
86
99
umf_option(UMF_USE_ASAN "Enable AddressSanitizer checks" OFF )
@@ -100,6 +113,11 @@ set_property(CACHE UMF_PROXY_LIB_BASED_ON_POOL
100
113
PROPERTY STRINGS ${KNOWN_PROXY_LIB_POOLS} )
101
114
list (APPEND UMF_OPTIONS_LIST UMF_PROXY_LIB_BASED_ON_POOL)
102
115
116
+ # --------------------------------------------------------------------------- #
117
+ # Setup required variables, definitions; fetch dependencies; include
118
+ # sub_directories based on build options; set flags; etc.
119
+ # --------------------------------------------------------------------------- #
120
+
103
121
if (UMF_BUILD_TESTS
104
122
AND DEFINED ENV{CI}
105
123
AND NOT UMF_TESTS_FAIL_ON_SKIP)
@@ -711,7 +729,7 @@ if(UMF_FORMAT_CODE_STYLE)
711
729
add_custom_target (
712
730
cmake-format-apply
713
731
COMMAND ${CMAKE_FORMAT} --in-place ${format_cmake_list}
714
- COMMENT "Format Cmake files using cmake-format" )
732
+ COMMENT "Format CMake files using cmake-format" )
715
733
endif ()
716
734
717
735
if (BLACK)
0 commit comments