diff options
author | Sergei Golubchik <serg@mariadb.org> | 2014-10-15 12:59:13 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2014-10-15 12:59:13 +0200 |
commit | f62c12b405ba7ec80b8e2490856b83c6f5899211 (patch) | |
tree | 010605c7f145da6ea6ac14b39abc4cf700d619b1 /cmake | |
parent | f947f73b2b6d2bd246b81a9038224d2a85777520 (diff) | |
parent | f1afc003eefe0aafd3e070c7453d9e029d8445a8 (diff) | |
download | mariadb-git-f62c12b405ba7ec80b8e2490856b83c6f5899211.tar.gz |
Merge 10.0.14 into 10.1
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/build_configurations/mysql_release.cmake | 7 | ||||
-rw-r--r-- | cmake/dtrace.cmake | 43 | ||||
-rw-r--r-- | cmake/install_macros.cmake | 4 | ||||
-rw-r--r-- | cmake/jemalloc.cmake | 82 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 29 | ||||
-rw-r--r-- | cmake/plugin.cmake | 2 | ||||
-rw-r--r-- | cmake/readline.cmake | 68 |
7 files changed, 108 insertions, 127 deletions
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 6673cdc438c..434e1cfda0e 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -109,14 +109,9 @@ ENDIF() IF(UNIX) SET(WITH_EXTRA_CHARSETS all CACHE STRING "") - IF(EXISTS "${CMAKE_SOURCE_DIR}/COPYING") - OPTION(WITH_READLINE "" ON) - ELSE() - OPTION(WITH_LIBEDIT "" ON) - ENDIF() - IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + SET(WITH_JEMALLOC "static" CACHE STRING "") IF(NOT IGNORE_AIO_CHECK) # Ensure aio is available on Linux (required by InnoDB) diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake index 1fc87cfcbef..5d0bb7ff8c9 100644 --- a/cmake/dtrace.cmake +++ b/cmake/dtrace.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2014, 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 @@ -80,13 +80,6 @@ IF(ENABLE_DTRACE) ${CMAKE_BINARY_DIR}/include/probes_mysql_dtrace.h ${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h ) - IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - # Systemtap object - EXECUTE_PROCESS( - COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base - -o ${CMAKE_BINARY_DIR}/probes_mysql.o - ) - ENDIF() ADD_CUSTOM_TARGET(gen_dtrace_header DEPENDS ${CMAKE_BINARY_DIR}/include/probes_mysql.d @@ -105,12 +98,7 @@ FUNCTION(DTRACE_INSTRUMENT target) IF(ENABLE_DTRACE) ADD_DEPENDENCIES(${target} gen_dtrace_header) - IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - TARGET_LINK_LIBRARIES(${target} ${CMAKE_BINARY_DIR}/probes_mysql.o) - ENDIF() - - # On Solaris, invoke dtrace -G to generate object file and - # link it together with target. + # Invoke dtrace to generate object file and link it together with target. IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") SET(objdir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir) SET(outfile ${objdir}/${target}_dtrace.o) @@ -127,6 +115,21 @@ FUNCTION(DTRACE_INSTRUMENT target) -P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake WORKING_DIRECTORY ${objdir} ) + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + # dtrace on Linux runs gcc and uses flags from environment + SET(CFLAGS_SAVED $ENV{CFLAGS}) + SET(ENV{CFLAGS} ${CMAKE_C_FLAGS}) + SET(outfile "${CMAKE_BINARY_DIR}/probes_mysql.o") + # Systemtap object + EXECUTE_PROCESS( + COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base + -o ${outfile} + ) + SET(ENV{CFLAGS} ${CFLAGS_SAVED}) + ENDIF() + + # Do not try to extend the library if we have not built the .o file + IF(outfile) # Add full object path to linker flags GET_TARGET_PROPERTY(target_type ${target} TYPE) IF(NOT target_type MATCHES "STATIC") @@ -138,12 +141,12 @@ FUNCTION(DTRACE_INSTRUMENT target) # but maybe one day this will be fixed. GET_TARGET_PROPERTY(target_location ${target} LOCATION) ADD_CUSTOM_COMMAND( - TARGET ${target} POST_BUILD - COMMAND ${CMAKE_AR} r ${target_location} ${outfile} - COMMAND ${CMAKE_RANLIB} ${target_location} - ) - # Used in DTRACE_INSTRUMENT_WITH_STATIC_LIBS - SET(TARGET_OBJECT_DIRECTORY_${target} ${objdir} CACHE INTERNAL "") + TARGET ${target} POST_BUILD + COMMAND ${CMAKE_AR} r ${target_location} ${outfile} + COMMAND ${CMAKE_RANLIB} ${target_location} + ) + # Used in DTRACE_INSTRUMENT_WITH_STATIC_LIBS + SET(TARGET_OBJECT_DIRECTORY_${target} ${objdir} CACHE INTERNAL "") ENDIF() ENDIF() ENDIF() diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 8226f0f705b..2680d9ccbb4 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -38,7 +38,9 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS) STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location}) STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location}) IF(CMAKE_GENERATOR MATCHES "Visual Studio") - STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location}) + STRING(REPLACE + "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" + pdb_location ${pdb_location}) ENDIF() set(comp "") diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake index b677f226266..876688f02f6 100644 --- a/cmake/jemalloc.cmake +++ b/cmake/jemalloc.cmake @@ -1,67 +1,37 @@ -# old cmake does not have ExternalProject file -IF(CMAKE_VERSION VERSION_LESS "2.8.6") - MACRO (CHECK_JEMALLOC) - ENDMACRO() - RETURN() -ENDIF() +INCLUDE (CheckLibraryExists) -INCLUDE(ExternalProject) +SET(WITH_JEMALLOC auto CACHE STRING + "Build with jemalloc. Possible values are 'yes', 'no', 'auto'") -MACRO (USE_BUNDLED_JEMALLOC) - SET(SOURCE_DIR "${CMAKE_SOURCE_DIR}/extra/jemalloc") - SET(BINARY_DIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/extra/jemalloc/build") - SET(LIBJEMALLOC "libjemalloc") - SET(JEMALLOC_CONFIGURE_OPTS "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}" "--with-private-namespace=jemalloc_internal_" "--enable-cc-silence") - IF (CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT APPLE) # see the comment in CMakeLists.txt - LIST(APPEND JEMALLOC_CONFIGURE_OPTS --enable-debug) +MACRO (CHECK_JEMALLOC) + # compatibility with old WITH_JEMALLOC values + IF(WITH_JEMALLOC STREQUAL "bundled") + MESSAGE(FATAL_ERROR "MariaDB no longer bundles jemalloc") ENDIF() - - IF(CMAKE_GENERATOR MATCHES "Makefiles") - SET(MAKE_COMMAND ${CMAKE_MAKE_PROGRAM}) - ELSE() # Xcode/Ninja generators - SET(MAKE_COMMAND make) + IF(WITH_JEMALLOC STREQUAL "system") + SET(WITH_JEMALLOC "yes") ENDIF() - - ExternalProject_Add(jemalloc - PREFIX extra/jemalloc - SOURCE_DIR ${SOURCE_DIR} - BINARY_DIR ${BINARY_DIR} - STAMP_DIR ${BINARY_DIR} - CONFIGURE_COMMAND "${SOURCE_DIR}/configure" ${JEMALLOC_CONFIGURE_OPTS} - BUILD_COMMAND ${MAKE_COMMAND} "build_lib_static" - INSTALL_COMMAND "" - ) - ADD_LIBRARY(libjemalloc STATIC IMPORTED) - SET_TARGET_PROPERTIES(libjemalloc PROPERTIES IMPORTED_LOCATION "${BINARY_DIR}/lib/libjemalloc_pic.a") - ADD_DEPENDENCIES(libjemalloc jemalloc) -ENDMACRO() -IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR APPLE) - # Linux and OSX are the only systems where bundled jemalloc can be built without problems, - # as they both have GNU make and jemalloc actually compiles. - # Also, BSDs use jemalloc as malloc already - SET(WITH_JEMALLOC_DEFAULT "yes") -ELSE() - SET(WITH_JEMALLOC_DEFAULT "no") -ENDIF() + IF(WITH_JEMALLOC STREQUAL "yes" OR WITH_JEMALLOC STREQUAL "auto" OR + WITH_JEMALLOC STREQUAL "static") + + IF(WITH_JEMALLOC STREQUAL "static") + SET(libname jemalloc_pic) + SET(CMAKE_REQUIRED_LIBRARIES pthread dl m) + SET(what bundled) + ELSE() + SET(libname jemalloc) + SET(what system) + ENDIF() -SET(WITH_JEMALLOC ${WITH_JEMALLOC_DEFAULT} CACHE STRING - "Which jemalloc to use. Possible values are 'no', 'bundled', 'system', 'yes' (system if possible, otherwise bundled)") + CHECK_LIBRARY_EXISTS(${libname} malloc_stats_print "" HAVE_JEMALLOC) + SET(CMAKE_REQUIRED_LIBRARIES) -MACRO (CHECK_JEMALLOC) - IF(WITH_JEMALLOC STREQUAL "system" OR WITH_JEMALLOC STREQUAL "yes") - CHECK_LIBRARY_EXISTS(jemalloc malloc_stats_print "" HAVE_JEMALLOC) IF (HAVE_JEMALLOC) - SET(LIBJEMALLOC jemalloc) - SET(MALLOC_LIBRARY "system jemalloc") - ELSEIF (WITH_JEMALLOC STREQUAL "system") - MESSAGE(FATAL_ERROR "system jemalloc is not found") - ELSEIF (WITH_JEMALLOC STREQUAL "yes") - SET(trybundled 1) + SET(LIBJEMALLOC ${libname}) + SET(MALLOC_LIBRARY "${what} jemalloc") + ELSEIF (NOT WITH_JEMALLOC STREQUAL "auto") + MESSAGE(FATAL_ERROR "${libname} is not found") ENDIF() ENDIF() - IF(WITH_JEMALLOC STREQUAL "bundled" OR trybundled) - USE_BUNDLED_JEMALLOC() - SET(MALLOC_LIBRARY "bundled jemalloc") - ENDIF() ENDMACRO() diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 53c3bad7fed..5a6e51e4120 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2014, 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 @@ -61,22 +61,30 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4) ENDIF() IF(MSVC) - # Enable debug info also in Release build, and create PDB to be able to analyze - # crashes - FOREACH(lang C CXX) - SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi") - ENDFOREACH() + # Enable debug info also in Release build, + # and create PDB to be able to analyze crashes. FOREACH(type EXE SHARED MODULE) - SET(CMAKE_{type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") + SET(CMAKE_{type}_LINKER_FLAGS_RELEASE + "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") ENDFOREACH() # Force static runtime libraries + # - Choose debugging information: + # /Z7 + # Produces an .obj file containing full symbolic debugging + # information for use with the debugger. The symbolic debugging + # information includes the names and types of variables, as well as + # functions and line numbers. No .pdb file is produced by the compiler. + FOREACH(lang C CXX) + SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7") + ENDFOREACH() FOREACH(flag - CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT + CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT) STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}") + STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}") ENDFOREACH() @@ -104,7 +112,6 @@ IF(MSVC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099") - IF(CMAKE_SIZEOF_VOID_P MATCHES 8) # _WIN64 is defined by the compiler itself. # Yet, we define it here again to work around a bug with Intellisense diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 632c4cfe442..ccd744cee6b 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -211,7 +211,7 @@ MACRO(MYSQL_ADD_PLUGIN) IF(CPACK_COMPONENTS_ALL AND NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT}) SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} ${ARG_COMPONENT} PARENT_SCOPE) - SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB-server" PARENT_SCOPE) + SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB" PARENT_SCOPE) IF (NOT ARG_CONFIG) SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${target}.cnf") diff --git a/cmake/readline.cmake b/cmake/readline.cmake index ad6a7382e2a..f570c91c1b5 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -116,24 +116,23 @@ ENDMACRO() MACRO (MYSQL_USE_BUNDLED_READLINE) SET(USE_NEW_READLINE_INTERFACE 1) SET(HAVE_HIST_ENTRY 0 CACHE INTERNAL "" FORCE) - SET(READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extra) - SET(READLINE_LIBRARY readline) + SET(MY_READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extra/readline) + SET(MY_READLINE_LIBRARY readline) ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/readline) ENDMACRO() MACRO (MYSQL_FIND_SYSTEM_READLINE) - FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h ) + FIND_PATH(READLINE_INCLUDE_DIR readline.h PATH_SUFFIXES readline) FIND_LIBRARY(READLINE_LIBRARY NAMES readline) MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY) - SET(CMAKE_REQUIRES_LIBRARIES ${READLINE_LIBRARY} ${CURSES_LIBRARY}) - IF(READLINE_LIBRARY AND READLINE_INCLUDE_DIR) SET(CMAKE_REQUIRED_LIBRARIES ${READLINE_LIBRARY} ${CURSES_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${READLINE_INCLUDE_DIR}) CHECK_CXX_SOURCE_COMPILES(" #include <stdio.h> - #include <readline/readline.h> + #include <readline.h> int main(int argc, char **argv) { rl_completion_func_t *func1= (rl_completion_func_t*)0; @@ -141,19 +140,9 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE) }" NEW_READLINE_INTERFACE) - CHECK_CXX_SOURCE_COMPILES(" - #include <stdio.h> - #include <readline/readline.h> - int main(int argc, char **argv) - { - HIST_ENTRY entry; - return 0; - }" - HAVE_HIST_ENTRY) - CHECK_C_SOURCE_COMPILES(" #include <stdio.h> - #include <readline/readline.h> + #include <readline.h> #if RL_VERSION_MAJOR > 5 #error #endif @@ -176,30 +165,27 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE) ENDIF(READLINE_V5) ENDIF(NEW_READLINE_INTERFACE) ENDIF() - SET(CMAKE_REQUIRES_LIBRARIES ) ENDMACRO() MACRO (MYSQL_FIND_SYSTEM_LIBEDIT) - - FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h ) - FIND_LIBRARY(READLINE_LIBRARY NAMES readline) - MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY) - - SET(CMAKE_REQUIRES_LIBRARIES ${READLINE_LIBRARY}) + FIND_PATH(LIBEDIT_INCLUDE_DIR readline.h PATH_SUFFIXES editline edit/readline) + FIND_LIBRARY(LIBEDIT_LIBRARY edit) + MARK_AS_ADVANCED(LIBEDIT_INCLUDE_DIR LIBEDIT_LIBRARY) - IF(READLINE_LIBRARY AND READLINE_INCLUDE_DIR) + IF(LIBEDIT_LIBRARY AND LIBEDIT_INCLUDE_DIR) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBEDIT_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${LIBEDIT_INCLUDE_DIR}) CHECK_CXX_SOURCE_COMPILES(" #include <stdio.h> - #include <readline/readline.h> + #include <readline.h> int main(int argc, char **argv) { - char res= *(*rl_completion_entry_function)(0,0); + int res= (*rl_completion_entry_function)(0,0); completion_matches(0,0); }" LIBEDIT_INTERFACE) SET(USE_LIBEDIT_INTERFACE ${LIBEDIT_INTERFACE}) ENDIF() - SET(CMAKE_REQUIRES_LIBRARIES) ENDMACRO() @@ -216,15 +202,33 @@ MACRO (MYSQL_CHECK_READLINE) IF (NOT APPLE) MYSQL_FIND_SYSTEM_READLINE() ENDIF() - IF(NOT USE_NEW_READLINE_INTERFACE) + IF(USE_NEW_READLINE_INTERFACE) + SET(MY_READLINE_INCLUDE_DIR ${READLINE_INCLUDE_DIR}) + SET(MY_READLINE_LIBRARY ${READLINE_LIBRARY} ${CURSES_LIBRARY}) + ELSE() MYSQL_FIND_SYSTEM_LIBEDIT() - IF(NOT USE_LIBEDIT_INTERFACE) + IF(USE_LIBEDIT_INTERFACE) + SET(MY_READLINE_INCLUDE_DIR ${LIBEDIT_INCLUDE_DIR}) + SET(MY_READLINE_LIBRARY ${LIBEDIT_LIBRARY} ${CURSES_LIBRARY}) + ELSE() MYSQL_USE_BUNDLED_READLINE() ENDIF() ENDIF() ENDIF() - SET(MY_READLINE_INCLUDE_DIR ${READLINE_INCLUDE_DIR}) - SET(MY_READLINE_LIBRARY ${READLINE_LIBRARY} ${CURSES_LIBRARY}) + + SET(CMAKE_REQUIRED_LIBRARIES ${MY_READLINE_LIBRARY}) + SET(CMAKE_REQUIRED_INCLUDES ${MY_READLINE_INCLUDE_DIR}) + CHECK_CXX_SOURCE_COMPILES(" + #include <stdio.h> + #include <readline.h> + int main(int argc, char **argv) + { + HIST_ENTRY entry; + return 0; + }" + HAVE_HIST_ENTRY) + SET(CMAKE_REQUIRED_LIBRARIES) + SET(CMAKE_REQUIRED_INCLUDES) ENDIF(NOT WIN32) ENDMACRO() |