buildProject.bat 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. rem Local build settings that should be configured before building for the first time.
  2. set CPP_COMPILER_FOLDER=C:\Program\CodeBlocks\MinGW\bin
  3. set CPP_COMPILER_PATH=%CPP_COMPILER_FOLDER%\x86_64-w64-mingw32-g++.exe
  4. rem Change the temporary folder if want generated scripts and objects to go somewhere else.
  5. set TEMPORARY_FOLDER=%TEMP%
  6. @echo off
  7. rem Using buildProject.bat
  8. rem %1 must be the *.DsrProj path or a folder containing such projects. The path is relative to the caller location.
  9. rem %2... are variable assignments sent as input to the given project file.
  10. rem CPP_COMPILER_PATH should be modified if it does not already refer to an installed C++ compiler.
  11. echo Running buildProject.bat %*
  12. rem Get the build system's folder, where the build system is located.
  13. set BUILDER_FOLDER=%~dp0%
  14. echo BUILDER_FOLDER = %BUILDER_FOLDER%
  15. set BUILDER_EXECUTABLE=%BUILDER_FOLDER%builder.exe
  16. echo BUILDER_EXECUTABLE = %BUILDER_EXECUTABLE%
  17. set DFPSR_LIBRARY=%BUILDER_FOLDER%..\..\DFPSR
  18. echo DFPSR_LIBRARY = %DFPSR_LIBRARY%
  19. set BUILDER_SOURCE=%BUILDER_FOLDER%\code\main.cpp %BUILDER_FOLDER%\code\Machine.cpp %BUILDER_FOLDER%\code\generator.cpp %BUILDER_FOLDER%\code\analyzer.cpp %BUILDER_FOLDER%\code\expression.cpp %DFPSR_LIBRARY%\collection\collections.cpp %DFPSR_LIBRARY%\api\fileAPI.cpp %DFPSR_LIBRARY%\api\bufferAPI.cpp %DFPSR_LIBRARY%\api\stringAPI.cpp %DFPSR_LIBRARY%\api\timeAPI.cpp %DFPSR_LIBRARY%\base\SafePointer.cpp
  20. echo BUILDER_SOURCE = %BUILDER_SOURCE%
  21. echo Change CPP_COMPILER_FOLDER and CPP_COMPILER_PATH in %BUILDER_FOLDER%\buildProject.bat if you are not using %CPP_COMPILER_PATH% as your compiler.
  22. rem Check if the build system is compiled
  23. if exist %BUILDER_EXECUTABLE% (
  24. echo Found the build system's binary.
  25. ) else (
  26. echo Building the Builder build system for first time use.
  27. pushd %CPP_COMPILER_FOLDER%
  28. %CPP_COMPILER_PATH% -o %BUILDER_EXECUTABLE% %BUILDER_SOURCE% -static -static-libgcc -static-libstdc++ -std=c++14
  29. popd
  30. if errorlevel 0 (
  31. echo Completed building the Builder build system.
  32. ) else (
  33. echo Failed building the Builder build system, which is needed to build your project!
  34. pause
  35. exit /b 1
  36. )
  37. )
  38. rem Call the build system with a filename for the output script, which is later called.
  39. set SCRIPT_PATH=%TEMPORARY_FOLDER%\dfpsr_compile.bat
  40. echo Generating %SCRIPT_PATH% from %1%
  41. if exist %SCRIPT_PATH% (
  42. del %SCRIPT_PATH%
  43. )
  44. %BUILDER_EXECUTABLE% %SCRIPT_PATH% %* Compiler=%CPP_COMPILER_PATH% CompileFrom=%CPP_COMPILER_FOLDER%
  45. if exist %SCRIPT_PATH% (
  46. echo Running %SCRIPT_PATH%
  47. %SCRIPT_PATH%
  48. )
  49. rem Calling the build system with only the temporary folder will call the compiler directly from the build system.
  50. rem %BUILDER_EXECUTABLE% %TEMPORARY_FOLDER% %* Compiler=%CPP_COMPILER_PATH% CompileFrom=%CPP_COMPILER_FOLDER%
  51. pause