summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-10-04 15:41:52 +0200
committerSergei Golubchik <sergii@pisem.net>2011-10-04 15:41:52 +0200
commit630b0b877937cfd564251a66d2e0166182bff4ff (patch)
tree53e64734919a809c95f246504ea337ae215ff88c /CMakeLists.txt
parentf3523559aaa5d6523d907d69de544ee24c9e6915 (diff)
downloadmariadb-git-630b0b877937cfd564251a66d2e0166182bff4ff.tar.gz
support for plugins on windows
CMakeLists.txt: 1. add -DSAFEMALLOC -DSAFE_MUTEX in the top-level CMakeLists.txt don't force plugins to copy-paste these lines in their CMakeLists.txt 2.1 search plugin/* for plugins (not only storage/*), 2.2 recognize MYSQL_PLUGIN (not only MYSQL_STORAGE_ENGINE), 2.3 extract library names from the plug.in (don't force library names to be ha_<engine>.dll and <engine>.lib) include/mysql/plugin.h: define MYSQL_PLUGIN_EXPORT appropriately (backport from 5.5) libmysqld/CMakeLists.txt: remove unnecessary workaround plugin/fulltext/CMakeLists.txt: build fulltext example plugin on windows storage/maria/CMakeLists.txt: The library is called libmaria_s.lib, not maria.lib storage/maria/unittest/CMakeLists.txt: The library is called libmaria_s.lib, not maria.lib storage/myisam/CMakeLists.txt: The library is called libmyisam_s.lib, not myisam.lib storage/mysql_storage_engine.cmake: introduce MYSQL_PLUGIN macro. don't force library names to be ha_<engine>.dll and <engine>.lib storage/xtradb/CMakeLists.txt: remove a condition from include win/README: don't use deprecated syntax win/configure-mariadb.sh: don't use deprecated syntax win/configure.js: 1. support MYSQL_PLUGIN in addition to MYSQL_STORAGE_ENGINE. 2. support plugin/* in addition to storage/*
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-xCMakeLists.txt48
1 files changed, 27 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4954e4a9d07..11e24652b33 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,6 +172,9 @@ ENDIF(ENABLED_DEBUG_SYNC)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+
# in some places we use DBUG_OFF
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDBUG_OFF")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DDBUG_OFF")
@@ -313,16 +316,15 @@ IF(WITHOUT_DYNAMIC_PLUGINS)
MESSAGE("Dynamic plugins are disabled.")
ENDIF(WITHOUT_DYNAMIC_PLUGINS)
-FILE(GLOB STORAGE_SUBDIRS storage/*)
+FILE(GLOB STORAGE_SUBDIRS storage/* plugin/*)
FOREACH(SUBDIR ${STORAGE_SUBDIRS})
- FILE(RELATIVE_PATH DIRNAME ${PROJECT_SOURCE_DIR}/storage ${SUBDIR})
IF (EXISTS ${SUBDIR}/CMakeLists.txt)
# Check MYSQL_STORAGE_ENGINE macro is present
- FILE(STRINGS ${SUBDIR}/CMakeLists.txt HAVE_STORAGE_ENGINE REGEX MYSQL_STORAGE_ENGINE)
+ FILE(STRINGS ${SUBDIR}/CMakeLists.txt HAVE_STORAGE_ENGINE REGEX "MYSQL_(STORAGE_ENGINE|PLUGIN)")
IF(HAVE_STORAGE_ENGINE)
# Extract name of engine from HAVE_STORAGE_ENGINE
- STRING(REGEX REPLACE ".*MYSQL_STORAGE_ENGINE\\((.*\)\\).*"
- "\\1" ENGINE_NAME ${HAVE_STORAGE_ENGINE})
+ STRING(REGEX REPLACE ".*MYSQL_(STORAGE_ENGINE|PLUGIN)\\((.*\)\\).*"
+ "\\2" ENGINE_NAME ${HAVE_STORAGE_ENGINE})
STRING(TOUPPER ${ENGINE_NAME} ENGINE)
STRING(TOLOWER ${ENGINE_NAME} ENGINE_LOWER)
@@ -331,21 +333,23 @@ FOREACH(SUBDIR ${STORAGE_SUBDIRS})
# build as shared library (dynamic).
IF(EXISTS ${SUBDIR}/plug.in)
FILE(READ ${SUBDIR}/plug.in PLUGIN_FILE_CONTENT)
- STRING (REGEX MATCH "MYSQL_PLUGIN_DYNAMIC" MYSQL_PLUGIN_DYNAMIC ${PLUGIN_FILE_CONTENT})
+ IF (PLUGIN_FILE_CONTENT MATCHES "MYSQL_PLUGIN_DYNAMIC\\(${ENGINE_LOWER}")
+ STRING (REGEX REPLACE
+ ".*MYSQL_PLUGIN_DYNAMIC\\(${ENGINE_LOWER},[ \\t]*\\[?([a-zA-Z0-9_]+/)*([a-zA-Z0-9_]+).*"
+ "\\2" MYSQL_PLUGIN_DYNAMIC ${PLUGIN_FILE_CONTENT})
+ ELSE (PLUGIN_FILE_CONTENT MATCHES "MYSQL_PLUGIN_DYNAMIC\\(${ENGINE_LOWER}")
+ SET (MYSQL_PLUGIN_DYNAMIC "")
+ ENDIF(PLUGIN_FILE_CONTENT MATCHES "MYSQL_PLUGIN_DYNAMIC\\(${ENGINE_LOWER}")
+ IF (PLUGIN_FILE_CONTENT MATCHES "MYSQL_PLUGIN_STATIC\\(${ENGINE_LOWER}")
+ STRING (REGEX REPLACE
+ ".*MYSQL_PLUGIN_STATIC\\(${ENGINE_LOWER},[ \\t]*\\[?([a-zA-Z0-9_]+/)*([a-zA-Z0-9_]+).*"
+ "\\2"
+ MYSQL_PLUGIN_STATIC ${PLUGIN_FILE_CONTENT})
+ ELSE (PLUGIN_FILE_CONTENT MATCHES "MYSQL_PLUGIN_STATIC\\(${ENGINE_LOWER}")
+ SET (MYSQL_PLUGIN_STATIC "")
+ ENDIF(PLUGIN_FILE_CONTENT MATCHES "MYSQL_PLUGIN_STATIC\\(${ENGINE_LOWER}")
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)
ENDIF(MYSQL_PLUGIN_MANDATORY)
@@ -359,15 +363,17 @@ FOREACH(SUBDIR ${STORAGE_SUBDIRS})
ENDIF(WITH_${ENGINE}_STORAGE_ENGINE AND MYSQL_PLUGIN_STATIC)
IF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
- SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_${PLUGIN_NAME}_plugin")
- SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${PLUGIN_NAME})
+ SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_${ENGINE_LOWER}_plugin")
+ SET (MYSQLD_STATIC_ENGINE_LIBS ${MYSQLD_STATIC_ENGINE_LIBS} ${MYSQL_PLUGIN_STATIC})
+ SET (MYSQLD_STATIC_ENGINES ${MYSQLD_STATIC_ENGINES} ${ENGINE})
SET (STORAGE_ENGINE_DEFS "${STORAGE_ENGINE_DEFS} -DWITH_${ENGINE}_STORAGE_ENGINE")
SET (WITH_${ENGINE}_STORAGE_ENGINE TRUE)
- SET (${ENGINE}_DIR ${DIRNAME})
+ SET (${ENGINE}_DIR ${SUBDIR})
ENDIF (ENGINE_BUILD_TYPE STREQUAL "STATIC")
ENDIF(EXISTS ${SUBDIR}/plug.in)
IF(NOT ENGINE_BUILD_TYPE STREQUAL "NONE")
+ SET (${ENGINE}_LIB ${MYSQL_PLUGIN_${ENGINE_BUILD_TYPE}})
LIST(APPEND ${ENGINE_BUILD_TYPE}_ENGINE_DIRECTORIES ${SUBDIR})
ENDIF(NOT ENGINE_BUILD_TYPE STREQUAL "NONE")