forked from esmuellert/codediff.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.cmd
More file actions
125 lines (109 loc) · 3.3 KB
/
build.cmd
File metadata and controls
125 lines (109 loc) · 3.3 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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
@echo off
REM Auto-generated by CMake - DO NOT EDIT MANUALLY
REM This script allows building without CMake installed
REM Auto-detects compiler: MSVC, Clang, MinGW GCC
setlocal enabledelayedexpansion
cd /d "%~dp0\libvscode-diff"
REM Create build directory
if not exist build mkdir build
if not exist build\include mkdir build\include
REM Generate version.h from VERSION file
set /p VERSION=<..\VERSION
powershell -NoLogo -NoProfile -Command "(Get-Content include\version.h.in) -replace '@''PROJECT_VERSION@', '!VERSION!' | Set-Content build\include\version.h"
echo Building vscode_diff (standalone mode)...
echo Platform: Windows
echo Version: !VERSION!
REM Source files (including bundled utf8proc)
set SOURCES=^
default_lines_diff_computer.c ^
src\char_level.c ^
src\line_level.c ^
src\myers.c ^
src\optimize.c ^
src\sequence.c ^
src\range_mapping.c ^
src\string_hash_map.c ^
src\utils.c ^
src\print_utils.c ^
src\utf8_utils.c ^
vendor\utf8proc.c
REM Auto-detect compiler
set COMPILER=unknown
where cl.exe >nul 2>&1
if !errorlevel! == 0 (
set COMPILER=msvc
goto :build_msvc
)
where clang.exe >nul 2>&1
if !errorlevel! == 0 (
set COMPILER=clang
goto :build_clang
)
where gcc.exe >nul 2>&1
if !errorlevel! == 0 (
set COMPILER=gcc
goto :build_gcc
)
echo Error: No C compiler found!
echo Please install one of: Visual Studio (MSVC), Clang, MinGW-w64
cd ..
exit /b 1
:build_msvc
echo Using MSVC compiler...
REM Check for OpenMP support (MSVC has built-in support)
set OMP_FLAGS=
set OMP_LINK=
cl.exe /? 2>&1 | findstr /C:"/openmp" >nul
if !errorlevel! == 0 (
echo OpenMP: enabled
set OMP_FLAGS=/openmp /DUSE_OPENMP
) else (
echo OpenMP: disabled
)
cl.exe /LD /O2 /W3 /std:c11 /DUTF8PROC_STATIC /DBUILDING_DLL !OMP_FLAGS! /Iinclude /Ibuild\include /Ivendor /Fobuild\ /Fdbuild\ /Fe:build\libvscode_diff.dll %SOURCES% /link /DLL /DEF:libvscode_diff.def
goto :build_done
:build_clang
echo Using Clang compiler...
if not exist build mkdir build
REM Check for OpenMP support with Clang
set OMP_FLAGS=
echo int main() { return 0; } > %TEMP%\omp_test.c
clang.exe -fopenmp %TEMP%\omp_test.c -o %TEMP%\omp_test.exe 2>nul
if !errorlevel! == 0 (
echo OpenMP: enabled
set OMP_FLAGS=-fopenmp -DUSE_OPENMP
) else (
echo OpenMP: disabled
)
del /q %TEMP%\omp_test.c %TEMP%\omp_test.exe 2>nul
clang.exe -shared -Wall -Wextra -std=c11 -O2 -DUTF8PROC_STATIC !OMP_FLAGS! -Iinclude -Ibuild\include -Ivendor -o build\libvscode_diff.dll %SOURCES%
goto :build_done
:build_gcc
echo Using MinGW GCC compiler...
if not exist build mkdir build
REM Check for OpenMP support with GCC
set OMP_FLAGS=
echo int main() { return 0; } > %TEMP%\omp_test.c
gcc.exe -fopenmp %TEMP%\omp_test.c -o %TEMP%\omp_test.exe 2>nul
if !errorlevel! == 0 (
echo OpenMP: enabled
set OMP_FLAGS=-fopenmp -DUSE_OPENMP
) else (
echo OpenMP: disabled
)
del /q %TEMP%\omp_test.c %TEMP%\omp_test.exe 2>nul
gcc.exe -shared -Wall -Wextra -std=c11 -O2 -DUTF8PROC_STATIC !OMP_FLAGS! -Iinclude -Ibuild\include -Ivendor -o build\libvscode_diff.dll %SOURCES%
goto :build_done
:build_done
if !errorlevel! neq 0 (
echo Build failed!
cd ..
exit /b 1
)
echo Installing to plugin root...
copy /Y build\libvscode_diff.dll ..\libvscode_diff.dll >nul
echo.
echo [OK] Build successful: libvscode_diff.dll
echo Build artifacts in: libvscode-diff\build\
cd ..
endlocal