-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_exe.cmd
More file actions
56 lines (48 loc) · 1.48 KB
/
build_exe.cmd
File metadata and controls
56 lines (48 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
@echo off
REM Script to build Python executable using PyInstaller
REM Set the main script and output executable name
set MAIN_SCRIPT=gui_main.py
set ICON_FILE=GUI/assets/icons/icons8-point-100.png
set OUTPUT_NAME=SmartLabellingTool
set BUILD_DIR=build
set DIST_DIR=dist
set SPEC_FILE=%OUTPUT_NAME%.spec
REM PyInstaller options
set CLEAN_OPTION=--clean
set ONEFILE_OPTION=--onefile
set DEBUG_OPTION=--debug=imports
set PATHS_OPTION=--paths=.
REM Additional PyInstaller options (modify as needed)
set EXTRA_OPTIONS=
REM Check if icon file exists
if exist "%ICON_FILE%" (
echo Using icon: %ICON_FILE%
set ICON_OPTION=--icon=%ICON_FILE%
) else (
echo No icon file found. Skipping icon option.
set ICON_OPTION=
)
REM Clean previous build directories if they exist
if exist "%BUILD_DIR%" (
echo Removing previous build directory...
rmdir /s /q "%BUILD_DIR%"
)
if exist "%DIST_DIR%" (
echo Removing previous dist directory...
rmdir /s /q "%DIST_DIR%"
)
if exist "%SPEC_FILE%" (
echo Removing previous spec file...
del "%SPEC_FILE%"
)
REM Run PyInstaller
echo Starting PyInstaller build...
pyinstaller %CLEAN_OPTION% %ONEFILE_OPTION% %DEBUG_OPTION% %PATHS_OPTION% %ICON_OPTION% %EXTRA_OPTIONS% --name=%OUTPUT_NAME% %MAIN_SCRIPT%
REM Check if the build was successful
if exist "%DIST_DIR%\%OUTPUT_NAME%.exe" (
echo Build successful! Executable created: %DIST_DIR%\%OUTPUT_NAME%.exe
) else (
echo Build failed. Check the logs for errors.
)
REM Pause to view output
pause