@elurjs/universal 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/commands.mjs +1 -1
- package/cli/create-app.mjs +11 -6
- package/cli/dev.mjs +4 -3
- package/cli/elur.mjs +60 -4
- package/docs/INSTALACION-Y-DEV.md +7 -4
- package/package.json +5 -1
- package/targets/linux/CMakeLists.txt +196 -0
- package/targets/linux/README.md +422 -0
- package/targets/linux/ci/tsan.supp +15 -0
- package/targets/linux/generated/elur_module_registrar.cpp +18 -0
- package/targets/linux/generated/module_sources.cmake +7 -0
- package/targets/linux/src/elur_applicator.cpp +5073 -0
- package/targets/linux/src/elur_applicator.h +387 -0
- package/targets/linux/src/elur_clip.cpp +76 -0
- package/targets/linux/src/elur_clip.h +23 -0
- package/targets/linux/src/elur_crypto_module.cpp +121 -0
- package/targets/linux/src/elur_events.h +57 -0
- package/targets/linux/src/elur_fonts.cpp +106 -0
- package/targets/linux/src/elur_fonts.h +31 -0
- package/targets/linux/src/elur_host.cpp +1041 -0
- package/targets/linux/src/elur_host.h +66 -0
- package/targets/linux/src/elur_http_module.cpp +437 -0
- package/targets/linux/src/elur_js.h +40 -0
- package/targets/linux/src/elur_modules.cpp +453 -0
- package/targets/linux/src/elur_modules.h +159 -0
- package/targets/linux/src/elur_renderer.h +46 -0
- package/targets/linux/src/elur_shot.cpp +64 -0
- package/targets/linux/src/elur_shot.h +17 -0
- package/targets/linux/src/elur_skia_a11y.cpp +987 -0
- package/targets/linux/src/elur_skia_a11y.h +146 -0
- package/targets/linux/src/elur_skia_app.cpp +1770 -0
- package/targets/linux/src/elur_skia_app.h +18 -0
- package/targets/linux/src/elur_state_module.cpp +99 -0
- package/targets/linux/src/elur_tck_module.cpp +186 -0
- package/targets/linux/src/elur_ui_module.cpp +84 -0
- package/targets/linux/src/elur_yoga.cpp +452 -0
- package/targets/linux/src/elur_yoga.h +95 -0
- package/targets/linux/src/main.cpp +294 -0
- package/targets/windows/Package.appxmanifest +28 -0
- package/targets/windows/README.md +44 -0
- package/targets/windows/elur-windows.vcxproj +133 -0
- package/targets/windows/packages.config +10 -0
- package/targets/windows/src/elur_crypto_module_win.cpp +106 -0
- package/targets/windows/src/elur_events.h +58 -0
- package/targets/windows/src/elur_host_win.cpp +645 -0
- package/targets/windows/src/elur_host_win.h +75 -0
- package/targets/windows/src/elur_http_module_win.cpp +331 -0
- package/targets/windows/src/elur_js.h +40 -0
- package/targets/windows/src/elur_modules.cpp +460 -0
- package/targets/windows/src/elur_modules.h +159 -0
- package/targets/windows/src/elur_state_module.cpp +99 -0
- package/targets/windows/src/elur_ui_module_win.cpp +75 -0
- package/targets/windows/src/elur_uia_host.h +129 -0
- package/targets/windows/src/elur_win_applicator.cpp +3118 -0
- package/targets/windows/src/elur_win_applicator.h +186 -0
- package/targets/windows/src/elur_yoga.cpp +452 -0
- package/targets/windows/src/elur_yoga.h +95 -0
- package/targets/windows/src/main.cpp +321 -0
package/cli/commands.mjs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
export const CLI_COMMANDS = [
|
|
14
14
|
{
|
|
15
15
|
cmd: "`elur build --target web|android|linux|windows [--apk --aab --release --engine hermes --splits --minify]`",
|
|
16
|
-
fn: "Build completo: bundling, lowering, assets, integración de host, Gradle; windows emite `generated/elurApp.{js,es5.qjsc}`
|
|
16
|
+
fn: "Build completo: bundling, lowering, assets, integración de host, Gradle; windows emite `generated/elurApp.{js,es5.qjsc}` y compila el exe por `msbuild` cuando corre en Windows (`--skip-host` lo omite — lo usa `dev`)",
|
|
17
17
|
estado: "Implementado", sub: ["build"],
|
|
18
18
|
},
|
|
19
19
|
{
|
package/cli/create-app.mjs
CHANGED
|
@@ -106,8 +106,10 @@ Prerequisitos por plataforma:
|
|
|
106
106
|
targets/linux/build\` (el scaffold no copia \`targets/linux\` — el
|
|
107
107
|
source está en \`node_modules/@elurjs/universal/targets/linux\`).
|
|
108
108
|
- windows — nativo: VS Build Tools 2022 (VCTools + MSBuild + Windows
|
|
109
|
-
11 SDK)
|
|
110
|
-
targets/windows/
|
|
109
|
+
11 SDK) + clone de \`quickjs-ng\` (el host enlaza \`qjs.lib\`);
|
|
110
|
+
\`msbuild node_modules/@elurjs/universal/targets/windows/
|
|
111
|
+
elur-windows.vcxproj /restore /p:ElurQjsDir=<clone>\` compila el
|
|
112
|
+
exe y resuelve los NuGet (WindowsAppSDK/CppWinRT). El loop dev es
|
|
111
113
|
local — \`dev:windows\` relanza \`elur-windows.exe\`. Desde
|
|
112
114
|
Linux/macOS hacia un host remoto: \`ELUR_WIN_SSH=user@host[:port]\`
|
|
113
115
|
habilita scp + relanzado por \`schtasks\` (ADR-0220).
|
|
@@ -136,11 +138,14 @@ Qué hace cada script:
|
|
|
136
138
|
index.html; \`--ssr\`/\`--ssg\` emiten aparte); \`build:android\` →
|
|
137
139
|
assets JS + .hbc/.qjsc + APK debug (\`--aab\`/\`--release\`/
|
|
138
140
|
\`--splits\`/\`--minify\`; release exige \`--engine\`);
|
|
139
|
-
\`build:linux\` → \`generated/\` + registrar de módulos
|
|
140
|
-
|
|
141
|
+
\`build:linux\` → \`generated/\` + registrar de módulos + en Linux
|
|
142
|
+
compila \`elur-linux\` por cmake (configure+build del host GTK4);
|
|
143
|
+
packaging linux: \`bun node_modules/@elurjs/universal/cli/package-linux.mjs
|
|
141
144
|
--format appimage|deb|rpm|flatpak\` (ADR-0186);
|
|
142
|
-
\`build:windows\` → \`generated/elurApp.{js,es5.qjsc}\`
|
|
143
|
-
|
|
145
|
+
\`build:windows\` → \`generated/elurApp.{js,es5.qjsc}\` + en
|
|
146
|
+
Windows compila \`elur-windows.exe\` por msbuild (paridad con
|
|
147
|
+
el APK de android; fuera de Windows solo emite el JS — el exe
|
|
148
|
+
lo produce la máquina Windows, ADR-0220).
|
|
144
149
|
- \`elur dev --target <p>\` watch-reconstruye \`src/\`, \`packages/\` y
|
|
145
150
|
el entry (debounce 400 ms); flags: \`--dev-fast\`, \`--no-serve\`,
|
|
146
151
|
\`--full\`, \`--json\` (NDJSON).
|
package/cli/dev.mjs
CHANGED
|
@@ -408,7 +408,7 @@ function rebuild() {
|
|
|
408
408
|
if (target === "linux") {
|
|
409
409
|
run("bun", join(__dirname, "elur.mjs"), "build", "--target", "linux",
|
|
410
410
|
"--app", appEntry,
|
|
411
|
-
...(devFast ? ["--dev-fast"] : []));
|
|
411
|
+
...(devFast ? ["--dev-fast"] : []), "--skip-host");
|
|
412
412
|
if (full) {
|
|
413
413
|
const linuxBuildDir = existsSync(join(process.cwd(), "targets/linux/build"))
|
|
414
414
|
? join(process.cwd(), "targets/linux/build")
|
|
@@ -430,7 +430,8 @@ function rebuild() {
|
|
|
430
430
|
if (target === "windows") {
|
|
431
431
|
run("bun", join(__dirname, "elur.mjs"), "build", "--target", "windows",
|
|
432
432
|
"--app", appEntry,
|
|
433
|
-
...(devFast ? ["--dev-fast"] : [])
|
|
433
|
+
...(devFast ? ["--dev-fast"] : []),
|
|
434
|
+
...(full ? [] : ["--skip-host"]));
|
|
434
435
|
const launched = restartWindowsHost();
|
|
435
436
|
log("dev.build.end", {
|
|
436
437
|
ok: true, ms: Date.now() - t0,
|
|
@@ -440,7 +441,7 @@ function rebuild() {
|
|
|
440
441
|
: launched === "ssh"
|
|
441
442
|
? "bundle Windows copiado + app relanzada (SSH)"
|
|
442
443
|
: process.platform === "win32"
|
|
443
|
-
? "bundle Windows en generated/ (host sin compilar: msbuild elur-windows.vcxproj /restore)"
|
|
444
|
+
? "bundle Windows en generated/ (host sin compilar: msbuild node_modules/@elurjs/universal/targets/windows/elur-windows.vcxproj /restore — exige clone quickjs-ng, /p:ElurQjsDir=…)"
|
|
444
445
|
: "bundle Windows en generated/ (ELUR_WIN_SSH no definido)",
|
|
445
446
|
});
|
|
446
447
|
return;
|
package/cli/elur.mjs
CHANGED
|
@@ -383,10 +383,66 @@ if (target === "web" && args.includes("--ssr")) {
|
|
|
383
383
|
if (existsSync(staleQjsc)) rmSync(staleQjsc, { force: true });
|
|
384
384
|
console.log(`[elur] ${target} (dev-fast) → generated/elurApp.js`);
|
|
385
385
|
} else {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
386
|
+
// QJSC es optimización (init −40%, ADR-0157): sin qjsc disponible
|
|
387
|
+
// el host cae a source JS — misma política graceful que android.
|
|
388
|
+
let qjscOk = false;
|
|
389
|
+
try {
|
|
390
|
+
run("bun", pkg("cli/gen-es5.mjs"),
|
|
391
|
+
"generated/elurApp.js", "generated/elurApp.es5.js");
|
|
392
|
+
run("bun", pkg("cli/gen-qjsc.mjs"), "generated/elurApp.es5.js");
|
|
393
|
+
qjscOk = true;
|
|
394
|
+
} catch (e) {
|
|
395
|
+
const stale = join(project, "generated/elurApp.es5.qjsc");
|
|
396
|
+
if (existsSync(stale)) rmSync(stale, { force: true });
|
|
397
|
+
if (requireQjsc) {
|
|
398
|
+
console.error(`[elur] gen:qjsc FALLÓ con --require-qjsc: ${e.message?.split("\n")[0]}`);
|
|
399
|
+
process.exit(1);
|
|
400
|
+
}
|
|
401
|
+
console.warn(`[elur] gen:qjsc omitido (${e.message?.split("\n")[0]}) — el host cargará source JS`);
|
|
402
|
+
}
|
|
403
|
+
console.log(`[elur] ${target} → generated/elurApp.js${qjscOk ? " + elurApp.es5.qjsc" : " (source — sin qjsc)"}`);
|
|
404
|
+
}
|
|
405
|
+
// Host nativo: el binario se compila una vez por máquina — build
|
|
406
|
+
// lo invoca (paridad con el APK de android); el loop dev pasa
|
|
407
|
+
// --skip-host porque el exe no cambia con cada save de JS.
|
|
408
|
+
if (target === "linux" && !args.includes("--skip-host")) {
|
|
409
|
+
const hostDir = [
|
|
410
|
+
join(project, "targets/linux"),
|
|
411
|
+
pkg("targets/linux"),
|
|
412
|
+
].find((d) => existsSync(join(d, "CMakeLists.txt")));
|
|
413
|
+
if (process.platform === "linux") {
|
|
414
|
+
if (!hostDir) {
|
|
415
|
+
console.warn("[elur] targets/linux no encontrado — host sin compilar");
|
|
416
|
+
} else {
|
|
417
|
+
const buildDir = join(hostDir, "build");
|
|
418
|
+
if (!existsSync(join(buildDir, "CMakeCache.txt"))) {
|
|
419
|
+
run("cmake", "-B", buildDir, "-S", hostDir,
|
|
420
|
+
...(process.env.ELUR_QJS_DIR ? [`-DELUR_QJS_DIR=${process.env.ELUR_QJS_DIR}`] : []));
|
|
421
|
+
}
|
|
422
|
+
run("cmake", "--build", buildDir, "-j4");
|
|
423
|
+
console.log(`[elur] host → ${buildDir}/elur-linux`);
|
|
424
|
+
}
|
|
425
|
+
} else if (hostDir) {
|
|
426
|
+
console.log("[elur] host linux sin compilar aquí — el binario lo produce cmake en la máquina Linux");
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (target === "windows" && !args.includes("--skip-host")) {
|
|
430
|
+
const vcxproj = [
|
|
431
|
+
join(project, "targets/windows/elur-windows.vcxproj"),
|
|
432
|
+
pkg("targets/windows/elur-windows.vcxproj"),
|
|
433
|
+
].find(existsSync);
|
|
434
|
+
if (process.platform === "win32") {
|
|
435
|
+
if (!vcxproj) {
|
|
436
|
+
console.warn("[elur] elur-windows.vcxproj no encontrado — host sin compilar");
|
|
437
|
+
} else {
|
|
438
|
+
run("msbuild", vcxproj,
|
|
439
|
+
"/p:Configuration=Release", "/p:Platform=x64", "/restore",
|
|
440
|
+
...(process.env.ELUR_QJS_DIR ? [`/p:ElurQjsDir=${process.env.ELUR_QJS_DIR}`] : []));
|
|
441
|
+
console.log("[elur] host → targets/windows/x64/Release/elur-windows.exe");
|
|
442
|
+
}
|
|
443
|
+
} else if (vcxproj) {
|
|
444
|
+
console.log("[elur] host windows sin compilar aquí — el .exe lo produce msbuild en la máquina Windows (o un host remoto)");
|
|
445
|
+
}
|
|
390
446
|
}
|
|
391
447
|
} else {
|
|
392
448
|
console.error(`[elur] target desconocido: ${target} (web|android|linux|ios|windows)`);
|
|
@@ -113,10 +113,13 @@ Scripts del scaffold (`create-app.mjs`):
|
|
|
113
113
|
`elurApp.es5.qjsc` (bytecode) si existe.
|
|
114
114
|
- `bun run dev:windows` → `elur dev --target windows` (ADR-0220): en
|
|
115
115
|
Windows el loop es **nativo local** — relanza `elur-windows.exe`
|
|
116
|
-
(`targets/windows/x64/{Release,Debug}/`
|
|
117
|
-
el loop GTK en Linux. Toolchain: VS Build Tools 2022
|
|
118
|
-
MSBuild + Windows 11 SDK)
|
|
119
|
-
|
|
116
|
+
(`node_modules/@elurjs/universal/targets/windows/x64/{Release,Debug}/`)
|
|
117
|
+
igual que el loop GTK en Linux. Toolchain: VS Build Tools 2022
|
|
118
|
+
(VCTools + MSBuild + Windows 11 SDK) + clone de `quickjs-ng` (el host
|
|
119
|
+
enlaza `qjs.lib`/`qjs-libc.lib` — `cmake -B build -DQJS_ENABLE_LIBC=ON`
|
|
120
|
+
dentro del clone); `msbuild node_modules/@elurjs/universal/targets/
|
|
121
|
+
windows/elur-windows.vcxproj /restore /p:ElurQjsDir=<clone>` compila
|
|
122
|
+
el exe y resuelve los NuGet (WindowsAppSDK 1.6+, CppWinRT 2.0+). Desde
|
|
120
123
|
Linux/macOS el host corre remoto: `ELUR_WIN_SSH=user@host[:port]`
|
|
121
124
|
habilita `scp` de `elurSignals.js`+bundle a `ELUR_WIN_DIR` (default
|
|
122
125
|
`C:/elur/generated`) + `schtasks /run /tn ELUR_WIN_TASK` (default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elurjs/universal",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
"targets/android/gradle",
|
|
39
39
|
"targets/android/gradlew",
|
|
40
40
|
"targets/android/gradlew.bat",
|
|
41
|
+
"targets/windows",
|
|
42
|
+
"targets/linux",
|
|
43
|
+
"!targets/linux/build*",
|
|
44
|
+
"!targets/linux/skia-libs",
|
|
41
45
|
"NOTICE",
|
|
42
46
|
"THIRD_PARTY_NOTICES.md",
|
|
43
47
|
"!docs/benchmarks",
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.22)
|
|
2
|
+
project(elur-linux CXX C)
|
|
3
|
+
|
|
4
|
+
# Host nativo Linux de Elur Universal (§19.4): QuickJS-ng embebido
|
|
5
|
+
# in-process + GTK4 + Pango + Yoga compartido (native/yoga, fase 0).
|
|
6
|
+
#
|
|
7
|
+
# Deps: pkg-config gtk4 (dev files). En máquinas sin libgtk-4-dev del
|
|
8
|
+
# sistema, los .pc locales se resuelven por PKG_CONFIG_PATH (ver
|
|
9
|
+
# targets/linux/README.md).
|
|
10
|
+
#
|
|
11
|
+
# QuickJS-ng: clone de referencia en <repo>/quickjs-ng (mismo árbol que
|
|
12
|
+
# el vendored Android, pin 60984dc / BC 28 — ADR-0156). Override con
|
|
13
|
+
# -DELUR_QJS_DIR=/ruta/quickjs-ng o cae a FetchContent del tarball pin.
|
|
14
|
+
|
|
15
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
16
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
17
|
+
|
|
18
|
+
find_package(PkgConfig REQUIRED)
|
|
19
|
+
pkg_check_modules(GTK4 REQUIRED IMPORTED_TARGET gtk4 fontconfig libsoup-3.0)
|
|
20
|
+
# ADR-0182: libcrypto (OpenSSL EVP) para el módulo builtin "crypto" —
|
|
21
|
+
# verificación ed25519 de envelopes SDUI. Opcional: sin él el módulo
|
|
22
|
+
# no se compila ni registra y negocia unavailable (fail-loud, no stub).
|
|
23
|
+
pkg_check_modules(LIBCRYPTO IMPORTED_TARGET libcrypto)
|
|
24
|
+
|
|
25
|
+
set(ELUR_NATIVE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../native)
|
|
26
|
+
|
|
27
|
+
# ── QuickJS-ng ─────────────────────────────────────────────────────
|
|
28
|
+
set(ELUR_QJS_DIR "" CACHE PATH "clone local de quickjs-ng (default ../../quickjs-ng)")
|
|
29
|
+
if(NOT ELUR_QJS_DIR)
|
|
30
|
+
set(ELUR_QJS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../quickjs-ng)
|
|
31
|
+
endif()
|
|
32
|
+
if(EXISTS ${ELUR_QJS_DIR}/quickjs.c)
|
|
33
|
+
set(QJS_SRC ${ELUR_QJS_DIR})
|
|
34
|
+
message(STATUS "quickjs-ng desde clone local: ${QJS_SRC}")
|
|
35
|
+
else()
|
|
36
|
+
include(FetchContent)
|
|
37
|
+
FetchContent_Declare(
|
|
38
|
+
quickjs
|
|
39
|
+
URL https://github.com/quickjs-ng/quickjs/archive/60984dc07cbb6b7885303b9542944b114203e918.tar.gz
|
|
40
|
+
)
|
|
41
|
+
FetchContent_MakeAvailable(quickjs)
|
|
42
|
+
set(QJS_SRC ${quickjs_SOURCE_DIR})
|
|
43
|
+
message(STATUS "quickjs-ng via FetchContent: ${QJS_SRC}")
|
|
44
|
+
endif()
|
|
45
|
+
|
|
46
|
+
# 4 fuentes core (mismo set que el cmake de Android)
|
|
47
|
+
add_library(elur-quickjs STATIC
|
|
48
|
+
${QJS_SRC}/dtoa.c
|
|
49
|
+
${QJS_SRC}/libregexp.c
|
|
50
|
+
${QJS_SRC}/libunicode.c
|
|
51
|
+
${QJS_SRC}/quickjs.c
|
|
52
|
+
)
|
|
53
|
+
target_include_directories(elur-quickjs PUBLIC ${QJS_SRC})
|
|
54
|
+
target_compile_definitions(elur-quickjs PRIVATE _GNU_SOURCE)
|
|
55
|
+
target_compile_definitions(elur-quickjs PRIVATE QJS_DISABLE_DEBUGGER)
|
|
56
|
+
set_target_properties(elur-quickjs PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
57
|
+
|
|
58
|
+
# ── Yoga compartido (native/yoga — fase 0, ADR-0110: 3.2.1 exige C++20)
|
|
59
|
+
file(GLOB_RECURSE YOGA_SOURCES ${ELUR_NATIVE_DIR}/yoga/*.cpp)
|
|
60
|
+
add_library(elur-yogacore STATIC ${YOGA_SOURCES})
|
|
61
|
+
target_include_directories(elur-yogacore PUBLIC ${ELUR_NATIVE_DIR})
|
|
62
|
+
target_compile_options(elur-yogacore PRIVATE -fexceptions -frtti)
|
|
63
|
+
set_target_properties(elur-yogacore PROPERTIES
|
|
64
|
+
CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON POSITION_INDEPENDENT_CODE ON)
|
|
65
|
+
|
|
66
|
+
# ── Host ───────────────────────────────────────────────────────────
|
|
67
|
+
# Módulos de paquetes (bindings.linux, ADR-0076/0103): el toolchain
|
|
68
|
+
# emite generated/module_sources.cmake con las rutas de los .cpp de
|
|
69
|
+
# cada packages/*/linux + generated/elur_module_registrar.cpp con las
|
|
70
|
+
# llamadas register*. Sin bindings el archivo no existe — el weak
|
|
71
|
+
# symbol de elur_modules.cpp deja el registry vacío.
|
|
72
|
+
set(ELUR_MODULE_SOURCES "")
|
|
73
|
+
set(ELUR_MODULE_REGISTRAR "")
|
|
74
|
+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/generated/module_sources.cmake)
|
|
75
|
+
include(${CMAKE_CURRENT_SOURCE_DIR}/generated/module_sources.cmake)
|
|
76
|
+
set(ELUR_MODULE_REGISTRAR
|
|
77
|
+
${CMAKE_CURRENT_SOURCE_DIR}/generated/elur_module_registrar.cpp)
|
|
78
|
+
endif()
|
|
79
|
+
|
|
80
|
+
# ADR-0187 — perfil de hilos. OFF (default): perfil S, js = ui = hilo
|
|
81
|
+
# GTK. ON: perfil D, el runtime QuickJS corre en un hilo propio con
|
|
82
|
+
# cola de tareas; las ops cruzan al ui como JSON (boundary de marshal
|
|
83
|
+
# real — flushOps/JSValue no cruzan hilos). Pensado para ejercitar el
|
|
84
|
+
# interleaving que Android ya tiene; combinar con -DCMAKE_BUILD_TYPE=
|
|
85
|
+
# Debug + sanitizers para CI de carreras.
|
|
86
|
+
option(ELUR_THREAD_MODEL_D "Perfil D: hilo JS propio + GTK como ui" OFF)
|
|
87
|
+
# TSan sobre el perfil D: -DELUR_TSAN=ON -DELUR_THREAD_MODEL_D=ON.
|
|
88
|
+
option(ELUR_TSAN "ThreadSanitizer (build de CI para perfil D)" OFF)
|
|
89
|
+
|
|
90
|
+
# Carril Skia opt-in (ADR-0123, propuesta skia-renderer-arbol fase 0):
|
|
91
|
+
# libskia.a estática local en targets/linux/skia-libs (gitignored,
|
|
92
|
+
# mismo patrón que skia-libs/<ABI> de Android). Sin la lib el host
|
|
93
|
+
# compila igual — el aplicador queda como stub y renderer=skia cae a
|
|
94
|
+
# views con warn explícito.
|
|
95
|
+
set(ELUR_SKIA_LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/skia-libs)
|
|
96
|
+
if(EXISTS ${ELUR_SKIA_LIBS_DIR}/libskia.a)
|
|
97
|
+
pkg_check_modules(FREETYPE REQUIRED IMPORTED_TARGET freetype2)
|
|
98
|
+
add_library(elur-skiatree STATIC
|
|
99
|
+
${ELUR_NATIVE_DIR}/skia-tree/elur_skia_tree.cpp)
|
|
100
|
+
target_include_directories(elur-skiatree PUBLIC
|
|
101
|
+
${ELUR_NATIVE_DIR}/skia-tree ${ELUR_SKIA_LIBS_DIR})
|
|
102
|
+
target_compile_options(elur-skiatree PRIVATE -fexceptions -frtti)
|
|
103
|
+
set_target_properties(elur-skiatree PROPERTIES
|
|
104
|
+
CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON)
|
|
105
|
+
set(ELUR_SKIA_LIB ${ELUR_SKIA_LIBS_DIR}/libskia.a
|
|
106
|
+
${ELUR_SKIA_LIBS_DIR}/libskcms.a)
|
|
107
|
+
message(STATUS "skia opt-in: ${ELUR_SKIA_LIBS_DIR}/libskia.a")
|
|
108
|
+
# Fase 3 — módulos de texto (rebuild con harfbuzz+icu bundled,
|
|
109
|
+
# args del vendor/skia out/linux-text): paragraph+shaper+unicode.
|
|
110
|
+
# Sin libskparagraph.a el árbol cae al path measureText/drawString
|
|
111
|
+
# (ELUR_SKIA_TEXT=1 marca el path completo — PUBLIC: la cabecera
|
|
112
|
+
# cambia de layout y el flag debe llegar a todo consumidor).
|
|
113
|
+
if(EXISTS ${ELUR_SKIA_LIBS_DIR}/libskparagraph.a)
|
|
114
|
+
target_compile_definitions(elur-skiatree PUBLIC ELUR_SKIA_TEXT=1)
|
|
115
|
+
foreach(m skparagraph skshaper skunicode_icu skunicode_core
|
|
116
|
+
icu harfbuzz)
|
|
117
|
+
if(EXISTS ${ELUR_SKIA_LIBS_DIR}/lib${m}.a)
|
|
118
|
+
list(APPEND ELUR_SKIA_LIB ${ELUR_SKIA_LIBS_DIR}/lib${m}.a)
|
|
119
|
+
endif()
|
|
120
|
+
endforeach()
|
|
121
|
+
endif()
|
|
122
|
+
# Fase 4 — backend GPU opt-in: si la libskia trae Ganesh GL
|
|
123
|
+
# (rebuild con skia_use_gl/egl/epoxy_egl) expone ELUR_SKIA_GL y
|
|
124
|
+
# enlaza epoxy; sin esos símbolos backend=gl cae a raster con warn.
|
|
125
|
+
find_program(NM_EXECUTABLE nm)
|
|
126
|
+
if(NM_EXECUTABLE)
|
|
127
|
+
execute_process(COMMAND ${NM_EXECUTABLE} ${ELUR_SKIA_LIBS_DIR}/libskia.a
|
|
128
|
+
OUTPUT_VARIABLE ELUR_SKIA_SYMS ERROR_QUIET)
|
|
129
|
+
if(ELUR_SKIA_SYMS MATCHES "GrDirectContexts6MakeGL")
|
|
130
|
+
target_compile_definitions(elur-skiatree PUBLIC ELUR_SKIA_GL=1)
|
|
131
|
+
pkg_check_modules(EPOXY REQUIRED IMPORTED_TARGET epoxy)
|
|
132
|
+
list(APPEND ELUR_SKIA_LIB PkgConfig::EPOXY)
|
|
133
|
+
message(STATUS "skia gpu: backend gl disponible (--skia-backend gl)")
|
|
134
|
+
endif()
|
|
135
|
+
endif()
|
|
136
|
+
endif()
|
|
137
|
+
|
|
138
|
+
add_executable(elur-linux
|
|
139
|
+
src/main.cpp
|
|
140
|
+
src/elur_host.cpp
|
|
141
|
+
src/elur_applicator.cpp
|
|
142
|
+
src/elur_skia_app.cpp
|
|
143
|
+
src/elur_skia_a11y.cpp
|
|
144
|
+
src/elur_shot.cpp
|
|
145
|
+
src/elur_yoga.cpp
|
|
146
|
+
${ELUR_NATIVE_DIR}/layout/elur_layout_style.cpp
|
|
147
|
+
src/elur_modules.cpp
|
|
148
|
+
src/elur_state_module.cpp
|
|
149
|
+
src/elur_http_module.cpp
|
|
150
|
+
src/elur_ui_module.cpp
|
|
151
|
+
src/elur_crypto_module.cpp
|
|
152
|
+
src/elur_fonts.cpp
|
|
153
|
+
src/elur_clip.cpp
|
|
154
|
+
src/elur_tck_module.cpp
|
|
155
|
+
${ELUR_MODULE_REGISTRAR}
|
|
156
|
+
${ELUR_MODULE_SOURCES}
|
|
157
|
+
)
|
|
158
|
+
target_include_directories(elur-linux PRIVATE
|
|
159
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
160
|
+
${ELUR_NATIVE_DIR}
|
|
161
|
+
${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
|
162
|
+
target_link_libraries(elur-linux PRIVATE
|
|
163
|
+
elur-quickjs elur-yogacore PkgConfig::GTK4 m dl pthread)
|
|
164
|
+
if(ELUR_SKIA_LIB)
|
|
165
|
+
target_include_directories(elur-linux PRIVATE
|
|
166
|
+
${ELUR_SKIA_LIBS_DIR})
|
|
167
|
+
target_compile_definitions(elur-linux PRIVATE ELUR_HAS_SKIA=1)
|
|
168
|
+
# Skia estático: fontconfig del sistema (ya viene por GTK4) +
|
|
169
|
+
# freetype (skia_use_system_freetype2 de la build oficial).
|
|
170
|
+
target_link_libraries(elur-linux PRIVATE elur-skiatree
|
|
171
|
+
${ELUR_SKIA_LIB} PkgConfig::FREETYPE fontconfig)
|
|
172
|
+
endif()
|
|
173
|
+
if(ELUR_THREAD_MODEL_D)
|
|
174
|
+
target_compile_definitions(elur-linux PRIVATE ELUR_THREAD_MODEL_D=1)
|
|
175
|
+
message(STATUS "perfil de hilos: D (hilo js propio + ui GTK)")
|
|
176
|
+
else()
|
|
177
|
+
message(STATUS "perfil de hilos: S (js = ui = GTK)")
|
|
178
|
+
endif()
|
|
179
|
+
if(ELUR_TSAN)
|
|
180
|
+
target_compile_options(elur-linux PRIVATE -fsanitize=thread -g)
|
|
181
|
+
target_link_options(elur-linux PRIVATE -fsanitize=thread)
|
|
182
|
+
# quickjs/yoga también bajo TSan — un .o sin instrumentar deja
|
|
183
|
+
# huecos en el grafo de happens-before.
|
|
184
|
+
target_compile_options(elur-quickjs PRIVATE -fsanitize=thread -g)
|
|
185
|
+
target_compile_options(elur-yogacore PRIVATE -fsanitize=thread -g)
|
|
186
|
+
target_link_libraries(elur-quickjs PRIVATE -fsanitize=thread)
|
|
187
|
+
target_link_libraries(elur-yogacore PRIVATE -fsanitize=thread)
|
|
188
|
+
message(STATUS "TSan habilitado (usar con ELUR_THREAD_MODEL_D=ON)")
|
|
189
|
+
endif()
|
|
190
|
+
if(LIBCRYPTO_FOUND)
|
|
191
|
+
target_link_libraries(elur-linux PRIVATE PkgConfig::LIBCRYPTO)
|
|
192
|
+
target_compile_definitions(elur-linux PRIVATE ELUR_HAVE_CRYPTO)
|
|
193
|
+
message(STATUS "módulo crypto: OpenSSL EVP Ed25519 habilitado")
|
|
194
|
+
else()
|
|
195
|
+
message(STATUS "módulo crypto: sin libcrypto — negociará unavailable")
|
|
196
|
+
endif()
|