1# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. 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# 17# Headers which need to be checked for abi/api compatibility are in 18# API_PREPROCESSOR_HEADER. plugin.h is tested implicitly via 19# plugin_audit.h and plugin_ftparser.h. 20# 21# We use gcc specific preprocessing command and sed/diff, so it will 22# only be run on Unix and only if gcc is used. On some Unixes, 23# (Solaris) sed or diff might act differently from GNU, so we run only 24# on systems we can trust. 25IF(APPLE OR CMAKE_SYSTEM_NAME MATCHES "Linux") 26 SET(RUN_ABI_CHECK 1) 27ELSE() 28 SET(RUN_ABI_CHECK 0) 29ENDIF() 30 31IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND RUN_ABI_CHECK) 32 IF(CMAKE_C_COMPILER MATCHES "ccache$") 33 SET(COMPILER ${CMAKE_C_COMPILER_ARG1}) 34 STRING(REGEX REPLACE "^ " "" COMPILER ${COMPILER}) 35 ELSE() 36 SET(COMPILER ${CMAKE_C_COMPILER}) 37 ENDIF() 38 SET(API_PREPROCESSOR_HEADER 39 ${CMAKE_SOURCE_DIR}/include/mysql/plugin_audit.h 40 ${CMAKE_SOURCE_DIR}/include/mysql/plugin_ftparser.h 41 ${CMAKE_SOURCE_DIR}/include/mysql.h 42 ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h 43 ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h 44 ${CMAKE_SOURCE_DIR}/include/mysql/client_plugin.h 45 ${CMAKE_SOURCE_DIR}/include/mysql/plugin_auth.h 46 ${CMAKE_SOURCE_DIR}/include/mysql/plugin_password_validation.h 47 ${CMAKE_SOURCE_DIR}/include/mysql/plugin_encryption.h 48 ${CMAKE_SOURCE_DIR}/include/mysql/plugin_data_type.h 49 ${CMAKE_SOURCE_DIR}/include/mysql/plugin_function.h 50 ) 51 52 ADD_CUSTOM_TARGET(abi_check ALL 53 COMMAND ${CMAKE_COMMAND} 54 -DCOMPILER=${COMPILER} 55 -DSOURCE_DIR=${CMAKE_SOURCE_DIR} 56 -DBINARY_DIR=${CMAKE_BINARY_DIR} 57 "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}" 58 -P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake 59 VERBATIM 60 ) 61 62 ADD_CUSTOM_TARGET(abi_update 63 COMMAND ${CMAKE_COMMAND} 64 -DCOMPILER=${COMPILER} 65 -DABI_UPDATE=1 66 -DSOURCE_DIR=${CMAKE_SOURCE_DIR} 67 -DBINARY_DIR=${CMAKE_BINARY_DIR} 68 "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}" 69 -P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake 70 VERBATIM 71 ) 72 73 ADD_CUSTOM_TARGET(abi_check_all 74 COMMAND ${CMAKE_COMMAND} 75 -DCOMPILER=${COMPILER} 76 -DSOURCE_DIR=${CMAKE_SOURCE_DIR} 77 -DBINARY_DIR=${CMAKE_BINARY_DIR} 78 "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}" 79 -P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake 80 VERBATIM 81 ) 82ENDIF() 83 84