create_msi.bat 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. REM Copyright (C) 1994-2018 Altair Engineering, Inc.
  2. REM For more information, contact Altair at www.altair.com.
  3. REM
  4. REM This file is part of the PBS Professional ("PBS Pro") software.
  5. REM
  6. REM Open Source License Information:
  7. REM
  8. REM PBS Pro is free software. You can redistribute it and/or modify it under the
  9. REM terms of the GNU Affero General Public License as published by the Free
  10. REM Software Foundation, either version 3 of the License, or (at your option) any
  11. REM later version.
  12. REM
  13. REM PBS Pro is distributed in the hope that it will be useful, but WITHOUT ANY
  14. REM WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15. REM FOR A PARTICULAR PURPOSE.
  16. REM See the GNU Affero General Public License for more details.
  17. REM
  18. REM You should have received a copy of the GNU Affero General Public License
  19. REM along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. REM
  21. REM Commercial License Information:
  22. REM
  23. REM For a copy of the commercial license terms and conditions,
  24. REM go to: (http://www.pbspro.com/UserArea/agreement.html)
  25. REM or contact the Altair Legal Department.
  26. REM
  27. REM Altair’s dual-license business model allows companies, individuals, and
  28. REM organizations to create proprietary derivative works of PBS Pro and
  29. REM distribute them - whether embedded or bundled with other software -
  30. REM under a commercial license agreement.
  31. REM
  32. REM Use of Altair’s trademarks, including but not limited to "PBS™",
  33. REM "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
  34. REM trademark licensing policies.
  35. setlocal
  36. @echo on
  37. cd "%~dp0..\..\..\..\"
  38. set PBS_RESOURCES=%~dp0resources
  39. set PBS_DIR=%CD%\PBS
  40. set PBS_EXECDIR=%CD%\PBS\exec
  41. set PBS_SPEC_FILE=%CD%\pbspro\pbspro.spec
  42. set PBS_VERSION=""
  43. set PBS_SHORT_VERSION=""
  44. set PBS_PRODUCT_NAME=PBS Pro
  45. set PBS_MSI_NAME=PBSPro
  46. set BUILD_TYPE=Release
  47. if not "%~1"=="" (
  48. set BUILD_TYPE=%~1
  49. )
  50. if "%BUILD_TYPE%"=="debug" (
  51. set BUILD_TYPE=Debug
  52. )
  53. cd win_build
  54. if not exist "%PBS_EXECDIR%\etc\vcredist_x86.exe" (
  55. echo Could not find "%PBS_EXECDIR%\etc\vcredist_x86.exe"
  56. exit /b 1
  57. )
  58. if not exist "%CD%\msi" (
  59. mkdir "%CD%\msi"
  60. )
  61. cd "%CD%\msi"
  62. REM Find PBSPro version from pbspro.spec file from root directory
  63. for /F "tokens=3 USEBACKQ" %%F IN (`findstr /l /c:" pbs_version " %PBS_SPEC_FILE%`) DO (
  64. set PBS_VERSION=%%F
  65. )
  66. for /F "tokens=1-3 delims=." %%F IN ("%PBS_VERSION%") DO (
  67. set PBS_SHORT_VERSION=%%F.%%G.%%H
  68. )
  69. set PBS_PRODUCT_NAME=%PBS_PRODUCT_NAME% %PBS_VERSION%
  70. set PBS_MSI_NAME=%PBS_MSI_NAME%_%PBS_VERSION%
  71. if "%BUILD_TYPE%"=="Debug" (
  72. set PBS_PRODUCT_NAME=%PBS_PRODUCT_NAME% - Debug Version
  73. set PBS_MSI_NAME=%PBS_MSI_NAME%_debug_version
  74. )
  75. REM Clean up previouly generated files (if any)
  76. 2>nul del /Q /F %PBS_MSI_NAME%.msi
  77. 2>nul del /Q /F %PBS_MSI_NAME%.wixpdb
  78. 2>nul del /Q /F pbsproexec_%BUILD_TYPE%.wxs
  79. 2>nul del /Q /F pbsproexec_%BUILD_TYPE%.wixobj
  80. 2>nul del /Q /F Product.wixobj
  81. REM Call Wix harvestor to generate pbsproexec.wxs
  82. heat dir "%PBS_EXECDIR%" -ag -cg pbsproexec -sfrag -sreg -template fragment -out pbsproexec_%BUILD_TYPE%.wxs -dr "INSTALLFOLDER" -var var.pbs_execdir
  83. if not %ERRORLEVEL% == 0 (
  84. echo Failed to generate pbsproexec_%BUILD_TYPE%.wxs
  85. exit /b 1
  86. )
  87. REM Call wix compiler to generate pbsproexec.wixobj and Product.wixobj
  88. candle -ext WixUIExtension -d"pbs_execdir=%PBS_EXECDIR%" -d"pbs_product_name=%PBS_PRODUCT_NAME%" -d"pbs_short_version=%PBS_SHORT_VERSION%" -d"pbs_resources=%PBS_RESOURCES%" "%~dp0Product.wxs" pbsproexec_%BUILD_TYPE%.wxs
  89. if not %ERRORLEVEL% == 0 (
  90. echo Failed to generate pbsproexec_%BUILD_TYPE%.wixobj and Product.wixobj
  91. exit /b 1
  92. )
  93. REM Call Wix linker to generate PBSPro msi
  94. light -ext WixUIExtension -o %PBS_MSI_NAME%.msi pbsproexec_%BUILD_TYPE%.wixobj Product.wixobj
  95. if not %ERRORLEVEL% == 0 (
  96. echo Failed to generate PBSPro msi
  97. exit /b 1
  98. )
  99. 2>nul rd /S /Q "%PBS_DIR%"
  100. exit /b 0