@@ -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)
1111include (${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
2636if (PROJECT_VERSION_PATCH GREATER 0)
2737 # set extra variable for Windows dll metadata
@@ -33,6 +43,10 @@ include(CMakePackageConfigHelpers)
3343include (GNUInstallDirs)
3444find_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
3751set (UMF_OPTIONS_LIST "" )
3852list (APPEND UMF_OPTIONS_LIST CMAKE_BUILD_TYPE )
@@ -43,7 +57,6 @@ macro(umf_option)
4357 option (${ARGV} )
4458endmacro ()
4559
46- # Build Options
4760umf_option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF )
4861umf_option(UMF_BUILD_LEVEL_ZERO_PROVIDER "Build Level Zero memory provider" ON )
4962umf_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)
5669umf_option(UMF_BUILD_BENCHMARKS "Build UMF benchmarks" OFF )
5770umf_option(UMF_BUILD_BENCHMARKS_MT "Build UMF multithreaded benchmarks" OFF )
5871umf_option(UMF_BUILD_EXAMPLES "Build UMF examples" ON )
59- umf_option(UMF_BUILD_FUZZTESTS "Build UMF fuzz tests" OFF )
6072umf_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 )
6274umf_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 )
7382set (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
8598umf_option(UMF_TESTS_FAIL_ON_SKIP "Treat skips in tests as fail" OFF )
8699umf_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} )
101114list (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+
103121if (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)
0 commit comments