We disable: - the tests (which require glib) although they can be reactivated with the `--tests` command line flag - shared library (lack of export symbol declarations means that although it can be built, no symbol is exported and therefore it can't be used) The `install` target installs the library and headers under the `build` folder, because it's a traditional practice to move libraries to a central location on Windows, unless you are using cygwin. In which case pass `prefix` to the command line. We adapt tools\windows\build_examples.bat to take the library that is built using scons or using tools\windows\build.bat
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%\lib\hammer_s.lib
|
|
echo STATIC_LIBRARY %BUILD%\lib\hammer_s.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%
|