revision-id: b7727a2c3398d3ae454fff1165330629521b7d77 (mariadb-10.3.5-158-gb7727a2) parent(s): c9839cb0b34014bb463aa790548a39a1975d9c16 author: Sachin Setiya committer: Sachin Setiya timestamp: 2018-04-17 16:29:46 +0530 message: vesa patch --- CMakeLists.txt | 3 +++ cmake/numa.cmake | 27 ++++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94362c3..52f511e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,6 +129,9 @@ IF(DEFINED ENV{CPPFLAGS}) ADD_DEFINITIONS($ENV{CPPFLAGS}) ENDIF() +# NUMA +SET(WITH_NUMA "AUTO" CACHE STRING "Build with non-uniform memory access, allowing --innodb-numa-interleave. Options are ON|OFF|AUTO. ON = enabled (requires NUMA library), OFF = disabled, AUTO = enabled if NUMA library found.") + SET(MYSQL_MAINTAINER_MODE "AUTO" CACHE STRING "MySQL maintainer-specific development environment. Options are: ON OFF AUTO.") # Packaging diff --git a/cmake/numa.cmake b/cmake/numa.cmake index 4bace0e..cdc3122 100644 --- a/cmake/numa.cmake +++ b/cmake/numa.cmake @@ -1,16 +1,18 @@ MACRO (MYSQL_CHECK_NUMA) - IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + STRING(TOLOWER "${WITH_NUMA}" WITH_NUMA_LOWERCASE) + + IF(NOT WITH_NUMA) + MESSAGE(STATUS "WITH_NUMA=OFF: NUMA memory allocation policy disabled") + + ELSEIF(NOT WITH_NUMA_LOWERCASE STREQUAL "auto" AND NOT WITH_NUMA_LOWERCASE STREQUAL "on") + MESSAGE(FATAL_ERROR "Wrong value for WITH_NUMA") + + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux") CHECK_INCLUDE_FILES(numa.h HAVE_NUMA_H) CHECK_INCLUDE_FILES(numaif.h HAVE_NUMAIF_H) IF(HAVE_NUMA_H AND HAVE_NUMAIF_H) - OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" ON) - ELSE() - OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" OFF) - ENDIF() - - IF(WITH_NUMA AND HAVE_NUMA_H AND HAVE_NUMAIF_H) SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} numa) CHECK_C_SOURCE_COMPILES( @@ -31,12 +33,19 @@ MACRO (MYSQL_CHECK_NUMA) ENDIF() ENDIF() - IF(WITH_NUMA AND NOT HAVE_LIBNUMA) + IF(WITH_NUMA_LOWERCASE STREQUAL "auto" AND HAVE_LIBNUMA) + MESSAGE(STATUS "WITH_NUMA=AUTO: NUMA memory allocation policy enabled") + ELSEIF(WITH_NUMA_LOWERCASE STREQUAL "auto" AND NOT HAVE_LIBNUMA) + MESSAGE(STATUS "WITH_NUMA=AUTO: NUMA memory allocation policy disabled") + ELSEIF(HAVE_LIBNUMA) + MESSAGE(STATUS "WITH_NUMA=ON: NUMA memory allocation policy enabled") + ELSE() # Forget it in cache, abort the build. UNSET(WITH_NUMA CACHE) UNSET(NUMA_LIBRARY CACHE) - MESSAGE(FATAL_ERROR "Could not find numa headers/libraries") + MESSAGE(FATAL_ERROR "WITH_NUMA=ON: Could not find NUMA headers/libraries") ENDIF() + ENDIF() ENDMACRO()