diff options
| author | Mikkel Hjortshoej <fyoucon@gmail.com> | 2020-08-23 15:25:19 +0200 |
|---|---|---|
| committer | Mikkel Hjortshoej <fyoucon@gmail.com> | 2020-08-23 15:25:19 +0200 |
| commit | ae2fc5830e18d536909fdb816c73b240867bff69 (patch) | |
| tree | 9fb66bd426f74319cb47e56f25a1d0cf6003d520 | |
| parent | 16b50a2f578a2038a747e7f42f330f845a92cd97 (diff) | |
Add git sha to `odin version` command
| -rw-r--r-- | .github/ISSUE_TEMPLATE/bug_report.md | 2 | ||||
| -rw-r--r-- | .github/workflows/ci.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/nightly.yml | 2 | ||||
| -rw-r--r-- | Makefile | 6 | ||||
| -rw-r--r-- | build.bat | 22 | ||||
| -rw-r--r-- | ci/build_ci.bat | 31 | ||||
| -rw-r--r-- | src/main.cpp | 12 |
7 files changed, 34 insertions, 43 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 68d842f9e..96746c20e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -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. * Operating System: -* Odin version/Commit: +* Please paste `odin version` output: ## Expected Behavior diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6de05c9b..ee9c0f138 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: shell: cmd run: | 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 shell: cmd run: | diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e75ec38e1..2dace6d2a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -22,7 +22,7 @@ jobs: shell: cmd run: | 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 shell: cmd run: | @@ -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 LDFLAGS=-pthread -ldl -lm -lstdc++ -CFLAGS=-std=c++11 +CFLAGS=-std=c++11 -DGIT_SHA=\"$(GIT_SHA)\" CC=clang OS=$(shell uname) @@ -20,5 +21,8 @@ debug: release: $(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 + @@ -12,9 +12,19 @@ if "%1" == "1" ( set release_mode=0 ) +:: Normal = 0, CI Nightly = 1 +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 +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 set compiler_flags=%compiler_flags% -Od -MDd -Z7 @@ -49,12 +59,10 @@ 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% ^ - && odin run examples/demo/demo.odin -if %errorlevel% neq 0 ( - goto end_of_build -) +cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name% + +if %errorlevel% neq 0 goto end_of_build +if %release_mode% EQU 0 odin run examples/demo/demo.odin del *.obj > NUL 2> NUL diff --git a/ci/build_ci.bat b/ci/build_ci.bat deleted file mode 100644 index 5d5b30a74..000000000 --- a/ci/build_ci.bat +++ /dev/null @@ -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 diff --git a/src/main.cpp b/src/main.cpp index 9e7f7b612..13d9e53bf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1684,7 +1684,17 @@ int main(int arg_count, char const **arg_ptr) { return 1; #endif } 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; } else { usage(args[0]); |