2
0

generate_asset_cmake.bat 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. @ECHO off
  2. REM Copyright (c) Contributors to the Open 3D Engine Project.
  3. REM For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. REM
  5. REM SPDX-License-Identifier: Apache-2.0 OR MIT
  6. setlocal enabledelayedexpansion
  7. :: TAB equals 4 spaces
  8. set TAB=
  9. :: Directory in which this batch file lives
  10. set CURRENT_DIRECTORY=%~dp0
  11. :: Destination file we're writing too
  12. set OUTPUT_FILE=atomsampleviewer_asset_files.cmake
  13. :: Write copyright header to top of file
  14. echo # > %OUTPUT_FILE%
  15. echo # Copyright (c) Contributors to the Open 3D Engine Project. >> %OUTPUT_FILE%
  16. echo # For complete copyright and license terms please see the LICENSE at the root of this distribution. >> %OUTPUT_FILE%
  17. echo # >> %OUTPUT_FILE%
  18. echo # SPDX-License-Identifier: Apache-2.0 OR MIT >> %OUTPUT_FILE%
  19. echo # >> %OUTPUT_FILE%
  20. echo.>> %OUTPUT_FILE%
  21. :: .cmake file first line should be "set(FILES"
  22. echo set(FILES>> %OUTPUT_FILE%
  23. :: Here we append the list of files
  24. (
  25. :: Recursive for loop for every file in directory and subdirectories
  26. for /R %%f in (*.*) do (
  27. :: Get full file path and name
  28. set filePath=%%f
  29. :: Remove the current directory from the file path. This gives us the local path
  30. set relativeFilePath=!filePath:%CURRENT_DIRECTORY%=!
  31. :: Turns "\my\asset\folder" into "/my/asset/folder" for cmake
  32. set relativeFilePath=!relativeFilePath:\=/!
  33. :: Filter out files in Materials/HotReloadTest. materialHotReloadPath is the first 23 characters of the relative file path
  34. set materialHotReloadPath=!relativeFilePath:~0,23!
  35. if not !materialHotReloadPath! == Materials/HotReloadTest (
  36. :: Filter out files in Cache/. cachePath is the first 6 characters of the relative file path
  37. set cachePath=!relativeFilePath:~0,6!
  38. if not !cachePath! == Cache/ (
  39. :: Filter only relevant file types
  40. if !relativeFilePath:~-4! == .lua echo %TAB%!relativeFilePath!
  41. if !relativeFilePath:~-5! == .pass echo %TAB%!relativeFilePath!
  42. if !relativeFilePath:~-5! == .azsl echo %TAB%!relativeFilePath!
  43. if !relativeFilePath:~-6! == .azsli echo %TAB%!relativeFilePath!
  44. if !relativeFilePath:~-7! == .shader echo %TAB%!relativeFilePath!
  45. if !relativeFilePath:~-13! == .materialtype echo %TAB%!relativeFilePath!
  46. )
  47. )
  48. )
  49. ) >> %OUTPUT_FILE%
  50. @echo ) >> %OUTPUT_FILE%