Commit 010bc51e authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix XML error in compiling MSI

parent 3bd236fe
......@@ -4,6 +4,10 @@ SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@")
SET(LIGHT_EXECUTABLE "@LIGHT_EXECUTABLE@")
SET(CMAKE_COMMAND "@CMAKE_COMMAND@")
SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
SET(MAJOR_VERSION "@MAJOR_VERSION@")
SET(MINOR_VERSION "@MINOR_VERSION@")
SET(PATCH "@PATCH@")
SET(ENV{VS_UNICODE_OUTPUT})
INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake)
......@@ -25,7 +29,16 @@ ENDFOREACH()
MACRO(MAKE_WIX_IDENTIFIER str varname)
STRING(REPLACE "/" "." ${varname} "${str}")
STRING(REPLACE "-" "_" ${varname} "${${varname}}")
STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}")
STRING(LENGTH "${${varname}}" len)
# Identifier should be smaller than 72 character
# We have to cut down the length to 70 chars, since we add 2 char prefix
# pretty often
IF(len GREATER 70)
STRING(RANDOM r)
STRING(SUBSTRING "${${varname}}" 0 65 shortstr)
SET(${varname} "${shortstr}${r}")
ENDIF()
ENDMACRO()
FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
......@@ -37,7 +50,7 @@ FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
IF(dir_rel)
MAKE_DIRECTORY(${dir_root}/${dir_rel})
MAKE_WIX_IDENTIFIER("${dir_rel}" id)
FILE(APPEND ${file} "<DirectoryRef Id='directory.${id}'>\n")
FILE(APPEND ${file} "<DirectoryRef Id='D.${id}'>\n")
ELSE()
FILE(APPEND ${file} "<DirectoryRef Id='INSTALLDIR'>\n")
ENDIF()
......@@ -47,10 +60,10 @@ FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
FILE(RELATIVE_PATH rel ${topdir} ${f})
MAKE_WIX_IDENTIFIER("${rel}" id)
FILE(TO_NATIVE_PATH ${f} f_native)
FILE(APPEND ${file} " <Component Id='component.${id}' Guid='*'>\n")
FILE(APPEND ${file} " <File Id='file.${id}' KeyPath='yes' Source='${f_native}'/>\n")
FILE(APPEND ${file} " <Component Id='C.${id}' Guid='*'>\n")
FILE(APPEND ${file} " <File Id='F.${id}' KeyPath='yes' Source='${f_native}'/>\n")
FILE(APPEND ${file} " </Component>\n")
FILE(APPEND ${file_comp} " <ComponentRef Id='component.${id}'/>\n")
FILE(APPEND ${file_comp} " <ComponentRef Id='C.${id}'/>\n")
ENDIF()
ENDFOREACH()
FILE(APPEND ${file} "</DirectoryRef>\n")
......@@ -66,7 +79,7 @@ FUNCTION(TRAVERSE_DIRECTORIES dir topdir file prefix)
IF(rel AND IS_DIRECTORY "${f}")
MAKE_WIX_IDENTIFIER("${rel}" id)
GET_FILENAME_COMPONENT(name ${dir} NAME)
FILE(APPEND ${file} "${prefix}<Directory Id='directory.${id}' Name='${name}'>\n")
FILE(APPEND ${file} "${prefix}<Directory Id='D.${id}' Name='${name}'>\n")
ENDIF()
FILE(GLOB all_files ${dir}/*)
FOREACH(f ${all_files})
......@@ -96,8 +109,17 @@ FILE(WRITE directories.wxs "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi
TRAVERSE_DIRECTORIES(${abs}/dirs ${abs}/dirs directories.wxs "")
FILE(APPEND directories.wxs "</DirectoryRef>\n</Fragment>\n</Wix>\n")
FILE(GLOB WXS_FILES *.wxs)
SET(WIXOBJ_NATIVE_FILES)
SET(WXS_NATIVE_FILES)
FOREACH(f "${WXS_FILES}")
FILE(TO_NATIVE_PATH "${f}" f)
EXECUTE_PROCESS(COMMAND ${CANDLE_EXECUTABLE} ${f})
STRING(REPLACE ".wxs" ".wixobj" f "${f}")
LIST(APPEND WIXOBJ_NATIVE_FILES ${f})
ENDFOREACH()
EXECUTE_PROCESS(
COMMAND ${CANDLE_EXECUTABLE} *.wxs
COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension *.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi
COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension ${WIXOBJ_NATIVE_FILES} -out ${CPACK_PACKAGE_FILE_NAME}.msi
)
......@@ -13,19 +13,10 @@
</Directory>
</Directory>
</Directory>
<Directory Id="CommonAppDataFolder">
<Directory Id="directory.Data.MySQL" Name="MySQL">
<Directory Id="DATADIR" LongName="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@" src=".\">
<Directory Id="DATADIR" Name=".">
<!-- *****************************************************************************************
data directory
-->
<Directory Id="DataDir" Name="data">
<Directory Id="mysql" Name="mysql">
<Feature Id='Server' Level='1' Title="MySQL Server" Description="Install MySQL server" Display="expand">
<ComponentGroupRef Id='componentgroup.Server'/>
<Feature Level='1' Id='ClientPrograms' Title="Client Programs" Description="Various helpful (commandline) tools including the mysql command line client" >
<ComponentRef Id="componentgroup.Client" />
<ComponentGroupRef Id="componentgroup.Client" />
</Feature>
</Feature>
<Feature Id='Devel' Level='1' Title="Development Components"
......
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