install-build-obs.cmd 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. @echo off
  2. SETLOCAL EnableDelayedExpansion
  3. REM Check if obs-studio build exists.
  4. REM If the obs-studio directory does exist, check if the last OBS tag built
  5. REM matches the latest OBS tag.
  6. REM If the tags match, do not build obs-studio.
  7. REM If the tags do not match, build obs-studio.
  8. REM If the obs-studio directory doesn't exist, build obs-studio.
  9. echo Checking for obs-studio build...
  10. set OBSLatestTagPrePull=0
  11. set OBSLatestTagPostPull=0
  12. echo Latest tag pre-pull: %OBSLatestTagPrePull%
  13. echo Latest tag post-pull: %OBSLatestTagPostPull%
  14. REM Set up the build flag as undefined.
  15. set "BuildOBS="
  16. REM Check the last tag successfully built by CI.
  17. if exist C:\projects\obs-studio-last-tag-built.txt (
  18. set /p OBSLastTagBuilt=<C:\projects\obs-studio-last-tag-built.txt
  19. ) else (
  20. set OBSLastTagBuilt=0
  21. )
  22. REM If obs-studio directory exists, run git pull and get the latest tag number.
  23. if exist C:\projects\obs-studio\ (
  24. echo obs-studio directory exists
  25. echo Updating tag info
  26. cd C:\projects\obs-studio\
  27. git describe --tags --abbrev=0 > C:\projects\latest-obs-studio-tag-pre-pull.txt
  28. set /p OBSLatestTagPrePull=<C:\projects\latest-obs-studio-tag-pre-pull.txt
  29. git checkout master
  30. git pull
  31. git describe --tags --abbrev=0 > C:\projects\latest-obs-studio-tag-post-pull.txt
  32. set /p OBSLatestTagPostPull=<C:\projects\latest-obs-studio-tag-post-pull.txt
  33. set /p OBSLatestTag=<C:\projects\latest-obs-studio-tag-post-pull.txt
  34. echo %OBSLatestTagPostPull%> C:\projects\latest-obs-studio-tag.txt
  35. )
  36. REM Check the obs-studio tags for mismatches.
  37. REM If a new tag was pulled, set the build flag.
  38. if not %OBSLatestTagPrePull%==%OBSLatestTagPostPull% (
  39. echo Latest tag pre-pull: %OBSLatestTagPrePull%
  40. echo Latest tag post-pull: %OBSLatestTagPostPull%
  41. echo Tags do not match. Need to rebuild OBS.
  42. set BuildOBS=true
  43. )
  44. REM If the latest git tag doesn't match the last built tag, set the build flag.
  45. if not %OBSLatestTagPostPull%==%OBSLastTagBuilt% (
  46. echo Last built OBS tag: %OBSLastTagBuilt%
  47. echo Latest tag post-pull: %OBSLatestTagPostPull%
  48. echo Tags do not match. Need to rebuild OBS.
  49. set BuildOBS=true
  50. )
  51. REM If obs-studio directory does not exist, clone the git repo, get the latest
  52. REM tag number, and set the build flag.
  53. if not exist C:\projects\obs-studio (
  54. echo obs-studio directory does not exist
  55. git clone --recursive https://github.com/obsproject/obs-studio
  56. cd C:\projects\obs-studio\
  57. git describe --tags --abbrev=0 > C:\projects\obs-studio-latest-tag.txt
  58. set /p OBSLatestTag=<C:\projects\obs-studio-latest-tag.txt
  59. set BuildOBS=true
  60. )
  61. REM Some debug info
  62. echo:
  63. echo Latest tag pre-pull: %OBSLatestTagPrePull%
  64. echo Latest tag post-pull: %OBSLatestTagPostPull%
  65. echo Latest tag: %OBSLatestTag%
  66. echo Last built OBS tag: %OBSLastTagBuilt%
  67. if defined BuildOBS (
  68. echo BuildOBS: true
  69. ) else (
  70. echo BuildOBS: false
  71. )
  72. echo:
  73. REM If the build flag is set, build obs-studio.
  74. if defined BuildOBS (
  75. echo Building obs-studio...
  76. echo git checkout %OBSLatestTag%
  77. git checkout %OBSLatestTag%
  78. echo:
  79. echo Removing previous build dirs...
  80. if exist build rmdir /s /q C:\projects\obs-studio\build
  81. if exist build32 rmdir /s /q C:\projects\obs-studio\build32
  82. if exist build64 rmdir /s /q C:\projects\obs-studio\build64
  83. echo Making new build dirs...
  84. mkdir build
  85. mkdir build32
  86. mkdir build64
  87. echo Running cmake for obs-studio %OBSLatestTag% 32-bit...
  88. cd ./build32
  89. cmake -G "Visual Studio 14 2015" -DCOPIED_DEPENDENCIES=false -DCOPY_DEPENDENCIES=true ..
  90. echo:
  91. echo:
  92. echo Running cmake for obs-studio %OBSLatestTag% 64-bit...
  93. cd ../build64
  94. cmake -G "Visual Studio 14 2015 Win64" -DCOPIED_DEPENDENCIES=false -DCOPY_DEPENDENCIES=true ..
  95. echo:
  96. echo:
  97. echo Building obs-studio %OBSLatestTag% 32-bit ^(Build Config: %build_config%^)...
  98. call msbuild /m /p:Configuration=%build_config% C:\projects\obs-studio\build32\obs-studio.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
  99. echo Building obs-studio %OBSLatestTag% 64-bit ^(Build Config: %build_config%^)...
  100. call msbuild /m /p:Configuration=%build_config% C:\projects\obs-studio\build64\obs-studio.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
  101. cd ..
  102. git describe --tags --abbrev=0 > C:\projects\obs-studio-last-tag-built.txt
  103. set /p OBSLastTagBuilt=<C:\projects\obs-studio-last-tag-built.txt
  104. ) else (
  105. echo Last OBS tag built is: %OBSLastTagBuilt%
  106. echo No need to rebuild OBS.
  107. )