[cpack_installer] post install hooks to install cmake and python
This commit is contained in:
@@ -334,7 +334,8 @@ function(ly_add_target)
|
||||
|
||||
if(NOT ly_add_target_IMPORTED)
|
||||
if(NOT ly_add_target_INSTALL_COMPONENT)
|
||||
set(ly_add_target_INSTALL_COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT})
|
||||
#set(ly_add_target_INSTALL_COMPONENT ${LY_DEFAULT_INSTALL_COMPONENT})
|
||||
set(ly_add_target_INSTALL_COMPONENT ${ly_add_target_NAMESPACE})
|
||||
endif()
|
||||
|
||||
ly_install_target(
|
||||
|
||||
@@ -286,7 +286,7 @@ endfunction()
|
||||
function(ly_setup_others)
|
||||
|
||||
# List of directories we want to install relative to engine root
|
||||
set(DIRECTORIES_TO_INSTALL Tools/LyTestTools Tools/RemoteConsole)
|
||||
set(DIRECTORIES_TO_INSTALL Tools/LyTestTools Tools/RemoteConsole Tools/Redistributables/CMake)
|
||||
foreach(dir ${DIRECTORIES_TO_INSTALL})
|
||||
|
||||
get_filename_component(install_path ${dir} DIRECTORY)
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version='1.0' encoding='windows-1252'?>
|
||||
|
||||
<?include "cpack_variables.wxi"?>
|
||||
|
||||
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'
|
||||
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
|
||||
<Fragment>
|
||||
|
||||
<!-- RemoveFolderEx works on properties instead of directory references -->
|
||||
<Property Id="INSTALLPATH">
|
||||
<RegistrySearch Id="INSTALLPATH_REGSEARCH"
|
||||
Root="HKLM"
|
||||
Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)\$(var.CPACK_PACKAGE_VERSION)"
|
||||
Name="Install Path"
|
||||
Type="raw"/>
|
||||
</Property>
|
||||
|
||||
<DirectoryRef Id="INSTALL_ROOT">
|
||||
<!-- this will clear out any additional files as part of the installation that weren't originally
|
||||
included of the MSI table -->
|
||||
<Component Id="SanitizeInstallFolder" Guid="{85468941-52E6-4C04-A66D-8E3CA3BBF04A}">
|
||||
<Condition><![CDATA[Installed OR NOT MANUALPRODUCTFOUND]]></Condition>
|
||||
<util:RemoveFolderEx On="uninstall" Property="INSTALLPATH"/>
|
||||
|
||||
<!-- registry entry is required to properly initialize the property during uninstall-->
|
||||
<RegistryValue Root="HKLM"
|
||||
Key="Software\$(var.CPACK_PACKAGE_VENDOR)\$(var.CPACK_PACKAGE_NAME)\$(var.CPACK_PACKAGE_VERSION)"
|
||||
Name="Install Path"
|
||||
Type="string"
|
||||
Value="[INSTALL_ROOT]"
|
||||
KeyPath="yes"/>
|
||||
</Component>
|
||||
|
||||
<!-- installation directory references for use in post install commands -->
|
||||
<Directory Id="root.cmake" Name="cmake">
|
||||
<Directory Id="root.cmake.runtime" Name="runtime"/>
|
||||
</Directory>
|
||||
<Directory Id="root.python" Name="python"/>
|
||||
<Directory Id="root.tools" Name="Tools">
|
||||
<Directory Id="root.tools.redist" Name="Redistributables">
|
||||
<Directory Id="root.tools.redist.cmake" Name="CMake"/>
|
||||
</Directory>
|
||||
</Directory>
|
||||
</DirectoryRef>
|
||||
|
||||
<Property Id="CMakeArchvieName" Value="cmake-3.19.1-win64-x64"/>
|
||||
|
||||
<CustomAction Id="ExtractCMake"
|
||||
ExeCommand=""[SystemFolder]cmd.exe" /C tar -x -f "[root.tools.redist.cmake][CMakeArchvieName].zip" -C "[root.tools.redist]CMake""
|
||||
Directory="INSTALL_ROOT"
|
||||
Execute="deferred"
|
||||
Impersonate="no"/>
|
||||
|
||||
<CustomAction Id="MoveCMake"
|
||||
ExeCommand=""[SystemFolder]cmd.exe" /C move "[root.tools.redist.cmake][CMakeArchvieName]" "[root.cmake]runtime""
|
||||
Directory="INSTALL_ROOT"
|
||||
Execute="deferred"
|
||||
Impersonate="no"/>
|
||||
|
||||
<CustomAction Id="ConfigurePython"
|
||||
ExeCommand=""[SystemFolder]cmd.exe" /C set "LY_CMAKE_PATH=[root.cmake.runtime]bin" && "[root.python]get_python.bat""
|
||||
Directory="INSTALL_ROOT"
|
||||
Execute="deferred"
|
||||
Impersonate="no"/>
|
||||
|
||||
</Fragment>
|
||||
</Wix>
|
||||
@@ -17,8 +17,7 @@
|
||||
<!-- auto distribute the installable files across N cab files -->
|
||||
<MediaTemplate EmbedCab="$(var.CPACK_EMBED_ARTIFACTS)"/>
|
||||
|
||||
<MajorUpgrade
|
||||
Schedule="afterInstallInitialize"
|
||||
<MajorUpgrade Schedule="afterInstallInitialize"
|
||||
AllowSameVersionUpgrades="yes"
|
||||
DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
|
||||
|
||||
@@ -41,8 +40,24 @@
|
||||
<FeatureRef Id="ProductFeature">
|
||||
<ComponentRef Id="DesktopShortcuts"/>
|
||||
<ComponentRef Id="StartMenuShortcuts"/>
|
||||
|
||||
<!-- for removing cmake and python on uninstall -->
|
||||
<ComponentRef Id="SanitizeInstallFolder"/>
|
||||
</FeatureRef>
|
||||
|
||||
<InstallExecuteSequence>
|
||||
<!-- limit the actions to first time install and repairs -->
|
||||
<Custom Action="ExtractCMake" Before="InstallFinalize">
|
||||
NOT Installed Or REINSTALL
|
||||
</Custom>
|
||||
<Custom Action="MoveCMake" After="ExtractCMake">
|
||||
NOT Installed Or REINSTALL
|
||||
</Custom>
|
||||
<Custom Action="ConfigurePython" After="MoveCMake">
|
||||
NOT Installed Or REINSTALL
|
||||
</Custom>
|
||||
</InstallExecuteSequence>
|
||||
|
||||
<UIRef Id="$(var.CPACK_WIX_UI_REF)" />
|
||||
|
||||
<?include "properties.wxi"?>
|
||||
|
||||
@@ -83,9 +83,14 @@ set(CPACK_WIX_PRODUCT_ICON ${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/produc
|
||||
set(CPACK_WIX_TEMPLATE "${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/Template.wxs.in")
|
||||
|
||||
set(CPACK_WIX_EXTRA_SOURCES
|
||||
"${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/PostInstallSetup.wxs"
|
||||
"${CPACK_SOURCE_DIR}/Platform/Windows/Packaging/Shortcuts.wxs"
|
||||
)
|
||||
|
||||
set(CPACK_WIX_EXTENSIONS
|
||||
WixUtilExtension
|
||||
)
|
||||
|
||||
set(_embed_artifacts "yes")
|
||||
|
||||
if(LY_INSTALLER_DOWNLOAD_URL)
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
@echo off
|
||||
rem
|
||||
rem All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
rem its licensors.
|
||||
rem
|
||||
rem For complete copyright and license terms please see the LICENSE at the root of this
|
||||
rem distribution (the "License"). All use of this software is governed by the License,
|
||||
rem or, if provided, by the license below or the license accompanying this file. Do not
|
||||
rem remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem
|
||||
|
||||
pushd %~dp0%
|
||||
|
||||
pushd %~dp0..
|
||||
set ENGINE_ROOT=%CD%
|
||||
popd
|
||||
|
||||
set cmake_version=3.19.1
|
||||
|
||||
if not "%1"=="" (
|
||||
set LY_3RDPARTY_PATH=%1
|
||||
)
|
||||
if "%LY_3RDPARTY_PATH%"=="" goto no_3rd_party
|
||||
|
||||
if not exist %LY_3RDPARTY_PATH% mkdir %LY_3RDPARTY_PATH%
|
||||
goto install_cmake
|
||||
|
||||
:no_3rd_party
|
||||
echo A path to where the 3rd party folder is required for setup.
|
||||
echo Either supply one through the LY_3RDPARTY_PATH environment
|
||||
echo variable or as an argument to this script
|
||||
goto fail
|
||||
|
||||
|
||||
:install_cmake
|
||||
set cmake_install_path=%LY_3RDPARTY_PATH%\CMake\%cmake_version%\Windows
|
||||
set cmake_archive_name=cmake-%cmake_version%-win64-x64
|
||||
set cmake_archive_path="%ENGINE_ROOT%\Tools\Redistributables\CMake\%cmake_archive_name%.zip"
|
||||
if exist "%cmake_install_path%\bin\cmake.exe" goto install_python
|
||||
|
||||
echo Installing CMake %cmake_version% to %cmake_install_path%
|
||||
if not exist %cmake_install_path% mkdir %cmake_install_path%
|
||||
powershell.exe -nologo -noprofile -command^
|
||||
"& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::ExtractToDirectory('%cmake_archive_path%', '%cmake_install_path%'); }"
|
||||
if ERRORLEVEL 1 goto cmake_failed
|
||||
|
||||
set cmake_extracted_path=%cmake_install_path%\%cmake_archive_name%
|
||||
for /d %%a in ("%cmake_extracted_path%\*") do move "%%a" "%cmake_install_path%\"
|
||||
rmdir %cmake_extracted_path%
|
||||
|
||||
goto success
|
||||
|
||||
if ERRORLEVEL 1 goto cmake_failed
|
||||
set LY_CMAKE_PATH="%cmake_install_path%\bin"
|
||||
goto install_python
|
||||
|
||||
:cmake_failed
|
||||
echo Failed to extract cmake to path %cmake_install_path%
|
||||
goto fail
|
||||
|
||||
|
||||
:install_python
|
||||
echo Installing python...
|
||||
call %ENGINE_ROOT%\python\get_python.bat
|
||||
if ERRORLEVEL 1 goto python_failed
|
||||
goto register_engine
|
||||
|
||||
:python_failed
|
||||
echo Failed to acquire python
|
||||
goto fail
|
||||
|
||||
|
||||
:register_engine
|
||||
echo Registering engine...
|
||||
call %ENGINE_ROOT%\scripts\o3de.bat register --this-engine
|
||||
if ERRORLEVEL 1 goto registration_failed
|
||||
goto success
|
||||
|
||||
:registration_failed
|
||||
echo Failed to register the engine
|
||||
goto fail
|
||||
|
||||
|
||||
:fail
|
||||
echo O3DE setup failed
|
||||
popd
|
||||
exit /b 1
|
||||
|
||||
:success
|
||||
echo O3DE setup complete
|
||||
popd
|
||||
exit /b %ERRORLEVEL%
|
||||
Reference in New Issue
Block a user