diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2017-08-28 16:10:25 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2017-08-30 14:44:18 +0000 |
commit | 43b262af55db507320b165bb0f9abf05b2f05a89 (patch) | |
tree | dbad10bfd5bf0072c1d6392d16b065c321032278 | |
parent | 49f3fb8feb8552d1d914fecdbbdb006e3edb4a95 (diff) | |
download | mariadb-git-43b262af55db507320b165bb0f9abf05b2f05a89.tar.gz |
One more attempt to fix dependencies with mysqld import/export libraries
with Visual Studio
simplify logic, VS generator seems to have problems if generated file
(with ADD_CUSTOM_COMMAND) depends on another generated file.
So, the fix is just to have mysqld_lib.{def,lib,exp} to be generated in a
single ADD_CUSTOM_COMMAND rather than two steps.
-rw-r--r-- | cmake/create_initial_db.cmake.in | 4 | ||||
-rw-r--r-- | sql/CMakeLists.txt | 44 |
2 files changed, 29 insertions, 19 deletions
diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake.in index c77e28d882c..baa48847815 100644 --- a/cmake/create_initial_db.cmake.in +++ b/cmake/create_initial_db.cmake.in @@ -82,7 +82,3 @@ EXECUTE_PROCESS ( IF(NOT RESULT EQUAL 0) MESSAGE(FATAL_ERROR "Could not create initial database \n ${OUT} \n ${ERR}") ENDIF() - -EXECUTE_PROCESS ( - COMMAND "@CMAKE_COMMAND@" -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep -) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index eddbccfbb66..3b9da7ef150 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -225,23 +225,35 @@ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS) 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)) + 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) + ADD_CUSTOM_COMMAND( - OUTPUT ${MYSQLD_DEF} + OUTPUT ${MYSQLD_DEF} ${MYSQLD_LIB} ${MYSQLD_EXP} COMMAND cscript ARGS //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 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_LIBRARY(mysqld_import_lib UNKNOWN IMPORTED GLOBAL) SET_TARGET_PROPERTIES(mysqld_import_lib PROPERTIES IMPORTED_LOCATION ${MYSQLD_LIB}) @@ -258,7 +270,10 @@ 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) @@ -272,7 +287,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 @@ -408,15 +422,15 @@ IF(WIN32 AND MYSQLD_EXECUTABLE) ENDIF() MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data) ADD_CUSTOM_COMMAND( - OUTPUT initdb.dep - COMMAND ${CMAKE_COMMAND} - ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep + COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DEPENDS mysqld ) ADD_CUSTOM_TARGET(initial_database ALL - DEPENDS initdb.dep + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep ) INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION . COMPONENT DataFiles |