Skip to content

Commit 81a0344

Browse files
Merge branch 'fluent:master' into master
2 parents 2cb4b87 + 44b9f65 commit 81a0344

136 files changed

Lines changed: 12442 additions & 11622 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/call-build-windows.yaml

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,90 @@ jobs:
106106
with:
107107
ref: ${{ inputs.ref }}
108108

109+
- name: Set up CMake
110+
run: |
111+
$cmakeVersion = "${{ matrix.config.cmake_version }}"
112+
$cmakeArch = "x86_64"
113+
$cmakeUrl = "https://github.com/Kitware/CMake/releases/download/v${cmakeVersion}/cmake-${cmakeVersion}-windows-${cmakeArch}.zip"
114+
$cmakeZip = "$env:RUNNER_TEMP\cmake-${cmakeVersion}.zip"
115+
$cmakeDir = "C:\Program Files\CMake"
116+
117+
Write-Host "Downloading CMake ${cmakeVersion} from official GitHub releases: ${cmakeUrl}"
118+
119+
# Download with retry logic
120+
$maxRetries = 3
121+
$retryCount = 0
122+
$downloaded = $false
123+
124+
while ($retryCount -lt $maxRetries -and -not $downloaded) {
125+
try {
126+
$retryCount++
127+
Write-Host "Attempt $retryCount of $maxRetries"
128+
Invoke-WebRequest -Uri $cmakeUrl -OutFile $cmakeZip -UseBasicParsing -ErrorAction Stop
129+
130+
# Verify file was downloaded and has content
131+
if (Test-Path $cmakeZip) {
132+
$fileInfo = Get-Item $cmakeZip
133+
if ($fileInfo.Length -gt 0) {
134+
Write-Host "Download successful. File size: $($fileInfo.Length) bytes"
135+
$downloaded = $true
136+
} else {
137+
Write-Host "Downloaded file is empty, retrying..."
138+
Remove-Item $cmakeZip -Force -ErrorAction SilentlyContinue
139+
}
140+
}
141+
} catch {
142+
Write-Host "Download attempt $retryCount failed: $_"
143+
if ($retryCount -lt $maxRetries) {
144+
Start-Sleep -Seconds 2
145+
Remove-Item $cmakeZip -Force -ErrorAction SilentlyContinue
146+
} else {
147+
throw "Failed to download CMake after $maxRetries attempts: $_"
148+
}
149+
}
150+
}
151+
152+
# Verify it's a valid ZIP file by checking the header (ZIP files start with PK)
153+
$header = [System.IO.File]::ReadAllBytes($cmakeZip)[0..1]
154+
if (-not ($header[0] -eq 0x50 -and $header[1] -eq 0x4B)) {
155+
Write-Host "Warning: File may not be a valid ZIP. First bytes: $($header[0]), $($header[1])"
156+
Write-Host "Expected: 80, 75 (PK in hex)"
157+
throw "Downloaded file is not a valid ZIP archive"
158+
}
159+
Write-Host "ZIP file validation passed (PK header found)"
160+
161+
Write-Host "Extracting CMake to C:\Program Files"
162+
# Remove existing CMake directory if it exists
163+
if (Test-Path $cmakeDir) {
164+
Remove-Item $cmakeDir -Recurse -Force
165+
}
166+
167+
# Extract ZIP file
168+
Expand-Archive -Path $cmakeZip -DestinationPath "C:\Program Files" -Force
169+
170+
# Rename extracted folder to standard CMake directory name
171+
$extractedDir = "C:\Program Files\cmake-${cmakeVersion}-windows-${cmakeArch}"
172+
if (Test-Path $extractedDir) {
173+
Rename-Item -Path $extractedDir -NewName "CMake" -Force
174+
}
175+
176+
# Verify installation
177+
$cmakeExe = "$cmakeDir\bin\cmake.exe"
178+
if (Test-Path $cmakeExe) {
179+
Write-Host "CMake installed successfully"
180+
& $cmakeExe --version
181+
} else {
182+
throw "CMake installation verification failed: $cmakeExe not found"
183+
}
184+
shell: pwsh
185+
109186
- name: Get dependencies
110187
run: |
111188
Invoke-WebRequest -OutFile winflexbison.zip $env:WINFLEXBISON
112189
Expand-Archive winflexbison.zip -Destination C:\WinFlexBison
113190
Copy-Item -Path C:\WinFlexBison/win_bison.exe C:\WinFlexBison/bison.exe
114191
Copy-Item -Path C:\WinFlexBison/win_flex.exe C:\WinFlexBison/flex.exe
115192
echo "C:\WinFlexBison" | Out-File -FilePath $env:GITHUB_PATH -Append
116-
choco install cmake --version "${{ matrix.config.cmake_version }}" --force
117193
env:
118194
WINFLEXBISON: https://github.com/lexxmark/winflexbison/releases/download/v2.5.22/win_flex_bison-2.5.22.zip
119195
shell: pwsh

