Skip to content

Commit a32d9ce

Browse files
authored
UE5.5 and PythonDocumentation (#94)
+ Added `IAssetTypeActions` for better UE support and re import + use pdoc to generate python documentation for a more pleasing look + additional python documentation
1 parent 8210a41 commit a32d9ce

File tree

28 files changed

+630
-250
lines changed

28 files changed

+630
-250
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,23 @@ jobs:
116116
if: ${{ matrix.unreal }}
117117
working-directory: ${{github.workspace}}/build
118118
shell: bash
119-
run: cmake --install . --config $BUILD_TYPE --prefix comp_unreal --component unreal
120-
- name: Upload UE
119+
run: |
120+
cmake $GITHUB_WORKSPACE -DINKCPP_UNREAL_TARGET_VERSION="5.5"
121+
cmake --install . --config $BUILD_TYPE --prefix comp_unreal_5_5 --component unreal
122+
cmake $GITHUB_WORKSPACE -DINKCPP_UNREAL_TARGET_VERSION="5.4"
123+
cmake --install . --config $BUILD_TYPE --prefix comp_unreal_5_4 --component unreal
124+
- name: Upload UE 5.5
125+
if: ${{ matrix.unreal }}
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: unreal_5_5
129+
path: build/comp_unreal_5_5/
130+
- name: Upload UE 5.4
121131
if: ${{ matrix.unreal }}
122132
uses: actions/upload-artifact@v4
123133
with:
124-
name: unreal
125-
path: build/comp_unreal/
134+
name: unreal_5_4
135+
path: build/comp_unreal_5_4/
126136

127137
# Make sure Inkproof has everything it needs to run our executable
128138
- name: Setup Ink Proof
@@ -181,6 +191,13 @@ jobs:
181191
uses: actions/setup-python@v5
182192
with:
183193
python-version: "3.x"
194+
- name: install pyton libs
195+
run: >-
196+
python3 -m
197+
pip install
198+
pybind11-stubgen
199+
pdoc
200+
--user
184201
- name: Install Doxygen
185202
run: |
186203
sudo apt-get install graphviz -y
@@ -198,11 +215,11 @@ jobs:
198215
- name: Configure CMake
199216
shell: bash
200217
working-directory: ${{github.workspace}}/build
201-
run: cmake $GITHUB_WORKSPACE -DINKCPP_PY=ON -DINKCPP_DOC_BlueprintUE=ON
218+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DINKCPP_PY=ON -DINKCPP_DOC_BlueprintUE=ON
202219
- name: Build
203220
working-directory: ${{github.workspace}}/build
204221
shell: bash
205-
run: cmake --build . --target doc
222+
run: cmake --build . --target doc --config Release
206223
- name: Upload
207224
uses: actions/upload-artifact@v4
208225
with:
@@ -226,6 +243,8 @@ jobs:
226243
python3 -m
227244
pip install
228245
build
246+
pybind11-stubgen
247+
pdoc
229248
pytest
230249
--user
231250
- name: Build python release
@@ -247,7 +266,7 @@ jobs:
247266
- name: Test python release
248267
run: |
249268
python3 -m pip install dist/*.whl --user
250-
python3 -m pytest
269+
python3 -m pytest inkcpp_python/tests
251270
- name: Remove wheel
252271
run: |
253272
rm dist/*.whl

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ jobs:
2626
run: |
2727
mkdir artifacts
2828
ID=$(gh run list -b master --limit 1 --json databaseId | jq '.[0].databaseId')
29-
gh run download $ID -D artifacts -n linux-cl -n linux-lib -n linux-clib -n unreal -n macos-cl -n macos-lib -n macos-clib -n macos-arm-cl -n macos-arm-lib -n macos-arm-clib -n win64-cl -n win64-lib -n win64-clib -n python-package-distribution
29+
gh run download $ID -D artifacts -n linux-cl -n linux-lib -n linux-clib -n unreal_5_5 -n unreal_5_4 -n macos-cl -n macos-lib -n macos-clib -n macos-arm-cl -n macos-arm-lib -n macos-arm-clib -n win64-cl -n win64-lib -n win64-clib -n python-package-distribution
3030
mv artifacts/python-package-distribution dist
3131
- name: Zip
3232
working-directory: ${{github.workspace}}/artifacts
3333
run: |
34-
for f in linux-cl linux-lib linux-clib unreal macos-cl macos-lib macos-clib macos-arm-cl macos-arm-lib macos-arm-clib win64-cl win64-lib win64-clib; do zip -r ../$f.zip $f; done
34+
for f in linux-cl linux-lib linux-clib unreal_5_5 unreal_5_4 macos-cl macos-lib macos-clib macos-arm-cl macos-arm-lib macos-arm-clib win64-cl win64-lib win64-clib; do zip -r ../$f.zip $f; done
3535
- name: List
3636
run: tree
3737
- name: Publish to PyPI
@@ -45,5 +45,5 @@ jobs:
4545
--repo="$GITHUB_REPOSITORY" \
4646
--title="${GITHUB_REPOSITORY#*/} ${tag#v}" \
4747
--generate-notes \
48-
"$tag" "linux-cl.zip" "linux-lib.zip" "linux-clib.zip" "unreal.zip" "macos-cl.zip" "macos-lib.zip" "macos-clib.zip" "win64-cl.zip" "macos-arm-cl.zip" "macos-arm-lib.zip" "macos-arm-clib.zip" "win64-lib.zip" "win64-clib.zip"
48+
"$tag" "linux-cl.zip" "linux-lib.zip" "linux-clib.zip" "unreal_5_5.zip" "unreal_5_4.zip" "macos-cl.zip" "macos-lib.zip" "macos-clib.zip" "win64-cl.zip" "macos-arm-cl.zip" "macos-arm-lib.zip" "macos-arm-clib.zip" "win64-lib.zip" "win64-clib.zip"
4949

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
path = proofing/ink-proof
33
url = https://github.com/chromy/ink-proof.git
44
shallow = true
5-
[submodule "inkcpp_py/pybind11"]
6-
path = inkcpp_py/pybind11
5+
[submodule "inkcpp_python/pybind11"]
6+
path = inkcpp_python/pybind11
77
url = https://github.com/pybind/pybind11.git
88
branch = stable
99
shallow = true

CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set(CMAKE_TLS_VERIFY true)
2525
enable_testing()
2626

2727
# Project setup
28-
project(inkcpp VERSION 0.1.6)
28+
project(inkcpp VERSION 0.1.7)
2929
SET(CMAKE_CXX_STANDARD 20)
3030
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
3131
SET(CMAKE_INSTALL_LIBRARY_DIR lib)
@@ -57,7 +57,7 @@ endif()
5757

5858
if (INKCPP_PY)
5959
add_compile_options(-fPIC)
60-
add_subdirectory(inkcpp_py)
60+
add_subdirectory(inkcpp_python)
6161
endif(INKCPP_PY)
6262
add_subdirectory(shared)
6363
add_subdirectory(inkcpp)
@@ -154,10 +154,11 @@ if (DOXYGEN_FOUND)
154154
COMPONENTS Interpreter
155155
)
156156
add_custom_target(inkcpp_py_doc
157-
python -m pydoc -w inkcpp_py
158-
COMMAND mv "./inkcpp_py.html" ${PY_HTML}
157+
python -m pybind11_stubgen -o . inkcpp_py
158+
COMMAND python -m pdoc -d google -o . inkcpp_py.pyi
159+
COMMAND ${CMAKE_COMMAND} -E copy "./inkcpp_py.html" ${PY_HTML}
159160
DEPENDS inkcpp_py
160-
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/inkcpp_py"
161+
WORKING_DIRECTORY $<TARGET_FILE_DIR:inkcpp_py>
161162
COMMENT "Generates simple python documentation")
162163
add_dependencies(doc inkcpp_py_doc)
163164
else()

