In order to guarantee that Hammer can build on Windows, an appveyor.yml and associated build scripts will build hammer and its examples. The idea is that as soon as the appveyor.yml exists in the repository, pull requests that would impede Windows portability would be immediately detected. The scripts expect CL.EXE to be in the path, and will produce their results in build/ The highest level of warning is enabled on CL.EXE, minus warnings that bring CL.EXE to a level that ressembles C99. The only notable warning that was disabled is the one that tells you about implicit truncating conversions. Hammer's source code has quite a few implicit conversions say from a 64bit unsigned integer to a integer of a lesser size (signed or otherwise)
47 lines
1.1 KiB
Batchfile
47 lines
1.1 KiB
Batchfile
@echo off
|
|
setlocal
|
|
|
|
REM This script must be run after vcvarsall.bat has been run,
|
|
REM so that cl.exe is in your path.
|
|
where cl.exe || goto vsmissing_err
|
|
|
|
REM HEREPATH is <drive_letter>:<script_directory>
|
|
set HEREPATH=%~d0%~p0
|
|
|
|
REM Set up SRC, BUILD and CLFLAGS
|
|
call %HEREPATH%\env.bat
|
|
call %HEREPATH%\clvars.bat
|
|
|
|
echo SRC=%SRC%, BUILD=%BUILD%
|
|
echo Building with flags: %CLFLAGS%
|
|
|
|
pushd %SRC%
|
|
mkdir %BUILD%\obj
|
|
del /Q %BUILD%\obj\
|
|
|
|
cl.exe -nologo -FC -EHsc -Z7 -Oi -GR- -Gm- %CLFLAGS% -c ^
|
|
@%HEREPATH%\hammer_lib_src_list ^
|
|
-Fo%BUILD%\obj\
|
|
if %errorlevel% neq 0 goto err
|
|
|
|
lib.exe %BUILD%\obj\*.obj -OUT:%BUILD%\hammer.lib
|
|
echo STATIC_LIBRARY %BUILD%\hammer.lib
|
|
if %errorlevel% neq 0 goto err
|
|
popd
|
|
|
|
REM TODO(uucidl): how to build and run the tests? They are written with glib.h
|
|
REM which might be a challenge on windows. On the other hand the API of glib.h
|
|
REM does not seem too hard to reimplement.
|
|
|
|
echo SUCCESS: Successfully built
|
|
endlocal
|
|
exit /b 0
|
|
|
|
:vsmissing_err
|
|
echo ERROR: CL.EXE missing. Have you run vcvarsall.bat?
|
|
exit /b 1
|
|
|
|
:err
|
|
endlocal
|
|
echo ERROR: Failed to build
|
|
exit /b %errorlevel%
|