.github/workflows/call-windows-unit-tests.yaml

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,90 @@ jobs:
6363
with:
6464
ref: ${{ inputs.ref }}
6565

66+
- name: Set up CMake
67+
run: |
68+
$cmakeVersion = "${{ matrix.config.cmake_version }}"
69+
$cmakeArch = "x86_64"
70+
$cmakeUrl = "https://github.com/Kitware/CMake/releases/download/v${cmakeVersion}/cmake-${cmakeVersion}-windows-${cmakeArch}.zip"
71+
$cmakeZip = "$env:RUNNER_TEMP\cmake-${cmakeVersion}.zip"
72+
$cmakeDir = "C:\Program Files\CMake"
73+
74+
Write-Host "Downloading CMake ${cmakeVersion} from official GitHub releases: ${cmakeUrl}"
75+
76+
# Download with retry logic
77+
$maxRetries = 3
78+
$retryCount = 0
79+
$downloaded = $false
80+
81+
while ($retryCount -lt $maxRetries -and -not $downloaded) {
82+
try {
83+
$retryCount++
84+
Write-Host "Attempt $retryCount of $maxRetries"
85+
Invoke-WebRequest -Uri $cmakeUrl -OutFile $cmakeZip -UseBasicParsing -ErrorAction Stop
86+
87+
# Verify file was downloaded and has content
88+
if (Test-Path $cmakeZip) {
89+
$fileInfo = Get-Item $cmakeZip
90+
if ($fileInfo.Length -gt 0) {
91+
Write-Host "Download successful. File size: $($fileInfo.Length) bytes"
92+
$downloaded = $true
93+
} else {
94+
Write-Host "Downloaded file is empty, retrying..."
95+
Remove-Item $cmakeZip -Force -ErrorAction SilentlyContinue
96+
}
97+
}
98+
} catch {
99+
Write-Host "Download attempt $retryCount failed: $_"
100+
if ($retryCount -lt $maxRetries) {
101+
Start-Sleep -Seconds 2
102+
Remove-Item $cmakeZip -Force -ErrorAction SilentlyContinue
103+
} else {
104+
throw "Failed to download CMake after $maxRetries attempts: $_"
105+
}
106+
}
107+
}
108+
109+
# Verify it's a valid ZIP file by checking the header (ZIP files start with PK)
110+
$header = [System.IO.File]::ReadAllBytes($cmakeZip)[0..1]
111+
if (-not ($header[0] -eq 0x50 -and $header[1] -eq 0x4B)) {
112+
Write-Host "Warning: File may not be a valid ZIP. First bytes: $($header[0]), $($header[1])"
113+
Write-Host "Expected: 80, 75 (PK in hex)"
114+
throw "Downloaded file is not a valid ZIP archive"
115+
}
116+
Write-Host "ZIP file validation passed (PK header found)"
117+
118+
Write-Host "Extracting CMake to C:\Program Files"
119+
# Remove existing CMake directory if it exists
120+
if (Test-Path $cmakeDir) {
121+
Remove-Item $cmakeDir -Recurse -Force
122+
}
123+
124+
# Extract ZIP file
125+
Expand-Archive -Path $cmakeZip -DestinationPath "C:\Program Files" -Force
126+
127+
# Rename extracted folder to standard CMake directory name
128+
$extractedDir = "C:\Program Files\cmake-${cmakeVersion}-windows-${cmakeArch}"
129+
if (Test-Path $extractedDir) {
130+
Rename-Item -Path $extractedDir -NewName "CMake" -Force
131+
}
132+
133+
# Verify installation
134+
$cmakeExe = "$cmakeDir\bin\cmake.exe"
135+
if (Test-Path $cmakeExe) {
136+
Write-Host "CMake installed successfully"
137+
& $cmakeExe --version
138+
} else {
139+
throw "CMake installation verification failed: $cmakeExe not found"
140+
}
141+
shell: pwsh
142+
66143
- name: Get dependencies
67144
run: |
68145
Invoke-WebRequest -OutFile winflexbison.zip $env:WINFLEXBISON
69146
Expand-Archive winflexbison.zip -Destination C:\WinFlexBison
70147
Copy-Item -Path C:\WinFlexBison/win_bison.exe C:\WinFlexBison/bison.exe
71148
Copy-Item -Path C:\WinFlexBison/win_flex.exe C:\WinFlexBison/flex.exe
72149
echo "C:\WinFlexBison" | Out-File -FilePath $env:GITHUB_PATH -Append
73-
choco install cmake.portable --version "${{ matrix.config.cmake_version }}" --force
74150
env:
75151
WINFLEXBISON: https://github.com/lexxmark/winflexbison/releases/download/v2.5.22/win_flex_bison-2.5.22.zip
76152
shell: pwsh

