diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | cmake/CMakeLis.txt | 0 | ||||
-rw-r--r-- | cmake/bison.cmake | 20 | ||||
-rw-r--r-- | cmake/install_macros.cmake | 64 | ||||
-rw-r--r-- | cmake/plugin.cmake | 4 | ||||
-rw-r--r-- | cmake/sign.cmake.in | 18 | ||||
-rw-r--r-- | extra/yassl/CMakeLists.txt | 5 | ||||
-rw-r--r-- | extra/yassl/taocrypt/CMakeLists.txt | 4 | ||||
-rw-r--r-- | libmysqld/CMakeLists.txt | 9 | ||||
-rw-r--r-- | sql/CMakeLists.txt | 79 | ||||
-rw-r--r-- | strings/CMakeLists.txt | 4 | ||||
-rw-r--r-- | vio/CMakeLists.txt | 4 | ||||
-rw-r--r-- | zlib/CMakeLists.txt | 5 |
13 files changed, 103 insertions, 119 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index df4ac556726..11874650d18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -492,6 +492,12 @@ ENDIF() INCLUDE(CPack) +IF(WIN32 AND SIGNCODE) + # Configure post-install script for authenticode signing + CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/sign.cmake.in sign.cmake @ONLY) + INSTALL(SCRIPT ${PROJECT_BINARY_DIR}/sign.cmake) +ENDIF() + IF(NON_DISTRIBUTABLE_WARNING) MESSAGE(WARNING " You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.") diff --git a/cmake/CMakeLis.txt b/cmake/CMakeLis.txt new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/cmake/CMakeLis.txt diff --git a/cmake/bison.cmake b/cmake/bison.cmake index d5c725fbbde..0892a213d04 100644 --- a/cmake/bison.cmake +++ b/cmake/bison.cmake @@ -47,6 +47,21 @@ MACRO (RUN_BISON input_yy output_cc output_h) ENDIF() ENDIF() IF(BISON_USABLE) + # Workaround for VS regenerating output even + # when outputs are up-to-date. At least, fix output timestamp + # after build so that files that depend on generated header are + # not rebuilt. + IF(CMAKE_GENERATOR MATCHES "Visual Studio") + FIND_PROGRAM(TOUCH_EXECUTABLE touch DOC "Path to touch executable" + PATHS "C:/Program Files/Git/usr/bin" + "C:/Program Files (x86)/Git/usr/bin") + IF(TOUCH_EXECUTABLE) + SET(VS_FIX_OUTPUT_TIMESTAMPS + COMMAND ${TOUCH_EXECUTABLE} -r ${input_yy} ${output_cc} + COMMAND ${TOUCH_EXECUTABLE} -r ${input_yy} ${output_h}) + ENDIF() + ENDIF() + ADD_CUSTOM_COMMAND( OUTPUT ${output_cc} ${output_h} @@ -54,8 +69,9 @@ MACRO (RUN_BISON input_yy output_cc output_h) --output=${output_cc} --defines=${output_h} ${input_yy} - DEPENDS ${input_yy} - ) + ${VS_FIX_OUTPUT_TIMESTAMPS} + DEPENDS ${input_yy} + ) ELSE() # Bison is missing or not usable, e.g too old IF(EXISTS ${output_cc} AND EXISTS ${output_h}) diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 22a525d7344..7da8edd22eb 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -32,17 +32,8 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS) ENDIF() SET(targets ${ARG_DEFAULT_ARGS}) FOREACH(target ${targets}) - GET_TARGET_PROPERTY(type ${target} TYPE) - GET_TARGET_PROPERTY(location ${target} LOCATION) - STRING(REPLACE ".exe" ".pdb" pdb_location ${location}) - STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location}) - STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location}) - IF(CMAKE_GENERATOR MATCHES "Visual Studio") - STRING(REPLACE - "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" - pdb_location ${pdb_location}) - ENDIF() - + GET_TARGET_PROPERTY(target_type ${target} TYPE) + set(comp "") IF(ARG_COMPONENT STREQUAL "Server") IF(target MATCHES "mysqld" OR type MATCHES "MODULE") @@ -62,11 +53,9 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS) IF(NOT comp) SET(comp Debuginfo_archive_only) # not in MSI ENDIF() - IF(type MATCHES "STATIC") - # PDB for static libraries might be unsupported http://public.kitware.com/Bug/view.php?id=14600 - SET(opt OPTIONAL) - ENDIF() - INSTALL(FILES ${pdb_location} DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp} ${opt}) + IF(NOT target_type MATCHES "STATIC") + INSTALL(FILES $<TARGET_PDB_FILE:${target}> DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp}) + ENDIF() ENDFOREACH() ENDIF() ENDFUNCTION() @@ -218,37 +207,22 @@ IF(WIN32) ENDIF() ENDIF() -MACRO(SIGN_TARGET) - MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN}) - SET(target ${ARG_DEFAULT_ARGS}) - IF(ARG_COMPONENT) - SET(comp COMPONENT ${ARG_COMPONENT}) - ELSE() - SET(comp) - ENDIF() - GET_TARGET_PROPERTY(target_type ${target} TYPE) - IF(target_type AND NOT target_type MATCHES "STATIC") - GET_TARGET_PROPERTY(target_location ${target} LOCATION) - IF(CMAKE_GENERATOR MATCHES "Visual Studio") - STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" - target_location ${target_location}) - ENDIF() - INSTALL(CODE - "EXECUTE_PROCESS(COMMAND - \"${SIGNTOOL_EXECUTABLE}\" verify /pa /q \"${target_location}\" - RESULT_VARIABLE ERR) - IF(NOT \${ERR} EQUAL 0) - EXECUTE_PROCESS(COMMAND - \"${SIGNTOOL_EXECUTABLE}\" sign ${SIGNTOOL_PARAMETERS} \"${target_location}\" - RESULT_VARIABLE ERR) + +FUNCTION(SIGN_TARGET target) + IF(NOT SIGNCODE) + RETURN() ENDIF() - IF(NOT \${ERR} EQUAL 0) - MESSAGE(FATAL_ERROR \"Error signing '${target_location}'\") + GET_TARGET_PROPERTY(target_type ${target} TYPE) + IF((NOT target_type) OR (target_type MATCHES "STATIC")) + RETURN() ENDIF() - " ${comp}) - ENDIF() -ENDMACRO() - + # Mark executable for signing by creating empty *.signme file + # The actual signing happens in preinstall step + # (which traverses + ADD_CUSTOM_COMMAND(TARGET ${target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E touch "$<TARGET_FILE:${target}>.signme" + ) +ENDFUNCTION() # Installs targets, also installs pdbs on Windows. # diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index ba7bac837b1..f14edf0cd20 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -200,7 +200,9 @@ MACRO(MYSQL_ADD_PLUGIN) OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}") # Install dynamic library IF(ARG_COMPONENT) - IF(CPACK_COMPONENTS_ALL AND NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT}) + IF(CPACK_COMPONENTS_ALL AND NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT} + AND INSTALL_SYSCONF2DIR) + IF (ARG_STORAGE_ENGINE) SET(ver " = %{version}-%{release}") ENDIF() diff --git a/cmake/sign.cmake.in b/cmake/sign.cmake.in new file mode 100644 index 00000000000..61ae38d152d --- /dev/null +++ b/cmake/sign.cmake.in @@ -0,0 +1,18 @@ +FILE(GLOB_RECURSE files "@CMAKE_BINARY_DIR@/*.signme") +MESSAGE(STATUS "signing files") +FOREACH(f ${files}) + STRING(REPLACE ".signme" "" exe_location "${f}") + + string (REPLACE ";" " " params "@SIGNTOOL_PARAMETERS@") + #MESSAGE("@SIGNTOOL_EXECUTABLE@" sign ${params} "${exe_location}") + + EXECUTE_PROCESS(COMMAND + "@SIGNTOOL_EXECUTABLE@" sign @SIGNTOOL_PARAMETERS@ "${exe_location}" + RESULT_VARIABLE ERR) + IF(NOT ${ERR} EQUAL 0) + MESSAGE( "Error ${ERR} signing ${exe_location}") + ELSE() + FILE(REMOVE ${f}) + ENDIF() + +ENDFOREACH() diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt index f3232896c6a..c456af9be15 100644 --- a/extra/yassl/CMakeLists.txt +++ b/extra/yassl/CMakeLists.txt @@ -30,8 +30,3 @@ SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp sr ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES}) RESTRICT_SYMBOL_EXPORTS(yassl) -IF(MSVC) - INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug) -ENDIF() - - diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt index eeed35fd6f4..7d95348c6e7 100644 --- a/extra/yassl/taocrypt/CMakeLists.txt +++ b/extra/yassl/taocrypt/CMakeLists.txt @@ -32,7 +32,3 @@ SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES}) RESTRICT_SYMBOL_EXPORTS(taocrypt) -IF(MSVC) - INSTALL_DEBUG_TARGET(taocrypt DESTINATION ${INSTALL_LIBDIR}/debug) -ENDIF() - diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 7c01e4af9dc..bf585f74f63 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -152,15 +152,6 @@ MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS} INSTALL(FILES embedded_priv.h DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT ${COMPONENT_MYSQLSERVER}) -# Visual Studio users need debug static library -IF(MSVC) - INSTALL_DEBUG_TARGET(mysqlserver DESTINATION ${INSTALL_LIBDIR}/debug) -ENDIF() - -IF(UNIX) - INSTALL_DEBUG_TARGET(mysqlserver DESTINATION ${INSTALL_LIBDIR} RENAME - ${CMAKE_STATIC_LIBRARY_PREFIX}mysqld-debug) -ENDIF() # List of exported functions in embedded (client api except client plugin or # async (*_start/*_cont functions) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index ca2b059eeef..846df00498f 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -26,24 +26,13 @@ ${CMAKE_BINARY_DIR}/sql 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 @@ -53,7 +42,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) @@ -122,7 +111,6 @@ SET (SQL_SOURCE table_cache.cc ${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc ${GEN_SOURCES} - ${GEN_DIGEST_SOURCES} ${MYSYS_LIBWRAP_SOURCE} ) @@ -143,7 +131,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} @@ -180,7 +167,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) @@ -191,25 +178,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() @@ -225,7 +232,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) @@ -239,7 +248,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 @@ -265,10 +273,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) @@ -302,7 +306,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) @@ -314,11 +318,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) diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt index 1e364bc951b..32a3f06c861 100644 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -35,7 +35,3 @@ ADD_CONVENIENCE_LIBRARY(strings ${STRINGS_SOURCES}) ADD_EXECUTABLE(conf_to_src EXCLUDE_FROM_ALL conf_to_src.c) TARGET_LINK_LIBRARIES(conf_to_src strings) - -IF(MSVC) - INSTALL_DEBUG_TARGET(strings DESTINATION ${INSTALL_LIBDIR}/debug) -ENDIF() diff --git a/vio/CMakeLists.txt b/vio/CMakeLists.txt index 2fb82ef9dd2..cdb28799ada 100644 --- a/vio/CMakeLists.txt +++ b/vio/CMakeLists.txt @@ -20,7 +20,3 @@ ADD_DEFINITIONS(${SSL_DEFINES}) SET(VIO_SOURCES vio.c viosocket.c viossl.c viopipe.c vioshm.c viosslfactories.c) ADD_CONVENIENCE_LIBRARY(vio ${VIO_SOURCES}) TARGET_LINK_LIBRARIES(vio ${LIBSOCKET}) - -IF(MSVC) - INSTALL_DEBUG_TARGET(vio DESTINATION ${INSTALL_LIBDIR}/debug) -ENDIF() diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt index 7668ce723b8..dd1e45d4acf 100644 --- a/zlib/CMakeLists.txt +++ b/zlib/CMakeLists.txt @@ -22,8 +22,3 @@ SET(ZLIB_SOURCES adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio. zutil.c zutil.h) ADD_CONVENIENCE_LIBRARY(zlib ${ZLIB_SOURCES}) RESTRICT_SYMBOL_EXPORTS(zlib) - -IF(MSVC) - INSTALL_DEBUG_TARGET(zlib DESTINATION ${INSTALL_LIBDIR}/debug) -ENDIF() - |