Commit b94d8621 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Build cleanups

- Simplify sql-bench installation, 
do not try to resolve names : this leads to probem
if builddir is symlink located on different filesystem.
(reported by alik)

- Make WITHOUT_XXX (disabling plugin) work for DEFAULT
plugins. Prior to the patch is behaved just like 
MANDATORY.

- LINK_LIBRARIES in MYSQL_ADD_PLUGIN had no effect for
statically linked plugins.

- Fix constant rebuild of initdb target on Windows.
parent f2f65eef
...@@ -46,7 +46,8 @@ OPTION(COMMUNITY_BUILD "Set to true if this is a community build" ON) ...@@ -46,7 +46,8 @@ OPTION(COMMUNITY_BUILD "Set to true if this is a community build" ON)
SET(MANUFACTURER_DOCSTRING SET(MANUFACTURER_DOCSTRING
"Set the entity that appears as the manufacturer of packages that support a manufacturer field.") "Set the entity that appears as the manufacturer of packages that support a manufacturer field.")
IF(NOT DEFINED MANUFACTURER) IF(NOT DEFINED MANUFACTURER)
SET(MANUFACTURER "Built from Source" CACHE BOOL ${MANUFACTURER_DOCSTRING}) SET(MANUFACTURER "Built from Source" CACHE STRING ${MANUFACTURER_DOCSTRING})
MARK_AS_ADVANCED(MANUFACTURER)
ENDIF() ENDIF()
# We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug # We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug
......
...@@ -57,11 +57,17 @@ MACRO(MYSQL_ADD_PLUGIN) ...@@ -57,11 +57,17 @@ MACRO(MYSQL_ADD_PLUGIN)
SET(WITHOUT_NDBCLUSTER 1) SET(WITHOUT_NDBCLUSTER 1)
ENDIF() ENDIF()
IF(ARG_DEFAULT)
IF(NOT DEFINED WITH_${plugin} AND
NOT DEFINED WITH_${plugin}_STORAGE_ENGINE)
SET(WITH_${plugin} 1)
ENDIF()
ENDIF()
IF(WITH_${plugin}_STORAGE_ENGINE IF(WITH_${plugin}_STORAGE_ENGINE
OR WITH_{$plugin} OR WITH_{$plugin}
OR WITH_ALL OR WITH_ALL
OR WITH_MAX OR WITH_MAX
OR ARG_DEFAULT
AND NOT WITHOUT_${plugin}_STORAGE_ENGINE AND NOT WITHOUT_${plugin}_STORAGE_ENGINE
AND NOT WITHOUT_${plugin} AND NOT WITHOUT_${plugin}
AND NOT ARG_MODULE_ONLY) AND NOT ARG_MODULE_ONLY)
...@@ -88,6 +94,7 @@ MACRO(MYSQL_ADD_PLUGIN) ...@@ -88,6 +94,7 @@ MACRO(MYSQL_ADD_PLUGIN)
IF(NOT ARG_DEPENDENCIES) IF(NOT ARG_DEPENDENCIES)
SET(ARG_DEPENDENCIES) SET(ARG_DEPENDENCIES)
ENDIF() ENDIF()
SET(BUILD_PLUGIN 1)
# Build either static library or module # Build either static library or module
IF (WITH_${plugin} AND NOT ARG_MODULE_ONLY) IF (WITH_${plugin} AND NOT ARG_MODULE_ONLY)
ADD_LIBRARY(${target} STATIC ${SOURCES}) ADD_LIBRARY(${target} STATIC ${SOURCES})
...@@ -148,9 +155,6 @@ MACRO(MYSQL_ADD_PLUGIN) ...@@ -148,9 +155,6 @@ MACRO(MYSQL_ADD_PLUGIN)
DTRACE_INSTRUMENT(${target}) DTRACE_INSTRUMENT(${target})
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX "" SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN") COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
IF(ARG_LINK_LIBRARIES)
TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
ENDIF()
TARGET_LINK_LIBRARIES (${target} mysqlservices) TARGET_LINK_LIBRARIES (${target} mysqlservices)
# Plugin uses symbols defined in mysqld executable. # Plugin uses symbols defined in mysqld executable.
...@@ -165,17 +169,30 @@ MACRO(MYSQL_ADD_PLUGIN) ...@@ -165,17 +169,30 @@ MACRO(MYSQL_ADD_PLUGIN)
ENDIF() ENDIF()
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
IF(NOT ARG_MODULE_ONLY) IF(NOT ARG_MODULE_ONLY)
# set cached variable, e.g with checkbox in GUI # set cached variable, e.g with checkbox in GUI
SET(${with_var} OFF CACHE BOOL "Link ${plugin} statically to the server" SET(${with_var} OFF CACHE BOOL "Link ${plugin} statically to the server"
FORCE) FORCE)
ENDIF() ENDIF()
SET_TARGET_PROPERTIES(${target} PROPERTIES SET_TARGET_PROPERTIES(${target} PROPERTIES
OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}") OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}")
# Install dynamic library # Install dynamic library
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT Server) MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT Server)
INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug) INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug)
ELSE()
IF(WITHOUT_${plugin})
# Update cache variable
STRING(REPLACE "WITH_" "WITHOUT_" without_var ${with_var})
SET(${without_var} ON CACHE BOOL "Don't build ${plugin}"
FORCE)
ENDIF()
SET(BUILD_PLUGIN 0)
ENDIF() ENDIF()
IF(BUILD_PLUGIN AND ARG_LINK_LIBRARIES)
TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
ENDIF()
ENDMACRO() ENDMACRO()
......
...@@ -24,6 +24,7 @@ ENDIF() ...@@ -24,6 +24,7 @@ ENDIF()
# Build mysql_fix_privilege_tables.sql (concatenate 2 sql scripts) # Build mysql_fix_privilege_tables.sql (concatenate 2 sql scripts)
IF(NOT WIN32 OR CMAKE_CROSSCOMPILING) IF(NOT WIN32 OR CMAKE_CROSSCOMPILING)
FIND_PROGRAM(CAT_EXECUTABLE cat DOC "path to the executable") FIND_PROGRAM(CAT_EXECUTABLE cat DOC "path to the executable")
MARK_AS_ADVANCED(CAT_EXECUTABLE)
ENDIF() ENDIF()
IF(CAT_EXECUTABLE) IF(CAT_EXECUTABLE)
......
...@@ -14,12 +14,6 @@ ...@@ -14,12 +14,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Install sql-bench files # Install sql-bench files
FILE(GLOB all_files
${CMAKE_SOURCE_DIR}/sql-bench/*
${CMAKE_SOURCE_DIR}/sql-bench/Data/ATIS/*
${CMAKE_SOURCE_DIR}/sql-bench/Data/Wisconsin/*
${CMAKE_SOURCE_DIR}/sql-bench/limits/*
)
IF(NOT INSTALL_SQLBENCHDIR) IF(NOT INSTALL_SQLBENCHDIR)
RETURN() RETURN()
...@@ -31,30 +25,39 @@ ELSE() ...@@ -31,30 +25,39 @@ ELSE()
SET(prefix ${INSTALL_SQLBENCHDIR}/) SET(prefix ${INSTALL_SQLBENCHDIR}/)
ENDIF() ENDIF()
GET_FILENAME_COMPONENT(basedir ${CMAKE_SOURCE_DIR} ABSOLUTE) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Data/ATIS
DESTINATION ${prefix}sql-bench/Data)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Data/Wisconsin
DESTINATION ${prefix}sql-bench/Data)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/limits
DESTINATION ${prefix}sql-bench)
FILE(GLOB all_files ${CMAKE_CURRENT_SOURCE_DIR}/*)
FOREACH(file ${all_files}) FOREACH(file ${all_files})
IF(NOT IS_DIRECTORY ${file} AND NOT ${file} MATCHES "Make|as3ap|/example$" ) IF(NOT IS_DIRECTORY ${file} AND NOT ${file} MATCHES "Make|as3ap|/example$" )
FILE(RELATIVE_PATH relpath ${basedir} ${file})
SET(target_relpath ${relpath})
GET_FILENAME_COMPONENT(ext ${file} EXT) GET_FILENAME_COMPONENT(ext ${file} EXT)
GET_FILENAME_COMPONENT(dir ${relpath} PATH) GET_FILENAME_COMPONENT(name ${file} NAME)
SET(target ${name})
IF(ext MATCHES ".sh$") IF(ext MATCHES ".sh$")
# Those are perl files actually # Those are perl files actually
STRING(REPLACE ".sh" "" target_relpath ${target_relpath} ) STRING(REPLACE ".sh" "" target ${target} )
IF(WIN32) IF(WIN32)
IF(NOT ext MATCHES ".pl") IF(NOT ext MATCHES ".pl")
SET(target_relpath "${target_relpath}.pl") SET(target "${target}.pl")
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()
SET(target "${CMAKE_BINARY_DIR}/${target_relpath}") SET(target "${CMAKE_CURRENT_BINARY_DIR}/${target}")
CONFIGURE_FILE(${file} ${target} COPYONLY) CONFIGURE_FILE(${file} ${target} COPYONLY)
IF (ext MATCHES ".bat") IF (ext MATCHES ".bat")
IF(WIN32) IF(WIN32)
INSTALL(FILES ${target} DESTINATION ${prefix}${dir}) INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench)
ENDIF() ENDIF()
ELSE() ELSE()
INSTALL(FILES ${target} DESTINATION ${prefix}${dir}) INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench)
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDFOREACH() ENDFOREACH()
...@@ -42,7 +42,6 @@ SET (SQL_SOURCE ...@@ -42,7 +42,6 @@ SET (SQL_SOURCE
../sql-common/client.c derror.cc des_key_file.cc ../sql-common/client.c derror.cc des_key_file.cc
discover.cc ../libmysql/errmsg.c field.cc field_conv.cc discover.cc ../libmysql/errmsg.c field.cc field_conv.cc
filesort.cc gstream.cc sha2.cc filesort.cc gstream.cc sha2.cc
ha_partition.cc
handler.cc hash_filo.h sql_plugin_services.h handler.cc hash_filo.h sql_plugin_services.h
hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
item_create.cc item_func.cc item_geofunc.cc item_row.cc item_create.cc item_func.cc item_geofunc.cc item_row.cc
...@@ -266,18 +265,20 @@ IF(WIN32 AND MYSQLD_EXECUTABLE) ...@@ -266,18 +265,20 @@ IF(WIN32 AND MYSQLD_EXECUTABLE)
ENDIF() ENDIF()
MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data) MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data)
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm OUTPUT initdb.dep
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data
COMMAND ${CMAKE_COMMAND} -E touch initdb.dep
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS mysqld DEPENDS mysqld
) )
ADD_CUSTOM_TARGET(initial_database ADD_CUSTOM_TARGET(initial_database
ALL ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm DEPENDS initdb.dep
) )
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION . COMPONENT DataFiles INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION .
PATTERN "bootstrap.sql" EXCLUDE) COMPONENT DataFiles PATTERN "initdb.dep" EXCLUDE PATTERN "bootstrap.sql" EXCLUDE)
ELSE() ELSE()
# Not windows or cross compiling, just install an empty directory # Not windows or cross compiling, just install an empty directory
INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql) INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment