Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9a6ae97
lib: support browser virtual filesystems in chunkio
edsiper Sep 17, 2026
d03d53f
http_server: separate configuration from server implementation
edsiper Sep 17, 2026
0326781
build: add pinned browser WebAssembly profile and dependencies
edsiper Sep 17, 2026
e4710dd
wasm: implement browser Fetch transport
edsiper Sep 17, 2026
ebb6a80
wasm: restore and checkpoint browser persistent storage
edsiper Sep 17, 2026
e5a27f1
wasm: expose browser SDK lifecycle and recovery controls
edsiper Sep 17, 2026
1a8135e
blob_db: support the browser WebAssembly runtime
edsiper Sep 17, 2026
8cc04a0
config: support the browser WebAssembly runtime
edsiper Sep 17, 2026
fe56af8
downstream: support the browser WebAssembly runtime
edsiper Sep 17, 2026
f0e4ff8
engine: cancel browser requests during shutdown
edsiper Sep 17, 2026
46d87f6
gzip: support the browser WebAssembly runtime
edsiper Sep 17, 2026
386cb28
help: support the browser WebAssembly runtime
edsiper Sep 17, 2026
5cb7b0b
http_client: route browser requests through Fetch
edsiper Sep 17, 2026
3cb1627
http_common: adapt browser requests and guard stream failures
edsiper Sep 17, 2026
f028171
input: guard browser threading and clean up failed initialization
edsiper Sep 17, 2026
8789816
input_chunk: preserve accounting on browser targets
edsiper Sep 17, 2026
7ca3dcc
input_ingest: support the browser WebAssembly runtime
edsiper Sep 17, 2026
d4059f6
lib: support the browser WebAssembly runtime
edsiper Sep 17, 2026
95012c9
lua: support Lua 5.4 and preserve sparse table entries
edsiper Sep 17, 2026
ad82067
network: support the browser WebAssembly runtime
edsiper Sep 17, 2026
5f6a339
output: validate browser transport and worker settings
edsiper Sep 17, 2026
7f54480
storage: support browser virtual filesystem paths
edsiper Sep 17, 2026
c7a574f
upstream: support the browser WebAssembly runtime
edsiper Sep 17, 2026
1570beb
filter_lua: support the browser Lua runtime
edsiper Sep 17, 2026
8b95d22
processor_sql: preserve MessagePack string boundaries
edsiper Sep 17, 2026
ff136d2
tests: cover Lua table conversion boundaries
edsiper Sep 17, 2026
cc6436c
tests: cover SQL string boundaries
edsiper Sep 17, 2026
307037c
tests: integration: cover Lua filter and processor behavior
edsiper Sep 17, 2026
60ff57e
tests: integration: bound HTTP timeout retry scheduling
edsiper Sep 17, 2026
a7185af
tests: integration: retry transient startup health timeouts
edsiper Sep 17, 2026
c6c011a
tests: add browser WebAssembly validation and demo
edsiper Sep 17, 2026
196d862
workflows: validate browser WebAssembly and sanitizer builds
edsiper Sep 17, 2026
7ee8b8a
wasm: document browser SDK and toolchain constraints
edsiper Sep 17, 2026
0931930
tests: generate the browser Lua harness in the build tree
edsiper Sep 19, 2026
3211e33
wasm: document required upstream dependency updates
edsiper Sep 19, 2026
94ef390
wasm: preserve terminal SDK states and close workers
edsiper Sep 30, 2026
79d3dcf
tests: cover browser SDK teardown and sparse Lua records
edsiper Sep 30, 2026
d74ef8f
tests: internal: bound sparse Lua array expectations
edsiper Sep 30, 2026
01f1fa0
tests: integration: cover large sparse Lua keys
edsiper Sep 30, 2026
b2bddb6
wasm: clarify bundled dependency requirements after rebase
edsiper Sep 30, 2026
f9b5e79
wasm: reject HTTP requests with invalid headers
edsiper Oct 23, 2026
b8b2782
tests: cover rejected headers in browser HTTP adapters
edsiper Oct 23, 2026
980603d
build: update browser crypto to OpenSSL 3.5.9
edsiper Oct 23, 2026
12e9c0e
workflows: publish experimental browser SDK artifacts
edsiper Oct 23, 2026
7129fb8
wasm: document SDK review and experimental artifacts
edsiper Oct 23, 2026
c5f6420
wasm: cap browser HTTP timeouts at Fetch limit
edsiper Oct 23, 2026
4bcf4c9
tests: cover browser HTTP timeout boundaries
edsiper Oct 23, 2026
d4ea047
workflows: avoid persisting browser CI checkout credentials
edsiper Oct 23, 2026
0502d9c
wasm: align demo documentation with SDK lifecycle
edsiper Oct 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .emscripten-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.0.9
116 changes: 116 additions & 0 deletions .github/workflows/wasm-browser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Browser WebAssembly

on:
workflow_dispatch:
pull_request:
push:
branches: ['**']

concurrency:
group: wasm-browser-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
wasm:
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
sanitizer: [none, address]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install build prerequisites
run: sudo apt-get update && sudo apt-get install -y cmake make flex bison perl pkg-config
- name: Install pinned Emscripten SDK
shell: bash
run: |
set -euo pipefail
git init "$RUNNER_TEMP/flb-emsdk"
git -C "$RUNNER_TEMP/flb-emsdk" remote add origin https://github.com/emscripten-core/emsdk.git
git -C "$RUNNER_TEMP/flb-emsdk" fetch --depth=1 origin 5eb0bde7585670252e8ba05e9d361627bffd08b5
git -C "$RUNNER_TEMP/flb-emsdk" checkout --detach FETCH_HEAD
read -r flb_sdk_version < .emscripten-version
"$RUNNER_TEMP/flb-emsdk/emsdk" install "$flb_sdk_version"
"$RUNNER_TEMP/flb-emsdk/emsdk" activate "$flb_sdk_version"
- name: Build and test
shell: bash
env:
FLB_SANITIZER: ${{ matrix.sanitizer }}
run: |
source "$RUNNER_TEMP/flb-emsdk/emsdk_env.sh"
set -euo pipefail
flb_cmake_flags=()
if [[ "$FLB_SANITIZER" == address ]]; then
flb_cmake_flags+=(-DLIBCO_TESTS_ASAN=ON -DCMAKE_C_FLAGS=-fsanitize=address
'-DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address -sALLOW_MEMORY_GROWTH=1')
fi
emcmake cmake -S . -B build-wasm -DFLB_WASM_BROWSER=ON \
-DFLB_DEBUG=OFF -DFLB_RELEASE=OFF -DCMAKE_BUILD_TYPE=MinSizeRel "${flb_cmake_flags[@]}"
cmake --build build-wasm -j8
ctest --test-dir build-wasm --output-on-failure
node --test tests/wasm/sdk_unit_test.mjs tests/wasm/sdk_worker_unit_test.mjs
- name: Package experimental browser SDK
if: matrix.sanitizer == 'none'
shell: bash
env:
FLB_SOURCE_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
FLB_BUILD_SHA: ${{ github.sha }}
run: |
set -euo pipefail
flb_package="fluent-bit-browser-experimental"
mkdir -p "dist/$flb_package"
cp -a build-wasm/sdk/browser/. "dist/$flb_package/"
test -s "dist/$flb_package/fluent-bit-runtime.wasm"
test -s "dist/$flb_package/fluent-bit-runtime.js"
python3 - <<'PYTHON'
import json
import os
from pathlib import Path
metadata = {
"experimental": True,
"source_commit": os.environ["FLB_SOURCE_SHA"],
"build_commit": os.environ["FLB_BUILD_SHA"],
"emscripten": Path(".emscripten-version").read_text().strip(),
"sanitizer": "none",
"validation": "Build, CTest and SDK unit tests passed; browser job status is separate",
"requirements": "HTTPS and cross-origin isolation (COOP/COEP)"
}
Path("dist/fluent-bit-browser-experimental/build-info.json").write_text(
json.dumps(metadata, indent=2) + "\n")
PYTHON
(cd "dist/$flb_package" && sha256sum -- *.js *.wasm *.d.ts package.json \
README.md LICENSE build-info.json > SHA256SUMS)
tar -czf "dist/$flb_package.tar.gz" -C dist "$flb_package"
(cd dist && sha256sum "$flb_package.tar.gz" > "$flb_package.tar.gz.sha256")
- name: Upload experimental browser SDK
if: matrix.sanitizer == 'none'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: fluent-bit-browser-experimental-${{ github.event.pull_request.head.sha || github.sha }}
path: |
dist/fluent-bit-browser-experimental.tar.gz
dist/fluent-bit-browser-experimental.tar.gz.sha256
if-no-files-found: error
retention-days: 30
compression-level: 0
- name: Test browser lifecycle and startup failures
shell: bash
run: |
set -euo pipefail
python3 -m venv "$RUNNER_TEMP/flb-browser-tests"
"$RUNNER_TEMP/flb-browser-tests/bin/python" -m pip install playwright==1.62.0
"$RUNNER_TEMP/flb-browser-tests/bin/python" -m playwright install --with-deps chromium
flb_browser=$("$RUNNER_TEMP/flb-browser-tests/bin/python" -c \
'from playwright.sync_api import sync_playwright; p = sync_playwright().start(); print(p.chromium.executable_path); p.stop()')
"$RUNNER_TEMP/flb-browser-tests/bin/python" tests/wasm/sdk_test.py \
--build-dir build-wasm --browser "$flb_browser"
"$RUNNER_TEMP/flb-browser-tests/bin/python" tests/wasm/sdk_test.py \
--build-dir build-wasm --browser "$flb_browser" --pthread-only
"$RUNNER_TEMP/flb-browser-tests/bin/python" tests/wasm/browser_page_test.py \
--build-dir build-wasm --browser "$flb_browser"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ lib/jemalloc
tests/internal/flb_tests_internal.h
tests/runtime/flb_tests_runtime.h
build/*
/build-wasm/
/build-wasm-asan/
/build-wasm-release/
/build-wasm-*/
include/fluent-bit/flb_info.h
include/fluent-bit/flb_plugins.h
include/fluent-bit/flb_version.h
Expand Down
35 changes: 33 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
cmake_minimum_required(VERSION 3.12)
project(fluent-bit C)

option(FLB_WASM_BROWSER "Enable the experimental Emscripten browser build profile" OFF)
if(FLB_WASM_BROWSER)
include(cmake/wasm-browser.cmake)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
message(FATAL_ERROR "Emscripten builds require -DFLB_WASM_BROWSER=ON")
endif()

include(CheckCCompilerFlag)

# CMP0069 ensures that LTO is enabled for all compilers
Expand Down Expand Up @@ -130,9 +137,15 @@ endif()
INCLUDE(TestBigEndian)
include(GNUInstallDirs)
include(ExternalProject)
include(cmake/FindJournald.cmake)
if(NOT FLB_WASM_BROWSER)
include(cmake/FindJournald.cmake)
endif()
include(cmake/FindMonkey.cmake)
include(cmake/macros.cmake)
if(FLB_WASM_BROWSER)
include(cmake/wasm-openssl.cmake)
include(cmake/wasm-filesystem.cmake)
endif()
include(cmake/platform_feature_checks.cmake)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
find_package(Sanitizers)
Expand Down Expand Up @@ -204,6 +217,10 @@ option(FLB_SQLDB "Enable SQL embedded DB" Yes)
option(FLB_HTTP_SERVER "Enable HTTP Server" Yes)
option(FLB_BACKTRACE "Enable stacktrace support" Yes)
option(FLB_LUAJIT "Enable Lua Scripting support" Yes)
option(FLB_WASM_LUA "Enable portable Lua in the browser build" No)
if(FLB_WASM_LUA AND NOT FLB_WASM_BROWSER)
message(FATAL_ERROR "FLB_WASM_LUA requires FLB_WASM_BROWSER=ON")
endif()
option(FLB_RECORD_ACCESSOR "Enable record accessor" Yes)
option(FLB_SIGNV4 "Enable AWS Signv4 support" Yes)
option(FLB_AWS "Enable AWS support" Yes)
Expand Down Expand Up @@ -1183,7 +1200,11 @@ else()
endif ()

# Configuration file YAML format support
if(FLB_CONFIG_YAML)
if(FLB_CONFIG_YAML AND FLB_WASM_BROWSER)
include(cmake/wasm-libyaml.cmake)
set(FLB_HAVE_LIBYAML 1)
FLB_DEFINITION(FLB_HAVE_LIBYAML)
elseif(FLB_CONFIG_YAML)
find_package(PkgConfig)
# libyaml's corresponding pkg-config file is yaml-0.1.pc.
# We should search it first.
Expand Down Expand Up @@ -1404,6 +1425,10 @@ if(FLB_LUAJIT)
include(cmake/luajit.cmake)
endif()
FLB_DEFINITION(FLB_HAVE_LUAJIT)
FLB_DEFINITION(FLB_HAVE_LUA)
elseif(FLB_WASM_LUA)
include(cmake/wasm-lua.cmake)
FLB_DEFINITION(FLB_HAVE_LUA)
endif()

# PostgreSQL
Expand Down Expand Up @@ -1605,6 +1630,12 @@ if(FLB_TESTS_INTERNAL)
add_subdirectory(tests/internal/)
endif()

if(FLB_WASM_BROWSER)
enable_testing()
include(cmake/wasm-sdk.cmake)
add_subdirectory(tests/wasm)
endif()

# Installer Generation (Cpack)
# ============================

Expand Down
5 changes: 5 additions & 0 deletions cmake/headers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ include_directories(
${FLB_PATH_ROOT_BINARY_DIR}/lib/monkey/include/monkey/
)

if(NOT FLB_HTTP_SERVER)
# mk_core is configured directly under the Fluent Bit project in this mode.
include_directories(${FLB_PATH_ROOT_BINARY_DIR}/include/monkey)
endif()

if(FLB_YYJSON)
include_directories(${FLB_PATH_ROOT_SOURCE}/${FLB_PATH_LIB_YYJSON}/src)
endif()
Expand Down
11 changes: 11 additions & 0 deletions cmake/plugins_options.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
macro(DEFINE_OPTION option_name description default_value)
set(temp_value ${default_value})
if(FLB_WASM_BROWSER)
list(FIND FLB_WASM_BROWSER_PLUGINS "${option_name}" wasm_plugin_index)
if(wasm_plugin_index EQUAL -1)
if(${option_name})
message(FATAL_ERROR "${option_name} is not supported by the browser build profile")
endif()
set(temp_value OFF)
else()
set(temp_value ON)
endif()
endif()
if(FLB_MINIMAL)
set(temp_value OFF)
endif()
Expand Down
109 changes: 109 additions & 0 deletions cmake/wasm-browser.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Experimental browser cross-compilation profile, distinct from FLB_WASM
# (which embeds WAMR in a native Fluent Bit process).
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
message(FATAL_ERROR
"FLB_WASM_BROWSER requires Emscripten. Use: "
"emcmake cmake -S . -B build-wasm -DFLB_WASM_BROWSER=ON")
endif()

# Keep compiler and runtime shims in lockstep. Check before downloading or
# compiling dependencies; a different SDK needs the complete validation matrix.
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../.emscripten-version" FLB_WASM_EMSCRIPTEN_VERSION LIMIT_COUNT 1)
if(NOT EMSCRIPTEN_VERSION VERSION_EQUAL FLB_WASM_EMSCRIPTEN_VERSION)
message(FATAL_ERROR
"FLB_WASM_BROWSER requires Emscripten ${FLB_WASM_EMSCRIPTEN_VERSION} (found '${EMSCRIPTEN_VERSION}')")
endif()

