mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 09:14:17 +01:00
CMake cleanup
- use FIND_PACKAGE(LIBAIO) to find libaio - Use standard CMake conventions in Find{PMEM,URING}.cmake - Drop the LIB from LIB{PMEM,URING}_{INCLUDE_DIR,LIBRARIES} It is cleaner, and consistent with how other packages are handled in CMake. e.g successful FIND_PACKAGE(PMEM) now sets PMEM_FOUND, PMEM_LIBRARIES, PMEM_INCLUDE_DIR, not LIBPMEM_{FOUND,LIBRARIES,INCLUDE_DIR}. - Decrease the output. use FIND_PACKAGE with QUIET argument. - for Linux packages, either liburing, or libaio is required If liburing is installed, libaio does not need to be present . Use FIND_PACKAGE([LIBAIO|URING] REQUIRED) if either library is required.
This commit is contained in:
parent
2e31b2ffe9
commit
cb545f1116
7 changed files with 36 additions and 47 deletions
7
cmake/FindLIBAIO.cmake
Normal file
7
cmake/FindLIBAIO.cmake
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
find_path(LIBAIO_INCLUDE_DIR NAMES libaio.h)
|
||||||
|
find_library(LIBAIO_LIBRARIES NAMES aio)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||||
|
LIBAIO DEFAULT_MSG
|
||||||
|
LIBAIO_LIBRARIES LIBAIO_INCLUDE_DIR)
|
|
@ -1,9 +1,9 @@
|
||||||
find_path(LIBPMEM_INCLUDE_DIR NAMES libpmem.h)
|
find_path(PMEM_INCLUDE_DIR NAMES libpmem.h)
|
||||||
find_library(LIBPMEM_LIBRARIES NAMES pmem)
|
find_library(PMEM_LIBRARIES NAMES pmem)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||||
PMEM DEFAULT_MSG
|
PMEM DEFAULT_MSG
|
||||||
LIBPMEM_LIBRARIES LIBPMEM_INCLUDE_DIR)
|
PMEM_LIBRARIES PMEM_INCLUDE_DIR)
|
||||||
|
|
||||||
mark_as_advanced(LIBPMEM_INCLUDE_DIR LIBPMEM_LIBRARIES)
|
mark_as_advanced(PMEM_INCLUDE_DIR PMEM_LIBRARIES)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
find_path(LIBURING_INCLUDE_DIR NAMES liburing.h)
|
find_path(URING_INCLUDE_DIR NAMES liburing.h)
|
||||||
find_library(LIBURING_LIBRARIES NAMES uring)
|
find_library(URING_LIBRARIES NAMES uring)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||||
URING DEFAULT_MSG
|
URING DEFAULT_MSG
|
||||||
LIBURING_LIBRARIES LIBURING_INCLUDE_DIR)
|
URING_LIBRARIES URING_INCLUDE_DIR)
|
||||||
|
|
||||||
mark_as_advanced(LIBURING_INCLUDE_DIR LIBURING_LIBRARIES)
|
mark_as_advanced(URING_INCLUDE_DIR URING_LIBRARIES)
|
||||||
|
|
|
@ -135,15 +135,12 @@ IF(UNIX)
|
||||||
SET(PLUGIN_AUTH_PAM YES CACHE BOOL "")
|
SET(PLUGIN_AUTH_PAM YES CACHE BOOL "")
|
||||||
|
|
||||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
IF(NOT IGNORE_AIO_CHECK)
|
FIND_PACKAGE(URING)
|
||||||
# Ensure aio is available on Linux (required by InnoDB)
|
FIND_PACKAGE(LIBAIO)
|
||||||
CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H)
|
IF(NOT URING_FOUND AND NOT LIBAIO_FOUND AND NOT IGNORE_AIO_CHECK)
|
||||||
CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
|
|
||||||
IF(NOT HAVE_LIBAIO_H OR NOT HAVE_LIBAIO)
|
|
||||||
UNSET(HAVE_LIBAIO_H CACHE)
|
|
||||||
UNSET(HAVE_LIBAIO CACHE)
|
|
||||||
MESSAGE(FATAL_ERROR "
|
MESSAGE(FATAL_ERROR "
|
||||||
aio is required on Linux, you need to install the required library:
|
Either liburing or libaio is required on Linux.
|
||||||
|
You can install libaio like this:
|
||||||
|
|
||||||
Debian/Ubuntu: apt-get install libaio-dev
|
Debian/Ubuntu: apt-get install libaio-dev
|
||||||
RedHat/Fedora/Oracle Linux: yum install libaio-devel
|
RedHat/Fedora/Oracle Linux: yum install libaio-devel
|
||||||
|
@ -151,15 +148,8 @@ IF(UNIX)
|
||||||
|
|
||||||
If you really do not want it, pass -DIGNORE_AIO_CHECK=YES to cmake.
|
If you really do not want it, pass -DIGNORE_AIO_CHECK=YES to cmake.
|
||||||
")
|
")
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# Unfortunately, linking shared libmysqld with static aio
|
|
||||||
# does not work, unless we add also dynamic one. This also means
|
|
||||||
# libmysqld.so will depend on libaio.so
|
|
||||||
#SET(LIBMYSQLD_SO_EXTRA_LIBS aio)
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Compiler options
|
# Compiler options
|
||||||
|
|
|
@ -337,11 +337,11 @@ SET(INNOBASE_SOURCES
|
||||||
ut/ut0wqueue.cc)
|
ut/ut0wqueue.cc)
|
||||||
|
|
||||||
OPTION(WITH_PMEM "Support redo log in persistent memory" OFF)
|
OPTION(WITH_PMEM "Support redo log in persistent memory" OFF)
|
||||||
FIND_PACKAGE(PMEM)
|
FIND_PACKAGE(PMEM QUIET)
|
||||||
IF(PMEM_FOUND)
|
IF(PMEM_FOUND)
|
||||||
INCLUDE_DIRECTORIES(${LIBPMEM_INCLUDES})
|
INCLUDE_DIRECTORIES(${PMEM_INCLUDES})
|
||||||
ADD_COMPILE_FLAGS(log/log0log.cc COMPILE_FLAGS "-DHAVE_PMEM")
|
ADD_COMPILE_FLAGS(log/log0log.cc COMPILE_FLAGS "-DHAVE_PMEM")
|
||||||
SET(PMEM_LIBRARY ${LIBPMEM_LIBRARIES})
|
SET(PMEM_LIBRARY ${PMEM_LIBRARIES})
|
||||||
ELSE()
|
ELSE()
|
||||||
IF(WITH_PMEM)
|
IF(WITH_PMEM)
|
||||||
MESSAGE(FATAL_ERROR "WITH_PMEM=ON cannot be satisfied")
|
MESSAGE(FATAL_ERROR "WITH_PMEM=ON cannot be satisfied")
|
||||||
|
|
|
@ -53,18 +53,7 @@ ENDIF()
|
||||||
# OS tests
|
# OS tests
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
|
||||||
ADD_DEFINITIONS("-DUNIV_LINUX -D_GNU_SOURCE=1")
|
ADD_DEFINITIONS("-DUNIV_LINUX -D_GNU_SOURCE=1")
|
||||||
|
|
||||||
IF (NOT URING_FOUND)
|
|
||||||
CHECK_INCLUDE_FILES (libaio.h HAVE_LIBAIO_H)
|
|
||||||
CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
|
|
||||||
|
|
||||||
IF(HAVE_LIBAIO_H AND HAVE_LIBAIO)
|
|
||||||
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO)
|
|
||||||
LINK_LIBRARIES(aio)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
IF(HAVE_LIBNUMA)
|
IF(HAVE_LIBNUMA)
|
||||||
LINK_LIBRARIES(numa)
|
LINK_LIBRARIES(numa)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
|
@ -3,24 +3,27 @@ IF(WIN32)
|
||||||
SET(EXTRA_SOURCES tpool_win.cc aio_win.cc)
|
SET(EXTRA_SOURCES tpool_win.cc aio_win.cc)
|
||||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
OPTION(WITH_URING "Require that io_uring be used" OFF)
|
OPTION(WITH_URING "Require that io_uring be used" OFF)
|
||||||
FIND_PACKAGE(URING)
|
OPTION(WITH_LIBAIO "Require that libaio is used, unless uring is there" OFF)
|
||||||
|
IF(WITH_URING)
|
||||||
|
SET(URING_REQUIRED REQUIRED)
|
||||||
|
ELSEIF(WITH_LIBAIO)
|
||||||
|
SET(LIBAIO_REQIRED REQUIRED)
|
||||||
|
ENDIF()
|
||||||
|
FIND_PACKAGE(URING QUIET ${URING_REQUIRED})
|
||||||
IF(URING_FOUND)
|
IF(URING_FOUND)
|
||||||
SET(URING_FOUND ${URING_FOUND} PARENT_SCOPE)
|
SET(URING_FOUND ${URING_FOUND} PARENT_SCOPE)
|
||||||
SET(TPOOL_DEFINES "-DHAVE_URING" PARENT_SCOPE)
|
SET(TPOOL_DEFINES "-DHAVE_URING" PARENT_SCOPE)
|
||||||
ADD_DEFINITIONS(-DHAVE_URING)
|
ADD_DEFINITIONS(-DHAVE_URING)
|
||||||
LINK_LIBRARIES(${LIBURING_LIBRARIES})
|
LINK_LIBRARIES(${URING_LIBRARIES})
|
||||||
INCLUDE_DIRECTORIES(${LIBURING_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${URING_INCLUDE_DIR})
|
||||||
SET(EXTRA_SOURCES aio_liburing.cc)
|
SET(EXTRA_SOURCES aio_liburing.cc)
|
||||||
ELSE()
|
ELSE()
|
||||||
IF(WITH_URING)
|
FIND_PACKAGE(LIBAIO QUIET ${LIBAIO_REQUIRED})
|
||||||
MESSAGE(FATAL_ERROR "WITH_URING=ON cannot be satisfied")
|
IF(LIBAIO_FOUND)
|
||||||
ENDIF()
|
|
||||||
CHECK_INCLUDE_FILES (libaio.h HAVE_LIBAIO_H)
|
|
||||||
CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
|
|
||||||
IF(HAVE_LIBAIO_H AND HAVE_LIBAIO)
|
|
||||||
SET(TPOOL_DEFINES "-DLINUX_NATIVE_AIO" PARENT_SCOPE)
|
SET(TPOOL_DEFINES "-DLINUX_NATIVE_AIO" PARENT_SCOPE)
|
||||||
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO)
|
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO)
|
||||||
LINK_LIBRARIES(aio)
|
INCLUDE_DIRECTORIES(${LIBAIO_INCLUDE_DIR})
|
||||||
|
LINK_LIBRARIES(${LIBAIO_LIBRARIES})
|
||||||
SET(EXTRA_SOURCES aio_linux.cc)
|
SET(EXTRA_SOURCES aio_linux.cc)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
Loading…
Add table
Reference in a new issue