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-init_env_command.cmd 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. @echo off
  2. REM ########################################################################################################################
  3. SET PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin;!PATH!
  4. set "SCRIPT_PATH=%~dp0"
  5. set "PLATFORM=x86"
  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 # Set to 1 to skip new compilers.
  53. if not defined SKIP_VS2017 (
  54. SET SKIP_VS2017=1
  55. )
  56. if not defined SKIP_VS2015 (
  57. SET SKIP_VS2015=1
  58. )
  59. if not defined SKIP_VS2013 (
  60. SET SKIP_VS2013=0
  61. )
  62. SET VSTOOLS=
  63. SET VSCMake=
  64. set VCVARSALLPATH=../../VC/vcvarsall.bat
  65. if %SKIP_VS2017% == 0 (
  66. set "VSTOOLS=%VS150COMNTOOLS%"
  67. set VSCMake=Visual Studio 15 2017
  68. ) else if %SKIP_VS2015% == 0 (
  69. echo Visual Studio 2017 detection skipped as requested
  70. set "VSTOOLS=%VS140COMNTOOLS%"
  71. set VSCMake=Visual Studio 14 2015
  72. ) else (
  73. echo Visual Studio 2017 detection skipped as requested
  74. echo Visual Studio 2015 detection skipped as requested
  75. set "VSTOOLS=%VS120COMNTOOLS%"
  76. set VSCMake=Visual Studio 12 2013
  77. )
  78. if exist "!VSTOOLS!%VCVARSALLPATH%" (
  79. if %PLATFORM% == x64 (
  80. if exist "!VSTOOLS!../../VC/bin/x64" (
  81. echo Found %VSCMake% tools: !VSTOOLS!%VCVARSALLPATH% %PLATFORM%
  82. call "!VSTOOLS!%VCVARSALLPATH%" %PLATFORM%
  83. ) else (
  84. echo Found %VSCMake% tools: !VSTOOLS!%VCVARSALLPATH% x86_amd64
  85. call "!VSTOOLS!%VCVARSALLPATH%" x86_amd64
  86. )
  87. ) else (
  88. echo Found %VSCMake% tools: !VSTOOLS!vsvars32.bat
  89. call "!VSTOOLS!vsvars32.bat"
  90. )
  91. goto terminate
  92. )
  93. set VSCMake=!VSCMake! %VSPLATFORMGENERATOR%
  94. goto terminate_success
  95. :terminate_error
  96. echo ######################################################################################
  97. echo ## ##
  98. echo ## ERROR : Microsoft Visual Studio Common tools initialisation script not found ##
  99. echo ## ##
  100. echo ######################################################################################
  101. echo An error occured during environment initializing !
  102. pause
  103. exit 1
  104. REM #######################################################################################
  105. :terminate_success
  106. goto terminate
  107. REM #######################################################################################
  108. REM #######################################################################################
  109. :terminate