CMakeLists.txt

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,38 +1219,7 @@ endif()
12191219
# LibBacktrace (friendly stacktrace support)
12201220
# =========================================
12211221
if(FLB_BACKTRACE)
1222-
if(FLB_PREFER_SYSTEM_LIB_BACKTRACE)
1223-
find_path(LIBBACKTRACE_INCLUDE_DIRS NAMES backtrace.h)
1224-
find_library(LIBBACKTRACE_LIBRARIES NAMES backtrace)
1225-
endif()
1226-
if(LIBBACKTRACE_INCLUDE_DIRS AND LIBBACKTRACE_LIBRARIES)
1227-
message(STATUS "libbacktrace found (${LIBBACKTRACE_LIBRARIES})")
1228-
include_directories(${LIBBACKTRACE_INCLUDE_DIRS})
1229-
link_directories(${LIBBACKTRACE_LIBRARY_DIRS})
1230-
else()
1231-
message(STATUS "libbacktrace not found, building ourselves")
1232-
if (CMAKE_OSX_SYSROOT)
1233-
# From macOS Mojave, /usr/include does not store C SDK headers.
1234-
# For libbacktrace building on macOS, we have to tell C headers where they are located.
1235-
set(DEPS_C_COMPILER "${CMAKE_C_COMPILER} -isysroot ${CMAKE_OSX_SYSROOT}")
1236-
else()
1237-
set(DEPS_C_COMPILER "${CMAKE_C_COMPILER}")
1238-
endif()
1239-
set(FLB_LIBBACKTRACE_PATH "${CMAKE_CURRENT_BINARY_DIR}/backtrace-prefix/lib/libbacktrace.a")
1240-
ExternalProject_Add(backtrace
1241-
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/libbacktrace-8602fda/
1242-
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/libbacktrace-8602fda/configure ${AUTOCONF_HOST_OPT} --prefix=<INSTALL_DIR> --enable-shared=no --enable-static=yes
1243-
BUILD_COMMAND ${EXTERNAL_BUILD_TOOL}
1244-
BUILD_BYPRODUCTS ${FLB_LIBBACKTRACE_PATH}
1245-
INSTALL_COMMAND ${EXTERNAL_BUILD_TOOL} DESTDIR= install
1246-
)
1247-
add_library(libbacktrace STATIC IMPORTED GLOBAL)
1248-
set_target_properties(libbacktrace PROPERTIES IMPORTED_LOCATION ${FLB_LIBBACKTRACE_PATH})
1249-
add_dependencies(libbacktrace backtrace)
1250-
include_directories("${CMAKE_CURRENT_BINARY_DIR}/backtrace-prefix/include/")
1251-
set(LIBBACKTRACE_LIBRARIES "libbacktrace")
1252-
endif()
1253-
FLB_DEFINITION(FLB_HAVE_LIBBACKTRACE)
1222+
include(cmake/libbacktrace.cmake)
12541223
endif()
12551224

12561225
# Onigmo (Regex Engine) options

0 commit comments

Comments
 (0)