Skip to content

Commit 35885ce

Browse files
cosmo0920edsiper
authored andcommitted
build: Enable wasm and filter_wasm on x86_64 Windows
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 8f21248 commit 35885ce

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

cmake/windows-setup.cmake

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
# Not all plugins are supported on Windows yet. This file tweaks
44
# the build flags so that we can compile fluent-bit on it.
55

6+
set(FLB_ARCH "")
7+
8+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(ARM64|AARCH64|arm64)$")
9+
set(FLB_ARCH "arm64")
10+
11+
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
12+
set(FLB_ARCH "x64")
13+
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
14+
set(FLB_ARCH "x86")
15+
endif()
16+
17+
if(NOT FLB_ARCH)
18+
message(WARNING "Unknown architecture; falling back to x64 heuristics")
19+
set(FLB_ARCH "x64")
20+
endif()
21+
22+
message(STATUS "Detected target architecture: ${FLB_ARCH}")
23+
624
if(FLB_WINDOWS_DEFAULTS)
725
message(STATUS "Overriding setttings with windows-setup.cmake")
826
set(FLB_REGEX Yes)
@@ -17,7 +35,13 @@ if(FLB_WINDOWS_DEFAULTS)
1735
if (NOT FLB_LIBYAML_DIR)
1836
set(FLB_CONFIG_YAML No)
1937
endif ()
20-
set(FLB_WASM No)
38+
if(FLB_ARCH STREQUAL "arm64")
39+
set(FLB_WASM No)
40+
elseif(FLB_ARCH STREQUAL "x64")
41+
set(FLB_WASM Yes)
42+
elseif(FLB_ARCH STREQUAL "x86")
43+
set(FLB_WASM Yes)
44+
endif()
2145
set(FLB_WAMRC No)
2246

2347
# INPUT plugins
@@ -107,7 +131,13 @@ if(FLB_WINDOWS_DEFAULTS)
107131
set(FLB_FILTER_GEOIP2 Yes)
108132
set(FLB_FILTER_AWS Yes)
109133
set(FLB_FILTER_ECS Yes)
110-
set(FLB_FILTER_WASM No)
134+
if(FLB_ARCH STREQUAL "arm64")
135+
set(FLB_FILTER_WASM No)
136+
elseif(FLB_ARCH STREQUAL "x64")
137+
set(FLB_FILTER_WASM Yes)
138+
elseif(FLB_ARCH STREQUAL "x86")
139+
set(FLB_FILTER_WASM Yes)
140+
endif()
111141
endif()
112142

113143
# Search bison and flex executables

0 commit comments

Comments
 (0)