-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathbuild.cmd
More file actions
132 lines (100 loc) · 4.58 KB
/
build.cmd
File metadata and controls
132 lines (100 loc) · 4.58 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
@echo off
setlocal enabledelayedexpansion
set PATH="C:\Program Files\7-Zip";%PATH%
where /q git.exe || (
echo ERROR: "git.exe" not found
exit /b 1
)
if exist "%ProgramFiles%\7-Zip\7z.exe" (
set SZIP="%ProgramFiles%\7-Zip\7z.exe"
) else (
where /q 7za.exe || (
echo ERROR: 7-Zip installation or "7za.exe" not found
exit /b 1
)
set SZIP=7za.exe
)
rem *** Visual Studio environment ***
where /Q cl.exe || (
set __VSCMD_ARG_NO_LOGO=1
for /f "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath') do set VS=%%i
if "!VS!" equ "" (
echo ERROR: Visual Studio installation not found
exit /b 1
)
call "!VS!\VC\Auxiliary\Build\vcvarsall.bat" amd64 || exit /b 1
)
rem *** ninja
where /q ninja.exe || (
curl -LOsf https://github.com/ninja-build/ninja/releases/download/v1.13.1/ninja-win.zip || exit /b 1
%SZIP% x -bb0 -y ninja-win.zip 1>nul 2>nul || exit /b 1
del ninja-win.zip 1>nul 2>nul
)
rem *** clone aseprite repo
if not exist aseprite (
call git clone --recursive --tags https://github.com/aseprite/aseprite.git aseprite || echo "failed to clone repo" && exit /b 1
) else (
call git -C aseprite fetch --tags || echo "failed to fetch repo" && exit /b 1
)
rem *** get name of newest tag
if "%ASEPRITE_VERSION%" equ "" (
for /F "delims=" %%v in ('"git -C aseprite tag --sort=creatordate"') do (
set ASEPRITE_VERSION=%%v
)
)
echo building %ASEPRITE_VERSION%
rem **** update local aseprite repo to selected tag
call git -C aseprite clean --quiet -fdx
call git -C aseprite submodule foreach --recursive git clean -xfd
call git -C aseprite fetch --quiet --depth=1 --no-tags origin %ASEPRITE_VERSION%:refs/remotes/origin/%ASEPRITE_VERSION% || echo "failed to fetch repo" && exit /b 1
call git -C aseprite reset --quiet --hard origin/%ASEPRITE_VERSION% || echo "failed to update repo" && exit /b 1
call git -C aseprite submodule update --init --recursive || echo "failed to update submodules" && exit /b 1
python -c "v = open('aseprite/src/ver/CMakeLists.txt').read(); open('aseprite/src/ver/CMakeLists.txt', 'w').write(v.replace('1.x-dev', '%ASEPRITE_VERSION%'[1:]))"
rem *** download skia
if exist aseprite\laf\misc\skia-tag.txt (
set /p SKIA_VERSION=<aseprite\laf\misc\skia-tag.txt
) else (
if "%ASEPRITE_VERSION:beta=%" neq "%ASEPRITE_VERSION%" (
set SKIA_VERSION=m124-08a5439a6b
) else (
set SKIA_VERSION=m102-861e4743af
)
)
if not exist skia-%SKIA_VERSION% (
mkdir skia-%SKIA_VERSION%
pushd skia-%SKIA_VERSION%
curl -sfLO https://github.com/aseprite/skia/releases/download/%SKIA_VERSION%/Skia-Windows-Release-x64.zip || echo failed to download skia && exit /b 1
%SZIP% x -y Skia-Windows-Release-x64.zip
popd
)
rem *** build aseprite
if exist build rd /s /q build
set LINK=opengl32.lib
cmake.exe ^
-G Ninja ^
-S aseprite ^
-B build ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 ^
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW ^
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW ^
-DCMAKE_POLICY_DEFAULT_CMP0092=NEW ^
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ^
-DENABLE_CCACHE=OFF ^
-DOPENSSL_USE_STATIC_LIBS=TRUE ^
-DLAF_BACKEND=skia ^
-DSKIA_DIR=%CD%\skia-%SKIA_VERSION% ^
-DSKIA_LIBRARY_DIR=%CD%\skia-%SKIA_VERSION%\out\Release-x64 ^
-DSKIA_OPENGL_LIBRARY= || echo failed to configure build && exit /b 1
ninja.exe -C build || echo build failed && exit /b 1
rem *** create output folder
mkdir aseprite-%ASEPRITE_VERSION%
echo # This file is here so Aseprite behaves as a portable program >aseprite-%ASEPRITE_VERSION%\aseprite.ini
xcopy /E /Q /Y aseprite\docs aseprite-%ASEPRITE_VERSION%\docs\
xcopy /E /Q /Y build\bin\aseprite.exe aseprite-%ASEPRITE_VERSION%\
xcopy /E /Q /Y build\bin\data aseprite-%ASEPRITE_VERSION%\data\
if "%GITHUB_WORKFLOW%" neq "" (
mkdir github
move aseprite-%ASEPRITE_VERSION% github\
echo ASEPRITE_VERSION=%ASEPRITE_VERSION%>>"%GITHUB_OUTPUT%"
)