Skip to content

Commit 9f8a611

Browse files
lilyco-42luadebug
andauthored
Add package eui-neo v0.5.5 (#10561)
* Add package eui-neo v0.5.5 Add xmake package recipe for EUI-NEO, a cross-platform, high-performance, low-overhead C++17 GPUI framework. Features: - Configurable window backend (glfw/sdl2) - Configurable render backend (opengl/vulkan) - Static/shared library builds - Markdown support via md4c - Vulkan low-latency presentation option Source: https://github.com/lilyco-42/EUI-NEO Local test results (Windows/MSVC 2026): - xmake require eui-neo: install OK - xmake build: compile + link OK - xmake run: EUI-NEO package test OK * Update EUI-NEO package definition and build options * Update xmake.lua * Switch to fork as used to be * Update dependency for non-Windows platforms * Update URLs and remove shared library config * Add xmake.lua for EUI-NEO project setup Initialize EUI-NEO project with configuration options and build rules. * Add Windows system links for MinGW platform * Replace curl with libcurl in xmake.lua * Keep windows mingw linux macosx * Refactor compilation flags for C and Objective-C files Refactor MSVC compilation flags for C files and add Objective-C support for native bridge on macOS. * Refactor option definitions in xmake.lua * Remove example and user app build options Removed options for building example and user applications from the xmake configuration. Cleaned up related code sections for better maintainability. * Remove unused app configuration options Removed unused configuration options for apps and user_apps. --------- Co-authored-by: Saikari <lin@sz.cn.eu.org>
1 parent 7334405 commit 9f8a611

2 files changed

Lines changed: 323 additions & 0 deletions

File tree

packages/e/eui-neo/port/xmake.lua

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
set_project("EUI-NEO")
2+
set_version("0.5.5")
3+
set_xmakever("2.9.0")
4+
set_languages("c99", "cxx17")
5+
6+
option("window_backend", {default = "glfw", values = {"glfw", "sdl2"}, description = "Window backend: glfw or sdl2"})
7+
option("render_backend", {default = "opengl", values = {"auto", "opengl", "vulkan"}, description = "Render backend: auto, opengl, or vulkan"})
8+
option("shared", {default = false, description = "Build eui_neo as a shared library instead of a static library."})
9+
option("modules", {default = true, description = "Build optional EUI-NEO modules when their directories are present."})
10+
option("markdown", {default = true, description = "Enable MD4C Markdown parsing support."})
11+
option("vulkan_low_latency", {default = false, description = "Prefer low-latency Vulkan presentation when available."})
12+
13+
local render_backend = get_config("render_backend") or "opengl"
14+
if render_backend == "auto" then
15+
if find_package("vulkan") then
16+
render_backend = "vulkan"
17+
else
18+
render_backend = "opengl"
19+
print("Vulkan SDK not found; falling back to OpenGL.")
20+
end
21+
end
22+
23+
local window_backend = get_config("window_backend") or "glfw"
24+
local build_shared = get_config("shared") and true or false
25+
local build_modules = get_config("modules") and true or false
26+
local enable_markdown = get_config("markdown") and true or false
27+
local vk_low_latency = get_config("vulkan_low_latency") and true or false
28+
29+
print("EUI render backend: requested=%s, resolved=%s", get_config("render_backend") or "opengl", render_backend)
30+
print("EUI window backend: %s", window_backend)
31+
32+
add_requires("freetype", {configs = {png = true, zlib = true, bzip2 = false, harfbuzz = false, brotli = false}})
33+
add_requires("libpng", "zlib")
34+
35+
if window_backend == "glfw" then
36+
add_requires("glfw", {configs = {shared = false}})
37+
end
38+
if window_backend == "sdl2" then
39+
add_requires("sdl2", {configs = {shared = false}})
40+
end
41+
if render_backend == "vulkan" then
42+
add_requires("vulkan")
43+
end
44+
if not is_plat("windows") then
45+
add_requires("libcurl", {configs = {shared = false}})
46+
end
47+
48+
if render_backend == "opengl" then
49+
target("eui_glad")
50+
set_kind("static")
51+
add_files("3rd/glad/src/glad.c",
52+
{force = {cxflags = {is_plat("windows") and "/TC" or ""}}})
53+
add_includedirs("3rd/glad/include", {public = true})
54+
target_end()
55+
end
56+
57+
if enable_markdown then
58+
target("eui_md4c")
59+
set_kind("static")
60+
add_files("3rd/md4c/src/md4c.c",
61+
{force = {cxflags = {is_plat("windows") and "/TC" or ""}}})
62+
add_includedirs("3rd/md4c/src", {public = true})
63+
target_end()
64+
end
65+
66+
target("eui_neo")
67+
set_kind(build_shared and "shared" or "static")
68+
set_group("framework")
69+
70+
add_files(
71+
"core/platform/async.cpp",
72+
"core/platform/json.cpp",
73+
"core/platform/network.cpp",
74+
"core/platform/performance_stats.cpp",
75+
"core/platform/platform.cpp",
76+
"core/render/image.cpp",
77+
"core/render/image_facade.cpp",
78+
"core/render/image_source.cpp",
79+
"core/render/primitive.cpp",
80+
"core/render/render_backend.cpp",
81+
"core/render/shadertoy.cpp",
82+
"core/render/shadertoy_json.cpp",
83+
"core/render/shadertoy_primitive.cpp",
84+
"core/render/stb_image_impl.cpp",
85+
"core/render/text.cpp",
86+
"core/window/window_backend.cpp"
87+
)
88+
89+
local c_flags = {}
90+
if is_plat("windows") then
91+
table.insert(c_flags, "/TC")
92+
end
93+
94+
local bridge_flags = table.copy(c_flags)
95+
if is_plat("macosx") then
96+
table.insert(bridge_flags, "-x")
97+
table.insert(bridge_flags, "objective-c")
98+
end
99+
100+
add_files("3rd/yyjson-0.12.0/src/yyjson.c", {force = {cxflags = c_flags}})
101+
add_files("core/platform/native_bridge.c", "core/platform/tray_bridge.c",
102+
{force = {cxflags = bridge_flags}})
103+
104+
if render_backend == "opengl" then
105+
add_files(
106+
"core/render/opengl/opengl_backend.cpp",
107+
"core/render/opengl/opengl_image.cpp",
108+
"core/render/opengl/opengl_primitives.cpp",
109+
"core/render/opengl/opengl_shadertoy.cpp",
110+
"core/render/opengl/opengl_text.cpp"
111+
)
112+
elseif render_backend == "vulkan" then
113+
add_files(
114+
"core/render/vulkan/vulkan_backend.cpp",
115+
"core/render/vulkan/vulkan_cache.cpp",
116+
"core/render/vulkan/vulkan_primitives.cpp",
117+
"core/render/vulkan/vulkan_polygon.cpp",
118+
"core/render/vulkan/vulkan_shadertoy.cpp",
119+
"core/render/vulkan/vulkan_text.cpp",
120+
"core/render/vulkan/vulkan_image.cpp"
121+
)
122+
end
123+
124+
if window_backend == "glfw" then
125+
add_files("core/platform/ime_bridge.c",
126+
{force = {cxflags = bridge_flags}})
127+
end
128+
129+
add_includedirs("include", ".", "3rd/tray", {public = true})
130+
add_includedirs("3rd/yyjson-0.12.0/src")
131+
add_includedirs("3rd")
132+
133+
add_defines("YYJSON_DISABLE_WRITER=1")
134+
if render_backend == "opengl" then
135+
add_defines("EUI_RENDER_BACKEND_OPENGL=1", {public = true})
136+
elseif render_backend == "vulkan" then
137+
add_defines("EUI_RENDER_BACKEND_VULKAN=1", {public = true})
138+
if vk_low_latency then
139+
add_defines("EUI_VULKAN_LOW_LATENCY_PRESENT=1")
140+
end
141+
end
142+
if window_backend == "sdl2" then
143+
add_defines("EUI_WINDOW_BACKEND_SDL2=1", {public = true})
144+
end
145+
146+
if is_plat("windows") then
147+
add_defines("EUI_TRAY_WINAPI=1", "NOMINMAX", {public = true})
148+
add_syslinks("winmm", "urlmon", "shell32", "user32", "imm32", "pdh", "comdlg32", {public = true})
149+
elseif is_plat("macosx") then
150+
add_defines("EUI_TRAY_APPKIT=1", {public = true})
151+
add_frameworks("Cocoa", {public = true})
152+
add_syslinks("objc", {public = true})
153+
end
154+
155+
if enable_markdown then
156+
add_defines("EUI_HAS_MD4C=1", {public = true})
157+
add_deps("eui_md4c")
158+
end
159+
160+
add_packages("freetype", "libpng", "zlib", {public = true})
161+
if render_backend == "opengl" then
162+
add_deps("eui_glad")
163+
if is_plat("windows") then
164+
add_syslinks("opengl32", {public = true})
165+
elseif is_plat("linux") then
166+
add_syslinks("GL", {public = true})
167+
elseif is_plat("macosx") then
168+
add_frameworks("OpenGL", {public = true})
169+
end
170+
elseif render_backend == "vulkan" then
171+
add_packages("vulkan", {public = true})
172+
end
173+
if window_backend == "glfw" then
174+
add_packages("glfw", {public = true})
175+
elseif window_backend == "sdl2" then
176+
add_packages("sdl2", {public = true})
177+
end
178+
add_packages("libcurl", {public = true, optional = true})
179+
if not is_plat("windows", "mingw") and has_package("libcurl") then
180+
add_defines("EUI_HAS_CURL=1", {public = true})
181+
end
182+
183+
if not is_plat("windows", "mingw") then
184+
add_syslinks("pthread", {public = true})
185+
end
186+
187+
add_installfiles("include/(**)", {prefixdir = "include"})
188+
add_installfiles("components/(**.h)", {prefixdir = "include/components"})
189+
add_installfiles("core/(**.h)", {prefixdir = "include/core"})
190+
add_installfiles("3rd/stb_image.h", "3rd/nanosvg.h", "3rd/nanosvgrast.h", {prefixdir = "include/3rd"})
191+
add_installfiles("3rd/tray/tray.h", {prefixdir = "include/3rd/tray"})
192+
if render_backend == "opengl" then
193+
add_installfiles("3rd/glad/include/(**.h)", {prefixdir = "include"})
194+
end
195+
if enable_markdown then
196+
add_installfiles("3rd/md4c/src/md4c.h", {prefixdir = "include"})
197+
end
198+
199+
if is_plat("windows") then
200+
add_cxflags("/utf-8")
201+
if not is_mode("debug") then
202+
add_cxflags("/O1", "/GS-", "/sdl-", "/wd4819")
203+
end
204+
else
205+
if not is_mode("debug") then
206+
add_cxxflags("-Os", "-fno-exceptions", "-fno-rtti")
207+
end
208+
end
209+
target_end()
210+
211+
if build_modules then
212+
if os.exists("modules/keyboard/keyboard.h") then
213+
target("eui_module_keyboard")
214+
set_kind("headeronly")
215+
set_group("modules")
216+
add_includedirs("modules/keyboard", {public = true})
217+
add_deps("eui_neo")
218+
target_end()
219+
end
220+
221+
if os.exists("modules/media/media.h") then
222+
target("eui_module_media")
223+
set_kind("headeronly")
224+
set_group("modules")
225+
add_includedirs("modules/media", {public = true})
226+
add_deps("eui_neo")
227+
target_end()
228+
end
229+
230+
if os.exists("modules/serial/serial.h") then
231+
target("eui_module_serial")
232+
set_kind("static")
233+
set_group("modules")
234+
add_files("modules/serial/serial.cpp")
235+
add_includedirs("modules/serial", {public = true})
236+
add_deps("eui_neo")
237+
if is_plat("windows") then
238+
add_cxflags("/utf-8")
239+
if not is_mode("debug") then
240+
add_cxflags("/O1", "/GS-", "/sdl-", "/wd4819")
241+
end
242+
else
243+
if not is_mode("debug") then
244+
add_cxxflags("-Os", "-fno-exceptions", "-fno-rtti")
245+
end
246+
end
247+
target_end()
248+
end
249+
end

packages/e/eui-neo/xmake.lua

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package("eui-neo")
2+
set_homepage("https://github.com/sudoevolve/EUI-NEO")
3+
set_description("Cross-platform, high-performance, low-overhead C++17 GPUI framework")
4+
set_license("Apache-2.0")
5+
6+
add_urls("https://github.com/sudoevolve/EUI-NEO/archive/refs/tags/$(version).tar.gz",
7+
"https://github.com/sudoevolve/EUI-NEO.git")
8+
9+
add_versions("v0.5.5", "cf0da91d7544fe406b704922137fd4d55ed080b3e647501e0ca5303abb00eb98")
10+
11+
add_configs("window_backend", {description = "Window backend", default = "glfw", values = {"glfw", "sdl2"}})
12+
add_configs("render_backend", {description = "Render backend", default = "opengl", values = {"auto", "opengl", "vulkan"}})
13+
add_configs("markdown", {description = "Enable MD4C Markdown parsing support", default = true, type = "boolean"})
14+
add_configs("vulkan_low_latency", {description = "Prefer low-latency Vulkan presentation", default = false, type = "boolean"})
15+
16+
add_deps("freetype", "libpng", "zlib")
17+
18+
if is_plat("windows", "mingw") then
19+
add_syslinks("imm32", "urlmon", "comdlg32")
20+
end
21+
22+
on_load(function(package)
23+
if package:config("window_backend") == "glfw" then
24+
package:add("deps", "glfw")
25+
end
26+
if package:config("window_backend") == "sdl2" then
27+
package:add("deps", "sdl2")
28+
end
29+
if package:config("render_backend") == "opengl" then
30+
package:add("deps", "glad")
31+
end
32+
if package:config("render_backend") == "vulkan" then
33+
package:add("deps", "vulkan")
34+
end
35+
if not package:is_plat("windows", "mingw") then
36+
package:add("deps", "libcurl")
37+
end
38+
end)
39+
40+
on_install("windows", "mingw", "linux", "macosx", function(package)
41+
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
42+
local configs = {}
43+
configs.window_backend = package:config("window_backend")
44+
configs.render_backend = package:config("render_backend")
45+
configs.markdown = package:config("markdown")
46+
configs.vulkan_low_latency = package:config("vulkan_low_latency")
47+
import("package.tools.xmake").install(package, configs)
48+
end)
49+
50+
on_test(function (package)
51+
assert(package:check_cxxsnippets({test = [[
52+
namespace app {
53+
const DslAppConfig& dslAppConfig() {
54+
static const DslAppConfig config = DslAppConfig{}
55+
.title("Test app")
56+
.pageId("test_app")
57+
.windowSize(1440, 920)
58+
.fps(90.0);
59+
return config;
60+
}
61+
void compose(eui::Ui& ui, const eui::Screen& screen) {
62+
const bool compactHeader = screen.width < 850.0f;
63+
const float headerHeight = compactHeader ? 118.0f : 92.0f;
64+
ui.stack("root").size(screen.width, screen.height).content([&] {
65+
ui.rect("root.background").size(screen.width, screen.height).build();
66+
}).build();
67+
}
68+
}
69+
void test() {
70+
eui::Ui ui;
71+
ui.stack("root");
72+
}
73+
]]}, {configs = {languages = "c++17"}, includes = "eui_neo.h"}))
74+
end)

0 commit comments

Comments
 (0)