File: build_windows.bat

package info (click to toggle)
mfgtools 1.5.243-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,296 kB
  • sloc: cpp: 10,100; javascript: 546; python: 335; sh: 85; xml: 53; makefile: 18
file content (112 lines) | stat: -rw-r--r-- 2,471 bytes parent folder | download | duplicates (2)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
@echo off
setlocal enabledelayedexpansion

echo [INFO] Starting Windows build process

call :install_dependencies || goto :error
call :setup_environment || goto :error
call :build_project || goto :error
call :copy_artifacts || goto :error

echo [SUCCESS] Windows build completed successfully
exit /b 0

:install_dependencies
echo [INFO] Installing build dependencies via Chocolatey
choco install cmake pkgconfiglite ninja --yes --no-progress
if errorlevel 1 (
    echo [ERROR] Failed to install build dependencies
    exit /b 1
)
echo [SUCCESS] Build dependencies installed
pip install pytest
if errorlevel 1 (
    echo [ERROR] Failed to install pytest
    exit /b 1
)
echo [SUCCESS] pytest installed
exit /b 0

:setup_environment
echo [INFO] Setting up build environment
cd wrapper
set PROJECT_DIR=%CD%

if exist "vcpkg" (
    echo [INFO] Removing existing vcpkg directory
    rmdir /s /q vcpkg
)

echo [INFO] Cloning vcpkg repository
git clone https://github.com/microsoft/vcpkg.git
if errorlevel 1 (
    echo [ERROR] Failed to clone vcpkg repository
    exit /b 1
)

cd vcpkg
echo [INFO] Bootstrapping vcpkg
call bootstrap-vcpkg.bat
if errorlevel 1 (
    echo [ERROR] Failed to bootstrap vcpkg
    exit /b 1
)

set VCPKG_ROOT=%CD%
set PATH=%VCPKG_ROOT%;%PATH%
cd %PROJECT_DIR%
echo [SUCCESS] Build environment setup completed
exit /b 0

:build_project
echo [INFO] Configuring and building project
cmake --preset=windows
if errorlevel 1 (
    echo [ERROR] CMake configuration failed
    call :debug_info
    exit /b 1
)

cmake --build build
if errorlevel 1 (
    echo [ERROR] Build failed
    call :debug_info
    exit /b 1
)
echo [SUCCESS] Project built successfully
exit /b 0

:copy_artifacts
echo [INFO] Copying built libraries
set TARGET_DIR=libuuu\lib\windows\x86_64
mkdir "%TARGET_DIR%" 2>nul

REM Try different build output locations
for %%D in (Debug Release .) do (
    if exist "build\%%D\*.dll" (
        echo [INFO] Copying DLLs from build\%%D\
        copy "build\%%D\*.dll" "%TARGET_DIR%\" >nul
        if not errorlevel 1 (
            echo [SUCCESS] DLL files copied successfully
            exit /b 0
        )
    )
)

echo [ERROR] No DLL files found in any expected location
call :debug_info
exit /b 1

:debug_info
echo [DEBUG] Current directory: %CD%
if exist "build" (
    echo [DEBUG] Build directory contents:
    dir build /s
) else (
    echo [DEBUG] Build directory does not exist
)
exit /b 0

:error
echo [ERROR] Build script failed
exit /b 1