# Reject incompatible overrides instead of silently producing a native or
# browser-incompatible build. These are profile constraints, not defaults.
foreach(option_name
FLB_ALL FLB_DEV FLB_BINARY FLB_SHARED_LIB FLB_EXAMPLES
FLB_TESTS_RUNTIME FLB_TESTS_INTERNAL FLB_TESTS_INTERNAL_FUZZ
FLB_TESTS_OSSFUZZ FLB_BENCHMARKS FLB_COVERAGE
FLB_TLS FLB_AWS FLB_SIGNV4 FLB_AWS_ERROR_REPORTER
FLB_HTTP_SERVER FLB_CHUNK_TRACE FLB_SQLDB
FLB_JEMALLOC FLB_BACKTRACE FLB_VALGRIND FLB_MTRACE FLB_INOTIFY
FLB_LUAJIT FLB_WASM FLB_WAMRC FLB_WASM_STACK_PROTECT
FLB_KAFKA FLB_ZIG FLB_RIPSER FLB_USE_RIPSER
FLB_PROXY_GO FLB_CUSTOM_CALYPTIA FLB_AVRO_ENCODER FLB_ARROW
FLB_UNICODE_ENCODER FLB_USE_SIMDUTF FLB_STATIC_CONF
FLB_EVENT_LOOP_EPOLL FLB_EVENT_LOOP_KQUEUE
FLB_EVENT_LOOP_SELECT FLB_EVENT_LOOP_LIBEVENT
FLB_PREFER_SYSTEM_LIBS FLB_PREFER_SYSTEM_LIB_BACKTRACE
FLB_PREFER_SYSTEM_LIB_CARES FLB_PREFER_SYSTEM_LIB_JEMALLOC
FLB_PREFER_SYSTEM_LIB_KAFKA FLB_PREFER_SYSTEM_LIB_LUAJIT
FLB_PREFER_SYSTEM_LIB_MSGPACK FLB_PREFER_SYSTEM_LIB_NGHTTP2
FLB_PREFER_SYSTEM_LIB_SQLITE FLB_PREFER_SYSTEM_LIB_ZSTD)
if(${option_name})
message(FATAL_ERROR "${option_name} is not supported by the browser build profile")
endif()
set(${option_name} OFF CACHE BOOL "Disabled by the browser build profile")
endforeach()

set(FLB_SIMD "Off" CACHE STRING "Enable SIMD support (On, Off, Auto)")
set(FLB_IPO "Off" CACHE STRING "Build with interprocedural optimization")
set(FLB_SECURITY "Off" CACHE STRING "Build with security optimizations")
set(FLB_EVENT_LOOP_POLL ON CACHE BOOL "Enable poll(2) event loop backend")
set(CIO_BACKEND_FILESYSTEM ON CACHE BOOL "Enable browser virtual filesystem chunks" FORCE)
set(FLB_CONFIG_YAML ON CACHE BOOL "Enable browser YAML configuration")
set(FLB_WASM_LUA ON CACHE BOOL "Enable portable Lua in the browser build")
set(LIBCO_TESTS ON CACHE BOOL "Build coroutine tests")

# Emscripten supplies linkable stubs for several unavailable OS services.
# Compilation probes cannot establish that these services work in a browser.
foreach(feature FLB_HAVE_FORK FLB_HAVE_SYS_WAIT_H FLB_HAVE_ACCEPT4 FLB_HAVE_UNIX_SOCKET)
set(${feature} OFF CACHE INTERNAL "Unavailable in browsers" FORCE)
endforeach()

# Candidate local-data plugins and the Fetch-backed HTTP output. Inclusion is a compilation
# target, not a claim of browser runtime support. Keep new plugins opt-in.
set(FLB_WASM_BROWSER_PLUGINS
FLB_IN_DUMMY
FLB_IN_EMITTER
FLB_IN_EVENT_TYPE
FLB_IN_FLUENTBIT_METRICS
FLB_IN_FLUENTBIT_LOGS
FLB_IN_LIB
FLB_IN_RANDOM
FLB_IN_STORAGE_BACKLOG
FLB_PROCESSOR_CONTENT_MODIFIER
FLB_PROCESSOR_CUMULATIVE_TO_DELTA
FLB_PROCESSOR_LABELS
FLB_PROCESSOR_METRICS_SELECTOR
FLB_PROCESSOR_OPENTELEMETRY_ENVELOPE
FLB_PROCESSOR_SQL
FLB_PROCESSOR_SAMPLING
FLB_FILTER_ALTER_SIZE
FLB_FILTER_EXPECT
FLB_FILTER_GREP
FLB_FILTER_LOG_TO_METRICS
FLB_FILTER_LUA
FLB_FILTER_MODIFY
FLB_FILTER_MULTILINE
FLB_FILTER_NEST
FLB_FILTER_PARSER
FLB_FILTER_RECORD_MODIFIER
FLB_FILTER_REWRITE_TAG
FLB_FILTER_STDOUT
FLB_FILTER_THROTTLE
FLB_FILTER_TYPE_CONVERTER
FLB_OUT_COUNTER
FLB_OUT_FLOWCOUNTER
FLB_OUT_HTTP
FLB_OUT_LOKI
FLB_OUT_OPENTELEMETRY
FLB_OUT_LIB
FLB_OUT_NULL
FLB_OUT_STDOUT)

