Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO off
- :: Output Formatting Glitter
- SET NLM=^
- SET NL=^^^%NLM%%NLM%^%NLM%%NLM%
- SET NL3=^^^%NLM%%NLM%^%NLM%%NLM%^^^%NLM%%NLM%^%NLM%%NLM%^^^%NLM%%NLM%^%NLM%%NLM%
- SET NS=^^^%NLM%%NLM%^%NLM%%NLM%*****************************************************************************^^^%NLM%%NLM%^%NLM%%NLM%
- :: warning. Lines 4 and 5 are required to be empty for the formatting to work properly
- :: idea: > to temp file, read temp file to stdout, >> temp file to log file, delete temp file.
- :OPTIONS
- SET Flags=-std=c++14 -Wall -Wextra -pedantic
- SET LogName=compile.log
- :START
- SET msg=Running compile script
- ECHO %msg% > %LogName% 2>&1
- ECHO %NL%%msg%
- GOTO:COMMONOBJECTS
- ::START
- :COMMONOBJECTS
- SET msg=compiling common objects...
- ECHO %msg% >> %LogName% 2>&1
- ECHO %NL3%%NS% %msg%%NS%
- SET compile_objects=(Utility Manifest)
- SET dir=xCommon
- @ECHO on
- @FOR %%i IN %compile_objects% DO (
- CALL g++ %Flags% -c -o "./obj/%%i.o" "./%dir%/%%i.cpp" >> %LogName% 2>&1
- @IF ERRORLEVEL 1 (GOTO:ERR)
- )
- @ECHO off
- SET proj_objects=
- ::COMMONOBJECTS
- :XCHILD
- SET msg=compiling child objects...
- ECHO %msg% >> %LogName% 2>&1
- ECHO %NL3%%NS% %msg%%NS%
- SET compile_objects=(xchild ManifestChild SyncroChild)
- SET dir=xChild
- @ECHO on
- @FOR %%i IN %compile_objects% DO (
- CALL g++ %Flags% -c -o "./obj/%%i.o" "./%dir%/%%i.cpp" >> %LogName% 2>&1
- @IF ERRORLEVEL 1 (GOTO:ERR)
- )
- @ECHO off
- SET msg=compiling child executible...
- ECHO %msg% >> %LogName% 2>&1
- ECHO %NL3%%NS% %msg%%NS%
- SET filename=xfile_writer.exe
- SET used_objects=(xchild Manifest Utility ManifestChild SyncroChild)
- FOR %%i IN %used_objects% DO CALL SET "proj_objects=%%proj_objects%% "./obj/%%i.o""
- @ECHO on
- g++ -mconsole -s -o "./release/%filename%" %proj_objects% >> %LogName% 2>&1
- @IF ERRORLEVEL 1 (GOTO:ERR)
- @ECHO off
- SET proj_objects=
- ::XCHILD
- :XPARENT
- SET msg=compiling xfile objects...
- ECHO %msg% >> %LogName% 2>&1
- ECHO %NL3%%NS% %msg%%NS%
- SET compile_objects=(xfile xfile_internal ManifestParent SyncroParent)
- SET dir=xParent
- @ECHO on
- @FOR %%i IN %compile_objects% DO (
- CALL g++ %Flags% -c -o "./obj/%%i.o" "./%dir%/%%i.cpp" >> %LogName% 2>&1
- @IF ERRORLEVEL 1 (GOTO:ERR)
- )
- @ECHO off
- SET msg=compiling xfile windres resources...
- ECHO %msg% >> %LogName% 2>&1
- ECHO %NL3%%NS% %msg%%NS%
- @ECHO on
- windres "./%dir%/xfile.rc" -O coff -o "./obj/xfile.res" >> %LogName% 2>&1
- @IF ERRORLEVEL 1 (GOTO:ERR)
- @ECHO off
- SET proj_objects=
- ::XPARENT
- :UNITTEST
- SET msg=compiling unit test objects...
- ECHO %msg% >> %LogName% 2>&1
- ECHO %NL3%%NS%%msg%
- SET compile_objects=(tester)
- SET dir=tester
- @ECHO on
- @FOR %%i IN %compile_objects% DO (
- CALL g++ %Flags% -c -o "./obj/%%i.o" "./%dir%/%%i.cpp" >> %LogName% 2>&1
- @IF ERRORLEVEL 1 (GOTO:ERR)
- )
- @ECHO off
- SET msg=compiling unit test executible...
- ECHO %msg% >> %LogName% 2>&1
- ECHO %NL3%%NS% %msg%%NS%
- SET filename=xfile_unit_test
- SET used_objects=(tester xfile xfile_internal Utility Manifest ManifestParent SyncroParent)
- FOR %%i IN %used_objects% DO CALL SET "proj_objects=%%proj_objects%% "./obj/%%i.o""
- @ECHO on
- g++ -mconsole -o "./release/%filename%.exe" %proj_objects% "./obj/xfile.res" >> %LogName% 2>&1
- @IF ERRORLEVEL 1 (GOTO:ERR)
- @ECHO off
- SET proj_objects=
- ::UNITTEST
- :END
- SET msg=compile script finished successfully.
- ECHO %msg% >> %LogName% 2>&1
- ECHO %NL3%%NS% %msg%%NS%
- PAUSE
- GOTO:EOF
- :ERR
- @ECHO off
- SET msg=!!! Error Detected !!!
- ECHO %msg% >> %LogName% 2>&1
- ECHO %NL3%%msg%
- :EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement