fixex: windows failing to compile with build.bat
authorBenjamín García Roqués <benjamingarciaroques@gmail.com>
Sun, 18 Feb 2024 15:23:53 +0000 (12:23 -0300)
committerBenjamín García Roqués <benjamingarciaroques@gmail.com>
Sun, 18 Feb 2024 15:23:53 +0000 (12:23 -0300)
build.bat
shared/include/bh.h

index fa8262a6d274027b5b37830e921338b5581b49e4..5244f69bd512370872aae66a3466802c6c728200 100644 (file)
--- a/build.bat
+++ b/build.bat
@@ -17,6 +17,12 @@ set FLAGS=%FLAGS% "/I%PWD%\shared\include" /DONYX_RUNTIME_LIBRARY=wasmer
 rc.exe misc/icon_resource.rc
 cl.exe %FLAGS% /Icompiler/include /std:c17 /TC %SOURCE_FILES% /link /IGNORE:4217 %LINK_OPTIONS% /DEBUG /OUT:onyx.exe /incremental:no /opt:ref /subsystem:console misc\icon_resource.res
 
+REM Don't continue if we had compilation errors. This prevents CI to succeed.
+if %ERRORLEVEL% neq 0 (
+    echo Compiler compilation failed.
+    exit /b %ERRORLEVEL%
+)
+
 del *.pdb > NUL 2> NUL
 del *.ilk > NUL 2> NUL
 del *.obj > NUL 2> NUL
@@ -24,6 +30,11 @@ del misc\icon_resource.res
 
 cl /MT /std:c17 /TC /I compiler/include /I shared/include /D_USRDLL /D_WINDLL runtime\onyx_runtime.c /link /DLL ws2_32.lib bcrypt.lib Synchronization.lib kernel32.lib /OUT:onyx_runtime.dll
 
+if %ERRORLEVEL% neq 0 (
+    echo Onyx runtime compilation failed.
+    exit /b %ERRORLEVEL%
+)
+
 del onyx_runtime.obj
 del onyx_runtime.lib
 del onyx_runtime.exp
index 5004b9c68fdd886b1addc533c5e58240fb52c96c..4e5616135d446302472b50169b2549236920223c 100644 (file)
@@ -1926,6 +1926,10 @@ b32 bh_file_stat(char const* filename, bh_file_stats* out) {
     out->modified_time = timespec_to_ms(s.st_mtimespec);
     out->accessed_time = timespec_to_ms(s.st_atimespec);
     out->change_time   = timespec_to_ms(s.st_ctimespec);
+#elif defined(_BH_WINDOWS)
+    out->modified_time = s.st_mtime * 1000;
+    out->accessed_time = s.st_atime * 1000;
+    out->change_time   = s.st_ctime * 1000;
 #else
     out->modified_time = timespec_to_ms(s.st_mtim);
     out->accessed_time = timespec_to_ms(s.st_atim);