Commit 718ee3e5 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Refactor some stuff

parent b852bf83
......@@ -25,18 +25,32 @@ FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
@ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/extra.wxs.in
${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
@ONLY@
)
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}")
ENDIF()
ADD_CUSTOM_TARGET(
MSI
COMMAND set VS_UNICODE_OUTPUT=
COMMAND ${CMAKE_COMMAND} -DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
COMMAND ${CMAKE_COMMAND}
-DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake
-DCPACK_WIX_EXTRA_SOURCE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
${CONFIG_PARAM}
-P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
)
ADD_CUSTOM_TARGET(
MSI_ESSENTIALS
COMMAND set VS_UNICODE_OUTPUT=
COMMAND ${CMAKE_COMMAND} -DESSENTIALS=1 -DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
COMMAND ${CMAKE_COMMAND} -DESSENTIALS=1
-DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake
-DCPACK_WIX_EXTRA_SOURCE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
${CONFIG_PARAM}
-P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
)
......@@ -181,7 +181,7 @@ MACRO(MAKE_WIX_IDENTIFIER str varname)
ENDMACRO()
FUNCTION(TRAVERSE_FILES dir topdir file file_comp file_default_component dir_root)
FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
FILE(GLOB all_files ${dir}/*)
IF(NOT all_files)
RETURN()
......@@ -219,13 +219,13 @@ FUNCTION(TRAVERSE_FILES dir topdir file file_comp file_default_component dir_roo
IF(NONEXEFILES)
GENERATE_GUID(guid)
SET(ComponentId "C._files_${COMP_NAME}.${DirectoryRefId}")
FILE(APPEND ${file_default_component}
FILE(APPEND ${file}
"<DirectoryRef Id='${DirectoryRefId}'>\n<Component Guid='${guid}' Id='${ComponentId}' ${Win64}>${NONEXEFILES}\n</Component></DirectoryRef>\n")
FILE(APPEND ${file_comp} " <ComponentRef Id='${ComponentId}'/>\n")
ENDIF()
FOREACH(f ${all_files})
IF(IS_DIRECTORY ${f})
TRAVERSE_FILES(${f} ${topdir} ${file} ${file_comp} ${file_default_component} ${dir_root})
TRAVERSE_FILES(${f} ${topdir} ${file} ${file_comp} ${dir_root})
ENDIF()
ENDFOREACH()
ENDFUNCTION()
......@@ -244,33 +244,41 @@ FUNCTION(TRAVERSE_DIRECTORIES dir topdir file prefix)
ENDIF()
ENDFOREACH()
IF(rel AND IS_DIRECTORY "${f}")
FILE(APPEND ${file} "</Directory>\n")
FILE(APPEND ${file} "${prefix}</Directory>\n")
ENDIF()
ENDFUNCTION()
SET(CPACK_WIX_COMPONENTS)
SET(CPACK_WIX_COMPONENT_GROUPS)
GET_FILENAME_COMPONENT(abs . ABSOLUTE)
FOREACH(d ${DIRS})
GET_FILENAME_COMPONENT(d ${d} ABSOLUTE)
GET_FILENAME_COMPONENT(d_name ${d} NAME)
FILE(WRITE
${abs}/${d_name}.wxs "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\n<Fragment>\n")
FILE(WRITE
${abs}/${d_name}_default_component.wxs "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'><Fragment>")
FILE(WRITE
${abs}/${d_name}_component_group.wxs "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Fragment>\n<ComponentGroup Id='componentgroup.${d_name}'>")
FILE(WRITE ${abs}/${d_name}_component_group.wxs "<ComponentGroup Id='componentgroup.${d_name}'>")
SET(COMP_NAME ${d_name})
TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs ${abs}/${d_name}_component_group.wxs ${abs}/${d_name}_default_component.wxs "${abs}/dirs")
FILE(APPEND ${abs}/${d_name}_default_component.wxs "\n</Fragment>\n</Wix>")
FILE(APPEND ${abs}/${d_name}.wxs " </Fragment>\n</Wix>")
FILE(APPEND ${abs}/${d_name}_component_group.wxs "</ComponentGroup>\n</Fragment>\n</Wix>")
TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs ${abs}/${d_name}_component_group.wxs "${abs}/dirs")
FILE(APPEND ${abs}/${d_name}_component_group.wxs "</ComponentGroup>")
FILE(READ ${d_name}.wxs WIX_TMP)
SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}")
FILE(REMOVE ${d_name}.wxs)
FILE(READ ${d_name}_component_group.wxs WIX_TMP)
SET(CPACK_WIX_COMPONENT_GROUPS "${CPACK_WIX_COMPONENT_GROUPS}\n${WIX_TMP}")
FILE(REMOVE ${d_name}_component_group.wxs)
ENDFOREACH()
FILE(WRITE directories.wxs "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\n<Fragment>\n<DirectoryRef Id='INSTALLDIR'>\n")
FILE(WRITE directories.wxs "<DirectoryRef Id='INSTALLDIR'>\n")
TRAVERSE_DIRECTORIES(${abs}/dirs ${abs}/dirs directories.wxs "")
FILE(APPEND directories.wxs "</DirectoryRef>\n</Fragment>\n</Wix>\n")
FILE(APPEND directories.wxs "</DirectoryRef>\n")
FILE(READ directories.wxs CPACK_WIX_DIRECTORIES)
FILE(REMOVE directories.wxs)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
FILE(GLOB WXS_FILES *.wxs)
SET(WXS_FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs ${CPACK_WIX_EXTRA_SOURCE})
SET(WIXOBJ_NATIVE_FILES)
SET(WXS_NATIVE_FILES)
FOREACH(f "${WXS_FILES}")
......
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="INSTALLDIR">
<Component Id="RegKeys" Guid="*">
<RegistryKey
Id='MySQLKey'
Root='HKLM'
Key='SOFTWARE\MySQL AB\[ProductName]'
Action='createAndRemoveOnUninstall'>
<RegistryValue
Type='string'
Name='Location'
Value='[INSTALLDIR]'/>
<RegistryValue
Type="string"
Name="Version"
Value="[ProductVersion]"/>
<RegistryValue
Type="string"
Name="DataLocation"
Value="[DATADIR]"/>
</RegistryKey>
</Component>
</DirectoryRef>
<Feature
Id='RegKeys'
Display='hidden'
Level='1'>
<ComponentRef Id='RegKeys'/>
</Feature>
</Fragment>
</Wix>
\ No newline at end of file
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"
Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@" Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@" Language="1033" Manufacturer="MySQL AB">
<Package Id='*' Keywords='Installer' Description="MySQL Database Server"
<Product
Id="*"
UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"
Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@"
Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
Language="1033"
Manufacturer="MySQL AB">
<Package Id='*'
Keywords='Installer'
Description="MySQL Database Server"
Manufacturer='MySQL AB'
InstallerVersion='200' Languages='1033' Compressed='yes' SummaryCodepage='1252'
InstallerVersion='200'
Languages='1033'
Compressed='yes'
SummaryCodepage='1252'
Platform='@Platform@'/>
<Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
<!-- Upgrade -->
<Upgrade Id="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3">
<UpgradeVersion
Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
IncludeMinimum="yes"
Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
Property="OLDERVERSIONBEINGUPGRADED" />
<UpgradeVersion
Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
OnlyDetect="yes"
Property="NEWERVERSIONDETECTED" />
</Upgrade>
<Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
NOT NEWERVERSIONDETECTED OR Installed
</Condition>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize"/>
</InstallExecuteSequence>
<!-- UI -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
<UIRef Id="@CPACK_WIX_UI@" />
<UIRef Id="WixUI_ErrorProgressText" />
<WixVariable
Id="WixUIBannerBmp"
Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminHeader.jpg" />
<WixVariable
Id="WixUIDialogBmp"
Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminBackground.jpg" />
<Icon
Id="icon.ico"
SourceFile="@CMAKE_CURRENT_SOURCE_DIR@/MySQLServer.ico"/>
<Property
Id="ARPPRODUCTICON"
Value="icon.ico" />
<!-- Installation root-->
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='@PlatformProgramFilesFolder@'>
<Directory Id='directory.MySQL' Name='MySQL'>
......@@ -14,13 +65,18 @@
</Directory>
</Directory>
</Directory>
<!-- CPACK_WIX_FEATURES -->
@CPACK_WIX_FEATURES@
<!--CPACK_WIX_FEATURES end -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
<UIRef Id="@CPACK_WIX_UI@" />
<UIRef Id="WixUI_ErrorProgressText" />
<WixVariable Id="WixUIBannerBmp" Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminHeader.jpg" />
<WixVariable Id="WixUIDialogBmp" Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminBackground.jpg" />
<!-- CPACK_WIX_DIRECTORIES -->
@CPACK_WIX_DIRECTORIES@
<!--CPACK_WIX_COMPONENTS-->
@CPACK_WIX_COMPONENTS@
<!--CPACK_WIX_COMPONENTS_GROUPS -->
@CPACK_WIX_COMPONENT_GROUPS@
</Product>
</Wix>
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