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