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.

build.cmd 6.8KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. setlocal enableextensions
  4. set BuildType=Release
  5. set BuildOption=--release
  6. set base_dir=%~dp0
  7. set build_dir_base=%base_dir%\build
  8. set install_dir_base=%base_dir%\dist
  9. set dependencies_dir=%base_dir%\dependencies
  10. set UserDataSubdir=openvibe-3.1.0
  11. set PlatformTarget=x64
  12. :parameter_parse
  13. if /i "%1"=="-h" (
  14. echo Usage: build.cmd [Build Type] [Init-env Script]
  15. echo -- Build Type option can be : --release (-r^), --debug (-d^). Default is Release.
  16. pause
  17. exit 0
  18. ) else if /i "%1"=="--help" (
  19. echo Usage: build.cmd [Build Type] [Init-env Script]
  20. echo -- Build Type option can be : --release (-r^), --debug (-d^). Default is Release.
  21. pause
  22. exit 0
  23. ) else if /i "%1"=="-d" (
  24. set BuildType=Debug
  25. set BuildOption=--debug
  26. SHIFT
  27. Goto parameter_parse
  28. ) else if /i "%1"=="--debug" (
  29. set BuildType=Debug
  30. set BuildOption=--debug
  31. SHIFT
  32. Goto parameter_parse
  33. ) else if /i "%1"=="-r" (
  34. set BuildType=Release
  35. set BuildOption=--release
  36. SHIFT
  37. Goto parameter_parse
  38. ) else if /i "%1"=="--release" (
  39. set BuildType=Release
  40. set BuildOption=--release
  41. SHIFT
  42. Goto parameter_parse
  43. ) else if /i "%1"=="--build-dir" (
  44. set build_dir_base=%2
  45. SHIFT
  46. SHIFT
  47. Goto parameter_parse
  48. ) else if /i "%1"=="--install-dir" (
  49. set install_dir_base=%2
  50. SHIFT
  51. SHIFT
  52. Goto parameter_parse
  53. ) else if /i "%1"=="--dependencies-dir" (
  54. set dependencies_dir=%2
  55. SHIFT
  56. SHIFT
  57. Goto parameter_parse
  58. ) else if /i "%1"=="--vsproject" (
  59. set vsbuild=--vsproject
  60. SHIFT
  61. Goto parameter_parse
  62. ) else if /i "%1"=="--vsbuild" (
  63. set vsbuild=--vsbuild
  64. SHIFT
  65. Goto parameter_parse
  66. ) else if /i "%1"=="--vsbuild-all" (
  67. set multibuild_all=TRUE
  68. SHIFT
  69. Goto parameter_parse
  70. ) else if /i "%1" == "--userdata-subdir" (
  71. set UserDataSubdir=%2
  72. SHIFT
  73. SHIFT
  74. Goto parameter_parse
  75. ) else if /i "%1" == "--platform-target" (
  76. set PlatformTarget=%2
  77. SHIFT
  78. SHIFT
  79. Goto parameter_parse
  80. ) else if /i "%1" neq "" (
  81. echo Unknown parameter "%1"
  82. exit /b 1
  83. )
  84. if /i "%PlatformTarget%" neq "x86" (
  85. SET dependencies_dir=%dependencies_dir%_%PlatformTarget%
  86. )
  87. if not defined multibuild_all (
  88. REM the default build
  89. echo Building sdk
  90. cd %base_dir%\sdk\scripts
  91. call windows-build.cmd --no-pause %vsbuild% %BuildOption% --build-dir %build_dir_base%\sdk-%BuildType%-%PlatformTarget% --install-dir %install_dir_base%\sdk-%BuildType%-%PlatformTarget% --dependencies-dir %dependencies_dir% --userdata-subdir %UserDataSubdir% --build-unit --build-validation --test-data-dir %dependencies_dir%\test-input --platform-target %PlatformTarget%
  92. call :check_errors !errorlevel! "!BuildType! SDK" || exit /b !_errlevel!
  93. echo Building designer
  94. cd %base_dir%\designer\scripts
  95. call windows-build.cmd --no-pause %vsbuild% %BuildOption% --build-dir %build_dir_base%\designer-%BuildType%-%PlatformTarget% --install-dir %install_dir_base%\designer-%BuildType%-%PlatformTarget% --sdk %install_dir_base%\sdk-%BuildType%-%PlatformTarget% --dependencies-dir %dependencies_dir% --userdata-subdir %UserDataSubdir% --platform-target %PlatformTarget%
  96. call :check_errors !errorlevel! "!BuildType! Designer" || exit /b !_errlevel!
  97. echo Building extras
  98. cd %base_dir%\extras\scripts
  99. call windows-build.cmd --no-pause %vsbuild% %BuildOption% --build-dir %build_dir_base%\extras-%BuildType%-%PlatformTarget% --install-dir %install_dir_base%\extras-%BuildType%-%PlatformTarget% --sdk %install_dir_base%\sdk-%BuildType%-%PlatformTarget% --designer %install_dir_base%\designer-%BuildType%-%PlatformTarget% --dependencies-dir %dependencies_dir% --userdata-subdir %UserDataSubdir% --platform-target %PlatformTarget%
  100. call :check_errors !errorlevel! "!BuildType! Extras" || exit /b !_errlevel!
  101. ) else (
  102. REM a build that creates a visual studio solution
  103. echo Building sdk
  104. cd %base_dir%\sdk\scripts
  105. call windows-build.cmd --no-pause --vsbuild --debug --build-dir %build_dir_base%\sdk-%PlatformTarget% --install-dir %install_dir_base%\sdk-%PlatformTarget% --dependencies-dir %dependencies_dir% --userdata-subdir %UserDataSubdir% --build-unit --build-validation --test-data-dir %dependencies_dir%\test-input --platform-target %PlatformTarget%
  106. call :check_errors !errorlevel! "Debug SDK" || exit /b !_errlevel!
  107. call windows-build.cmd --no-pause --vsbuild --release --build-dir %build_dir_base%\sdk-%PlatformTarget% --install-dir %install_dir_base%\sdk-%PlatformTarget% --dependencies-dir %dependencies_dir% --userdata-subdir %UserDataSubdir% --build-unit --build-validation --test-data-dir %dependencies_dir%\test-input --platform-target %PlatformTarget%
  108. call :check_errors !errorlevel! "Release SDK" || exit /b !_errlevel!
  109. echo Building designer
  110. cd %base_dir%\designer\scripts
  111. call windows-build.cmd --no-pause --vsbuild --debug --build-dir %build_dir_base%\designer-%PlatformTarget% --install-dir %install_dir_base%\designer-%PlatformTarget% --sdk %install_dir_base%\sdk-%PlatformTarget% --dependencies-dir %dependencies_dir% --userdata-subdir %UserDataSubdir% --platform-target %PlatformTarget%
  112. call :check_errors !errorlevel! "Debug Designer" || exit /b !_errlevel!
  113. call windows-build.cmd --no-pause --vsbuild --release --build-dir %build_dir_base%\designer-%PlatformTarget% --install-dir %install_dir_base%\designer-%PlatformTarget% --sdk %install_dir_base%\sdk-%PlatformTarget% --dependencies-dir %dependencies_dir% --userdata-subdir %UserDataSubdir% --platform-target %PlatformTarget%
  114. call :check_errors !errorlevel! "Release Designer" || exit /b !_errlevel!
  115. echo Building extras
  116. cd %base_dir%\extras\scripts
  117. call windows-build.cmd --no-pause --vsbuild --debug --build-dir %build_dir_base%\extras-%PlatformTarget% --install-dir %install_dir_base%\extras-%PlatformTarget% --sdk %install_dir_base%\sdk-%PlatformTarget% --designer %install_dir_base%\designer-%PlatformTarget% --dependencies-dir %dependencies_dir% --userdata-subdir %UserDataSubdir% --platform-target %PlatformTarget%
  118. call :check_errors !errorlevel! "Debug Extras" || exit /b !_errlevel!
  119. call windows-build.cmd --no-pause --vsbuild --release --build-dir %build_dir_base%\extras-%PlatformTarget% --install-dir %install_dir_base%\extras-%PlatformTarget% --sdk %install_dir_base%\sdk-%PlatformTarget% --designer %install_dir_base%\designer-%PlatformTarget% --dependencies-dir %dependencies_dir% --userdata-subdir %UserDataSubdir% --platform-target %PlatformTarget%
  120. call :check_errors !errorlevel! "Release Extras" || exit /b !_errlevel!
  121. echo Generating meta project
  122. where /q python
  123. if !errorlevel! neq 0 (
  124. echo Python not in path, trying C:\python34\python ...
  125. set my_python=C:\python34\python
  126. ) else (
  127. set my_python=python
  128. )
  129. !my_python! %base_dir%\visual_gen\generateVS.py --platformtarget %PlatformTarget% --builddir %build_dir_base% --outsln %build_dir_base%\OpenViBE-Meta-%PlatformTarget%.sln
  130. if !errorlevel! neq 0 (
  131. echo Error constructing the meta .sln file
  132. exit /b !errorlevel!
  133. )
  134. )
  135. :check_errors
  136. SET _errlevel=%1
  137. SET _stageName=%2
  138. if !_errlevel! neq 0 (
  139. echo Error while building !_stageName!
  140. exit /b !_errlevel!
  141. )