win-installer.bat 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. @echo off
  2. :: create binary directory if needed
  3. if not exist "%HOMEDRIVE%\Program Files (x86)\tibasicc\bin" (
  4. mkdir "%HOMEDRIVE%\Program Files (x86)\tibasicc\bin" || goto adminError
  5. echo folder "%HOMEDRIVE%\Program Files (x86)\tibasicc\bin" has been created.
  6. )
  7. :: add g++ to path variable (only in this session)
  8. set PATH=%PATH%;C:\MinGW\bin\
  9. :: compiling
  10. echo g++ -g -Wall -pedantic -c -o src/compiler.o src/compiler.cc
  11. g++ -g -Wall -pedantic -c -o src/compiler.o src/compiler.cc || goto compileError
  12. echo g++ -g -Wall -pedantic -c -o src/token_util.o src/token_util.cc
  13. g++ -g -Wall -pedantic -c -o src/token_util.o src/token_util.cc || goto compileError
  14. echo g++ -g -Wall -pedantic -c -o src/main.o src/main.cc
  15. g++ -g -Wall -pedantic -c -o src/main.o src/main.cc || goto compileError
  16. echo g++ -o tibasicc src/compiler.o src/token_util.o src/main.o
  17. g++ -o tibasicc src/compiler.o src/token_util.o src/main.o
  18. :: move executable to the final directory
  19. copy tibasicc.exe "%HOMEDRIVE%\Program Files (x86)\tibasicc\bin" || goto movingError
  20. goto success
  21. :adminError
  22. echo.
  23. echo Error: TI-Basic couldn't be installed.
  24. echo Make sure to run this program with admin privileges.
  25. echo.
  26. exit
  27. :compileError
  28. echo.
  29. echo Error: TI-Basic couldn't be installed.
  30. echo Compiling with g++ failed. Make sure that it is installed correctly.
  31. echo.
  32. exit
  33. :movingError
  34. echo.
  35. echo Error: TI-Basic couldn't be installed.
  36. echo Moving the binary to your program files failed. Make sure that you have appropriate permissions to this directory.
  37. echo.
  38. exit
  39. :success
  40. echo.
  41. echo.
  42. echo.
  43. echo tibasicc has been successfully installed.
  44. echo But now you need to add "%HOMEDRIVE%\MinGW\bin" and "%HOMEDRIVE%\Program Files (x86)\tibasicc\bin"
  45. echo ........to your Path variable manually (sorry, but this just is how Windows works).
  46. echo.
  47. pause