diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-07-02 22:08:51 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-07-02 22:08:51 +0200 |
commit | 9809f05199aeb0b67991fac41bd86f38730768dc (patch) | |
tree | fa2792ff86d0da014b535d743759810612338042 /cmake | |
parent | 0accbd0364e0333e0b119aa9ce93e34ded9df6cb (diff) | |
parent | 5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a (diff) | |
download | mariadb-git-9809f05199aeb0b67991fac41bd86f38730768dc.tar.gz |
5.5-merge
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Makefile.am | 40 | ||||
-rw-r--r-- | cmake/abi_check.cmake | 18 | ||||
-rw-r--r-- | cmake/build_configurations/mysql_release.cmake | 63 | ||||
-rw-r--r-- | cmake/character_sets.cmake | 14 | ||||
-rw-r--r-- | cmake/cmake_parse_arguments.cmake | 2 | ||||
-rw-r--r-- | cmake/configure.pl | 10 | ||||
-rw-r--r-- | cmake/do_abi_check.cmake | 30 | ||||
-rw-r--r-- | cmake/dtrace.cmake | 12 | ||||
-rw-r--r-- | cmake/info_bin.cmake | 30 | ||||
-rw-r--r-- | cmake/info_macros.cmake.in | 132 | ||||
-rw-r--r-- | cmake/info_src.cmake | 31 | ||||
-rw-r--r-- | cmake/install_layout.cmake | 29 | ||||
-rw-r--r-- | cmake/install_macros.cmake | 19 | ||||
-rw-r--r-- | cmake/libutils.cmake | 5 | ||||
-rw-r--r-- | cmake/maintainer.cmake | 54 | ||||
-rw-r--r-- | cmake/make_dist.cmake.in | 63 | ||||
-rw-r--r-- | cmake/mysql_add_executable.cmake | 4 | ||||
-rw-r--r-- | cmake/mysql_version.cmake | 115 | ||||
-rw-r--r-- | cmake/os/Linux.cmake | 2 | ||||
-rw-r--r-- | cmake/os/SunOS.cmake | 1 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 13 | ||||
-rw-r--r-- | cmake/os/WindowsCache.cmake | 10 | ||||
-rw-r--r-- | cmake/plugin.cmake | 34 | ||||
-rw-r--r-- | cmake/versioninfo.rc.in | 8 |
24 files changed, 496 insertions, 243 deletions
diff --git a/cmake/Makefile.am b/cmake/Makefile.am deleted file mode 100644 index af3ec4f980d..00000000000 --- a/cmake/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ -EXTRA_DIST = \ - cmake_parse_arguments.cmake \ - cpack_source_ignore_files.cmake \ - package_name.cmake \ - configurable_file_content.in \ - check_minimal_version.cmake \ - create_initial_db.cmake.in \ - make_dist.cmake.in \ - dtrace.cmake \ - abi_check.cmake \ - bison.cmake \ - configure.pl \ - character_sets.cmake \ - libutils.cmake \ - readline.cmake \ - mysql_version.cmake \ - install_macros.cmake \ - ssl.cmake \ - plugin.cmake \ - zlib.cmake \ - stack_direction.c \ - do_abi_check.cmake \ - merge_archives_unix.cmake.in \ - dtrace_prelink.cmake \ - versioninfo.rc.in \ - mysql_add_executable.cmake \ - tags.cmake \ - install_layout.cmake \ - build_configurations/mysql_release.cmake \ - os/Windows.cmake \ - os/WindowsCache.cmake \ - os/Linux.cmake \ - os/SunOS.cmake \ - os/Darwin.cmake \ - os/HP-UX.cmake \ - os/AIX.cmake \ - os/OS400.cmake \ - os/Cygwin.cmake - - diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake index b9ff9f7af73..a671aeff342 100644 --- a/cmake/abi_check.cmake +++ b/cmake/abi_check.cmake @@ -19,20 +19,30 @@ # plugin_audit.h and plugin_ftparser.h. # # We use gcc specific preprocessing command and sed/diff, so it will -# only be run on Unix and only if gcc is used. -IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux") +# only be run on Unix and only if gcc is used. On some Unixes, +# (Solaris) sed or diff might act differently from GNU, so we run only +# on systems we can trust. +IF(APPLE OR CMAKE_SYSTEM_NAME MATCHES "Linux") + SET(RUN_ABI_CHECK 1) +ELSE() + SET(RUN_ABI_CHECK 0) +ENDIF() + +IF(CMAKE_COMPILER_IS_GNUCC AND RUN_ABI_CHECK) IF(CMAKE_C_COMPILER MATCHES "ccache$") SET(COMPILER ${CMAKE_C_COMPILER_ARG1}) STRING(REGEX REPLACE "^ " "" COMPILER ${COMPILER}) ELSE() SET(COMPILER ${CMAKE_C_COMPILER}) ENDIF() - SET(API_PREPROCESSOR_HEADER + SET(API_PREPROCESSOR_HEADER ${CMAKE_SOURCE_DIR}/include/mysql/plugin_audit.h ${CMAKE_SOURCE_DIR}/include/mysql/plugin_ftparser.h ${CMAKE_SOURCE_DIR}/include/mysql.h - ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h + ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v1.h ${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h + ${CMAKE_SOURCE_DIR}/include/mysql/client_plugin.h + ${CMAKE_SOURCE_DIR}/include/mysql/plugin_auth.h ) ADD_CUSTOM_TARGET(abi_check ALL diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 9d010ef7f2a..91d598db465 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -101,8 +101,10 @@ IF(NOT COMPILATION_COMMENT) ENDIF() IF(WIN32) - # Sign executables with authenticode certificate - SET(SIGNCODE 1 CACHE BOOL "") + IF(NOT CMAKE_USING_VC_FREE_TOOLS) + # Sign executables with authenticode certificate + SET(SIGNCODE 1 CACHE BOOL "") + ENDIF() ENDIF() IF(UNIX) @@ -115,13 +117,26 @@ IF(UNIX) OPTION(WITH_PIC "" ON) # Why? - # Ensure aio is available on Linux (required by InnoDB) IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H) - CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO) - IF(NOT HAVE_LIBAIO_H OR NOT HAVE_LIBAIO) - MESSAGE(FATAL_ERROR "aio is required on Linux") + IF(NOT IGNORE_AIO_CHECK) + # Ensure aio is available on Linux (required by InnoDB) + CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H) + CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO) + IF(NOT HAVE_LIBAIO_H OR NOT HAVE_LIBAIO) + MESSAGE(FATAL_ERROR " + aio is required on Linux, you need to install the required library: + + Debian/Ubuntu: apt-get install libaio-dev + RedHat/Fedora/Oracle Linux: yum install libaio-devel + SuSE: zypper install libaio-devel + + If you really do not want it, pass -DIGNORE_AIO_CHECK to cmake. + ") + ENDIF() ENDIF() + + # Enable fast mutexes on Linux + OPTION(WITH_FAST_MUTEXES "" ON) ENDIF() ENDIF() @@ -131,16 +146,16 @@ IF(UNIX) # Default GCC flags IF(CMAKE_COMPILER_IS_GNUCC) - SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer") + SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing") SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}") ENDIF() IF(CMAKE_COMPILER_IS_GNUCXX) - SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer") + SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing") SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}") ENDIF() - + # HPUX flags IF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") IF(CMAKE_C_COMPILER_ID MATCHES "HP") @@ -156,7 +171,7 @@ IF(UNIX) ENDIF() SET(WITH_SSL no) ENDIF() - + # Linux flags IF(CMAKE_SYSTEM_NAME MATCHES "Linux") IF(CMAKE_C_COMPILER_ID MATCHES "Intel") @@ -173,18 +188,18 @@ IF(UNIX) SET(WITH_SSL no) ENDIF() ENDIF() - + # OSX flags IF(APPLE) - SET(COMMON_C_FLAGS "-g -fno-common") + SET(COMMON_C_FLAGS "-g -fno-common -fno-strict-aliasing") # XXX: why are we using -felide-constructors on OSX? - SET(COMMON_CXX_FLAGS "-g -fno-common -felide-constructors") + SET(COMMON_CXX_FLAGS "-g -fno-common -felide-constructors -fno-strict-aliasing") SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os ${COMMON_C_FLAGS}") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os ${COMMON_CXX_FLAGS}") ENDIF() - + # Solaris flags IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") IF(CMAKE_SYSTEM_VERSION VERSION_GREATER "5.9") @@ -219,22 +234,4 @@ IF(UNIX) ENDIF() ENDIF() ENDIF() - - IF(CMAKE_C_FLAGS_DEBUG) - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" - CACHE STRING "Debug C compile flags") - ENDIF() - IF(CMAKE_CXX_FLAGS_DEBUG) - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" - CACHE STRING "Debug C++ compile flags") - ENDIF() - IF(CMAKE_C_FLAGS_RELWITHDEBINFO) - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" - CACHE STRING "RelWithDebInfo C compile flags") - ENDIF() - IF(CMAKE_CXX_FLAGS_RELWITHDEBINFO) - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" - CACHE STRING "RelWithDebInfo C++ compile flags") - ENDIF() - ENDIF() diff --git a/cmake/character_sets.cmake b/cmake/character_sets.cmake index d51444ec433..1cf63ed1462 100644 --- a/cmake/character_sets.cmake +++ b/cmake/character_sets.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,17 +13,19 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#Charsets and collations +# Charsets and collations IF(NOT DEFAULT_CHARSET) -SET(DEFAULT_CHARSET "latin1") + SET(DEFAULT_CHARSET "latin1") ENDIF() -IF(NOT DEFAULT_COLLATIONS) -SET(DEFAULT_COLLATION "latin1_swedish_ci") +IF(NOT DEFAULT_COLLATION) + SET(DEFAULT_COLLATION "latin1_swedish_ci") ENDIF() SET(CHARSETS ${DEFAULT_CHARSET} latin1 utf8 utf8mb4) -SET(CHARSETS_COMPLEX big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32) +SET(CHARSETS_COMPLEX + big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 + sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32) SET(CHARSETS_AVAILABLE binary armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257 diff --git a/cmake/cmake_parse_arguments.cmake b/cmake/cmake_parse_arguments.cmake index ea601f916a8..db540ae9020 100644 --- a/cmake/cmake_parse_arguments.cmake +++ b/cmake/cmake_parse_arguments.cmake @@ -15,7 +15,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Handy macro to parse macro arguments -MACRO(CMAKE_PARSE_ARGUMENTS prefix arg_names option_names) +MACRO(MYSQL_PARSE_ARGUMENTS prefix arg_names option_names) SET(DEFAULT_ARGS) FOREACH(arg_name ${arg_names}) SET(${prefix}_${arg_name}) diff --git a/cmake/configure.pl b/cmake/configure.pl index 1dc8080810c..bf872264953 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -185,6 +185,16 @@ foreach my $option (@ARGV) ($option =~ /enable/ ? "1" : "0"); next; } + if ($option =~ /with-comment=/) + { + $cmakeargs = $cmakeargs." \"-DWITH_COMMENT=".substr($option,13)."\""; + next; + } + if ($option =~ /with-gcov/) + { + $cmakeargs = $cmakeargs." -DENABLE_GCOV=ON"; + next; + } $option = uc($option); $option =~ s/-/_/g; diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake index 78006bd018c..96943e1a4c4 100644 --- a/cmake/do_abi_check.cmake +++ b/cmake/do_abi_check.cmake @@ -53,23 +53,27 @@ SET(abi_check_out ${BINARY_DIR}/abi_check.out) FOREACH(file ${ABI_HEADERS}) - SET(tmpfile ${file}.pp.tmp) - EXECUTE_PROCESS( - COMMAND ${COMPILER} - -E -nostdinc -dI -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include - -I${BINARY_DIR}/include -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql - ${file} - ERROR_QUIET OUTPUT_FILE ${tmpfile}) - EXECUTE_PROCESS( - COMMAND sed -e - "/^# /d" -e "/^[ ]*$/d" -e "/^#pragma GCC set_debug_pwd/d" -e "/^#ident/d" - RESULT_VARIABLE result OUTPUT_FILE ${abi_check_out} INPUT_FILE ${tmpfile}) + GET_FILENAME_COMPONENT(header_basename ${file} NAME) + SET(tmpfile ${BINARY_DIR}/${header_basename}.pp.tmp) + + EXECUTE_PROCESS( + COMMAND ${COMPILER} + -E -nostdinc -dI -DMYSQL_ABI_CHECK -I${SOURCE_DIR}/include + -I${BINARY_DIR}/include -I${SOURCE_DIR}/include/mysql -I${SOURCE_DIR}/sql + ${file} + ERROR_QUIET OUTPUT_FILE ${tmpfile}) + EXECUTE_PROCESS( + COMMAND sed -e "/^# /d" + -e "/^[ ]*$/d" + -e "/^#pragma GCC set_debug_pwd/d" + -e "/^#ident/d" + RESULT_VARIABLE result OUTPUT_FILE ${abi_check_out} INPUT_FILE ${tmpfile}) IF(NOT ${result} EQUAL 0) MESSAGE(FATAL_ERROR "sed returned error ${result}") ENDIF() FILE(REMOVE ${tmpfile}) - EXECUTE_PROCESS(COMMAND diff -w ${file}.pp ${abi_check_out} RESULT_VARIABLE - result) + EXECUTE_PROCESS( + COMMAND diff -w ${file}.pp ${abi_check_out} RESULT_VARIABLE result) IF(NOT ${result} EQUAL 0) MESSAGE(FATAL_ERROR "ABI check found difference between ${file}.pp and ${abi_check_out}") diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake index c12a74cba31..5beb45ca524 100644 --- a/cmake/dtrace.cmake +++ b/cmake/dtrace.cmake @@ -153,13 +153,23 @@ ENDFUNCTION() # to mysqld. MACRO (DTRACE_INSTRUMENT_STATIC_LIBS target libs) IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ENABLE_DTRACE) + # Filter out non-static libraries in the list, if any + SET(static_libs) FOREACH(lib ${libs}) + GET_TARGET_PROPERTY(libtype ${lib} TYPE) + IF(libtype MATCHES STATIC_LIBRARY) + SET(static_libs ${static_lics} ${lib}) + ENDIF() + ENDFOREACH() + + FOREACH(lib ${static_libs}) SET(dirs ${dirs} ${TARGET_OBJECT_DIRECTORY_${lib}}) ENDFOREACH() + SET (obj ${CMAKE_CURRENT_BINARY_DIR}/${target}_dtrace_all.o) ADD_CUSTOM_COMMAND( OUTPUT ${obj} - DEPENDS ${libs} + DEPENDS ${static_libs} COMMAND ${CMAKE_COMMAND} -DDTRACE=${DTRACE} -DOUTFILE=${obj} diff --git a/cmake/info_bin.cmake b/cmake/info_bin.cmake new file mode 100644 index 00000000000..9cec3de0e0f --- /dev/null +++ b/cmake/info_bin.cmake @@ -0,0 +1,30 @@ +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +# The sole purpose of this cmake control file is to create the "INFO_BIN" file. + +# By having a separate cmake file for this, it is ensured this happens +# only in the build (Unix: "make") phase, not when cmake runs. +# This, in turn, avoids creating stuff in the source directory - +# it should get into the binary directory only. + + +# Get the macros which the "INFO_*" files. +INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake) + +# Here is where the action is. +CREATE_INFO_BIN() + diff --git a/cmake/info_macros.cmake.in b/cmake/info_macros.cmake.in new file mode 100644 index 00000000000..9e08cffb2bf --- /dev/null +++ b/cmake/info_macros.cmake.in @@ -0,0 +1,132 @@ +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +# Handle/create the "INFO_*" files describing a MySQL (server) binary. +# This is part of the fix for bug#42969. + + +# Several of cmake's variables need to be translated from '@' notation +# to '${}', this is done by the "configure" call in top level "CMakeLists.txt". +# If further variables are used in this file, add them to this list. + +SET(VERSION "@VERSION@") +SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@") +SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") +SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@") +SET(CMAKE_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@") +SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@") +SET(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@") +SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@") +SET(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@") +SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@") +SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@") + + +# Create an "INFO_SRC" file with information about the source (only). +# We use "bzr version-info", if possible, and the "VERSION" contents. +# +# Outside development (BZR tree), the "INFO_SRC" file will not be modified +# provided it exists (from "make dist" or a source tarball creation). + +MACRO(CREATE_INFO_SRC target_dir) + SET(INFO_SRC "${target_dir}/INFO_SRC") + + IF(EXISTS ${CMAKE_SOURCE_DIR}/.bzr) + # Sources are in a BZR repository: Always update. + EXECUTE_PROCESS( + COMMAND ${BZR_EXECUTABLE} version-info ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE VERSION_INFO + RESULT_VARIABLE RESULT + ) + FILE(WRITE ${INFO_SRC} "${VERSION_INFO}\n") + # to debug, add: FILE(APPEND ${INFO_SRC} "\nResult ${RESULT}\n") + # For better readability ... + FILE(APPEND ${INFO_SRC} "\nMySQL source ${VERSION}\n") + ELSEIF(EXISTS ${INFO_SRC}) + # Outside a BZR tree, there is no need to change an existing "INFO_SRC", + # it cannot be improved. + ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/Docs/INFO_SRC) + # If we are building from a source distribution, it also contains "INFO_SRC". + # Similar, the export used for a release build already has the file. + FILE(READ ${CMAKE_SOURCE_DIR}/Docs/INFO_SRC SOURCE_INFO) + FILE(WRITE ${INFO_SRC} "${SOURCE_INFO}\n") + ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/INFO_SRC) + # This is not the proper location, but who knows ... + FILE(READ ${CMAKE_SOURCE_DIR}/INFO_SRC SOURCE_INFO) + FILE(WRITE ${INFO_SRC} "${SOURCE_INFO}\n") + ELSE() + # This is a fall-back. + FILE(WRITE ${INFO_SRC} "\nMySQL source ${VERSION}\n") + ENDIF() +ENDMACRO(CREATE_INFO_SRC) + + +# This is for the "real" build, must be run again with each cmake run +# to make sure we report the current flags (not those of some previous run). + +MACRO(CREATE_INFO_BIN) + SET(INFO_BIN "Docs/INFO_BIN") + + FILE(WRITE ${INFO_BIN} "===== Information about the build process: =====\n") + IF (WIN32) + EXECUTE_PROCESS(COMMAND cmd /c date /T OUTPUT_VARIABLE TMP_DATE) + ELSEIF(UNIX) + EXECUTE_PROCESS(COMMAND date "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) + ELSE() + SET(TMP_DATE "(no date command known for this platform)") + ENDIF() + SITE_NAME(HOSTNAME) + FILE(APPEND ${INFO_BIN} "Build was run at ${TMP_DATE} on host '${HOSTNAME}'\n\n") + + # According to the cmake docs, these variables should always be set. + # However, they are empty in my tests, using cmake 2.6.4 on Linux, various Unix, and Windows. + # Still, include this code, so we will profit if a build environment does provide that info. + IF(CMAKE_HOST_SYSTEM) + FILE(APPEND ${INFO_BIN} "Build was done on ${CMAKE_HOST_SYSTEM} using ${CMAKE_HOST_SYSTEM_PROCESSOR}\n") + ENDIF() + IF(CMAKE_CROSSCOMPILING) + FILE(APPEND ${INFO_BIN} "Build was done for ${CMAKE_SYSTEM} using ${CMAKE_SYSTEM_PROCESSOR}\n") + ENDIF() + + # ${CMAKE_VERSION} doesn't work in 2.6.0, use the separate components. + FILE(APPEND ${INFO_BIN} "Build was done using cmake ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} \n\n") + + IF (WIN32) + FILE(APPEND ${INFO_BIN} "===== Compiler / generator used: =====\n") + FILE(APPEND ${INFO_BIN} ${CMAKE_GENERATOR} "\n\n") + ELSEIF(UNIX) + FILE(APPEND ${INFO_BIN} "===== Compiler flags used (from the 'sql/' subdirectory): =====\n") + IF(EXISTS sql/CMakeFiles/sql.dir/flags.make) + EXECUTE_PROCESS(COMMAND egrep "^# compile|^C_|^CXX_" sql/CMakeFiles/sql.dir/flags.make OUTPUT_VARIABLE COMPILE_FLAGS) + FILE(APPEND ${INFO_BIN} ${COMPILE_FLAGS} "\n") + ELSE() + FILE(APPEND ${INFO_BIN} "File 'sql/CMakeFiles/sql.dir/flags.make' is not yet found.\n\n") + ENDIF() + ENDIF() + FILE(APPEND ${INFO_BIN} "Pointer size: ${CMAKE_SIZEOF_VOID_P}\n\n") + + FILE(APPEND ${INFO_BIN} "===== Feature flags used: =====\n") + IF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt) + # Attention: "-N" prevents cmake from entering a recursion, and it must be a separate flag from "-L". + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -N -L ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE FEATURE_FLAGS) + FILE(APPEND ${INFO_BIN} ${FEATURE_FLAGS} "\n") + ELSE() + FILE(APPEND ${INFO_BIN} "File 'CMakeCache.txt' is not yet found.\n\n") + ENDIF() + + FILE(APPEND ${INFO_BIN} "===== EOF =====\n") +ENDMACRO(CREATE_INFO_BIN) + diff --git a/cmake/info_src.cmake b/cmake/info_src.cmake new file mode 100644 index 00000000000..97776b70901 --- /dev/null +++ b/cmake/info_src.cmake @@ -0,0 +1,31 @@ +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +# The sole purpose of this cmake control file is to create the "INFO_SRC" file. + +# As long as and "bzr pull" (or "bzr commit") is followed by a "cmake", +# the call in top level "CMakeLists.txt" is sufficient. +# This file is to provide a separate target for the "make" phase, +# to ensure the BZR revision-id is correct even after a sequence +# cmake ; make ; bzr pull ; make + + +# Get the macros which handle the "INFO_*" files. +INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake) + +# Here is where the action is. +CREATE_INFO_SRC(${CMAKE_BINARY_DIR}/Docs) + diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index ade6cdb747f..bbf29c2e46c 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -26,7 +26,7 @@ # Build as per default RPM layout, with prefix=/usr # # DEB -# Build as per STANDALONE, prefix=/opt/mysql-$major.$minor +# Build as per STANDALONE, prefix=/opt/mysql/server-$major.$minor # # SVR4 # Solaris package layout suitable for pkg* tools, prefix=/opt/mysql/mysql @@ -59,19 +59,22 @@ # - INSTALL_SUPPORTFILESDIR (various extra support files) # # - INSTALL_MYSQLDATADIR (data directory) +# +# When changing this page, _please_ do not forget to update public Wiki +# http://forge.mysql.com/wiki/CMake#Fine-tuning_installation_paths IF(NOT INSTALL_LAYOUT) SET(DEFAULT_INSTALL_LAYOUT "STANDALONE") ENDIF() SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}" -CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer) or UNIX") +CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer), RPM, DEB, SVR4") IF(UNIX) IF(INSTALL_LAYOUT MATCHES "RPM") SET(default_prefix "/usr") ELSEIF(INSTALL_LAYOUT MATCHES "DEB") - SET(default_prefix "/opt/${MYSQL_BASE_VERSION}") + SET(default_prefix "/opt/mysql/server-${MYSQL_BASE_VERSION}") # This is required to avoid "cpack -GDEB" default of prefix=/usr SET(CPACK_SET_DESTDIR ON) ELSEIF(INSTALL_LAYOUT MATCHES "SVR4") @@ -83,12 +86,26 @@ IF(UNIX) SET(CMAKE_INSTALL_PREFIX ${default_prefix} CACHE PATH "install prefix" FORCE) ENDIF() + SET(VALID_INSTALL_LAYOUTS "RPM" "STANDALONE" "DEB" "SVR4") + LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" ind) + IF(ind EQUAL -1) + MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}." + " Choose between ${VALID_INSTALL_LAYOUTS}" ) + ENDIF() + SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" CACHE PATH "config directory (for my.cnf)") MARK_AS_ADVANCED(SYSCONFDIR) ENDIF() # +# plugin_tests's value should not be used by imported plugins, +# just use if(INSTALL_PLUGINTESTDIR). +# The plugin must set its own install path for tests +# +FILE(GLOB plugin_tests ${CMAKE_SOURCE_DIR}/plugin/*/tests) + +# # STANDALONE layout # SET(INSTALL_BINDIR_STANDALONE "bin") @@ -112,6 +129,7 @@ SET(INSTALL_SQLBENCHDIR_STANDALONE ".") SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files") # SET(INSTALL_MYSQLDATADIR_STANDALONE "data") +SET(INSTALL_PLUGINTESTDIR_STANDALONE ${plugin_tests}) # # RPM layout @@ -142,6 +160,7 @@ SET(INSTALL_SQLBENCHDIR_RPM "") SET(INSTALL_SUPPORTFILESDIR_RPM "share/mysql") # SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql") +SET(INSTALL_PLUGINTESTDIR_RPM ${plugin_tests}) # # DEB layout @@ -167,6 +186,7 @@ SET(INSTALL_SQLBENCHDIR_DEB ".") SET(INSTALL_SUPPORTFILESDIR_DEB "support-files") # SET(INSTALL_MYSQLDATADIR_DEB "data") +SET(INSTALL_PLUGINTESTDIR_DEB ${plugin_tests}) # # SVR4 layout @@ -192,6 +212,7 @@ SET(INSTALL_SQLBENCHDIR_SVR4 ".") SET(INSTALL_SUPPORTFILESDIR_SVR4 "support-files") # SET(INSTALL_MYSQLDATADIR_SVR4 "/var/lib/mysql") +SET(INSTALL_PLUGINTESTDIR_SVR4 ${plugin_tests}) # Clear cached variables if install layout was changed @@ -206,7 +227,7 @@ SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "") # will be defined as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE # layout is chosen) FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN - INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA) + INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA PLUGINTEST) SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}} CACHE STRING "${var} installation directory" ${FORCE}) MARK_AS_ADVANCED(INSTALL_${var}DIR) diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 56a540fde89..e244e4262e0 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -78,12 +78,14 @@ FUNCTION(INSTALL_MANPAGE file) ELSE() SET(SECTION man8) ENDIF() - INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}") + MESSAGE("huj!") + INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}" + COMPONENT ManPages) ENDIF() ENDFUNCTION() FUNCTION(INSTALL_SCRIPT) - CMAKE_PARSE_ARGUMENTS(ARG + MYSQL_PARSE_ARGUMENTS(ARG "DESTINATION;COMPONENT" "" ${ARGN} @@ -137,12 +139,7 @@ IF(UNIX) STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" output ${output}) ENDIF() - IF(component) - SET(COMP COMPONENT ${component}) - ELSE() - SET(COMP) - ENDIF() - INSTALL(FILES ${output} DESTINATION ${destination} ${COMP}) + INSTALL(FILES ${output} DESTINATION ${destination} COMPONENT ${component}) ENDIF() ENDMACRO() @@ -205,7 +202,7 @@ ENDMACRO() # FUNCTION(MYSQL_INSTALL_TARGETS) - CMAKE_PARSE_ARGUMENTS(ARG + MYSQL_PARSE_ARGUMENTS(ARG "DESTINATION;COMPONENT" "" ${ARGN} @@ -224,8 +221,6 @@ FUNCTION(MYSQL_INSTALL_TARGETS) IF(SIGNCODE AND SIGNCODE_ENABLED) SIGN_TARGET(${target}) ENDIF() - # For Windows, add version info to executables - ADD_VERSION_INFO(${target}) # Install man pages on Unix IF(UNIX) GET_TARGET_PROPERTY(target_location ${target} LOCATION) @@ -249,7 +244,7 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug FUNCTION(INSTALL_DEBUG_TARGET target) - CMAKE_PARSE_ARGUMENTS(ARG + MYSQL_PARSE_ARGUMENTS(ARG "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT" "" ${ARGN} diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index ba63df71428..89eb5a74d80 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -213,7 +213,7 @@ ENDMACRO() # [OUTPUT_NAME output_name] #) MACRO(MERGE_LIBRARIES) - CMAKE_PARSE_ARGUMENTS(ARG + MYSQL_PARSE_ARGUMENTS(ARG "EXPORTS;OUTPUT_NAME;COMPONENT" "STATIC;SHARED;MODULE;NOINSTALL" ${ARGN} @@ -250,6 +250,9 @@ MACRO(MERGE_LIBRARIES) ENDFOREACH() ENDIF() CREATE_EXPORT_FILE(SRC ${TARGET} "${ARG_EXPORTS}") + IF(NOT ARG_NOINSTALL) + ADD_VERSION_INFO(${TARGET} SHARED SRC) + ENDIF() ADD_LIBRARY(${TARGET} ${LIBTYPE} ${SRC}) TARGET_LINK_LIBRARIES(${TARGET} ${LIBS}) IF(ARG_OUTPUT_NAME) diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake new file mode 100644 index 00000000000..d24211a6ff8 --- /dev/null +++ b/cmake/maintainer.cmake @@ -0,0 +1,54 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +INCLUDE(CheckCCompilerFlag) + +# Setup GCC (GNU C compiler) warning options. +MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS) + SET(MY_MAINTAINER_WARNINGS + "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror") + CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" + HAVE_DECLARATION_AFTER_STATEMENT) + IF(HAVE_DECLARATION_AFTER_STATEMENT) + SET(MY_MAINTAINER_DECLARATION_AFTER_STATEMENT + "-Wdeclaration-after-statement") + ENDIF() + SET(MY_MAINTAINER_C_WARNINGS + "${MY_MAINTAINER_WARNINGS} ${MY_MAINTAINER_DECLARATION_AFTER_STATEMENT}" + CACHE STRING "C warning options used in maintainer builds.") + # Do not make warnings in checks into errors. + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error") +ENDMACRO() + +# Setup G++ (GNU C++ compiler) warning options. +MACRO(SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS) + SET(MY_MAINTAINER_CXX_WARNINGS + "${MY_MAINTAINER_WARNINGS} -Wno-unused-parameter -Woverloaded-virtual" + CACHE STRING "C++ warning options used in maintainer builds.") +ENDMACRO() + +# Setup ICC (Intel C Compiler) warning options. +MACRO(SET_MYSQL_MAINTAINER_INTEL_C_OPTIONS) + SET(MY_MAINTAINER_WARNINGS "-Wcheck") + SET(MY_MAINTAINER_C_WARNINGS "${MY_MAINTAINER_WARNINGS}" + CACHE STRING "C warning options used in maintainer builds.") +ENDMACRO() + +# Setup ICPC (Intel C++ Compiler) warning options. +MACRO(SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS) + SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_WARNINGS}" + CACHE STRING "C++ warning options used in maintainer builds.") +ENDMACRO() + diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index 13950e08553..5aa1fc8fd0e 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,19 +14,12 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Make source distribution -# If bzr is present, run bzr export, add output of BUILD/autorun.sh -# if autotools are present, also pack bison output into it. +# If bzr is present, run bzr export. # Otherwise, just run cpack with source configuration. SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@") SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") SET(CPACK_SOURCE_PACKAGE_FILE_NAME "@CPACK_SOURCE_PACKAGE_FILE_NAME@") -SET(GLIBTOOLIZE_EXECUTABLE "@GLIBTOOLIZE_EXECUTABLE@") -SET(LIBTOOLIZE_EXECUTABLE "@LIBTOOLIZE_EXECUTABLE@") -SET(ACLOCAL_EXECUTABLE "@ACLOCAL_EXECUTABLE@") -SET(AUTOCONF_EXECUTABLE "@AUTOCONF_EXECUTABLE@") -SET(AUTOHEADER_EXECUTABLE "@AUTOHEADER_EXECUTABLE@") -SET(AUTOMAKE_EXECUTABLE "@AUTOMAKE_EXECUTABLE@") SET(CMAKE_CPACK_COMMAND "@CMAKE_CPACK_COMMAND@") SET(CMAKE_COMMAND "@CMAKE_COMMAND@") SET(BZR_EXECUTABLE "@BZR_EXECUTABLE@") @@ -35,6 +28,9 @@ SET(TAR_EXECUTABLE "@TAR_EXECUTABLE@") SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@") SET(CMAKE_MAKE_PROGRAM "@CMAKE_MAKE_PROGRAM@") SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") +SET(PLUGIN_REPOS "@PLUGIN_REPOS@") + +SET(VERSION "@VERSION@") SET(MYSQL_DOCS_LOCATION "@MYSQL_DOCS_LOCATION@") @@ -58,6 +54,22 @@ IF(BZR_EXECUTABLE) ENDIF() ENDIF() +IF(BZR_EXECUTABLE) + FOREACH(REPO ${PLUGIN_REPOS}) + GET_FILENAME_COMPONENT(PLUGIN_NAME ${REPO} NAME) + SET(DEST ${PACKAGE_DIR}/plugin/${PLUGIN_NAME}) + MESSAGE(STATUS "Running bzr export for plugin/${PLUGIN_NAME}") + EXECUTE_PROCESS( + COMMAND "${BZR_EXECUTABLE}" export ${DEST} + WORKING_DIRECTORY ${REPO} + RESULT_VARIABLE RESULT + ) + IF(NOT RESULT EQUAL 0) + MESSAGE(STATUS "bzr export failed") + ENDIF() + ENDFOREACH() +ENDIF() + IF(NOT BZR_EXECUTABLE) MESSAGE(STATUS "bzr not found or source dir is not a repo, use CPack") @@ -101,44 +113,31 @@ IF(NOT BZR_EXECUTABLE) ) ENDIF() -# Try to pack output of BUILD/autorun, if autotools are present -IF(GLIBTOOLIZE_EXECUTABLE OR LIBTOOLIZE_EXECUTABLE) - IF(ACLOCAL_EXECUTABLE AND AUTOMAKE_EXECUTABLE AND AUTOCONF_EXECUTABLE - AND AUTOHEADER_EXECUTABLE) - SET(HAVE_AUTOTOOLS 1) - ENDIF() -ENDIF() - -IF(HAVE_AUTOTOOLS) - EXECUTE_PROCESS(COMMAND BUILD/autorun.sh - WORKING_DIRECTORY ${PACKAGE_DIR}) -ELSE() - MESSAGE( "Autotools not found, resulting source package can only be built" - " with cmake") - CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/configure.pl - ${PACKAGE_DIR}/configure - COPYONLY) - IF(UNIX) - EXECUTE_PROCESS(COMMAND chmod +x ${PACKAGE_DIR}/configure) - ENDIF() -ENDIF() - # Copy bison output CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h ${PACKAGE_DIR}/sql/sql_yacc.h COPYONLY) CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc ${PACKAGE_DIR}/sql/sql_yacc.cc COPYONLY) +# Copy spec files +CONFIGURE_FILE(${CMAKE_BINARY_DIR}/support-files/mysql.${VERSION}.spec + ${PACKAGE_DIR}/support-files/mysql.${VERSION}.spec COPYONLY) + # Add documentation, if user has specified where to find them IF(MYSQL_DOCS_LOCATION) MESSAGE("Copying documentation files from " ${MYSQL_DOCS_LOCATION}) EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_directory "${MYSQL_DOCS_LOCATION}" "${PACKAGE_DIR}") ENDIF() +# Ensure there is an "INFO_SRC" file. +INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake) +IF(NOT EXISTS ${PACKAGE_DIR}/Docs/INFO_SRC) + CREATE_INFO_SRC(${PACKAGE_DIR}/Docs) +ENDIF() + # In case we used CPack, it could have copied some # extra files that are not usable on different machines. FILE(REMOVE ${PACKAGE_DIR}/CMakeCache.txt) -FILE(REMOVE_RECURSE ${PACKAGE_DIR}/autom4te.cache) # When packing source, prefer gnu tar to "cmake -P tar" # cmake does not preserve timestamps.gnuwin32 tar is broken, cygwin is ok diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index 86301c2eec8..ac812fbcdfd 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -28,7 +28,7 @@ INCLUDE(cmake_parse_arguments) FUNCTION (MYSQL_ADD_EXECUTABLE)
# Pass-through arguments for ADD_EXECUTABLE
- CMAKE_PARSE_ARGUMENTS(ARG
+ MYSQL_PARSE_ARGUMENTS(ARG
"WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION;COMPONENT"
""
${ARGN}
@@ -37,7 +37,7 @@ FUNCTION (MYSQL_ADD_EXECUTABLE) LIST(REMOVE_AT ARG_DEFAULT_ARGS 0)
SET(sources ${ARG_DEFAULT_ARGS})
-
+ ADD_VERSION_INFO(${target} EXECUTABLE sources)
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
# tell CPack where to install
IF(NOT ARG_EXCLUDE_FROM_ALL)
diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index 6adca2ccc2f..5aca3c825a6 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -13,17 +13,29 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# Read value for a variable from configure.in +# +# Global constants, only to be changed between major releases. +# + +SET(SHARED_LIB_MAJOR_VERSION "18") +SET(PROTOCOL_VERSION "10") +SET(DOT_FRM_VERSION "6") + +# Generate "something" to trigger cmake rerun when VERSION changes +CONFIGURE_FILE( + ${CMAKE_SOURCE_DIR}/VERSION + ${CMAKE_BINARY_DIR}/VERSION.dep +) + +# Read value for a variable from VERSION. MACRO(MYSQL_GET_CONFIG_VALUE keyword var) IF(NOT ${var}) - IF (EXISTS ${CMAKE_SOURCE_DIR}/configure.in) - FILE (STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "^[ ]*${keyword}=") - IF(str) - STRING(REPLACE "${keyword}=" "" str ${str}) - STRING(REGEX REPLACE "[ ].*" "" str ${str}) - SET(${var} ${str} CACHE INTERNAL "Config variable") - ENDIF() + FILE (STRINGS ${CMAKE_SOURCE_DIR}/VERSION str REGEX "^[ ]*${keyword}=") + IF(str) + STRING(REPLACE "${keyword}=" "" str ${str}) + STRING(REGEX REPLACE "[ ].*" "" str "${str}") + SET(${var} ${str}) ENDIF() ENDIF() ENDMACRO() @@ -32,57 +44,32 @@ ENDMACRO() # Read mysql version for configure script MACRO(GET_MYSQL_VERSION) + MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MAJOR" MAJOR_VERSION) + MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MINOR" MINOR_VERSION) + MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_PATCH" PATCH_VERSION) + MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_EXTRA" EXTRA_VERSION) - IF(NOT VERSION_STRING) - IF(EXISTS ${CMAKE_SOURCE_DIR}/configure.in) - FILE(STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "AM_INIT_AUTOMAKE") - STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][^ \\)]+" VERSION_STRING "${str}") - IF(NOT VERSION_STRING) - STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}") - IF(NOT VERSION_STRING) - FILE(STRINGS configure.in str REGEX "AC_INIT\\(") - STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][a-zAZ0-9]+" VERSION_STRING "${str}") - ENDIF() - ENDIF() - ENDIF() + IF(NOT MAJOR_VERSION OR NOT MINOR_VERSION OR NOT PATCH_VERSION) + MESSAGE(FATAL_ERROR "VERSION file cannot be parsed.") ENDIF() - - IF(NOT VERSION_STRING) - MESSAGE(FATAL_ERROR - "VERSION_STRING cannot be parsed, please specify -DVERSION_STRING=major.minor.patch-extra" - "when calling cmake") - ENDIF() - - SET(VERSION ${VERSION_STRING}) - STRING(REPLACE "-" "_" MYSQL_U_SCORE_VERSION "${VERSION_STRING}") - - # Remove trailing (non-numeric) part of the version string - STRING(REGEX REPLACE "[^\\.0-9].*" "" VERSION_STRING ${VERSION_STRING}) - - STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" MAJOR_VERSION "${VERSION_STRING}") - STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" MINOR_VERSION "${VERSION_STRING}") - STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" PATCH "${VERSION_STRING}") + SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}") + MESSAGE("-- MySQL ${VERSION}") SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version") - SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}") - MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH}") + SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") + STRING(REPLACE "-" "_" MYSQL_RPM_VERSION "${VERSION}") + MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH_VERSION}") MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION) SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION}) SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION}) - SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH}) + SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION}) ENDMACRO() # Get mysql version and other interesting variables GET_MYSQL_VERSION() -MYSQL_GET_CONFIG_VALUE("PROTOCOL_VERSION" PROTOCOL_VERSION) -MYSQL_GET_CONFIG_VALUE("DOT_FRM_VERSION" DOT_FRM_VERSION) -MYSQL_GET_CONFIG_VALUE("MYSQL_TCP_PORT_DEFAULT" MYSQL_TCP_PORT_DEFAULT) -MYSQL_GET_CONFIG_VALUE("MYSQL_UNIX_ADDR_DEFAULT" MYSQL_UNIX_ADDR_DEFAULT) -MYSQL_GET_CONFIG_VALUE("SHARED_LIB_MAJOR_VERSION" SHARED_LIB_MAJOR_VERSION) -IF(NOT MYSQL_TCP_PORT_DEFAULT) - SET(MYSQL_TCP_PORT_DEFAULT "3306") -ENDIF() +SET(MYSQL_TCP_PORT_DEFAULT "3306") + IF(NOT MYSQL_TCP_PORT) SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT}) SET(MYSQL_TCP_PORT_DEFAULT "0") @@ -130,9 +117,8 @@ ENDIF() # Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx # for more info. IF(MSVC) - GET_TARGET_PROPERTY(location gen_versioninfo LOCATION) - IF(NOT location) GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) + SET(FILETYPE VFT_APP) CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in ${CMAKE_BINARY_DIR}/versioninfo_exe.rc) @@ -140,31 +126,14 @@ IF(MSVC) SET(FILETYPE VFT_DLL) CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in ${CMAKE_BINARY_DIR}/versioninfo_dll.rc) - - ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_BINARY_DIR}/versioninfo_exe.res - ${CMAKE_BINARY_DIR}/versioninfo_dll.res - COMMAND ${CMAKE_RC_COMPILER} versioninfo_exe.rc - COMMAND ${CMAKE_RC_COMPILER} versioninfo_dll.rc - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - ADD_CUSTOM_TARGET(gen_versioninfo - DEPENDS - ${CMAKE_BINARY_DIR}/versioninfo_exe.res - ${CMAKE_BINARY_DIR}/versioninfo_dll.res - ) - ENDIF() - - FUNCTION(ADD_VERSION_INFO target) - GET_TARGET_PROPERTY(target_type ${target} TYPE) - ADD_DEPENDENCIES(${target} gen_versioninfo) - IF(target_type MATCHES "SHARED" OR target_type MATCHES "MODULE") - SET_PROPERTY(TARGET ${target} APPEND PROPERTY LINK_FLAGS - "\"${CMAKE_BINARY_DIR}/versioninfo_dll.res\"") - ELSEIF(target_type MATCHES "EXE") - SET_PROPERTY(TARGET ${target} APPEND PROPERTY LINK_FLAGS - "${target_link_flags} \"${CMAKE_BINARY_DIR}/versioninfo_exe.res\"") + + FUNCTION(ADD_VERSION_INFO target target_type sources_var) + IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE") + SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc) + ELSEIF("${target_type}" MATCHES "EXE") + SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_exe.rc) ENDIF() + SET(${sources_var} ${${sources_var}} ${rcfile} PARENT_SCOPE) ENDFUNCTION() ELSE() FUNCTION(ADD_VERSION_INFO) diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake index 946e020d6f4..10d3a719609 100644 --- a/cmake/os/Linux.cmake +++ b/cmake/os/Linux.cmake @@ -33,7 +33,7 @@ ENDFOREACH() # Ensure we have clean build for shared libraries # without unresolved symbols -SET(LINK_FLAG_NO_UNDEFINED "--Wl,--no-undefined") +SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined") # 64 bit file offset support flag SET(_FILE_OFFSET_BITS 64) diff --git a/cmake/os/SunOS.cmake b/cmake/os/SunOS.cmake index e932e6c2b74..9e8ca0ef11f 100644 --- a/cmake/os/SunOS.cmake +++ b/cmake/os/SunOS.cmake @@ -17,7 +17,6 @@ INCLUDE(CheckSymbolExists) INCLUDE(CheckCSourceRuns) INCLUDE(CheckCSourceCompiles) -SET(TARGET_OS_SOLARIS 1) # Enable 64 bit file offsets SET(_FILE_OFFSET_BITS 64) diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index aac7e484f26..b51f3a2dc52 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2010 Sun Microsystems, Inc +# Copyright (C) 2010, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -91,7 +91,6 @@ IF(MSVC) STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}") ENDFOREACH() - ADD_DEFINITIONS(-DPTHREAD_STACK_MIN=1048576) # Mark 32 bit executables large address aware so they can # use > 2GB address space IF(CMAKE_SIZEOF_VOID_P MATCHES 4) @@ -105,14 +104,9 @@ IF(MSVC) ENDIF() #TODO: update the code and remove the disabled warnings - ADD_DEFINITIONS(/wd4800 /wd4805) - IF (MSVC_VERSION GREATER 1310) - ADD_DEFINITIONS(/wd4996) - ENDIF() + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099") - # Make class/struct definition mismatch an error (overseen too often, - # adds tons of new warnings) - ADD_DEFINITIONS(/we4099) IF(CMAKE_SIZEOF_VOID_P MATCHES 8) # _WIN64 is defined by the compiler itself. @@ -198,3 +192,4 @@ IF(NOT HAVE_SIZE_OF_SSIZE_T) ENDIF() SET(FN_NO_CASE_SENSE 1) +SET(USE_SYMDIR 1) diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 732f5d74181..68bbb337e15 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -57,6 +57,7 @@ SET(HAVE_FCNTL_H 1 CACHE INTERNAL "") SET(HAVE_FCNTL_NONBLOCK CACHE INTERNAL "") SET(HAVE_FCONVERT CACHE INTERNAL "") SET(HAVE_FDATASYNC CACHE INTERNAL "") +SET(HAVE_DECL_FDATASYNC CACHE INTERNAL "") SET(HAVE_FENV_H CACHE INTERNAL "") SET(HAVE_FESETROUND CACHE INTERNAL "") SET(HAVE_FGETLN CACHE INTERNAL "") @@ -75,9 +76,6 @@ SET(HAVE_FTRUNCATE CACHE INTERNAL "") SET(HAVE_GETADDRINFO 1 CACHE INTERNAL "") SET(HAVE_GETCWD 1 CACHE INTERNAL "") SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "") -SET(HAVE_GETHOSTBYNAME_R CACHE INTERNAL "") -SET(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE CACHE INTERNAL "") -SET(HAVE_GETHOSTBYNAME_R_RETURN_INT CACHE INTERNAL "") SET(HAVE_GETHRTIME CACHE INTERNAL "") SET(HAVE_GETLINE CACHE INTERNAL "") SET(HAVE_GETNAMEINFO CACHE INTERNAL "") @@ -103,6 +101,10 @@ SET(HAVE_IPV6_V6ONLY 1 CACHE INTERNAL "") SET(HAVE_ISINF CACHE INTERNAL "") SET(HAVE_ISNAN CACHE INTERNAL "") SET(HAVE_ISSETUGID CACHE INTERNAL "") +SET(HAVE_GETUID CACHE INTERNAL "") +SET(HAVE_GETEUID CACHE INTERNAL "") +SET(HAVE_GETGID CACHE INTERNAL "") +SET(HAVE_GETEGID CACHE INTERNAL "") SET(HAVE_LANGINFO_H CACHE INTERNAL "") SET(HAVE_LDIV 1 CACHE INTERNAL "") SET(HAVE_LIMITS_H 1 CACHE INTERNAL "") @@ -131,6 +133,7 @@ SET(HAVE_PASE_ENVIRONMENT CACHE INTERNAL "") SET(HAVE_PATHS_H CACHE INTERNAL "") SET(HAVE_PCLOSE CACHE INTERNAL "") SET(HAVE_PERROR 1 CACHE INTERNAL "") +SET(HAVE_PEERCRED CACHE INTERNAL "") SET(HAVE_POLL_H CACHE INTERNAL "") SET(HAVE_POPEN CACHE INTERNAL "") SET(HAVE_POLL CACHE INTERNAL "") @@ -338,6 +341,7 @@ SET(SIGNAL_RETURN_TYPE_IS_VOID 1 CACHE INTERNAL "") SET(C_HAS_inline CACHE INTERNAL "") SET(C_HAS___inline 1 CACHE INTERNAL "") SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "") +SET(FIONREAD_IN_SYS_FILIO CACHE INTERNAL "") SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "") SET(HAVE_CXXABI_H CACHE INTERNAL "") SET(HAVE_NDIR_H CACHE INTERNAL "") diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 31e1fceec23..615b1d7a717 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,8 +27,24 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) # [LINK_LIBRARIES lib1...libN] # [DEPENDENCIES target1...targetN] +# Append collections files for the plugin to the common files +# Make sure we don't copy twice if running cmake again + +MACRO(PLUGIN_APPEND_COLLECTIONS plugin) + SET(fcopied "${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/FilesCopied") + IF(NOT EXISTS ${fcopied}) + FILE(GLOB collections ${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/*) + FOREACH(cfile ${collections}) + FILE(READ ${cfile} contents) + GET_FILENAME_COMPONENT(fname ${cfile} NAME) + FILE(APPEND ${CMAKE_SOURCE_DIR}/mysql-test/collections/${fname} "${contents}") + FILE(APPEND ${fcopied} "${fname}\n") + ENDFOREACH() + ENDIF() +ENDMACRO() + MACRO(MYSQL_ADD_PLUGIN) - CMAKE_PARSE_ARGUMENTS(ARG + MYSQL_PARSE_ARGUMENTS(ARG "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME" "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED" ${ARGN} @@ -123,7 +139,7 @@ MACRO(MYSQL_ADD_PLUGIN) # Update mysqld dependencies SET (MYSQLD_STATIC_PLUGIN_LIBS ${MYSQLD_STATIC_PLUGIN_LIBS} - ${target} CACHE INTERNAL "" FORCE) + ${target} ${ARG_LINK_LIBRARIES} CACHE INTERNAL "" FORCE) IF(ARG_MANDATORY) SET(${with_var} ON CACHE INTERNAL "Link ${plugin} statically to the server" @@ -151,6 +167,7 @@ MACRO(MYSQL_ADD_PLUGIN) ENDIF() ENDIF() + ADD_VERSION_INFO(${target} MODULE SOURCES) ADD_LIBRARY(${target} MODULE ${SOURCES}) DTRACE_INSTRUMENT(${target}) SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX "" @@ -179,6 +196,10 @@ MACRO(MYSQL_ADD_PLUGIN) # Install dynamic library MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT Server) INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug) + # For internal testing in PB2, append collections files + IF(DEFINED ENV{PB2WORKDIR}) + PLUGIN_APPEND_COLLECTIONS(${plugin}) + ENDIF() ELSE() IF(WITHOUT_${plugin}) # Update cache variable @@ -206,4 +227,11 @@ MACRO(CONFIGURE_PLUGINS) ADD_SUBDIRECTORY(${dir}) ENDIF() ENDFOREACH() + FOREACH(dir ${dirs_plugin}) + IF (EXISTS ${dir}/.bzr) + MESSAGE(STATUS "Found repo ${dir}/.bzr") + LIST(APPEND PLUGIN_BZR_REPOS "${dir}") + ENDIF() + ENDFOREACH() + SET(PLUGIN_REPOS "${PLUGIN_BZR_REPOS}" CACHE INTERNAL "") ENDMACRO() diff --git a/cmake/versioninfo.rc.in b/cmake/versioninfo.rc.in index 97c45ec86c0..c625ce8c7f4 100644 --- a/cmake/versioninfo.rc.in +++ b/cmake/versioninfo.rc.in @@ -1,7 +1,7 @@ #include <windows.h>
VS_VERSION_INFO VERSIONINFO
-FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
-PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
+FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,0
+PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS__WINDOWS32
@@ -12,8 +12,8 @@ BEGIN BEGIN
BLOCK "040904E4"
BEGIN
- VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
- VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
+ VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.0\0"
+ VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.0\0"
END
END
BLOCK "VarFileInfo"
|