imgui: add statically linked GLFW 3.4 build (#53)
This commit is contained in:
@@ -5,6 +5,7 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
|||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
INSTALL_DIR="$DIR/imgui/install"
|
INSTALL_DIR="$DIR/imgui/install"
|
||||||
|
NJOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)"
|
||||||
|
|
||||||
# Dear ImGui (docking branch, version 1.92.7)
|
# Dear ImGui (docking branch, version 1.92.7)
|
||||||
IMGUI_COMMIT="934c6a5f5ef2355d6df25395d555cb71f790c4e9"
|
IMGUI_COMMIT="934c6a5f5ef2355d6df25395d555cb71f790c4e9"
|
||||||
@@ -12,6 +13,8 @@ IMGUI_COMMIT="934c6a5f5ef2355d6df25395d555cb71f790c4e9"
|
|||||||
IMPLOT_COMMIT="93c801b4bb801c5c11031d880b6af1d1f70bd79d"
|
IMPLOT_COMMIT="93c801b4bb801c5c11031d880b6af1d1f70bd79d"
|
||||||
# rlImGui
|
# rlImGui
|
||||||
RLIMGUI_COMMIT="286e11acd6c785004c9550c7ed3762add2ae3d47"
|
RLIMGUI_COMMIT="286e11acd6c785004c9550c7ed3762add2ae3d47"
|
||||||
|
# GLFW 3.4
|
||||||
|
GLFW_COMMIT="7b6aead9fb88b3623e3b3725ebb42670cbe4c579"
|
||||||
|
|
||||||
# Clone/update imgui
|
# Clone/update imgui
|
||||||
if [ ! -d "imgui-src/.git" ]; then
|
if [ ! -d "imgui-src/.git" ]; then
|
||||||
@@ -37,9 +40,40 @@ fi
|
|||||||
git -C rlimgui-src fetch --depth 1 origin "$RLIMGUI_COMMIT"
|
git -C rlimgui-src fetch --depth 1 origin "$RLIMGUI_COMMIT"
|
||||||
git -C rlimgui-src checkout --force "$RLIMGUI_COMMIT"
|
git -C rlimgui-src checkout --force "$RLIMGUI_COMMIT"
|
||||||
|
|
||||||
|
# Clone/update GLFW
|
||||||
|
if [ ! -d "glfw-src/.git" ]; then
|
||||||
|
rm -rf glfw-src
|
||||||
|
git clone --depth 1 https://github.com/glfw/glfw.git glfw-src
|
||||||
|
fi
|
||||||
|
git -C glfw-src fetch --depth 1 origin "$GLFW_COMMIT"
|
||||||
|
git -C glfw-src checkout --force "$GLFW_COMMIT"
|
||||||
|
|
||||||
|
# Install GLFW build dependencies
|
||||||
|
if [[ "$(uname)" == "Linux" ]]; then
|
||||||
|
if command -v dnf &>/dev/null; then
|
||||||
|
dnf install -y libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel mesa-libGL-devel
|
||||||
|
elif command -v apt-get &>/dev/null; then
|
||||||
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
|
apt-get update && apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev
|
||||||
|
else
|
||||||
|
sudo apt-get update && sudo apt-get install -y libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libgl-dev
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build GLFW static library
|
||||||
|
cmake -B glfw-src/build -S glfw-src \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
|
-DGLFW_BUILD_EXAMPLES=OFF \
|
||||||
|
-DGLFW_BUILD_TESTS=OFF \
|
||||||
|
-DGLFW_BUILD_DOCS=OFF \
|
||||||
|
-DGLFW_BUILD_WAYLAND=OFF
|
||||||
|
cmake --build glfw-src/build --parallel "$NJOBS"
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
rm -rf "$INSTALL_DIR"
|
rm -rf "$INSTALL_DIR"
|
||||||
mkdir -p "$INSTALL_DIR/include/extras" "$INSTALL_DIR/src"
|
mkdir -p "$INSTALL_DIR/include/extras" "$INSTALL_DIR/src" "$INSTALL_DIR/lib"
|
||||||
|
|
||||||
# imgui
|
# imgui
|
||||||
cp imgui-src/imgui.h imgui-src/imgui_internal.h imgui-src/imconfig.h \
|
cp imgui-src/imgui.h imgui-src/imgui_internal.h imgui-src/imconfig.h \
|
||||||
@@ -65,5 +99,9 @@ cp rlimgui-src/extras/FA6FreeSolidFontData.h rlimgui-src/extras/IconsFontAwesome
|
|||||||
"$INSTALL_DIR/include/extras/"
|
"$INSTALL_DIR/include/extras/"
|
||||||
cp rlimgui-src/rlImGui.cpp "$INSTALL_DIR/src/"
|
cp rlimgui-src/rlImGui.cpp "$INSTALL_DIR/src/"
|
||||||
|
|
||||||
|
# glfw
|
||||||
|
cp glfw-src/build/src/libglfw3.a "$INSTALL_DIR/lib/"
|
||||||
|
cp -r glfw-src/include/GLFW "$INSTALL_DIR/include/"
|
||||||
|
|
||||||
echo "Installed imgui to $INSTALL_DIR"
|
echo "Installed imgui to $INSTALL_DIR"
|
||||||
du -sh "$INSTALL_DIR"
|
du -sh "$INSTALL_DIR"
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ import os
|
|||||||
DIR = os.path.join(os.path.dirname(__file__), "install")
|
DIR = os.path.join(os.path.dirname(__file__), "install")
|
||||||
INCLUDE_DIR = os.path.join(DIR, "include")
|
INCLUDE_DIR = os.path.join(DIR, "include")
|
||||||
SRC_DIR = os.path.join(DIR, "src")
|
SRC_DIR = os.path.join(DIR, "src")
|
||||||
|
LIB_DIR = os.path.join(DIR, "lib")
|
||||||
|
|
||||||
|
|
||||||
def smoketest():
|
def smoketest():
|
||||||
assert os.path.isfile(os.path.join(INCLUDE_DIR, "imgui.h")), "imgui.h not found"
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "imgui.h")), "imgui.h not found"
|
||||||
assert os.path.isfile(os.path.join(SRC_DIR, "imgui.cpp")), "imgui.cpp not found"
|
assert os.path.isfile(os.path.join(SRC_DIR, "imgui.cpp")), "imgui.cpp not found"
|
||||||
|
assert os.path.isfile(os.path.join(LIB_DIR, "libglfw3.a")), "libglfw3.a not found"
|
||||||
|
assert os.path.isfile(os.path.join(INCLUDE_DIR, "GLFW", "glfw3.h")), "GLFW/glfw3.h not found"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
[project]
|
[project]
|
||||||
name = "imgui"
|
name = "imgui"
|
||||||
version = "1.92.7"
|
version = "1.92.7"
|
||||||
description = "Dear ImGui + ImPlot + rlImGui (source distribution)"
|
description = "Dear ImGui + ImPlot + rlImGui + GLFW 3.4 (static)"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
|
|||||||
Reference in New Issue
Block a user