File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
@ echo off
2
+ setlocal enabledelayedexpansion
3
+
2
4
:: Compiler and flags
3
5
set CXX = g++
4
- set CXXFLAGS = -std=c++17 -Iinclude -Wall -Wextra -Werror
6
+ set CXXFLAGS = -std=c++17 -Iinclude -Wall -Wextra -Werror -mthreads
5
7
6
8
:: Directories
7
9
set SRC_DIR = src
@@ -12,6 +14,11 @@ set OUTPUT_DIR=output
12
14
:: Target executable
13
15
set TARGET = scanner.exe
14
16
17
+ :: Clean old build files
18
+ if exist " %BUILD_DIR% " rmdir /s /q " %BUILD_DIR% "
19
+ if exist " %TARGET% " del " %TARGET% "
20
+ mkdir " %BUILD_DIR% "
21
+
15
22
:: Create necessary directories if they don't exist
16
23
if not exist " %BUILD_DIR% " mkdir " %BUILD_DIR% "
17
24
if not exist " %OUTPUT_DIR% " mkdir " %OUTPUT_DIR% "
@@ -21,6 +28,10 @@ echo Compiling source files...
21
28
for %%f in (%SRC_DIR% \*.cpp) do (
22
29
echo Compiling %%f ...
23
30
%CXX% %CXXFLAGS% -c %%f -o " %BUILD_DIR% \%%~nf .o"
31
+ if errorlevel 1 (
32
+ echo Failed to compile %%f .
33
+ exit /b 1
34
+ )
24
35
)
25
36
26
37
:: Link object files into the target executable
@@ -29,7 +40,8 @@ set OBJS=
29
40
for %%f in (%BUILD_DIR% \*.o) do (
30
41
set OBJS = !OBJS! %%f
31
42
)
32
- %CXX% %CXXFLAGS% -o %TARGET% %OBJS%
43
+ echo Object files: !OBJS!
44
+ %CXX% %CXXFLAGS% -static -static-libgcc -static-libstdc++ -o %TARGET% !OBJS!
33
45
34
46
if errorlevel 1 (
35
47
echo Build failed.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments