Skip to content

Commit 598a597

Browse files
committedMar 20, 2025·
Run stubgen in a separate script
1 parent 507cd12 commit 598a597

File tree

3 files changed

+16
-82
lines changed

3 files changed

+16
-82
lines changed
 

‎CMakeLists.txt

-11
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ set(Python_EXECUTABLE ".venv/Scripts/python.exe")
22
cmake_minimum_required(VERSION 3.15...3.27)
33
project(slimgui LANGUAGES CXX)
44

5-
# Extended stubgen for slimgui
6-
include(slimgui_stubgen.cmake)
7-
85
# Try to import all Python components potentially needed by nanobind
96
find_package(Python 3.8
107
REQUIRED COMPONENTS Interpreter Development.Module
@@ -36,14 +33,6 @@ nanobind_add_module(slimgui_ext
3633
src/c/imgui/imgui_widgets.cpp
3734
)
3835

39-
slimgui_add_stub(
40-
slimgui_ext_stub
41-
MODULE slimgui_ext
42-
OUTPUT "${CMAKE_SOURCE_DIR}/src/slimgui/slimgui_ext.pyi"
43-
PYTHON_PATH $<TARGET_FILE_DIR:slimgui_ext>
44-
DEPENDS slimgui_ext
45-
)
46-
4736
include_directories(${CMAKE_SOURCE_DIR}/src/c/imgui)
4837

4938
install(TARGETS slimgui_ext LIBRARY DESTINATION slimgui)

‎full_build.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Full build that builds the extension, the typing stub slimgui_ext.pyi, and all docs.
4+
# This got a bit more complex so I don't know how to do this in cmake anymore.
5+
6+
# CI builds don't need to run this, as the .pyi file is checked into git.
7+
8+
set -e
9+
10+
# generate the enums
11+
python gen/gen_nb_enums.py > src/im_enums.inl
12+
pip install --no-build-isolation -ve .
13+
14+
python -m nanobind.stubgen -i build/cp312-abi3-macosx_15_0_arm64 -q -m slimgui_ext -o src/slimgui/slimgui_ext.pyi
15+
python gen/amend_func_docs.py --cimgui-definitions-file gen/cimgui/definitions.json --imgui-h src/c/imgui/imgui.h --pyi-file src/slimgui/slimgui_ext.pyi -o src/slimgui/slimgui_ext.pyi
16+
python gen/build_docs.py --pyi-file src/slimgui/slimgui_ext.pyi --output docs/index.html docs/apiref.md

‎slimgui_stubgen.cmake

-71
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.