README.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ Ink Proofing Test Results: https://jbenda.github.io/inkcpp/proof
77

88
Doxygen Documentation: https://jbenda.github.io/inkcpp/html
99

10+
CLib Documentation: https://jbenda.github.io/inkcpp/html/group__clib.html
11+
12+
UE Documentation: https://jbenda.github.io/inkcpp/html/group__unreal.html
13+
14+
Python Documentation: https://jbenda.github.io/inkcpp/html/inkcpp_py.html
15+
1016
## Project Goals
1117
* Fast, simple, clean syntax
1218
* No heap allocations during execution (unless in emergencies)
@@ -17,6 +23,12 @@ Doxygen Documentation: https://jbenda.github.io/inkcpp/html
1723

1824
## Current Status
1925

26+
supported languages ([latest release](https://github.com/JBenda/inkcpp/releases/latest)):
27+
+ C++ [doc](https://jbenda.github.io/inkcpp/html/index.html)[example](https://jbenda.github.io/inkcpp/html/index.html)
28+
+ C [doc](https://jbenda.github.io/inkcpp/html/group__clib.html)[example](https://jbenda.github.io/inkcpp/html/group__clib.html#example_c)
29+
+ UE Blueprints [doc](https://jbenda.github.io/inkcpp/html/group__unreal.html)[distribution](https://www.unrealengine.com/marketplace/product/inkcpp)[example](https://jbenda.github.io/inkcpp/html/group__unreal.html#ue_example)
30+
+ Python [doc](https://jbenda.github.io/inkcpp/html/inkcpp_py.html)[distribution](https://pypi.org/project/inkcpp-py/)[example](https://jbenda.github.io/inkcpp/html/index.html#py)
31+
2032
Run `inkcpp_cl.exe -p myfile.json` to execute a compiled Ink JSON file in play mode. It can also operate on `.ink` files but `inklecate.exe` must be in the same folder or in the PATH.
2133
`inklecate` can be downloaded from the [official release page](https://github.com/inkle/ink/releases) and will be downloaded from CMake at configure time (located at `build/unreal/inkcpp/Resources/inklecate`).
2234
Or do it automatically with the `INKCPP_INKLECATE=OS` CMake flag. (It will be downloaded to `<build-dir>/inklecate/<os>/` and will be installed with `cmake --install . --component cl`)
@@ -39,9 +51,18 @@ Place the content of this file at your plugin folder of your UE project and at t
3951

4052
A example project can be found [here](https://jbenda.github.io/inkcpp/unreal/InkCPP_DEMO.zip). And here the [Documentation](https://jbenda.github.io/inkcpp/html/group__unreal.html).
4153

42-
Code for the Unreal plugin is located in the `unreal` directory. In order to install it, run `cmake --install . --component unreal --prefix Path/To/Unreal/Plugins/` which will add an `inkcpp` folder there with the `.uplugin`, the code for the UClasses, and all the inkcpp source files required. `config.h` will automatically detect it is being built in an Unreal plugin environment and disable STL and enable Unreal extensions (FString support, Unreal asserts, CityHash, etc.).
43-
44-
If you compile the UE Plugin by your self feel free to visit the [wiki page](https://github.com/JBenda/inkcpp/wiki/Unreal) for a more debug oriented build process.
54+
Code for the Unreal plugin is located in the `unreal` directory. In order to install it, run
55+
```sh
56+
mkdir build
57+
cd build
58+
mkdir plugin
59+
mkdir plugin-build
60+
cmake -DINKCPP_UNREAL_TARGET_VERSION="5.5" .
61+
cmake --install . --component unreal --prefix .\plugin # create source files for plugin
62+
\PATH\TO\UNREAL_ENGINE\Build\BatchFiles\RunUAT.bat BuildPlugin -plugin=GIT_REPO\build\plugin\inkcpp\inkcpp.uplugin -package=GIT_REPO\build\plugin-build\inkcpp -TargetPlatforms=Win64 # compile plugin
63+
move plugin-build\inkcpp UE_ENGINE\Engine\Plugins\inkcpp
64+
```
65+
Adapt `TargetPlatforms` as nessesarry. You might also want to install the Plugin directly into a project or the in UE5.5 introduced external plugin directory. Just adapt the pathets accordendly.
4566

4667
## Use standalone
4768

@@ -165,7 +186,7 @@ python -m pip install dist/*.whl --user
165186
# if inklecate is not in the same directory / inside Path set INKLECATE enviroment variable
166187
export INKLECATE=<PATH-TO-inklecate> # unix
167188
set INKLECTATE=<PATH-TO-inklecate> # windows
168-
python -m pytest
189+
python -m pytest inkcpp_python/tests
169190
```
170191

171192
Right now this only executes the internal unit tests which test the functions of particular classes. Soon it'll run more complex tests on .ink files using ink-proof.
@@ -174,15 +195,15 @@ Right now this only executes the internal unit tests which test the functions of
174195
## Python Bindings
175196

176197
The easy way to start is installing it with pip: `pip install inkcpp_py`.
177-
An example can be found at [example.py](./inkcpp_py/example.py).
198+
An example can be found at [example.py](./inkcpp_python/example.py).
178199
To build it from source use:
179200

180201
```sh
181202
git clone --recurse-submodules https://github.com/JBenda/inkcpp.git
182203
pip install .
183204
```
184205

185-
The python bindnigs are defined in `inkcpp_py` subfolder.
206+
The python bindnigs are defined in `inkcpp_python` subfolder.
186207

187208
## Dependencies
188209
The compiler depends on Nlohmann's JSON library and the C++ STL.

inkcpp/include/story.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class story
157157
* + INKCPP_TEST: (ON|OFF) weather or not execute tests
158158
* requires `inklecate` to be in the PATH or `INKCPP_INKLECATE=OS` or `=ALL`
159159
* + INKCPP_INKLECATE: (NONE|OS|ALL) download the current supported inklecate version from the
160-
* official [release page](https://github.com/inkle/ink/releases/latest)</br> They are stored at
160+
* official [release page](https://github.com/inkle/ink/releases/latest)<br/> They are stored at
161161
* `<build-dir>/inklecate/<os>/` and will be automatcilly used for the tests
162162
* + NONE: disable this function
163163
* + OS: only the version supported for the OS
@@ -212,8 +212,9 @@ class story
212212
* `pip install .`
213213
*
214214
* Here can you find an
215-
* [example](https://raw.githubusercontent.com/JBenda/inkcpp/master/inkcpp_py/example.py) inclusive
216-
* [story](https://raw.githubusercontent.com/JBenda/inkcpp/master/inkcpp_py/unreal_example.ink).
215+
* [example](https://raw.githubusercontent.com/JBenda/inkcpp/master/inkcpp_python/example.py)
216+
* inclusive
217+
* [story](https://raw.githubusercontent.com/JBenda/inkcpp/master/inkcpp_python/unreal_example.ink).
217218
*
218219
* [Python module documentation](./inkcpp_py.html)
219220
*/

inkcpp_py/pybind11

Lines changed: 0 additions & 1 deletion
This file was deleted.

inkcpp_python/pybind11

Submodule pybind11 added at 0c69e1e

0 commit comments

Comments
 (0)