Add git sha to odin version command

This commit is contained in:
Mikkel Hjortshoej
2020-08-23 15:25:19 +02:00
parent 16b50a2f57
commit ae2fc5830e
7 changed files with 35 additions and 44 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ assignees: ''
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions. Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
* Operating System: * Operating System:
* Odin version/Commit: * Please paste `odin version` output:
## Expected Behavior ## Expected Behavior
+1 -1
View File
@@ -44,7 +44,7 @@ jobs:
shell: cmd shell: cmd
run: | run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
./ci/build_ci.bat ./build.bat 1
- name: Odin run - name: Odin run
shell: cmd shell: cmd
run: | run: |
+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
shell: cmd shell: cmd
run: | run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat
./ci/build_ci.bat ./build.bat 1 1
- name: Odin run - name: Odin run
shell: cmd shell: cmd
run: | run: |
+5 -1
View File
@@ -1,6 +1,7 @@
GIT_SHA=$(shell git rev-parse --short HEAD)
DISABLED_WARNINGS=-Wno-switch -Wno-pointer-sign -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare -Wno-macro-redefined DISABLED_WARNINGS=-Wno-switch -Wno-pointer-sign -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare -Wno-macro-redefined
LDFLAGS=-pthread -ldl -lm -lstdc++ LDFLAGS=-pthread -ldl -lm -lstdc++
CFLAGS=-std=c++11 CFLAGS=-std=c++11 -DGIT_SHA=\"$(GIT_SHA)\"
CC=clang CC=clang
OS=$(shell uname) OS=$(shell uname)
@@ -20,5 +21,8 @@ debug:
release: release:
$(CC) src/main.cpp $(DISABLED_WARNINGS) $(CFLAGS) -O3 -march=native $(LDFLAGS) -o odin $(CC) src/main.cpp $(DISABLED_WARNINGS) $(CFLAGS) -O3 -march=native $(LDFLAGS) -o odin
nightly:
$(CC) src/main.cpp $(DISABLED_WARNINGS) $(CFLAGS) -DNIGHTLY -O3 -march=native $(LDFLAGS) -o odin
+16 -8
View File
@@ -12,9 +12,19 @@ if "%1" == "1" (
set release_mode=0 set release_mode=0
) )
set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF :: Normal = 0, CI Nightly = 1
set compiler_defines= -DLLVM_BACKEND_SUPPORT if "%2" == "1" (
set nightly=1
) else (
set nightly=0
)
set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF
set compiler_defines= -DLLVM_BACKEND_SUPPORT
for /f %%i in ('git rev-parse --short HEAD') do set GIT_SHA=%%i
if %ERRORLEVEL% equ 0 set compiler_defines=%compiler_defines% -DGIT_SHA=\"%GIT_SHA%\"
if %nightly% equ 1 set compiler_defines=%compiler_defines% -DNIGHTLY
if %release_mode% EQU 0 ( rem Debug if %release_mode% EQU 0 ( rem Debug
set compiler_flags=%compiler_flags% -Od -MDd -Z7 set compiler_flags=%compiler_flags% -Od -MDd -Z7
@@ -49,12 +59,10 @@ set linker_settings=%libs% %linker_flags%
del *.pdb > NUL 2> NUL del *.pdb > NUL 2> NUL
del *.ilk > NUL 2> NUL del *.ilk > NUL 2> NUL
cl %compiler_settings% "src\main.cpp" ^ cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name%
/link %linker_settings% -OUT:%exe_name% ^
&& odin run examples/demo/demo.odin if %errorlevel% neq 0 goto end_of_build
if %errorlevel% neq 0 ( if %release_mode% EQU 0 odin run examples/demo/demo.odin
goto end_of_build
)
del *.obj > NUL 2> NUL del *.obj > NUL 2> NUL
-31
View File
@@ -1,31 +0,0 @@
@echo off
:: Make sure this is a decent name and not generic
set exe_name=odin.exe
set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF -O2 -MT -Z7
set compiler_defines= -DLLVM_BACKEND_SUPPORT -DNO_ARRAY_BOUNDS_CHECK
set compiler_warnings= ^
-W4 -WX ^
-wd4100 -wd4101 -wd4127 -wd4189 ^
-wd4201 -wd4204 ^
-wd4456 -wd4457 -wd4480 ^
-wd4512
set compiler_includes=
set libs= ^
kernel32.lib ^
bin\llvm\windows\LLVM-C.lib
set linker_flags= -incremental:no -opt:ref -subsystem:console -debug
set compiler_settings=%compiler_includes% %compiler_flags% %compiler_warnings% %compiler_defines%
set linker_settings=%libs% %linker_flags%
del *.pdb > NUL 2> NUL
del *.ilk > NUL 2> NUL
cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name%
:end_of_build
+11 -1
View File
@@ -1684,7 +1684,17 @@ int main(int arg_count, char const **arg_ptr) {
return 1; return 1;
#endif #endif
} else if (command == "version") { } else if (command == "version") {
gb_printf("%.*s version %.*s\n", LIT(args[0]), LIT(ODIN_VERSION)); gb_printf("%.*s version %.*s", LIT(args[0]), LIT(ODIN_VERSION));
#ifdef NIGHTLY
gb_printf("-nightly");
#endif
#ifdef GIT_SHA
gb_printf("-%s", GIT_SHA);
#endif
gb_printf("\n");
return 0; return 0;
} else { } else {
usage(args[0]); usage(args[0]);