2
0

generate_asset_cmake.bat 1.9 KB

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