You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

windows-initialize-environment.cmd 3.3KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. @echo off
  2. REM setlocal EnableDelayedExpansion
  3. REM setlocal enableextensions
  4. set PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin;%PATH%
  5. set "SCRIPT_PATH=%~dp0"
  6. :parameter_parse
  7. if /i "%1" == "--dependencies-dir" (
  8. set "PATH_DEPENDENCIES=%2"
  9. SHIFT
  10. SHIFT
  11. Goto parameter_parse
  12. ) else if /i "%1" == "--platform-target" (
  13. if "%2"=="x64" (
  14. set PLATFORM=x64
  15. set VSPLATFORMGENERATOR=Win64
  16. ) else if "%2"=="x86" (
  17. set PLATFORM=x86
  18. set VSPLATFORMGENERATOR=
  19. ) else (
  20. echo Unknown platform %2 target
  21. Goto terminate
  22. )
  23. SHIFT
  24. SHIFT
  25. Goto parameter_parse
  26. ) else if not "%1" == "" (
  27. echo unrecognized option [%1]
  28. Goto terminate_error
  29. )
  30. if not defined PATH_DEPENDENCIES (
  31. if %PLATFORM%==x64 (
  32. SET "PATH_DEPENDENCIES=%SCRIPT_PATH%../dependencies_x64"
  33. ) else (
  34. SET "PATH_DEPENDENCIES=%SCRIPT_PATH%../dependencies"
  35. )
  36. set "PATH=!PATH_DEPENDENCIES!/cmake/bin;!PATH!"
  37. set "PATH=!PATH_DEPENDENCIES!/ninja;!PATH!"
  38. set "PATH=!PATH_DEPENDENCIES!/gtk/bin;!PATH!"
  39. ) else (
  40. for %%A in (%PATH_DEPENDENCIES%) DO (
  41. if exist "%%A\cmake\bin\" (
  42. set "PATH=%%A\cmake\bin;!PATH!"
  43. )
  44. if exist "%%A\gtk\bin\" (
  45. set "PATH=%%A\gtk\bin;!PATH!"
  46. )
  47. if exist "%%A\ninja\" (
  48. set "PATH=%%A\ninja;!PATH!"
  49. )
  50. )
  51. )
  52. REM ########################################################################################################################
  53. REM # Set to 1 to skip new compilers.
  54. if not defined SKIP_VS2017 (
  55. SET SKIP_VS2017=1
  56. )
  57. if not defined SKIP_VS2015 (
  58. SET SKIP_VS2015=1
  59. )
  60. if not defined SKIP_VS2013 (
  61. SET SKIP_VS2013=0
  62. )
  63. SET VSTOOLS=
  64. SET VSCMake=
  65. set VCVARSALLPATH=../../VC/vcvarsall.bat
  66. if %SKIP_VS2017% == 0 (
  67. set "VSTOOLS=%VS150COMNTOOLS%"
  68. set VSCMake=Visual Studio 15 2017
  69. ) else if %SKIP_VS2015% == 0 (
  70. echo Visual Studio 2017 detection skipped as requested
  71. set "VSTOOLS=%VS140COMNTOOLS%"
  72. set VSCMake=Visual Studio 14 2015
  73. ) else (
  74. echo Visual Studio 2017 detection skipped as requested
  75. echo Visual Studio 2015 detection skipped as requested
  76. set "VSTOOLS=%VS120COMNTOOLS%"
  77. set VSCMake=Visual Studio 12 2013
  78. )
  79. if exist "!VSTOOLS!%VCVARSALLPATH%" (
  80. if %PLATFORM% == x64 (
  81. if exist "!VSTOOLS!../../VC/bin/x64" (
  82. echo Found %VSCMake% tools: !VSTOOLS!%VCVARSALLPATH% %PLATFORM%
  83. call "!VSTOOLS!%VCVARSALLPATH%" %PLATFORM%
  84. ) else (
  85. echo Found %VSCMake% tools: !VSTOOLS!%VCVARSALLPATH% x86_amd64
  86. call "!VSTOOLS!%VCVARSALLPATH%" x86_amd64
  87. )
  88. ) else (
  89. echo Found %VSCMake% tools: !VSTOOLS!vsvars32.bat
  90. call "!VSTOOLS!vsvars32.bat"
  91. )
  92. goto terminate
  93. )
  94. set VSCMake=!VSCMake! %VSPLATFORMGENERATOR%
  95. goto terminate_success
  96. :terminate_error
  97. echo ######################################################################################
  98. echo ## ##
  99. echo ## ERROR : Microsoft Visual Studio Common tools initialisation script not found ##
  100. echo ## ##
  101. echo ######################################################################################
  102. echo An error occured during environment initializing !
  103. pause
  104. exit 1
  105. REM #######################################################################################
  106. :terminate_success
  107. goto terminate
  108. REM #######################################################################################
  109. :terminate