if(NOT FLB_WASM_LUA)
list(REMOVE_ITEM FLB_WASM_BROWSER_PLUGINS FLB_FILTER_LUA)
endif()

# Compile every dependency with the same threading ABI. The embedding API
# must dispatch engine operations to a worker, never the browser main thread.
add_compile_options(-pthread)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")

message(STATUS "Experimental browser profile: worker runtime, virtual filesystem, and Fetch HTTPS output")
6 changes: 6 additions & 0 deletions cmake/wasm-filesystem.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Browser filesystem glue, kept outside the portable ChunkIO library.
add_library(flb-wasm-filesystem INTERFACE)
target_link_libraries(flb-wasm-filesystem INTERFACE
"-lidbfs.js" "--pre-js=${PROJECT_SOURCE_DIR}/src/wasm/storage.js")
set_property(TARGET flb-wasm-filesystem PROPERTY INTERFACE_LINK_DEPENDS
"${PROJECT_SOURCE_DIR}/src/wasm/storage.js")
25 changes: 25 additions & 0 deletions cmake/wasm-libyaml.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Keep host pkg-config and native libraries out of the browser build.
set(FLB_WASM_YAML_PREFIX "${CMAKE_BINARY_DIR}/wasm-yaml")
file(MAKE_DIRECTORY "${FLB_WASM_YAML_PREFIX}/include")

ExternalProject_Add(flb-wasm-libyaml
EXCLUDE_FROM_ALL TRUE
URL https://codeload.github.com/yaml/libyaml/tar.gz/refs/tags/0.2.5
URL_HASH SHA256=fa240dbf262be053f3898006d502d514936c818e422afdcf33921c63bed9bf2e
PREFIX "${CMAKE_BINARY_DIR}/wasm-libyaml"
CMAKE_ARGS
"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
"-DCMAKE_INSTALL_PREFIX=${FLB_WASM_YAML_PREFIX}"
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
"-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -pthread"
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
-DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF
BUILD_BYPRODUCTS "${FLB_WASM_YAML_PREFIX}/lib/libyaml.a"
LOG_DOWNLOAD ON LOG_CONFIGURE ON LOG_BUILD ON LOG_INSTALL ON)

add_library(yaml STATIC IMPORTED GLOBAL)
set_target_properties(yaml PROPERTIES
IMPORTED_LOCATION "${FLB_WASM_YAML_PREFIX}/lib/libyaml.a"
INTERFACE_INCLUDE_DIRECTORIES "${FLB_WASM_YAML_PREFIX}/include"
INTERFACE_COMPILE_DEFINITIONS YAML_DECLARE_STATIC)
add_dependencies(yaml flb-wasm-libyaml)
13 changes: 13 additions & 0 deletions cmake/wasm-lua-source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.12)
project(flb_portable_lua C)

if(NOT EXISTS "${LUA_SOURCE_DIR}/src/lapi.c")
message(FATAL_ERROR "LUA_SOURCE_DIR must contain the pinned Lua source release")
endif()
file(GLOB lua_sources "${LUA_SOURCE_DIR}/src/*.c")
list(REMOVE_ITEM lua_sources "${LUA_SOURCE_DIR}/src/lua.c" "${LUA_SOURCE_DIR}/src/luac.c")
add_library(flb-lua STATIC ${lua_sources})
target_include_directories(flb-lua PUBLIC "${LUA_SOURCE_DIR}/src")
install(TARGETS flb-lua ARCHIVE DESTINATION lib)
install(FILES "${LUA_SOURCE_DIR}/src/lua.h" "${LUA_SOURCE_DIR}/src/luaconf.h"
"${LUA_SOURCE_DIR}/src/lauxlib.h" "${LUA_SOURCE_DIR}/src/lualib.h" DESTINATION include)
Loading
Loading