diff options
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-x | CMakeLists.txt | 162 |
1 files changed, 158 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8aed0eaa021..1e727080df2 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2006 MySQL AB +# Copyright (C) 2006-2009 MySQL AB & Monty Program Ab # # 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 @@ -66,6 +66,15 @@ IF(EXTRA_DEBUG) ADD_DEFINITIONS(-D EXTRA_DEBUG) ENDIF(EXTRA_DEBUG) +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFE_MUTEX") +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFE_MUTEX") + +OPTION (WITH_DEBUG_FULL "Enable malloc debug library (only debug builds)" OFF) +IF(WITH_DEBUG_FULL) + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC") +ENDIF() + IF(ENABLED_DEBUG_SYNC) ADD_DEFINITIONS(-D ENABLED_DEBUG_SYNC) ENDIF(ENABLED_DEBUG_SYNC) @@ -116,7 +125,6 @@ IF(MSVC) STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT}) # generate map files, set stack size (see bug#20815) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1048576") # remove support for Exception handling @@ -235,6 +243,17 @@ FOREACH(SUBDIR ${STORAGE_SUBDIRS}) STRING (REGEX MATCH "MYSQL_PLUGIN_DYNAMIC" MYSQL_PLUGIN_DYNAMIC ${PLUGIN_FILE_CONTENT}) STRING (REGEX MATCH "MYSQL_PLUGIN_MANDATORY" MYSQL_PLUGIN_MANDATORY ${PLUGIN_FILE_CONTENT}) STRING (REGEX MATCH "MYSQL_PLUGIN_STATIC" MYSQL_PLUGIN_STATIC ${PLUGIN_FILE_CONTENT}) + + # + # XTRADB is located in storage/xtradb, but it says everywhere it is 'innobase' (e.g. + # it declares 'builtin_innobase_plugin', not builtin_xtradb_plugin). + # Extract the intended plugin name from MYSQL_STORAGE_ENGINE definition and use it + # where appropriate. + STRING (REGEX MATCH "MYSQL_STORAGE_ENGINE.[a-z]*" PLUGIN_NAME ${PLUGIN_FILE_CONTENT}) + STRING (REGEX REPLACE "MYSQL_STORAGE_ENGINE.(.*)" "\\1" PLUGIN_NAME ${PLUGIN_NAME}) + + # Also remember this "xtradb"/"innobase" name discrepancy for libmysqld/CMakeLists.txt: + SET (plugin_dir_${PLUGIN_NAME} ${DIRNAME}) IF(MYSQL_PLUGIN_MANDATORY) SET(WITH_${ENGINE}_STORAGE_ENGINE TRUE) @@ -247,9 +266,10 @@ FOREACH(SUBDIR ${STORAGE_SUBDIRS}) ELSE(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC) SET(ENGINE_BUILD_TYPE "NONE") ENDIF(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC) + IF (ENGINE_BUILD_TYPE STREQUAL "STATIC") - SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_${ENGINE_LOWER}_plugin") - SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${ENGINE_LOWER}) + SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_${PLUGIN_NAME}_plugin") + SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${PLUGIN_NAME}) SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_${ENGINE}_STORAGE_ENGINE") SET (WITH_${ENGINE}_STORAGE_ENGINE TRUE) SET (${ENGINE}_DIR ${DIRNAME}) @@ -270,6 +290,14 @@ IF(NOT WITHOUT_PARTITION_STORAGE_ENGINE) SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_partition_plugin") ENDIF(NOT WITHOUT_PARTITION_STORAGE_ENGINE) +# Special handling for tmp tables with the maria engine +IF(WITH_MARIA_STORAGE_ENGINE) + ADD_DEFINITIONS(-DWITH_MARIA_STORAGE_ENGINE) + IF(WITH_MARIA_TMP_TABLES) + ADD_DEFINITIONS(-DUSE_MARIA_FOR_TMP_TABLES) + ENDIF(WITH_MARIA_TMP_TABLES) +ENDIF(WITH_MARIA_STORAGE_ENGINE) + ADD_DEFINITIONS(${STORAGE_ENGINE_DEFS}) # Now write out our mysql_plugin_defs struct @@ -299,14 +327,140 @@ ADD_SUBDIRECTORY(scripts) ADD_SUBDIRECTORY(zlib) ADD_SUBDIRECTORY(extra/yassl) ADD_SUBDIRECTORY(extra/yassl/taocrypt) +ADD_SUBDIRECTORY(extra/libevent) ADD_SUBDIRECTORY(extra) ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(sql) ADD_SUBDIRECTORY(server-tools/instance-manager) ADD_SUBDIRECTORY(libmysql) ADD_SUBDIRECTORY(tests) +ADD_SUBDIRECTORY(unittest/mytap) +ADD_SUBDIRECTORY(unittest/mysys) IF(WITH_EMBEDDED_SERVER) ADD_SUBDIRECTORY(libmysqld) ADD_SUBDIRECTORY(libmysqld/examples) ENDIF(WITH_EMBEDDED_SERVER) ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess) + +# Set up the installer +SET(CPACK_PACKAGE_NAME "MariaDB") +STRING(REPLACE "-MariaDB" "" CPACK_PACKAGE_VERSION ${VERSION}) +SET(CPACK_PACKAGE_VENDOR "Monty Program AB http://www.montyprogram.com") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MariaDB") +SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING) +SET(CPACK_GENERATOR NSIS) + +# Use our own NSIS template +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/win/cmake" ${CMAKE_MODULE_PATH}) + +# Installer components and grouping +SET(CPACK_COMPONENT_GROUP_SERVER_DESCRIPTION "The files necessary for running the MariaDB server.") +SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION "Files used in development on the MariaDB server.") +SET(CPACK_ALL_INSTALL_TYPES Normal Development) +SET(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "MariaDB server") +SET(CPACK_COMPONENT_RUNTIME_DESCRIPTION "The server itself. You want to install this one.") +SET(CPACK_COMPONENT_RUNTIME_GROUP "Server") +SET(CPACK_COMPONENT_RUNTIME_INSTALL_TYPES Normal Development) +SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Development headers") +SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "Header files for development on MariaDB.") +SET(CPACK_COMPONENT_HEADERS_DEPENDS runtime) +SET(CPACK_COMPONENT_HEADERS_GROUP "Development") +SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Development) +SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded") +SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Files for embedding MariaDB in other projects.") +SET(CPACK_COMPONENT_EMBEDDED_DEPENDS headers) +SET(CPACK_COMPONENT_EMBEDDED_GROUP "Development") +SET(CPACK_COMPONENT_EMBEDDED_INSTALL_TYPES Development) +SET(CPACK_COMPONENT_SCRIPTS_DISPLAY_NAME "Server scripts") +SET(CPACK_COMPONENT_SCRIPTS_DESCRIPTION "SQL and Perl scripts to control and modify the server. You need a perl installation for some of these to work.") +SET(CPACK_COMPONENT_SCRIPTS_DEPENDS runtime) +SET(CPACK_COMPONENT_SCRIPTS_GROUP "Server") +SET(CPACK_COMPONENT_SCRIPTS_INSTALL_TYPES Normal Development) +SET(CPACK_COMPONENT_MYSQLTEST_DISPLAY_NAME "MariaDB test suite") +SET(CPACK_COMPONENT_MYSQLTEST_DESCRIPTION "The MariaDB regression test suite.") +SET(CPACK_COMPONENT_MYSQLTEST_DEPENDS runtime) +SET(CPACK_COMPONENT_MYSQLTEST_GROUP "Testing") +SET(CPACK_COMPONENT_MYSQLTEST_INSTALL_TYPES Normal Development) +SET(CPACK_COMPONENT_SQLBENCH_DISPLAY_NAME "SQL Bench") +SET(CPACK_COMPONENT_SQLBENCH_DESCRIPTION "The MariaDB benchmark suite.") +SET(CPACK_COMPONENT_SQLBENCH_DEPENDS runtime) +SET(CPACK_COMPONENT_SQLBENCH_GROUP "Testing") +SET(CPACK_COMPONENT_SQLBENCH_INSTALL_TYPES Normal Development) + +# Add files to the installer +INSTALL(FILES COPYING EXCEPTIONS-CLIENT DESTINATION .) +INSTALL(FILES support-files/my-huge.ini support-files/my-innodb-heavy-4G.ini DESTINATION .) +INSTALL(FILES support-files/my-large.ini support-files/my-medium.ini DESTINATION .) +INSTALL(FILES support-files/my-small.ini DESTINATION .) +INSTALL(FILES Docs/INSTALL-BINARY DESTINATION Docs) +INSTALL(FILES COPYING DESTINATION Docs) +FILE(GLOB headerfiles "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") +INSTALL(FILES ${headerfiles} DESTINATION include COMPONENT headers) +INSTALL(FILES include/mysql/plugin.h DESTINATION include/mysql COMPONENT headers) +INSTALL(FILES libmysql/libmysql.def DESTINATION include COMPONENT headers) + +# Handle the database files +FILE(GLOB datafiles "${CMAKE_CURRENT_SOURCE_DIR}/win/data/mysql/*") +INSTALL(FILES ${datafiles} DESTINATION data/clean/mysql) +INSTALL(FILES win/data/maria_log.00000001 win/data/maria_log_control DESTINATION data/clean) +INSTALL(DIRECTORY win/data/test DESTINATION data/clean) +SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS} + IfFileExists '$INSTDIR\\\\data\\\\mysql\\\\db.frm' 0 CopyDatabaseFiles + MessageBox MB_OK 'There are already database files present in the data directory. Clean database files are not written to the directory' + GoTo EndCopyDatabaseFiles + CopyDatabaseFiles: + CopyFiles '$INSTDIR\\\\data\\\\clean\\\\*' '$INSTDIR\\\\data' + EndCopyDatabaseFiles:") +SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS} + MessageBox MB_OK 'This will not delete the database files in $INSTDIR\\\\data'") + +# Files in the share dir +INSTALL(FILES sql/share/errmsg.txt DESTINATION share COMPONENT runtime) +FILE(GLOB charsets sql/share/charsets/*) +INSTALL(FILES ${charsets} DESTINATION share/charsets COMPONENT runtime) +FILE(GLOB share_dirs sql/share/*/errmsg.sys) +FOREACH(ERRMSGFILE ${share_dirs}) + STRING(REPLACE "//" "/" ERRMSGFILE ${ERRMSGFILE}) # Work around a cmake bug + FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/sql/share ${ERRMSGFILE}) + STRING(REPLACE "/errmsg.sys" "" DIRNAME ${DIRNAME}) + INSTALL(FILES ${ERRMSGFILE} DESTINATION share/${DIRNAME} COMPONENT runtime) +ENDFOREACH(ERRMSGFILE ${share_dirs}) + +# MTR files +FILE(GLOB_RECURSE testfiles mysql-test/*) +FOREACH(testfile ${testfiles}) + FILE(RELATIVE_PATH dirname ${PROJECT_SOURCE_DIR} ${testfile}) + GET_FILENAME_COMPONENT(dirname ${dirname} PATH) + GET_FILENAME_COMPONENT(filename ${testfile} NAME) + GET_FILENAME_COMPONENT(ext ${testfile} EXT) + SET(ok "yes") + IF (NOT "x_${ext}" STREQUAL "x_") + # Test if this is one of the extensions we don't want to install + STRING(TOLOWER ${ext} ext) + IF(${ext} STREQUAL ".dir" OR ${ext} STREQUAL ".vcproj" OR ${ext} STREQUAL ".user" OR ${ext} STREQUAL ".ilk" + OR ${ext} STREQUAL ".idb" OR ${ext} STREQUAL ".map" OR ${ext} STREQUAL ".gcov" + OR ${ext} STREQUAL ".supp" OR ${ext} STREQUAL ".am" OR ${ext} STREQUAL ".stress") + SET(ok "no") + ENDIF() + ENDIF(NOT "x_${ext}" STREQUAL "x_") + IF (${ok} STREQUAL "yes") + # Message("Dir: ${dirname}. File: ${filename}. Ext: ${ext}") + INSTALL(FILES ${testfile} DESTINATION ${dirname} COMPONENT mysqltest) + ENDIF(${ok} STREQUAL "yes") +ENDFOREACH(testfile ${testfiles}) + +# SQL Bench +FILE(GLOB_RECURSE benchfiles sql-bench/*) +FOREACH(testfile ${testfiles}) + FILE(RELATIVE_PATH dirname ${PROJECT_SOURCE_DIR} ${testfile}) + GET_FILENAME_COMPONENT(dirname ${dirname} PATH) + GET_FILENAME_COMPONENT(filename ${testfile} NAME) + IF(NOT ${dirname} STREQUAL "sql-bench" OR ${filename} STREQUAL "README") + INSTALL(FILES ${testfile} DESTINATION ${dirname} COMPONENT sqlbench) + ENDIF() +ENDFOREACH(testfile ${testfiles}) + +INCLUDE(InstallRequiredSystemLibraries) + +# This must always be the last line +INCLUDE(CPack) |