v4k-git-backup/MAKE.bat

1011 lines
34 KiB
Batchfile
Raw Normal View History

@echo off
setlocal enableDelayedExpansion
cd /d "%~dp0"
2024-01-20 01:14:36 +00:00
rem echo Args: %*
2024-01-20 01:12:45 +00:00
rem show help
if "%1"=="-?" goto showhelp
if "%1"=="-h" goto showhelp
if "%1"=="help" (
:showhelp
2023-08-10 21:53:51 +00:00
echo %0 ; compile everything: `make dll dev` alias
echo %0 [help] ; show this screen
echo %0 [docs] ; generate tools/docs/docs.html file
echo %0 [cook] ; cook .zipfiles with tools/cook.ini cookbook
2023-11-19 16:10:42 +00:00
echo %0 [build_cook] ; build cook tool in release mode
2024-02-11 02:56:45 +00:00
echo %0 [sync] ; sync/reset repo to latest
2023-10-10 05:02:54 +00:00
echo %0 [fwk_prep] ; prepare files for fwk PR
echo %0 [fwk] ; update fwk-mirror fork
2023-08-10 21:53:51 +00:00
echo %0 [lua] ; execute lua script with v4k
echo %0 [html5] ; build HTML5 demo
echo %0 [web] ; run Python webserver in html5 dir
2023-10-09 05:50:16 +00:00
echo %0 [pull] ; pull changes from origin
echo %0 [push] ; prepare for commit, stage changes and commit them
2023-10-13 10:59:44 +00:00
echo %0 [dstat] ; show depot changes
2023-10-09 05:50:16 +00:00
echo %0 [dpush] ; push depot changes
echo %0 [depot] ; sync depot changes
2023-10-13 10:59:44 +00:00
echo %0 [fuse] ; fuse all binaries and cooked zipfiles found together
2023-08-10 21:53:51 +00:00
echo %0 [git] ; prepare for commit
2023-09-08 12:10:14 +00:00
echo %0 [vps] ; upload the release to VPS
2023-08-10 21:53:51 +00:00
echo %0 [tidy] ; clean up temp files
echo %0 [bind] ; generate lua bindings
2024-02-11 02:49:33 +00:00
echo %0 [checkmem] ; check untracked allocators in V4K
2023-10-26 07:20:59 +00:00
echo %0 [todo] ; check for @fixme and @todo
2023-10-28 18:04:10 +00:00
echo %0 [v4web] ; sync v4 website
2023-11-30 13:33:49 +00:00
echo %0 [swap] ; toggle #line directives on/off
2023-08-10 21:53:51 +00:00
echo %0 [split^|join] ; engine/v4k* ^>split^> engine/split/* or engine/split/* ^>join^> engine/v4k*
2023-12-12 10:56:44 +00:00
echo %0 [3rd] ; join 3rd parties together
2023-08-10 21:53:51 +00:00
echo %0 [lua] ; execute lua script with v4k
echo %0 [amalgamation] ; combine engine/v4k* into a single-header file
echo %0 [prep] ; combine split files into a single-header file, ready for use
echo %0 [sln] ; generate a xcode/gmake/ninja/visual studio solution
echo %0 [addons[ names ] ] ; specify list of addons you want to compile with the engine
2023-10-24 15:22:12 +00:00
echo %0 [cl^|tcc^|cc^|gcc^|clang^|clang-cl] [dbg^|dev^|rel^|ret] [static^|dll] [nov4k^|nodemos^|editor] [vis] [-- args]
echo cl \
echo tcc ^|
echo cc ^| select compiler. must be accessible in PATH
echo gcc ^| (will be autodetected when no option is provided^)
echo clang ^|
echo clang-cl /
echo dbg \ debug build: [x] ASAN [x] poison [x] asserts [x] profiler [x] symbols [ ] zero optimizations
echo dev ^| develop build: [ ] ASAN [x] poison [x] asserts [x] profiler [x] symbols [*] some optimizations (default^)
echo rel / release build: [ ] ASAN [ ] poison [ ] asserts [ ] profiler [x] symbols (cl,clang-cl only^) [x] many optimizations
2023-08-10 14:30:56 +00:00
echo static \ link v4k as static library
echo dll / link v4k as dynamic library (dll^) (default^)
echo nov4k \ do not compile framework
echo demos ^| do compile demos
echo editor / do compile editor
2023-09-10 16:16:25 +00:00
echo run ^| run compiled .exe
echo vis ^> visualize invokation cmdline.
echo args ^> after `--` separator is found, pass all remaining arguments to compiler as-is
2023-09-15 08:50:29 +00:00
echo run_args ^> after `//` separator is found, pass all remaining arguments to runtime exe as-is
echo.
exit /b
)
rem sync repo to latest
if "%1"=="sync" (
call MAKE.bat tidy
2023-12-04 08:44:52 +00:00
git reset --hard origin/main
exit /b
)
rem cook asset files
if "%1"=="cook" (
rem generate cooker twice: use multi-threaded version if available (cl). then cook.
2023-08-10 14:30:56 +00:00
rem call tools\tcc tools\cook.c -Iengine engine\v4k.c
rem cl tools\cook.c -Iengine engine\v4k.c
rem cook
tools\cook
exit /b
)
2023-11-19 13:12:48 +00:00
if "%1"=="build_cook" (
pushd tools
cl cook.c -I..\engine /openmp /Os /Ox /O2 /Oy /MT /DNDEBUG /GL /GF /Gw /arch:AVX2 /link /OPT:ICF /LTCG
popd
exit /b
)
rem generate bindings
2023-08-10 14:30:56 +00:00
if "%1"=="bind" (
rem luajit
2023-08-10 14:30:56 +00:00
tools\luajit tools\luajit_make_bindings.lua > v4k.lua
2023-10-09 06:43:21 +00:00
move /y v4k.lua bind
exit /b
)
2023-08-10 19:52:43 +00:00
if "%1"=="lua" (
2023-10-09 06:43:21 +00:00
pushd bind
luajit "..\%2"
2023-08-10 19:52:43 +00:00
popd
exit /b
)
rem generate documentation
if "%1"=="docs" (
rem set symbols...
git describe --tags --abbrev=0 > info.obj
set /p VERSION=<info.obj
git rev-list --count --first-parent HEAD > info.obj
set /p GIT_REVISION=<info.obj
git rev-parse --abbrev-ref HEAD > info.obj
set /p GIT_BRANCH=<info.obj
date /t > info.obj
set /p LAST_MODIFIED=<info.obj
2023-09-08 20:23:54 +00:00
git --no-pager log --pretty="format:[%%h](https://dev.v4.games/v4games/v4k/commit/%%H): %%s (**%%cN**)" > changelog.txt
rem ...and generate docs
2023-12-04 08:24:48 +00:00
rem cl tools\docs\docs.c engine\v4k.c -Iengine /Od /DNDEBUG %2
tools\docs engine\v4k.h --excluded=3rd_glad.h,v4k.h,v4k_compat.h, > v4k.html
2023-08-10 14:30:56 +00:00
move /y v4k.html engine\
2023-09-08 20:14:11 +00:00
del changelog.txt
2023-09-15 08:55:29 +00:00
del info.obj
exit /b
)
rem generate single-header distribution
if "%1"=="amalgamation" (
2023-08-10 14:30:56 +00:00
echo // This file is intended to be consumed by a compiler. Do not read. > v4k.h
echo // **Browse to any of the sources in engine/split/ folder instead** >> v4k.h
echo // ---------------------------------------------------------------- >> v4k.h
echo // #define V4K_IMPLEMENTATION early in **one** C file to unroll the >> v4k.h
echo // implementation. The symbol must be defined in a C (not C++^) file>> v4k.h
echo // ---------------------------------------------------------------- >> v4k.h
echo #pragma once >> v4k.h
2023-10-08 07:48:47 +00:00
type engine\split\3rd_icon_md.h >> v4k.h
2023-08-10 14:30:56 +00:00
type engine\split\3rd_glad.h >> v4k.h
type engine\v4k.h >> v4k.h
echo #ifdef V4K_IMPLEMENTATION >> v4k.h
echo #define V4K_3RD >> v4k.h
type engine\v4k >> v4k.h
type engine\v4k.c >> v4k.h
echo #endif // V4K_IMPLEMENTATION >> v4k.h
move /y v4k.h engine\joint
exit /b
)
2023-08-10 14:30:56 +00:00
rem generate prior files to a git release
if "%1"=="git" (
rem call make.bat dll
2023-08-14 17:43:07 +00:00
call make.bat prep
2023-08-10 14:30:56 +00:00
call make.bat bind
2023-09-11 11:42:52 +00:00
rem call make.bat docs
2023-11-28 13:31:56 +00:00
rem call make.bat amalgamation
2023-10-13 10:59:44 +00:00
rem call make.bat split
rem rd /q /s engine\split
rem md engine\split
2023-08-10 14:30:56 +00:00
rem move /y v4k_*.? engine\split\
rem move /y 3rd_*.? engine\split\
call make.bat tidy
2023-12-04 08:13:46 +00:00
git add engine/split
git add engine/joint
2023-12-04 08:15:35 +00:00
git add engine/v4k
2024-02-11 02:23:53 +00:00
git add engine/v4k.*
git add MAKE.bat
2023-12-04 08:15:35 +00:00
git add bind/v4k.lua
exit /b
)
2023-08-10 14:30:56 +00:00
if "%1"=="pull" (
2023-10-09 05:50:16 +00:00
git pull
2023-08-10 14:30:56 +00:00
exit /b
)
2023-10-09 05:50:16 +00:00
if "%1"=="depot" (
2023-10-20 19:29:51 +00:00
pushd depot\
git pull
popd
2023-10-09 05:50:16 +00:00
git submodule update --remote --merge depot/
exit /b
)
2023-08-10 14:30:56 +00:00
2023-10-13 10:09:54 +00:00
if "%1"=="dstat" (
pushd depot
git status
popd
exit /b
)
2023-10-09 05:50:16 +00:00
if "%1"=="dpush" (
2023-10-08 19:46:49 +00:00
pushd depot
git add .
2023-10-09 05:50:16 +00:00
if "%2"=="auto" (
git commit -m "asset update"
2023-10-09 05:55:43 +00:00
git push
2023-10-09 05:50:16 +00:00
) else (
git commit
2023-10-09 05:55:43 +00:00
if not "%2"=="local" (
git push
)
2023-10-08 19:47:29 +00:00
)
2023-10-08 19:46:49 +00:00
popd
2023-10-09 05:50:16 +00:00
2023-10-10 06:30:58 +00:00
if not "%2"=="noroot" (
2023-10-11 17:40:58 +00:00
git stash
2023-10-10 06:30:58 +00:00
git add depot
git commit -m "sync depot"
if not "%3"=="local" (
2023-10-11 07:20:25 +00:00
git pull
2023-10-10 06:30:58 +00:00
git push
)
2023-10-11 17:40:58 +00:00
git stash pop
2023-10-10 06:30:58 +00:00
)
2023-10-09 05:50:16 +00:00
exit /b
)
if "%1"=="push" (
call make.bat tidy
git status
2023-10-13 18:26:42 +00:00
if "%2"=="dp" (
call MAKE.bat dpush auto
)
2023-12-02 09:58:18 +00:00
rem git add .
2023-08-10 14:30:56 +00:00
git commit
2023-12-02 09:58:18 +00:00
git diff --quiet --exit-code --cached
if !ERRORLEVEL! neq 0 (
echo Commit was cancelled or failed
exit /b %ERRORLEVEL%
)
2023-10-09 05:50:16 +00:00
if not "%2"=="local" (
2023-08-10 23:17:10 +00:00
git push
)
2023-09-11 11:42:52 +00:00
call make.bat vps
2023-10-10 05:23:34 +00:00
call make.bat tidy
2023-08-10 14:30:56 +00:00
exit /b
)
if "%1"=="prep" (
2023-11-28 13:31:56 +00:00
call make.bat split
2023-08-10 14:30:56 +00:00
call make.bat amalgamation
exit /b
)
rem shortcuts for split & join amalgamation scripts
if "%1"=="split" (
call tools\split
exit /b
)
if "%1"=="join" (
call tools\join
exit /b
)
2023-12-12 10:56:44 +00:00
if "%1"=="3rd" (
call tools\join_3rd
exit /b
)
2023-11-30 13:33:49 +00:00
if "%1"=="swap" (
echo Swapping #line on v4k.h
call tools\linswap engine\v4k.h
echo Swapping #line on v4k.c
call tools\linswap engine\v4k.c
exit /b
)
2023-10-13 10:59:44 +00:00
rem fuse binaries and zipfiles
if "%1"=="fuse" (
setlocal enableDelayedExpansion
if "%2"=="cook" (
del *.zip 2> nul 1> nul & tools\cook --cook-jobs=1
)
for %%i in (*.exe) do set "var=%%i" && if not "!var:~0,6!"=="fused_" ( copy /y !var! fused_!var! 2>nul 1>nul & tools\ark fused_!var! *.zip )
endlocal
exit /b
)
rem check memory api calls
2024-02-11 02:49:33 +00:00
if "%1"=="checkmem" (
2023-10-13 20:16:25 +00:00
findstr /RNC:"[^_xv]realloc[(]" engine\split\v4k*
findstr /RNC:"[^_xv]REALLOC[(]" engine\split\v4k*
findstr /RNC:"[^_xv]MALLOC[(]" engine\split\v4k*
findstr /RNC:"[^_xv]xrealloc[(]" engine\split\v4k*
findstr /RNC:"[^_xv]malloc[(]" engine\split\v4k*
findstr /RNC:"[^_xv]free[(]" engine\split\v4k*
findstr /RNC:"[^_xv]calloc[(]" engine\split\v4k*
findstr /RNC:"[^_xv]strdup[(]" engine\split\v4k*
2024-02-11 02:49:33 +00:00
findstr /RNC:"[^_xv]array_init[(]" engine\split\v4k*
findstr /RNC:"[^_xv]array_resize[(]" engine\split\v4k*
findstr /RNC:"[^_xv]array_reserve[(]" engine\split\v4k*
findstr /RNC:"[^_xv]array_push[(]" engine\split\v4k*
findstr /RNC:"[^_xv]array_push_front[(]" engine\split\v4k*
findstr /RNC:"[^_xv]array_free[(]" engine\split\v4k*
findstr /RNC:"[^_xv]array_free[(]" engine\split\v4k*
findstr /RNC:"[^_xv]set_init[(]" engine\split\v4k*
findstr /RNC:"[^_xv]set_insert[(]" engine\split\v4k*
findstr /RNC:"[^_xv]map_init[(]" engine\split\v4k*
findstr /RNC:"[^_xv]map_insert[(]" engine\split\v4k*
2023-08-10 14:30:56 +00:00
exit /b
)
2023-10-26 07:20:59 +00:00
if "%1"=="todo" (
findstr /RNC:"[^_xv]@todo" engine\split\v4k*
findstr /RNC:"[^_xv]@fixme" engine\split\v4k*
exit /b
)
2023-10-28 18:04:10 +00:00
if "%1"=="v4web" (
pushd website\
git pull origin main
git add .
git commit -m "website update"
git push origin main
popd
2023-10-28 18:11:19 +00:00
git stash
git add website
git commit -m "sync website"
git pull
git push
git stash pop
2023-10-28 18:04:10 +00:00
exit /b
)
2023-08-10 14:30:56 +00:00
if "%1"=="html5" (
pushd demos\html5
call make.bat %2
popd
exit /b
)
2023-08-10 20:34:20 +00:00
if "%1"=="web" (
python demos\html5\host.py --directory demos\html5 --bind 127.0.0.1 8000
2023-08-10 20:34:20 +00:00
exit /b
)
2023-09-08 12:10:14 +00:00
if "%1"=="vps" (
2023-09-08 20:23:54 +00:00
call make.bat docs
2023-09-08 12:10:14 +00:00
tools\pscp -4 -batch -agent -P 22 -l app engine\v4k.html 128.140.14.212:/home/app/microblog/app/static/v4k/index.html
2023-09-08 12:33:36 +00:00
rem tools\pscp -4 -batch -agent -P 22 -l app engine\joint\v4k.h 128.140.14.212:/home/app/microblog/app/static/v4k/v4k.h
2023-09-08 12:10:14 +00:00
exit /b
)
2023-12-04 08:44:52 +00:00
if "%1"=="fwk" (
2023-12-01 22:03:32 +00:00
pushd ..\fwk-mirror
git fetch
git reset --hard origin/main
popd
call MAKE.bat fwk_prep
copy/y ..\fwk-mirror\engine\fwk.h _fwk\engine\fwk.h
copy/y ..\fwk-mirror\engine\fwk.c _fwk\engine\fwk.c
copy/y ..\fwk-mirror\engine\fwk _fwk\engine\fwk
copy/y ..\fwk-mirror\engine\split\*.inl _fwk\engine\split\
2023-12-04 08:10:39 +00:00
copy/y ..\fwk-mirror\engine\art\shaders\* _fwk\engine\art\shaders\
copy/y ..\fwk-mirror\tools\*.c _fwk\tools\
2023-12-04 08:44:52 +00:00
copy/y ..\fwk-mirror\demos\*.c _fwk\demos\
2023-12-01 22:03:32 +00:00
rem copy/y ..\fwk-mirror\engine\split\3rd_*.c _fwk\engine\split\
2024-02-11 02:49:33 +00:00
call MAKE.bat fwk_back
2023-12-01 22:03:32 +00:00
exit /b
)
2023-10-10 05:02:54 +00:00
if "%1"=="fwk_prep" (
2023-08-10 18:52:50 +00:00
if not exist "_fwk" mkdir "_fwk"
2023-08-14 17:25:13 +00:00
if not exist "_fwk\demos" mkdir "_fwk\demos"
if not exist "_fwk\tools" mkdir "_fwk\tools"
if not exist "_fwk\tools\editor" mkdir "_fwk\tools\editor"
if not exist "_fwk\engine" mkdir "_fwk\engine"
2023-09-11 11:01:26 +00:00
if not exist "_fwk\engine\art" mkdir "_fwk\engine\art"
if not exist "_fwk\engine\art\shaders" mkdir "_fwk\engine\art\shaders"
2023-08-14 17:25:13 +00:00
if not exist "_fwk\engine\split" mkdir "_fwk\engine\split"
2023-08-14 17:14:44 +00:00
setlocal enabledelayedexpansion
2023-08-14 17:25:13 +00:00
xcopy /y "*" "_fwk"
xcopy /y "engine\split\3rd_*" "_fwk\engine\split"
2023-09-11 11:01:26 +00:00
xcopy /y "engine\art\shaders\*" "_fwk\engine\art\shaders"
2023-08-14 17:25:13 +00:00
xcopy /y "demos" "_fwk\demos"
2023-11-19 13:12:48 +00:00
copy /y "engine\editor.c" "_fwk\engine\editor.c"
2023-12-01 22:03:32 +00:00
copy /y "engine\v4k.c" "_fwk\engine\fwk.c"
copy /y "engine\v4k.h" "_fwk\engine\fwk.h"
copy /y "engine\v4k" "_fwk\engine\fwk"
2023-10-09 06:43:21 +00:00
rem xcopy /y/E "tools "_fwk\tools"
2023-08-10 18:52:50 +00:00
for %%f in ("engine\split\v4k*") do (
set "filename=%%~nf"
set "newname=fwk!filename:v4k=!%%~xf"
2023-08-14 17:25:13 +00:00
echo Copying and renaming "%%f" to "_fwk\engine\split\!newname!"
copy "%%f" "_fwk\engine\split\!newname!"
2023-08-10 18:52:50 +00:00
)
2023-08-14 17:25:13 +00:00
for %%f in (_fwk\engine\split\*) do (
2023-08-10 18:52:50 +00:00
set "filename=%%~nxf"
if /i not "!filename:~0,4!"=="3rd_" (
echo Processing: %%f
tools\fwkren.exe %%f from
2023-08-11 19:46:46 +00:00
) else (
echo Skipping %%f
)
)
2023-08-14 17:30:36 +00:00
for %%f in (_fwk\demos\*.c) do (
2023-08-14 17:25:13 +00:00
set "filename=%%~nxf"
echo Processing: %%f
tools\fwkren.exe %%f from
)
2023-08-14 17:28:57 +00:00
rem for %%f in (_fwk\tools\*) do (
rem set "filename=%%~nxf"
rem echo Processing: %%f
rem tools\fwkren.exe %%f from
rem )
2023-10-09 06:43:21 +00:00
rem for %%f in (_fwk\tools\editor\*.c) do (
rem set "filename=%%~nxf"
rem echo Processing: %%f
rem tools\fwkren.exe %%f from
rem )
2023-08-11 19:46:46 +00:00
2023-10-09 06:43:21 +00:00
rem tools\fwkren.exe tools\cook.ini from
2023-08-14 17:27:44 +00:00
2023-08-11 19:46:46 +00:00
echo All done.
endlocal
exit /b
)
2024-02-11 02:49:33 +00:00
if "%1"=="fwk_back" (
2023-08-14 17:14:44 +00:00
if not exist "_fwk" exit /b
2023-08-11 19:46:46 +00:00
setlocal enabledelayedexpansion
2023-08-14 17:25:13 +00:00
xcopy /y "_fwk" "."
xcopy /y "_fwk\engine\split\3rd_*" "engine\split"
2023-09-11 11:01:26 +00:00
xcopy /y "_fwk\engine\art\shaders\*" "engine\art\shaders"
2023-11-19 13:12:48 +00:00
del "demos\*.c"
2023-08-14 17:25:13 +00:00
xcopy /y "_fwk\demos" "demos"
2023-11-19 12:07:28 +00:00
xcopy /y "_fwk\engine\editor.c" "engine\editor.c"
2023-12-01 22:03:32 +00:00
copy /y "_fwk\engine\fwk.c" "engine\v4k.c"
copy /y "_fwk\engine\fwk.h" "engine\v4k.h"
copy /y "_fwk\engine\fwk" "engine\v4k"
2023-11-19 12:07:28 +00:00
tools\fwkren.exe "engine\editor.c" to
2023-12-01 22:03:32 +00:00
tools\fwkren.exe "engine\v4k.c" to
tools\fwkren.exe "engine\v4k.h" to
tools\fwkren.exe "engine\v4k" to
2023-11-19 12:07:28 +00:00
tools\fwkren.exe "hello.c" to
2023-10-09 06:43:21 +00:00
rem xcopy /y/E "_fwk\tools "tools"
2023-08-14 17:25:13 +00:00
for %%f in ("_fwk\engine\split\fwk*") do (
2023-08-11 19:46:46 +00:00
set "filename=%%~nf"
set "newname=v4k!filename:fwk=!%%~xf"
echo Copying and renaming "%%f" to "engine\split\!newname!"
copy "%%f" "engine\split\!newname!"
)
for %%f in (engine\split\*) do (
set "filename=%%~nxf"
if /i not "!filename:~0,4!"=="3rd_" (
echo Processing: %%f
tools\fwkren.exe %%f to
2023-08-10 18:52:50 +00:00
) else (
echo Skipping %%f
)
)
2023-08-14 17:27:44 +00:00
for %%f in (demos\*.c) do (
2023-08-14 17:25:13 +00:00
set "filename=%%~nxf"
echo Processing: %%f
tools\fwkren.exe %%f to
)
2023-08-14 17:28:57 +00:00
rem for %%f in (tools\*.c) do (
rem set "filename=%%~nxf"
rem echo Processing: %%f
rem tools\fwkren.exe %%f to
rem )
2023-10-09 06:43:21 +00:00
rem for %%f in (tools\editor\*.c) do (
rem set "filename=%%~nxf"
rem echo Processing: %%f
rem tools\fwkren.exe %%f to
rem )
2023-08-10 18:52:50 +00:00
2023-10-09 06:43:21 +00:00
rem tools\fwkren.exe tools\cook.ini to
2023-08-14 17:27:44 +00:00
2023-12-01 22:12:02 +00:00
rem call make.bat join
rem call make.bat amalgamation
2023-11-28 13:31:56 +00:00
2023-08-10 18:52:50 +00:00
echo All done.
endlocal
exit /b
)
2023-11-05 15:30:11 +00:00
if "%1"=="fwk_mir" (
rd/q/s _fwk
rd/q/s ..\_fwk
mkdir ..\_fwk
setlocal enabledelayedexpansion
xcopy /y/E "*" "..\_fwk"
move "..\_fwk" _fwk
for %%f in ("engine\split\v4k*") do (
set "filename=%%~nf"
set "newname=fwk!filename:v4k=!%%~xf"
echo Copying and renaming "%%f" to "_fwk\engine\split\!newname!"
copy "%%f" "_fwk\engine\split\!newname!"
)
for %%f in (_fwk\engine\split\*) do (
set "filename=%%~nxf"
if /i not "!filename:~0,4!"=="3rd_" (
echo Processing: %%f
tools\fwkren.exe %%f from
) else (
echo Skipping %%f
)
)
for %%f in (_fwk\demos\*.c) do (
set "filename=%%~nxf"
echo Processing: %%f
tools\fwkren.exe %%f from
)
for %%f in (_fwk\tools\*) do (
set "filename=%%~nxf"
echo Processing: %%f
tools\fwkren.exe %%f from
)
for %%f in (_fwk\tools\editor\*.c) do (
set "filename=%%~nxf"
echo Processing: %%f
tools\fwkren.exe %%f from
)
tools\fwkren.exe _fwk\tools\cook.ini from
2023-11-28 14:38:30 +00:00
tools\fwkren.exe _fwk\engine\v4k.c from
tools\fwkren.exe _fwk\engine\v4k.h from
move _fwk\engine\v4k.h _fwk\engine\fwk.h
move _fwk\engine\v4k.c _fwk\engine\fwk.c
2023-11-05 15:30:11 +00:00
echo All done.
endlocal
exit /b
)
rem tidy environment
if "%1"=="tidy" (
move /y ??-*.png demos > nul 2> nul
move /y ??-*.c demos > nul 2> nul
2023-10-09 06:43:21 +00:00
del bind\v4k.dll > nul 2> nul
del .temp*.* > nul 2> nul
del *.zip > nul 2> nul
del *.mem > nul 2> nul
del *.exp > nul 2> nul
2023-10-14 19:47:24 +00:00
del *.exe.manifest > nul 2> nul
2023-08-14 17:10:31 +00:00
del tools\*.exp > nul 2> nul
del *.lib > nul 2> nul
2024-02-11 02:49:33 +00:00
del *.tmp > nul 2> nul
del *.exe > nul 2> nul
2023-10-28 20:52:28 +00:00
del *.log > nul 2> nul
del *.obj > nul 2> nul
2023-08-14 17:10:31 +00:00
del tools\*.obj > nul 2> nul
del *.o > nul 2> nul
del *.a > nul 2> nul
del *.pdb > nul 2> nul
del *.ilk > nul 2> nul
del *.png > nul 2> nul
del *.mp4 > nul 2> nul
del *.def > nul 2> nul
del *.dll > nul 2> nul
2023-12-12 18:18:36 +00:00
del *.ini > nul 2> nul
2023-11-15 19:14:14 +00:00
del *.csv > nul 2> nul
del 3rd_*.* > nul 2> nul
2023-08-10 14:30:56 +00:00
del v4k_*.* > nul 2> nul
2023-10-09 05:50:16 +00:00
del v4k.html > nul 2> nul
del changelog.txt > nul 2> nul
2023-12-12 16:28:07 +00:00
del steam_appid.txt > nul 2> nul
rem del ??-*.* > nul 2> nul
del temp_*.* > nul 2> nul
rd /q /s .vs > nul 2> nul
rd /q /s _debug > nul 2> nul
rd /q /s _devel > nul 2> nul
rd /q /s _release > nul 2> nul
2023-08-10 19:00:12 +00:00
rd /q /s _fwk > nul 2> nul
2023-10-01 06:49:08 +00:00
rd /q /s _cache > nul 2> nul
2023-12-12 16:28:07 +00:00
rd /q /s _deploy > nul 2> nul
rem rd /q /s _project > nul 2> nul
del tcc.bat > nul 2> nul
del sh.bat > nul 2> nul
exit /b
)
set cc=%cc%
set dll=dll
set build=dev
set args=-Iengine
2023-09-15 08:43:07 +00:00
set run_args=
set other=
2023-08-10 14:30:56 +00:00
set v4k=yes
2023-08-10 22:19:00 +00:00
set hello=no
set demos=no
2023-09-27 06:49:59 +00:00
set lab=no
2023-08-10 14:30:56 +00:00
set editor=no
set vis=no
set proj=no
set rc=0
2023-09-10 16:16:25 +00:00
set run=no
2024-01-20 01:12:45 +00:00
set addons=
set addons_names=
set addons_includes=
if "%1"=="addons[" (
shift && goto parse_addons
:parse_addons
if "%1"=="]" (
shift
) else (
set "addon_names=%1 %addon_names%"
2024-02-11 14:34:47 +00:00
rem depot folder
if exist "depot\deps\%1" (
set "addon_includes=-Idepot\deps\%1 %addon_includes%"
if exist "depot\deps\%1\%1.cpp" (
set "addons=depot\deps\%1\%1.cpp %addons%"
) else (
set "addons=depot\deps\%1\%1.c %addons%"
)
if exist "depot\deps\%1\include" (
set "addon_includes=-Idepot\deps\%1\include %addon_includes%"
)
2024-01-20 01:12:45 +00:00
)
2024-02-11 14:34:47 +00:00
if exist "plugins\%1" (
set "addon_includes=-Iplugins\%1 %addon_includes%"
if exist "plugins\%1\%1.cpp" (
set "addons=plugins\%1\%1.cpp %addons%"
) else (
set "addons=plugins\%1\%1.c %addons%"
)
if exist "plugins\%1\plugin.cpp" (
set "addons=plugins\%1\plugin.cpp %addons%"
) else (
set "addons=plugins\%1\plugin.c %addons%"
)
if exist "plugins\%1\include" (
set "addon_includes=-Iplugins\%1\include %addon_includes%"
)
2024-01-20 01:12:45 +00:00
)
shift && goto parse_addons
)
)
:parse_args
if "%1"=="--" shift && goto parse_compiler_args
2023-09-15 08:43:07 +00:00
if "%1"=="//" shift && goto parse_runtime_args
if "%1"=="dll" set "dll=%1" && goto loop
if "%1"=="static" set "dll=%1" && goto loop
if "%1"=="dbg" set "build=%1" && goto loop
if "%1"=="dev" set "build=%1" && goto loop
if "%1"=="rel" set "build=%1" && goto loop
2023-10-15 06:01:43 +00:00
if "%1"=="ret" set "build=%1" && goto loop
if "%1"=="debug" set "build=dbg" && goto loop
if "%1"=="devel" set "build=dev" && goto loop
if "%1"=="develop" set "build=dev" && goto loop
if "%1"=="developer" set "build=dev" && goto loop
if "%1"=="development" set "build=dev" && goto loop
if "%1"=="release" set "build=rel" && goto loop
if "%1"=="vis" set "vis=yes" && goto loop
2023-08-10 14:30:56 +00:00
if "%1"=="nov4k" set "v4k=no" && goto loop
if "%1"=="nodemos" set "demos=no" && goto loop
if "%1"=="demos" set "demos=yes" && set "hello=no" && goto loop
2023-09-27 06:49:59 +00:00
if "%1"=="lab" set "lab=yes" && set "hello=no" && goto loop
if "%1"=="noeditor" set "editor=no" && goto loop
2023-08-10 22:19:00 +00:00
if "%1"=="hello" set "hello=yes" && goto loop
2023-10-29 11:19:16 +00:00
if "%1"=="editor" set "editor=yes" && set "v4k=yes" && set "hello=no"&& goto loop
2023-09-10 16:16:25 +00:00
if "%1"=="run" set "run=yes" && goto loop
2023-09-27 06:49:59 +00:00
if "%1"=="all" set "v4k=yes" && set "demos=yes" && set "lab=yes" && set "editor=yes" && set "hello=yes" && goto loop
if "%1"=="tcc" set "cc=%1" && goto loop
if "%1"=="cl" set "cc=%1" && goto loop
if "%1"=="vc" set "cc=cl" && goto loop
if "%1"=="cc" set "cc=%1" && goto loop
if "%1"=="gcc" set "cc=%1" && goto loop
if "%1"=="clang" set "cc=%1" && goto loop
if "%1"=="clang-cl" set "cc=%1" && goto loop
if "%1"=="proj" set "proj=yes" && goto loop
if not "%1"=="" set "other=!other! %1" && set "editor=no" && set "demos=no"
:loop
if not "%1"=="" shift && goto parse_args
:parse_compiler_args
if not "%1"=="" set "args=!args! %1" && shift && goto parse_compiler_args
2023-09-15 08:43:07 +00:00
:parse_runtime_args
if not "%1"=="" set "run_args=!run_args! %1" && shift && goto parse_runtime_args
set vs=00
rem detect setup
if "!cc!"=="" (
set cc=cl
2023-10-24 13:22:15 +00:00
where cl /q
2023-10-24 13:45:41 +00:00
if not %ERRORLEVEL%==0 (
2023-10-24 13:22:15 +00:00
echo Detecting VS 2022/2019/2017/2015/2013 x64 ...
if exist "%VS170COMNTOOLS%/../../VC/Auxiliary/Build/vcvarsx86_amd64.bat" (
@call "%VS170COMNTOOLS%/../../VC/Auxiliary/Build/vcvarsx86_amd64.bat" > nul && set "vs=22"
) else if exist "%VS160COMNTOOLS%/../../VC/Auxiliary/Build/vcvarsx86_amd64.bat" (
@call "%VS160COMNTOOLS%/../../VC/Auxiliary/Build/vcvarsx86_amd64.bat" > nul && set "vs=19"
) else if exist "%VS150COMNTOOLS%/../../VC/Auxiliary/Build/vcvarsx86_amd64.bat" (
@call "%VS150COMNTOOLS%/../../VC/Auxiliary/Build/vcvarsx86_amd64.bat" > nul && set "vs=17"
) else if exist "%VS140COMNTOOLS%/../../VC/bin/x86_amd64/vcvarsx86_amd64.bat" (
@call "%VS140COMNTOOLS%/../../VC/bin/x86_amd64/vcvarsx86_amd64.bat" > nul && set "vs=15"
) else if exist "%VS120COMNTOOLS%/../../VC/bin/x86_amd64/vcvarsx86_amd64.bat" (
@call "%VS120COMNTOOLS%/../../VC/bin/x86_amd64/vcvarsx86_amd64.bat" > nul && set "vs=13"
) else if exist "%ProgramFiles%/microsoft visual studio/2022/community/VC/Auxiliary/Build/vcvarsx86_amd64.bat" (
@call "%ProgramFiles%/microsoft visual studio/2022/community/VC/Auxiliary/Build/vcvarsx86_amd64.bat" > nul && set "vs=22"
) else if exist "%ProgramFiles(x86)%/microsoft visual studio/2019/community/VC/Auxiliary/Build/vcvarsx86_amd64.bat" (
@call "%ProgramFiles(x86)%/microsoft visual studio/2019/community/VC/Auxiliary/Build/vcvarsx86_amd64.bat" > nul && set "vs=19"
) else if exist "%ProgramFiles(x86)%/microsoft visual studio/2017/community/VC/Auxiliary/Build/vcvarsx86_amd64.bat" (
@call "%ProgramFiles(x86)%/microsoft visual studio/2017/community/VC/Auxiliary/Build/vcvarsx86_amd64.bat" > nul && set "vs=17"
) else (
echo Detecting Mingw64 ...
set cc=gcc
where /q gcc.exe || ( echo Detecting TCC ... && set "cc=tcc" )
)
)
)
rem solution. @todo: lin/osx
if "!proj!"=="yes" if not "%vs%"=="00" pushd tools && premake5 vs20%vs% & popd
if "!proj!"=="yes" if "%vs%"=="00" pushd tools && premake5 vs2013 & popd
if "!proj!"=="yes" pushd tools && premake5 ninja & popd
if "!proj!"=="yes" pushd tools && premake5 gmake & popd & exit /b
rem --- pipeline
rem cl tools/ass2iqe.c /Fetools/ass2iqe.exe /nologo /openmp /O2 /Oy /MT /DNDEBUG assimp.lib
rem cl tools/iqe2iqm.cpp /Fetools/iqe2iqm.exe /nologo /openmp /O2 /Oy /MT /DNDEBUG
rem cl tools/mid2wav.c /Fetools/mid2wav.exe /nologo /openmp /O2 /Oy /MT /DNDEBUG
rem cl tools/xml2json.c /Fetools/xml2json.exe /nologo /openmp /O2 /Oy /MT /DNDEBUG
rem --- pipeline
rem gcc tools/ass2iqe.c -o tools/ass2iqe.exe -w -lassimp
rem gcc tools/iqe2iqm.cpp -o tools/iqe2iqm.exe -w -lstdc++
rem gcc tools/mid2wav.c -o tools/mid2wav.exe -w
rem gcc tools/xml2json.c -o tools/xml2json.exe -w
rem --- different strategies for release builds
rem 4.6s 6.9MiB (default)
rem 33.7s 6.6MiB /Ox /Oy /MT /DNDEBUG
rem 35.8s 5.3MiB /O2 /Oy /MT /DNDEBUG
rem 17.9s 4.6MiB /O1 /MT /DNDEBUG /GL /GF /arch:AVX2
rem 17.8s 4.6MiB /Os /Ox /O2 /Oy /MT /DNDEBUG /GL /GF /arch:AVX2
rem 18.8s 4.6MiB /Os /Ox /O2 /Oy /MT /DNDEBUG /GL /GF /Gw /link /OPT:ICF /LTCG
rem 18.0s 4.6MiB /openmp /Os /Ox /O2 /Oy /MT /DNDEBUG /GL /GF /Gw /arch:AVX2 /link /OPT:ICF /LTCG
if "!cc!"=="cl" (
if "!dll!"=="static" (
set export=/c
2023-08-10 14:30:56 +00:00
set import=v4k.obj
) else (
set export=/DAPI=EXPORT /LD
2023-08-10 14:30:56 +00:00
set import=/DAPI=IMPORT v4k.lib
)
2023-10-15 06:01:43 +00:00
if "!build!"=="ret" (
set args=-DENABLE_RETAIL -Dmain=WinMain !args!
set args=/nologo /Zi /MT /openmp /DNDEBUG=3 !args! /Os /Ox /O2 /Oy /GL /GF /Gw /arch:AVX2 /link /OPT:ICF /LTCG
)
if "!build!"=="rel" (
2023-10-13 15:13:45 +00:00
set args=/nologo /Zi /MT /openmp /DNDEBUG=2 !args! /Os /Ox /O2 /Oy /GL /GF /Gw /arch:AVX2 /link /OPT:ICF /LTCG
)
if "!build!"=="dev" (
2023-10-15 06:01:43 +00:00
set args=/nologo /Zi /MT /openmp /DNDEBUG=1 !args! && REM /Os /Ox /O2 /Oy /GL /GF /Gw /arch:AVX2
)
if "!build!"=="dbg" (
2023-10-15 06:01:43 +00:00
set args=/nologo /Zi /MT /DEBUG !args! /Od /fsanitize=address
rem make -- /RTC1, or make -- /Zi /fsanitize=address /DEBUG
)
set o=/Fe:
set echo=REM
) else if "!cc!"=="clang-cl" (
if "!dll!"=="static" (
set export=/c
2023-08-10 14:30:56 +00:00
set import=v4k.obj
) else (
set export=/DAPI=EXPORT /LD
2023-08-10 14:30:56 +00:00
set import=/DAPI=IMPORT v4k.lib
)
2023-10-15 06:01:43 +00:00
set warnings_fwkc=-Wno-deprecated-declarations -Wno-tautological-constant-out-of-range-compare
set warnings_demos=-Wno-empty-body -Wno-format-security -Wno-pointer-sign
2023-10-15 06:01:43 +00:00
set warnings=!warnings_fwkc! !warnings_demos!
2023-10-15 06:01:43 +00:00
if "!build!"=="ret" (
set args=-DENABLE_RETAIL -Dmain=WinMain !args!
set args=!warnings! /nologo /Zi /MT /openmp /DNDEBUG=3 !args! /Os /Ox /O2 /Oy /GF /Gw /arch:AVX2
)
if "!build!"=="rel" (
2023-10-13 15:13:45 +00:00
set args=!warnings! /nologo /Zi /MT /openmp /DNDEBUG=2 !args! /Os /Ox /O2 /Oy /GF /Gw /arch:AVX2
)
if "!build!"=="dev" (
2023-10-15 06:01:43 +00:00
set args=!warnings! /nologo /Zi /MT /openmp /DNDEBUG=1 !args! && REM /Os /Ox /O2 /Oy /GF /Gw /arch:AVX2
)
if "!build!"=="dbg" (
2023-10-15 06:01:43 +00:00
set args=!warnings! /nologo /Zi /MT /DEBUG !args! /Od /fsanitize=address
)
set o=-o
set echo=echo
) else if "!cc!"=="tcc" (
if "!dll!"=="static" (
set export=-c
2023-08-10 14:30:56 +00:00
set import=v4k.o
) else (
set export=-DAPI=EXPORT -shared
2023-08-10 14:30:56 +00:00
set import=-DAPI=IMPORT v4k.def
)
2023-10-15 06:01:43 +00:00
if "!build!"=="ret" (
set args=-DENABLE_RETAIL -Dmain=WinMain !args!
set args=-O3 -DNDEBUG=3 !args!
)
if "!build!"=="rel" (
2023-10-15 06:01:43 +00:00
set args=-O2 -DNDEBUG=2 !args!
)
if "!build!"=="dev" (
2023-10-15 06:01:43 +00:00
set args=-O1 -DNDEBUG=1 -g !args!
)
if "!build!"=="dbg" (
2023-10-15 06:01:43 +00:00
set args=-O0 -g !args!
)
set o=-o
set echo=echo
) else ( rem if "!cc!"=="gcc" or "clang"
set libs=-lws2_32 -lgdi32 -lwinmm -ldbghelp -lole32 -lshell32 -lcomdlg32
if "!dll!"=="static" (
set export=-c
2023-10-15 06:01:43 +00:00
set import=v4k.o -Wl,--allow-multiple-definition
) else (
2023-10-15 06:01:43 +00:00
set export=-DAPI=EXPORT -shared -o v4k.dll -Wl,--out-implib,v4k.a
2023-08-10 14:30:56 +00:00
set import=-DAPI=IMPORT v4k.a
)
2023-10-15 06:01:43 +00:00
set args=-Wno-implicit-function-declaration !libs! !args!
2023-10-15 06:01:43 +00:00
if "!build!"=="ret" (
set args=-DENABLE_RETAIL !args!
set args=-O3 -DNDEBUG=3 !args!
)
if "!build!"=="rel" (
rem @todo see: https://stackoverflow.com/questions/866721/how-to-generate-gcc-debug-symbol-outside-the-build-target
2023-10-15 06:01:43 +00:00
set args=-O2 -DNDEBUG=2 !args!
)
if "!build!"=="dev" (
2023-10-15 06:01:43 +00:00
set args=-O1 -DNDEBUG=1 -g !args!
)
if "!build!"=="dbg" (
2023-10-15 06:01:43 +00:00
set args=-O0 -g !args!
)
set o=-o
set echo=echo
)
echo build=!build!, type=!dll!, cc=!cc!, other=!other!, args=!args!
echo import=!import!, export=!export!
2024-01-20 01:12:45 +00:00
echo addons=!addon_names!
2023-10-07 17:34:09 +00:00
rem set BUILD_VERSION symbol
git describe --tags --abbrev=0 > info.obj
set /p VERSION=<info.obj
git rev-list --count --first-parent HEAD > info.obj
set /p GIT_REVISION=<info.obj
git rev-parse --abbrev-ref HEAD > info.obj
set /p GIT_BRANCH=<info.obj
date /t > info.obj
set /p LAST_MODIFIED=<info.obj
set args=-DBUILD_VERSION="\"!GIT_BRANCH!-!GIT_REVISION!-!build!-!dll!\"" !args!
if "!cc!"=="tcc" set "cc=call tools\tcc"
rem detect wether user-defined sources use single-header distro
2023-08-10 14:30:56 +00:00
rem if so, remove API=IMPORT flags and also do not produce v4k.dll by default
if not "!other!"=="" (
2023-08-10 14:30:56 +00:00
>nul find "V4K_IMPLEMENTATION" !other! && (
set import=
2023-08-10 14:30:56 +00:00
set v4k=no
)
)
rem framework
2023-08-10 14:30:56 +00:00
if "!v4k!"=="yes" (
2024-01-20 01:12:45 +00:00
tools\file2hash engine\v4k.c engine\v4k.h engine\v4k. engine\joint\v4k.h !addons! -- !build! !import! !export! !args! !dll! > nul
2023-10-01 06:49:08 +00:00
set cache=_cache\.!errorlevel!
md _cache 2>nul >nul
rem cache for `make rel` cl:48s->25s, tcc:3.3s->1.8s
if exist !cache!.o copy /y !cache!.o v4k.o 2>nul >nul
if exist !cache!.obj copy /y !cache!.obj v4k.obj 2>nul >nul
if exist !cache!.lib copy /y !cache!.lib v4k.lib 2>nul >nul
if exist !cache!.dll copy /y !cache!.dll v4k.dll 2>nul >nul
if exist !cache!.def copy /y !cache!.def v4k.def 2>nul >nul
if exist !cache!.pdb copy /y !cache!.pdb v4k.pdb 2>nul >nul
if not exist "!cache!" (
2024-02-11 00:20:04 +00:00
!echo! v4k && !cc! engine\v4k.c !addons! -DADDON !addon_includes! !export! !args! && if "!dll!"=="dll" copy /y v4k.dll bind\v4k.dll > nul || set rc=1
2023-10-01 06:49:08 +00:00
echo. > !cache!
if exist v4k.o copy /y v4k.o !cache!.o 2>nul >nul
if exist v4k.obj copy /y v4k.obj !cache!.obj 2>nul >nul
if exist v4k.lib copy /y v4k.lib !cache!.lib 2>nul >nul
if exist v4k.dll copy /y v4k.dll !cache!.dll 2>nul >nul
if exist v4k.def copy /y v4k.def !cache!.def 2>nul >nul
if exist v4k.pdb copy /y v4k.pdb !cache!.pdb 2>nul >nul
) else (
rem cached. do not compile...
echo v4k.c ^(cached^)
2023-10-09 06:43:21 +00:00
if "!dll!"=="dll" copy /y !cache!.dll bind\v4k.dll > nul || set rc=1
2023-10-01 06:49:08 +00:00
)
)
2023-10-28 20:52:28 +00:00
rem editor
if "!editor!"=="yes" (
2023-11-05 15:30:11 +00:00
set edit=-DCOOK_ON_DEMAND
2023-11-19 12:07:28 +00:00
rem set edit=-DUI_LESSER_SPACING -DUI_ICONS_SMALL !edit!
2024-01-20 01:12:45 +00:00
!echo! editor && !cc! !o! editor.exe engine\editor.c engine\v4k.c !addon_includes! !edit! -Iengine/joint !args! || set rc=1
2023-10-23 13:25:03 +00:00
rem if "!cc!"=="cl" (
rem set plug_export=/LD
rem ) else if "!cc!"=="clang-cl" (
rem set plug_export=/LD
rem ) else (
rem set plug_export=-shared
rem )
2023-09-18 17:50:50 +00:00
2023-10-23 13:25:03 +00:00
rem for %%f in ("workbench\plugins\*.c") do (
rem !echo! %%~nf && !cc! !o! %%~nf.dll %%f -Iworkbench !plug_export! !args! !import! || set rc=1
rem )
2023-10-23 13:25:03 +00:00
rem !echo! workbench && !cc! !o! workbench.exe workbench\workbench.c -Iworkbench !args! !import! || set rc=1
)
rem demos
if "!demos!"=="yes" (
2023-11-06 09:40:54 +00:00
for %%f in ("demos\??-*") do (
set "fname=%%~nf"
echo !fname!| findstr /R "^[0-9][0-9]-" >nul && (
if not "!fname:~0,2!"=="99" (
set limport=!import!
>nul find "V4K_IMPLEMENTATION" "demos\!fname!.c" && (
set limport=
)
2024-01-20 01:12:45 +00:00
!echo! !fname! && !cc! !o! !fname!.exe "demos\!fname!.c" !addon_includes! !limport! !args! || set rc=1
2023-11-06 09:40:54 +00:00
)
)
)
)
2023-11-06 09:40:54 +00:00
2023-09-27 06:49:59 +00:00
rem lab
if "!lab!"=="yes" (
2023-08-10 22:28:06 +00:00
for %%f in ("demos\99-*") do (
2023-10-10 05:14:16 +00:00
set limport=!import!
>nul find "V4K_IMPLEMENTATION" demos\%%~nf.c && (
set limport=
)
2024-01-20 01:12:45 +00:00
!echo! %%~nf && !cc! !o! %%~nf.exe demos\%%~nf.c !addon_includes! !limport! !args! || set rc=1
2023-08-10 22:28:06 +00:00
)
)
rem hello
if "!hello!"=="yes" (
2024-01-20 01:12:45 +00:00
!echo! hello && !cc! !o! hello.exe hello.c !addon_includes! !args! || set rc=1
)
rem user-defined apps
if not "!other!"=="" (
2023-09-15 08:43:07 +00:00
if "!vis!"=="yes" echo !cc! !other! !import! !args!
2023-10-12 11:36:40 +00:00
rem if "!cc!"=="cl" (
rem if "!build!"=="rel" (
rem set "import=!import! engine\v4k_win32_rel_glue.c"
rem set "args=!args! /SUBSYSTEM:WINDOWS"
rem )
rem )
2023-12-04 08:44:52 +00:00
for /f "tokens=*" %%a in ("%other%") do set exename=%%~na.exe
del !exename! >NUL
2024-01-20 01:12:45 +00:00
!echo! !other! && !cc! !other! !addon_includes! !import! !args! || set rc=1
)
2023-09-15 08:37:25 +00:00
if "!run!"=="yes" (
2023-10-29 11:37:09 +00:00
if "!rc!"=="1" (
echo build failed. skipping run!
) else (
set exename=hello.exe
if not "!other!"=="" (
for /f "tokens=*" %%a in ("!other!") do set exename=%%~na.exe
)
echo run !exename! !run_args!
!exename! !run_args! || set rc=1
2023-10-10 05:17:30 +00:00
)
2023-09-15 08:37:25 +00:00
)
2023-09-10 16:16:25 +00:00
rem PAUSE only if double-clicked from Windows explorer
2023-09-11 06:29:01 +00:00
(((echo.%cmdcmdline%)|%WINDIR%\system32\find.exe /I "%~0")>nul)&&pause
cmd /c exit !rc!