diff --git a/win/packaging/CMakeLists.txt b/win/packaging/CMakeLists.txt index d11053fa1dd..2c8f0c309eb 100644 --- a/win/packaging/CMakeLists.txt +++ b/win/packaging/CMakeLists.txt @@ -13,95 +13,99 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -IF(NOT WIN32) - RETURN() +SET(CAN_BUILD_MSI 1) +MACRO(CANT_BUILD_MSI reason) + IF(BUILD_RELEASE) + MESSAGE(FATAL_ERROR "Can't build MSI package - ${reason}") + ENDIF() + SET(CAN_BUILD_MSI 0) +ENDMACRO() + +IF (NOT CMAKE_C_COMPILER_ARCHITECTURE_ID) + CANT_BUILD_MSI("Can't determine compiler architecture") ENDIF() -IF(MSVC_VERSION LESS 1600) - RETURN() -ENDIF() -SET(MANUFACTURER "MariaDB Corporation Ab") +STRING(TOLOWER "${CMAKE_C_COMPILER_ARCHITECTURE_ID}" WIX_ARCH) + SET(WIX_BIN_PATHS) -FOREACH(WIX_VER 3.9 3.10 3.11) +FOREACH(WIX_VER 3.14 3.13 3.12 3.11) LIST(APPEND WIX_BIN_PATHS "$ENV{ProgramFiles}/WiX Toolset v${WIX_VER}/bin") LIST(APPEND WIX_BIN_PATHS "$ENV{ProgramFiles} (x86)/WiX Toolset v${WIX_VER}/bin") ENDFOREACH() - FIND_PATH(WIX_DIR heat.exe ${WIX_BIN_PATHS}) -SET(CPACK_WIX_PACKAGE_BASE_NAME "MariaDB") -IF(CMAKE_SIZEOF_VOID_P EQUAL 4) - SET(CPACK_WIX_UPGRADE_CODE "49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3") - SET(CPACK_WIX_PACKAGE_NAME "MariaDB ${MAJOR_VERSION}.${MINOR_VERSION}") -ELSE() - SET(CPACK_WIX_UPGRADE_CODE "2331E7BD-EE58-431B-9E18-B2B918BCEB1B") - SET(CPACK_WIX_PACKAGE_NAME "MariaDB ${MAJOR_VERSION}.${MINOR_VERSION} (x64)") -ENDIF() - -IF(WIX_DIR) -IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(WIX_ARCH_SUFFIX "x64") -ELSE() - SET(WIX_ARCH_SUFFIX "x86") -ENDIF() -# Need some Wix SDK libraries to link with customaction -IF(MSVC_VERSION EQUAL 1600 OR MSVC_VERSION EQUAL 1700 ) - SET(WIX_MSVC_SUFFIX "VS2010") -ELSEIF(MSVC_VERSION EQUAL 1800) - SET(WIX_MSVC_SUFFIX "VS2013") -ELSE() - SET(WIX_MSVC_SUFFIX "VS2015") +IF(NOT WIX_DIR) + CANT_BUILD_MSI("WiX version 3.11 or later not found") ENDIF() -FIND_LIBRARY(WIX_WCAUTIL_LIBRARY - NAMES wcautil${WIX_ARCH_SUFFIX} wcautil${WIX_MSVC_SUFFIX}${WIX_ARCH_SUFFIX} +GET_FILENAME_COMPONENT(WIX_SDK_DIR ../SDK/ ABSOLUTE BASE_DIR ${WIX_DIR} CACHE) +FIND_LIBRARY(WIX_WCAUTIL_LIBRARY wcautil - PATHS - ${WIX_DIR}/../SDK/${WIX_MSVC_SUFFIX}/lib/${WIX_ARCH_SUFFIX} + PATHS + ${WIX_SDK_DIR}/VS2017/lib/${WIX_ARCH} + ${WIX_SDK_DIR}/VS2015/lib/${WIX_ARCH} ) +IF(NOT WIX_WCAUTIL_LIBRARY) + CANT_BUILD_MSI("wcautil.lib not found for ${WIX_ARCH}") +ENDIF() + FIND_LIBRARY(WIX_DUTIL_LIBRARY - NAMES dutil${WIX_ARCH_SUFFIX} dutil PATHS - ${WIX_DIR}/../SDK/${WIX_MSVC_SUFFIX}/lib/${WIX_ARCH_SUFFIX} + ${WIX_SDK_DIR}/VS2017/lib/${WIX_ARCH} + ${WIX_SDK_DIR}/VS2015/lib/${WIX_ARCH} ) -ENDIF() IF(NOT WIX_DUTIL_LIBRARY) - MESSAGE(STATUS "Cannot find wix 3, installer project will not be generated") - IF(BUILD_RELEASE) - MESSAGE(FATAL_ERROR - "Can't find Wix. It is necessary for producing official package") - ENDIF() - RETURN() + CANT_BUILD_MSI("dutil.lib not found for ${WIX_ARCH}") ENDIF() -ADD_SUBDIRECTORY(ca) - -# extra.wxs.in needs DATADIR_MYSQL_FILES and DATADIR_PERFORMANCE_SCHEMA_FILES, i.e -# Wix-compatible file lists for ${builddir}\sql\data\{mysql,performance_schema} - -FOREACH(dir mysql performance_schema) - FILE(GLOB files ${CMAKE_BINARY_DIR}/sql/data/${dir}/*) - SET(filelist) - FOREACH(f ${files}) - IF(NOT f MATCHES ".rule") - FILE(TO_NATIVE_PATH "${f}" file_native_path) - GET_FILENAME_COMPONENT(file_name "${f}" NAME) - SET(filelist -"${filelist} -") - ENDIF() - ENDFOREACH() - STRING(TOUPPER ${dir} DIR_UPPER) - SET(DATADIR_${DIR_UPPER}_FILES "${filelist}") -ENDFOREACH() +FIND_PATH(WIX_INCLUDE_DIR + wcautil.h PATHS + ${WIX_SDK_DIR}/VS2017/inc + ${WIX_SDK_DIR}/VS2015/inc + ${WIX_SDK_DIR}/inc) +IF(NOT WIX_INCLUDE_DIR) + CANT_BUILD_MSI("wcautil.h not found for ${WIX_ARCH}") +ENDIF() FIND_PROGRAM(CANDLE_EXECUTABLE candle ${WIX_DIR}) +IF(NOT CANDLE_EXECUTABLE) + CANT_BUILD_MSI("candle.exe not found") +ENDIF() + FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR}) +IF(NOT LIGHT_EXECUTABLE) + CANT_BUILD_MSI("light.exe not found") +ENDIF() + +SET(CPACK_WIX_PACKAGE_BASE_NAME "MariaDB") + +SET(CPACK_WIX_UPGRADE_CODE_arm64 "5AA9B79C-643C-4151-811D-B6845AA5DB28") +SET(CPACK_WIX_UPGRADE_CODE_x86 "49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3") +SET(CPACK_WIX_UPGRADE_CODE_x64 "2331E7BD-EE58-431B-9E18-B2B918BCEB1B") + +SET(CPACK_WIX_UPGRADE_CODE ${CPACK_WIX_UPGRADE_CODE_${WIX_ARCH}}) +IF(NOT CPACK_WIX_UPGRADE_CODE) + MESSAGE_ONCE("unknown upgrade code for arch ${WIX_ARCH}") + CANT_BUILD_MSI("unknown upgrade code for arch ${WIX_ARCH}") +ENDIF() + +IF(WIX_ARCH STREQUAL "x86") + SET(CPACK_WIX_PACKAGE_NAME "MariaDB ${MAJOR_VERSION}.${MINOR_VERSION}") +ELSE() + SET(CPACK_WIX_PACKAGE_NAME "MariaDB ${MAJOR_VERSION}.${MINOR_VERSION} (${WIX_ARCH})") +ENDIF() + +IF(CAN_BUILD_MSI) + +ADD_SUBDIRECTORY(ca) +SET(MANUFACTURER "MariaDB Corporation Ab") + + # WiX wants the license text as rtf; if there is no rtf license, # we create a fake one from the plain text COPYING file. @@ -161,17 +165,6 @@ IF(THIRD_PARTY_FEATURE_CONDITION) SET(THIRD_PARTY_FEATURE_CONDITION "${THIRD_PARTY_FEATURE_CONDITION}") ENDIF() -IF(NOT CPACK_WIX_UI) - SET(CPACK_WIX_UI "MyWixUI_Mondo") -ENDIF() - -IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(WixWin64 " Win64='yes'") -ELSE() - SET(WixWin64) -ENDIF() - - IF(CMAKE_GENERATOR MATCHES "Visual Studio") SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}") ENDIF() @@ -209,10 +202,12 @@ ADD_CUSTOM_TARGET( -DWIXCA_LOCATION="$" -DMSVC_CRT_TYPE="${MSVC_CRT_TYPE}" -DDYNAMIC_UCRT_LINK="${DYNAMIC_UCRT_LINK}" + -DPlatform="${WIX_ARCH}" -P ${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake ) ADD_DEPENDENCIES(MSI wixca) +ENDIF(CAN_BUILD_MSI) IF(CMAKE_GENERATOR MATCHES "Visual Studio") SET(CPACK_CONFIG_PARAM -C $(Configuration)) diff --git a/win/packaging/ca/CMakeLists.txt b/win/packaging/ca/CMakeLists.txt index 326bab47de4..368a844f830 100644 --- a/win/packaging/ca/CMakeLists.txt +++ b/win/packaging/ca/CMakeLists.txt @@ -13,10 +13,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/${WIX_MSVC_SUFFIX}/inc) SET(WIXCA_SOURCES CustomAction.cpp CustomAction.def) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql ${CMAKE_CURRENT_SOURCE_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql ${CMAKE_CURRENT_SOURCE_DIR} ${WIX_INCLUDE_DIR}) # Custom action should not depend on C runtime, since we do not know if CRT is installed. FORCE_STATIC_CRT() diff --git a/win/packaging/create_msi.cmake b/win/packaging/create_msi.cmake index cb1a9654987..ab88c7fbc50 100644 --- a/win/packaging/create_msi.cmake +++ b/win/packaging/create_msi.cmake @@ -30,15 +30,12 @@ FOREACH(third_party ${WITH_THIRD_PARTY}) ENDFOREACH() +SET(CANDLE_ARCH -arch ${Platform}) IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(CANDLE_ARCH -arch x64) SET(Win64 " Win64='yes'") - SET(Platform x64) SET(PlatformProgramFilesFolder ProgramFiles64Folder) SET(CA_QUIET_EXEC CAQuietExec64) ELSE() - SET(CANDLE_ARCH -arch x86) - SET(Platform x86) SET(PlatformProgramFilesFolder ProgramFilesFolder) SET(CA_QUIET_EXEC CAQuietExec) SET(Win64) diff --git a/win/packaging/mysql_server.wxs.in b/win/packaging/mysql_server.wxs.in index 80dcc365e56..c1bcc0c9012 100644 --- a/win/packaging/mysql_server.wxs.in +++ b/win/packaging/mysql_server.wxs.in @@ -12,7 +12,7 @@ Keywords='Installer' Description='MariaDB Server' Manufacturer='@MANUFACTURER@' - InstallerVersion='301' + InstallerVersion='500' Languages='1033' Compressed='yes' SummaryCodepage='1252'