Commit ff1ee261 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 1eb9375a
......@@ -46,7 +46,8 @@ OPTION(COMMUNITY_BUILD "Set to true if this is a community build" ON)
SET(MANUFACTURER_DOCSTRING
"Set the entity that appears as the manufacturer of packages that support a manufacturer field.")
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()
# We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug
......
......@@ -57,11 +57,17 @@ MACRO(MYSQL_ADD_PLUGIN)
SET(WITHOUT_NDBCLUSTER 1)
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
OR WITH_{$plugin}
OR WITH_ALL
OR WITH_MAX
OR ARG_DEFAULT
AND NOT WITHOUT_${plugin}_STORAGE_ENGINE
AND NOT WITHOUT_${plugin}
AND NOT ARG_MODULE_ONLY)
......@@ -88,6 +94,7 @@ MACRO(MYSQL_ADD_PLUGIN)
IF(NOT ARG_DEPENDENCIES)
SET(ARG_DEPENDENCIES)
ENDIF()
SET(BUILD_PLUGIN 1)
# Build either static library or module
IF (WITH_${plugin} AND NOT ARG_MODULE_ONLY)
ADD_LIBRARY(${target} STATIC ${SOURCES})
......@@ -148,9 +155,6 @@ MACRO(MYSQL_ADD_PLUGIN)
DTRACE_INSTRUMENT(${target})
SET_TARGET_PROPERTIES (${target} PROPERTIES PREFIX ""
COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN")
IF(ARG_LINK_LIBRARIES)
TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
ENDIF()
TARGET_LINK_LIBRARIES (${target} mysqlservices)
# Plugin uses symbols defined in mysqld executable.
......@@ -175,7 +179,20 @@ MACRO(MYSQL_ADD_PLUGIN)
# Install dynamic library
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT Server)
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()
IF(BUILD_PLUGIN AND ARG_LINK_LIBRARIES)
TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
ENDIF()
ENDMACRO()
......
......@@ -24,6 +24,7 @@ ENDIF()
# Build mysql_fix_privilege_tables.sql (concatenate 2 sql scripts)
IF(NOT WIN32 OR CMAKE_CROSSCOMPILING)
FIND_PROGRAM(CAT_EXECUTABLE cat DOC "path to the executable")
MARK_AS_ADVANCED(CAT_EXECUTABLE)
ENDIF()
IF(CAT_EXECUTABLE)
......
......@@ -14,12 +14,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# 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)
RETURN()
......@@ -31,30 +25,39 @@ ELSE()
SET(prefix ${INSTALL_SQLBENCHDIR}/)
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})
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(dir ${relpath} PATH)
GET_FILENAME_COMPONENT(name ${file} NAME)
SET(target ${name})
IF(ext MATCHES ".sh$")
# Those are perl files actually
STRING(REPLACE ".sh" "" target_relpath ${target_relpath} )
STRING(REPLACE ".sh" "" target ${target} )
IF(WIN32)
IF(NOT ext MATCHES ".pl")
SET(target_relpath "${target_relpath}.pl")
SET(target "${target}.pl")
ENDIF()
ENDIF()
ENDIF()
SET(target "${CMAKE_BINARY_DIR}/${target_relpath}")
SET(target "${CMAKE_CURRENT_BINARY_DIR}/${target}")
CONFIGURE_FILE(${file} ${target} COPYONLY)
IF (ext MATCHES ".bat")
IF(WIN32)
INSTALL(FILES ${target} DESTINATION ${prefix}${dir})
INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench)
ENDIF()
ELSE()
INSTALL(FILES ${target} DESTINATION ${prefix}${dir})
INSTALL(FILES ${target} DESTINATION ${prefix}sql-bench)
ENDIF()
ENDIF()
ENDFOREACH()
......@@ -42,7 +42,6 @@ SET (SQL_SOURCE
../sql-common/client.c derror.cc des_key_file.cc
discover.cc ../libmysql/errmsg.c field.cc field_conv.cc
filesort.cc gstream.cc sha2.cc
ha_partition.cc
handler.cc hash_filo.h sql_plugin_services.h
hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
item_create.cc item_func.cc item_geofunc.cc item_row.cc
......@@ -266,18 +265,20 @@ IF(WIN32 AND MYSQLD_EXECUTABLE)
ENDIF()
MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm
OUTPUT initdb.dep
COMMAND ${CMAKE_COMMAND}
${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data
COMMAND ${CMAKE_COMMAND} -E touch initdb.dep
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS mysqld
)
ADD_CUSTOM_TARGET(initial_database
ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm
DEPENDS initdb.dep
)
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION . COMPONENT DataFiles
PATTERN "bootstrap.sql" EXCLUDE)
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION .
COMPONENT DataFiles PATTERN "initdb.dep" EXCLUDE PATTERN "bootstrap.sql" EXCLUDE)
ELSE()
# Not windows or cross compiling, just install an empty directory
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