build.cmd /size: 2788 b    last modification: 2024-01-16 10:21
1rem  When something fails, make sure to remove the cmake cache. When compile from
2rem  the Visual Studio environment mixed with compiling from the command line
3rem  some confusion can occur.
4
5setlocal
6
7@echo .
8@echo supported flags     : --arm64 --x64 --x86 --intel64 --intel86
9@echo .
10
11set luametatexsources=%~dp0
12set luametatexplatform=x64
13set msvcplatform=x64
14
15for %%G in (%*) do (
16    if [%%G] == [--arm64] (
17        set luametatexplatform=arm64
18        set msvcplatform=x86_arm64
19    )
20    if [%%G] == [--intel64] (
21        set luametatexplatform=x64
22        set msvcplatform=amd64
23    )
24    if [%%G] == [--intel86] (
25        set luametatexplatform=x86
26        set msvcplatform=x86_amd64
27    )
28    if [%%G] == [--x64] (
29        set luametatexplatform=x64
30        set msvcplatform=amd64
31    )
32    if [%%G] == [--x86] (
33        set luametatexplatform=x86
34        set msvcplatform=x86_amd64
35    )
36)
37
38set visualstudiopath=c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build
39set luametatexbuildpath=msvc-cmd-%luametatexplatform%-release
40
41@echo .
42@echo luametatexplatform  : %luametatexplatform%
43@echo msvcplatform        : %msvcplatform%
44@echo visualstudiopath    : %visualstudiopath%
45@echo luametatexbuildpath : %luametatexbuildpath%
46@echo .
47
48mkdir build
49chdir build
50rmdir /S /Q %luametatexbuildpath%
51mkdir %luametatexbuildpath%
52chdir %luametatexbuildpath%
53
54call "%visualstudiopath%\vcvarsall.bat" %msvcplatform%
55
56cmake ../..
57cmake --build . --config Release  --parallel 8
58
59cd ..
60cd ..
61
62dir build\%luametatexbuildpath%\Release\luametatex.exe
63
64@echo .
65@echo tex trees:
66@echo .
67@echo resources like public fonts  : tex/texmf/....
68@echo the context macro package    : tex/texmf-context/....
69@echo the luametatex binary        : tex/texmf-win64/bin/...
70@echo optional third party modules : tex/texmf-context/....
71@echo fonts installed by the user  : tex/texmf-fonts/fonts/data/....
72@echo styles made by the user      : tex/texmf-projects/tex/context/user/....
73@echo .
74@echo binaries:
75@echo .
76@echo tex/texmf-win64/bin/luametatex.exe : the compiled binary (some 2-3MB)
77@echo tex/texmf-win64/bin/mtxrun.exe     : copy of or link to luametatex.exe
78@echo tex/texmf-win64/bin/context.exe    : copy of or link to luametatex.exe
79@echo tex/texmf-win64/bin/mtxrun.lua     : copy of tex/texmf-context/scripts/context/lua/mtxrun.lua
80@echo tex/texmf-win64/bin/context.lua    : copy of tex/texmf-context/scripts/context/lua/context.lua
81@echo .
82@echo commands:
83@echo .
84@echo mtxrun --generate                 : create file database
85@echo mtxrun --script fonts --reload    : create font database
86@echo mtxrun --autogenerate context ... : run tex file (e.g. from editor)
87@echo .
88
89endlocal
90