|
| 1 | +# Copyright (c) 2023 Micron Technology, Inc. |
| 2 | +# |
| 3 | +# This program is free software; you can redistribute it and/or modify |
| 4 | +# it under the terms of the GNU General Public License as published by |
| 5 | +# the Free Software Foundation; version 2 of the License. |
| 6 | +# |
| 7 | +# This program is distributed in the hope that it will be useful, |
| 8 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | +# GNU General Public License for more details. |
| 11 | +# |
| 12 | +# You should have received a copy of the GNU General Public License |
| 13 | +# along with this program; if not, write to the Free Software |
| 14 | +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA |
| 15 | + |
| 16 | +find_package(PkgConfig) |
| 17 | + |
| 18 | +MACRO(SKIP_HSE_PLUGIN msg) |
| 19 | + MESSAGE_ONCE(SKIP_HSE_PLUGIN "Can't build the HSE plugin - ${msg}") |
| 20 | + ADD_FEATURE_INFO(HSE "OFF" "Storage Engine") |
| 21 | + RETURN() |
| 22 | +ENDMACRO() |
| 23 | + |
| 24 | +IF (NOT PKG_CONFIG_FOUND) |
| 25 | + SKIP_HSE_PLUGIN("pkg-config not found.") |
| 26 | +ENDIF() |
| 27 | + |
| 28 | +IF (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") |
| 29 | + SKIP_HSE_PLUGIN("HSE only supports Linux.") |
| 30 | +ENDIF() |
| 31 | + |
| 32 | +IF (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|s390x)") |
| 33 | + SKIP_HSE_PLUGIN("HSE only supports x86_64 and s390x.") |
| 34 | +ENDIF() |
| 35 | + |
| 36 | +pkg_check_modules(HSE hse-3>=3.0.0) |
| 37 | + |
| 38 | +IF (NOT HSE_FOUND) |
| 39 | + SKIP_HSE_PLUGIN("libhse-3 not found.") |
| 40 | +ENDIF() |
| 41 | + |
| 42 | +SET(HSE_SOURCES ha_hse.cc ha_hse.h) |
| 43 | +MYSQL_ADD_PLUGIN(hse ${HSE_SOURCES} STORAGE_ENGINE) |
| 44 | +target_include_directories(hse PRIVATE ${HSE_INCLUDE_DIRS}) |
| 45 | +target_compile_options(hse PRIVATE ${HSE_CFLAGS_OTHER}) |
| 46 | +target_link_libraries(hse ${HSE_LIBRARIES}) |
0 commit comments