Skip to content

Commit d567af1

Browse files
Raspberry PI (5) support (arm64-linux) (#79)
1 parent 73eeb5d commit d567af1

11 files changed

Lines changed: 56 additions & 35 deletions

File tree

README.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ xframes is actively maintained with planned features and enhancements. The focus
5858

5959
## Supported platforms - Node-API v9
6060

61-
| Architecture | OS | Notes |
62-
| ----------------- | ------------------------- | ----------------------------------------------- |
63-
| wasm32-emscripten | N/A | Works in browsers that support WebGPU rendering |
64-
| x64-windows | Windows 11 Home | Works |
65-
| x64-linux | WSL2 (Ubuntu) 24.04.1 LTS | Works by setting `export GALLIUM_DRIVER=d3d12` |
66-
| x64-linux | Debian Trixie | Works |
67-
| x64-linux | Ubuntu 24.04 LTS | Works |
61+
| Architecture | OS | Notes |
62+
| ----------------- | -------------------------------------------- | ----------------------------------------------------------------- |
63+
| wasm32-emscripten | N/A | Works in browsers that support WebGPU rendering |
64+
| x64-windows | Windows 11 Home | Works |
65+
| x64-linux | WSL2 (Ubuntu) 24.04.1 LTS | Works by setting `export GALLIUM_DRIVER=d3d12` |
66+
| x64-linux | Debian Trixie | Works |
67+
| x64-linux | Ubuntu 22.04 LTS | Works |
68+
| x64-linux | Ubuntu 24.04 LTS | Works |
69+
| arm64-linux | Raspberry Pi OS (Debian bookworm) Oct 2024  | Works, though there are stricter limits with custom fonts loading |
6870

6971
## Accessibility
7072

@@ -90,13 +92,15 @@ Accessibility is a key priority for the future of **xframes**. While the current
9092

9193
### Supported platforms
9294

93-
| Architecture | OS | Compiler | Notes |
94-
| ----------------- | ----------------------- | ------------------ | ----------------------------------------------- |
95-
| wasm32-emscripten | N/A | emsdk 3.1.64 | Works in browsers that support WebGPU rendering |
96-
| x64-windows | Windows 11 Home | Visual Studio 2022 | Works |
97-
| x64-linux | WSL2 Ubuntu 24.04.1 LTS | gcc 13.2.0 | Works by setting `export GALLIUM_DRIVER=d3d12` |
98-
| x64-linux | Debian Trixie | gcc 14 | Works |
99-
| x64-linux | Ubuntu 24.04 LTS | gcc 13.2 | Works |
95+
| Architecture | OS | Compiler | Notes |
96+
| ----------------- | -------------------------------------------- | ------------------ | ----- |
97+
| wasm32-emscripten | N/A | emsdk 3.1.64 | Works |
98+
| x64-windows | Windows 11 Home | Visual Studio 2022 | Works |
99+
| x64-linux | WSL2 Ubuntu 24.04.1 LTS | gcc 13.2.0 | Works |
100+
| x64-linux | Debian Trixie | gcc 14 | Works |
101+
| x64-linux | Ubuntu 22.04 LTS | gcc 12.2 | Works |
102+
| x64-linux | Ubuntu 24.04 LTS | gcc 13.2 | Works |
103+
| arm64-linux | Raspberry Pi OS (Debian bookworm) Oct 2024  | gcc 12.2 | Works |
100104

101105

102106
## Contributing

packages/dear-imgui/cpp/app/include/imgui_renderer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef IMGUI_VIEW
22
#define IMGUI_VIEW
33

4-
#include <format>
4+
#include <fmt/core.h>
55

66
#include "IconsFontAwesome6.h"
77
#include "imgui.h"

packages/dear-imgui/cpp/app/src/imgui_renderer.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void ImGuiRenderer::LoadFontsFromDefs() {
8888
if (item.is_object()) {
8989
if (item.contains("name") && item.contains("size") && item["name"].is_string() && item["size"].is_number()) {
9090
auto fontName = item["name"].template get<std::string>();
91-
auto pathToFont = std::format("{}/fonts/{}.ttf", m_assetsBasePath, fontName);
91+
auto pathToFont = fmt::format("{}/fonts/{}.ttf", m_assetsBasePath, fontName);
9292
auto fontSize = item["size"].template get<int>();
9393

9494
if (!m_fontDefMap.contains(fontName)) {
@@ -111,7 +111,7 @@ void ImGuiRenderer::LoadFontsFromDefs() {
111111
icons_config.MergeMode = true;
112112
icons_config.PixelSnapH = true;
113113
icons_config.GlyphMinAdvanceX = iconFontSize;
114-
auto pathToFaFontFile = std::format("{}/fonts/{}", m_assetsBasePath, FONT_ICON_FILE_NAME_FAS);
114+
auto pathToFaFontFile = fmt::format("{}/fonts/{}", m_assetsBasePath, FONT_ICON_FILE_NAME_FAS);
115115
// auto pathToMdiFontFile = std::format("assets/fonts/{}", FONT_ICON_FILE_NAME_MDI);
116116

117117
io.Fonts->AddFontFromFileTTF(pathToFaFontFile.c_str(), iconFontSize, &icons_config, icons_ranges);
@@ -150,7 +150,7 @@ void ImGuiRenderer::LoadFontsFromDefs() {
150150
icons_config.MergeMode = true;
151151
icons_config.PixelSnapH = true;
152152
icons_config.GlyphMinAdvanceX = iconFontSize;
153-
auto pathToFaFontFile = std::format("assets/fonts/{}", FONT_ICON_FILE_NAME_FAS);
153+
auto pathToFaFontFile = fmt::format("assets/fonts/{}", FONT_ICON_FILE_NAME_FAS);
154154

155155
m_loadedFonts.push_back(
156156
io.Fonts->AddFontFromFileTTF(pathToFaFontFile.c_str(), iconFontSize, &icons_config, icons_ranges)
@@ -203,11 +203,12 @@ void ImGuiRenderer::InitGlfw() {
203203
// This needs to be done explicitly later.
204204
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
205205
#else
206-
const char* glsl_version = "#version 150";
207-
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
208-
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
206+
// GL 3.0 + GLSL 130
207+
const char* glsl_version = "#version 130";
209208
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
210-
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
209+
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
210+
//glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only
211+
//glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // 3.0+ only
211212
#endif
212213

213214
m_glfwWindow = glfwCreateWindow(m_window_width, m_window_height, m_glWindowTitle, nullptr, nullptr);
@@ -390,7 +391,7 @@ void ImGuiRenderer::SetCurrentContext() {
390391
void ImGuiRenderer::HandleNextImageJob() {
391392
auto& [widgetId, url] = m_xframes->m_imageJobs.front();
392393

393-
auto pathToFile = std::format("{}/{}", m_assetsBasePath, url);
394+
auto pathToFile = fmt::format("{}/{}", m_assetsBasePath, url);
394395

395396
FILE* f = fopen(pathToFile.c_str(), "rb");
396397
if (f == NULL) {

packages/dear-imgui/examples/node-example/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/dear-imgui/examples/node-example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"homepage": "https://github.com/andreamancuso/xframes",
1010
"dependencies": {
1111
"@xframes/common": "0.0.13",
12-
"@xframes/node": "0.0.18",
12+
"@xframes/node": "0.0.19",
1313
"react": "18.2.0",
1414
"tsx": "^4.19.2",
1515
"typescript": "5.6.3",
@@ -24,4 +24,4 @@
2424
"@types/react": "^18.2.0",
2525
"prettier": "^3.3.3"
2626
}
27-
}
27+
}

packages/dear-imgui/npm/node/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ prebuilds
66

77
imgui.ini
88

9+
fmt.dll
910
glfw3.dll
1011
glfw3dll.lib
1112
xframes.exp

packages/dear-imgui/npm/node/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ if(NOT VCPKG_TARGET_TRIPLET)
1313
set(VCPKG_TARGET_TRIPLET "x64-windows")
1414
elseif(APPLE)
1515
set(VCPKG_TARGET_TRIPLET "x64-osx")
16+
elseif(__ARM_ARCH OR __TARGET_ARCH_ARM OR __TARGET_ARCH_THUMB OR _M_ARM OR __arm__ OR __arm64 OR _M_ARM64 OR __aarch64__ OR __AARCH64EL__)
17+
set(VCPKG_TARGET_TRIPLET "arm64-linux")
1618
else()
1719
set(VCPKG_TARGET_TRIPLET "x64-linux")
1820
endif()
@@ -29,6 +31,7 @@ find_package(OpenGL REQUIRED)
2931
find_package(glfw3 CONFIG REQUIRED)
3032
find_package(ada CONFIG REQUIRED)
3133
find_package(Stb REQUIRED)
34+
find_package(fmt CONFIG REQUIRED)
3235

3336
include_directories(${CMAKE_JS_INC})
3437

@@ -100,6 +103,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
100103
target_link_libraries(${PROJECT_NAME}
101104
${CMAKE_JS_LIB}
102105
ada::ada
106+
fmt::fmt
103107

104108
glfw
105109
OpenGL::GL

packages/dear-imgui/npm/node/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,18 @@ If a prebuilt module isn't found then you will need gcc 13+ to build the project
1818

1919
Ubuntu 24.04 dependencies:
2020

21-
`sudo apt install build-essential cmake libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config`
21+
`sudo apt install curl zip unzip tar build-essential cmake libglfw3 libglfw3-dev libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config`
2222

2323
Fedora 41 dependencies:
2424

25-
`sudo dnf install @development-tools gcc-c++ cmake glfw-devel`
25+
`sudo dnf install @development-tools gcc-c++ cmake glfw-devel`
26+
27+
Raspberry Pi OS
28+
29+
`sudo apt install curl zip unzip tar build-essential cmake libglfw3 libglfw3-dev libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config`
30+
31+
You must set:
32+
33+
`export VCPKG_FORCE_SYSTEM_BINARIES=1`
34+
35+
It suppresses the downloading of CMake and Ninja and forces the use of the system binaries.

packages/dear-imgui/npm/node/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/dear-imgui/npm/node/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { render } from "./lib/render";
66
const fontDefs: any = {
77
defs: [
88
{ name: "roboto-regular", sizes: [16, 18, 20, 24, 28, 32, 36, 48] },
9-
{ name: "roboto-bold", sizes: [16, 18, 20, 24, 28, 32, 36, 48] },
9+
// { name: "roboto-bold", sizes: [16, 18, 20, 24, 28, 32, 36, 48] },
1010
// { name: "roboto-light", sizes: [12, 14, 16, 18, 20, 24, 28, 32, 36, 48] },
11-
{ name: "roboto-mono-regular", sizes: [14, 16] },
11+
// { name: "roboto-mono-regular", sizes: [14, 16] },
1212
]
1313
.map(({ name, sizes }) => sizes.map((size) => ({ name, size })))
1414
.flat(),

0 commit comments

Comments
 (0)