make_msvc_test_files.bat 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. @echo off
  2. if "%1"=="" goto noargs
  3. pushd %1
  4. @REM /Gm- disables minimal rebuild, /O1 favor size, /MD selects external runtime,
  5. @REM /GL enable cross-module optimization
  6. set CL_COMMON_FLAGS=/nologo /Gm- /O1 /MD /GL
  7. call :make_obj ..\..\foo.c
  8. call :make_obj ..\..\bar.c
  9. call :make_obj ..\..\main.c
  10. call :make_dll msvc-%VisualStudioVersion%-foo-bar.dll foo.obj bar.obj
  11. call :make_binary_with_pdb msvc-%VisualStudioVersion%-foo-bar-main-cv.bin msvc-%VisualStudioVersion%-foo-bar-main-cv.pdb foo.obj bar.obj main.obj
  12. goto cleanup
  13. :make_dll:
  14. for /f "tokens=1,* delims= " %%a in ("%*") do set ALL_BUT_FIRST=%%b
  15. cl %CL_COMMON_FLAGS% /LD %ALL_BUT_FIRST% /link /OUT:%1
  16. exit /B 0
  17. :make_binary_with_pdb:
  18. for /f "tokens=2,* delims= " %%a in ("%*") do set ALL_BUT_FIRST=%%b
  19. cl %CL_COMMON_FLAGS% %ALL_BUT_FIRST% /link /OUT:%1 /PDB:%2 /DEBUG
  20. exit /B 0
  21. :make_obj:
  22. cl %CL_COMMON_FLAGS% /c %1
  23. exit /B 0
  24. :noargs:
  25. echo Usage: make_test_files.bat ^<output dir^>
  26. :cleanup:
  27. del foo.obj
  28. del bar.obj
  29. del main.obj
  30. popd