diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-09-19 12:06:50 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-09-19 12:06:50 +0300 |
commit | ec6042bda097fa53c43caf4a1acc32c5a77f6ed4 (patch) | |
tree | 751af6227789bfa916a6de426542a966845c8cd1 /sql/CMakeLists.txt | |
parent | ba0ee91077d9b89296328892aa5d5d293f4e0fb1 (diff) | |
parent | b337a0682943fa7e055380b7859762acf7fb588c (diff) | |
download | mariadb-git-ec6042bda097fa53c43caf4a1acc32c5a77f6ed4.tar.gz |
Merge branch '10.0' into 10.1
Diffstat (limited to 'sql/CMakeLists.txt')
-rw-r--r-- | sql/CMakeLists.txt | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index c34b22c4175..ee0b899eac0 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -48,24 +48,13 @@ ${WSREP_INCLUDES} SET(GEN_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc -${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h -) -SET(GEN_DIGEST_SOURCES - ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h +${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h +${CMAKE_CURRENT_BINARY_DIR}/lex_token.h ) SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} - ${GEN_DIGEST_SOURCES} PROPERTIES GENERATED 1) -# Gen_lex_token -# Make sure sql_yacc.h is generated before compiling gen_lex_token - -IF(NOT CMAKE_GENERATOR MATCHES "Visual Studio") - SET(DEPENDS_gen_lex_token DEPENDS gen_lex_token) - SET(DEPENDS_gen_lex_hash DEPENDS gen_lex_hash) -ENDIF() - IF(NOT CMAKE_CROSSCOMPILING) ADD_EXECUTABLE(gen_lex_token gen_lex_token.cc @@ -75,7 +64,7 @@ ENDIF() ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h COMMAND gen_lex_token > lex_token.h - ${DEPENDS_gen_lex_token} + DEPENDS gen_lex_token ) ADD_DEFINITIONS(-DMYSQL_SERVER -DHAVE_EVENT_SCHEDULER) @@ -148,7 +137,6 @@ SET (SQL_SOURCE table_cache.cc encryption.cc ${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc ${GEN_SOURCES} - ${GEN_DIGEST_SOURCES} ${MYSYS_LIBWRAP_SOURCE} ) @@ -169,7 +157,6 @@ RECOMPILE_FOR_EMBEDDED) ADD_LIBRARY(sql STATIC ${SQL_SOURCE}) ADD_DEPENDENCIES(sql GenServerSource) -ADD_DEPENDENCIES(sql GenDigestServerSource) DTRACE_INSTRUMENT(sql) TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} mysys mysys_ssl dbug strings vio pcre ${LIBJEMALLOC} @@ -208,7 +195,7 @@ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS) SET(MYSQLD_DEF ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.def) SET(MYSQLD_EXP ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.exp) SET(MYSQLD_LIB ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.lib) - SET(MYSQLD_CORELIBS sql mysys mysys_ssl dbug strings) + SET(MYSQLD_CORELIBS sql mysys dbug strings) FOREACH (CORELIB ${MYSQLD_CORELIBS}) GET_TARGET_PROPERTY(LOC ${CORELIB} LOCATION) FILE(TO_NATIVE_PATH ${LOC} LOC) @@ -219,25 +206,45 @@ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS) IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(_PLATFORM x64) ENDIF() + # Create a cmake script to generate import and export libs + # from a .def file + SET(CMAKE_CONFIGURABLE_FILE_CONTENT " + IF ((mysqld_lib.def IS_NEWER_THAN mysqld_lib.lib) OR + (mysqld_lib.def IS_NEWER_THAN mysqld_lib.exp)) + FILE(REMOVE mysqld_lib.lib mysqld_lib.exp) + SET(ENV{VS_UNICODE_OUTPUT}) + EXECUTE_PROCESS ( + COMMAND \"${CMAKE_LINKER}\" /lib /NAME:mysqld.exe \"/DEF:${MYSQLD_DEF}\" /MACHINE:${_PLATFORM} + RESULT_VARIABLE ret) + IF(NOT ret EQUAL 0) + MESSAGE(FATAL_ERROR \"process failed ret=\${ret}\") + ENDIF() + ENDIF() + ") + + CONFIGURE_FILE( + ${PROJECT_SOURCE_DIR}/cmake/configurable_file_content.in + make_mysqld_lib.cmake) + + IF(CMAKE_VERSION VERSION_GREATER "3.2.0") + SET(MYSQLD_LIB_BYPRODUCTS BYPRODUCTS ${MYSQLD_DEF} ${MYSQLD_LIB} ${MYSQLD_EXP}) + ENDIF() ADD_CUSTOM_COMMAND( - OUTPUT ${MYSQLD_DEF} - COMMAND cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js - ${_PLATFORM} /forLib ${LIB_LOCATIONS} > mysqld_lib.def.tmp + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.stamp + ${MYSQLD_LIB_BYPRODUCTS} + COMMENT "Generating mysqld_lib.def, mysqld_lib.lib, mysqld_lib.exp" + COMMAND cscript //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js + ${_PLATFORM} /forLib ${LIB_LOCATIONS} > mysqld_lib.def.tmp COMMAND ${CMAKE_COMMAND} -E copy_if_different mysqld_lib.def.tmp mysqld_lib.def COMMAND ${CMAKE_COMMAND} -E remove mysqld_lib.def.tmp + COMMAND ${CMAKE_COMMAND} -P make_mysqld_lib.cmake + COMMAND ${CMAKE_COMMAND} -E touch mysqld_lib.stamp WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${MYSQLD_CORELIBS} ) - ADD_CUSTOM_COMMAND( - OUTPUT ${MYSQLD_LIB} - COMMAND lib - ARGS /NAME:mysqld.exe "/DEF:${MYSQLD_DEF}" "/MACHINE:${_PLATFORM}" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${MYSQLD_DEF} - ) - ADD_CUSTOM_TARGET(gen_mysqld_lib DEPENDS ${MYSQLD_LIB}) + ADD_CUSTOM_TARGET(gen_mysqld_lib DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.stamp) ADD_LIBRARY(mysqld_import_lib UNKNOWN IMPORTED GLOBAL) SET_TARGET_PROPERTIES(mysqld_import_lib PROPERTIES IMPORTED_LOCATION ${MYSQLD_LIB}) ENDIF() @@ -253,7 +260,9 @@ IF(APPLE) ENDIF() IF(NOT WITHOUT_DYNAMIC_PLUGINS) - SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) + IF(NOT MSVC) + SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) + ENDIF() GET_TARGET_PROPERTY(mysqld_link_flags mysqld LINK_FLAGS) IF(NOT mysqld_link_flags) SET(mysqld_link_flags) @@ -267,7 +276,6 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS) ENDIF() ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS) -SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) TARGET_LINK_LIBRARIES(mysqld sql) # Provide plugins with minimal set of libraries @@ -293,10 +301,6 @@ IF(WITH_MYSQLD_LDFLAGS) SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}") ENDIF() -INSTALL_DEBUG_TARGET(mysqld - DESTINATION ${INSTALL_SBINDIR} - PDB_DESTINATION ${INSTALL_SBINDIR}/debug - RENAME mysqld-debug) INCLUDE(${CMAKE_SOURCE_DIR}/cmake/bison.cmake) @@ -330,7 +334,7 @@ ENDIF() ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h COMMAND gen_lex_hash > lex_hash.h - ${DEPENDS_gen_lex_hash} + DEPENDS gen_lex_hash ) MYSQL_ADD_EXECUTABLE(mysql_tzinfo_to_sql tztime.cc COMPONENT Server) @@ -342,11 +346,6 @@ ADD_CUSTOM_TARGET( DEPENDS ${GEN_SOURCES} ) -ADD_CUSTOM_TARGET( - GenDigestServerSource - DEPENDS ${GEN_DIGEST_SOURCES} -) - #Need this only for embedded SET_TARGET_PROPERTIES(GenServerSource PROPERTIES EXCLUDE_FROM_ALL TRUE) |