Skip to content

Commit

Permalink
feat(python): add vtfpp wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
craftablescience committed Nov 5, 2024
1 parent edda798 commit af55ca3
Show file tree
Hide file tree
Showing 7 changed files with 469 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ cmake-build-*/
out/

# Generated
__pycache__/
docs/html/
test/res/
test/Helpers.h
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ add_sourcepp_library(steampp C PYTHON ) # sourcepp::steampp
add_sourcepp_library(toolpp ) # sourcepp::toolpp
add_sourcepp_library(vcryptpp C CSHARP PYTHON ) # sourcepp::vcryptpp
add_sourcepp_library(vpkpp C CSHARP NO_TEST ) # sourcepp::vpkpp
add_sourcepp_library(vtfpp BENCH) # sourcepp::vtfpp
add_sourcepp_library(vtfpp PYTHON BENCH) # sourcepp::vtfpp


# Tests, part 2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Several modern C++20 libraries for sanely parsing Valve formats, rolled into one
<td><a href="https://en.wikipedia.org/wiki/BMP_file_format">BMP</a></td>
<td align="center">✅</td>
<td align="center">✅</td>
<td rowspan="23" align="center"></td>
<td rowspan="23" align="center">Python</td>
</tr>
<tr><!-- empty row to disable github striped bg color --></tr>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Several modern C++20 libraries for sanely parsing Valve formats, rolled into one
<td><a href="https://en.wikipedia.org/wiki/BMP_file_format">BMP</a></td>
<td align="center">✅</td>
<td align="center">✅</td>
<td rowspan="12" align="center"></td>
<td rowspan="12" align="center">Python</td>
</tr>
<tr>
<td><a href="https://openexr.com">EXR</a> v1</td>
Expand Down
7 changes: 2 additions & 5 deletions lang/python/dist/sourcepp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
from __future__ import annotations

from ._sourcepp_python import __author__, __doc__, __version__, gamepp, sourcepp, steampp, vcryptpp

__all__ = ['__author__', '__doc__', '__version__', 'gamepp', 'sourcepp', 'steampp', 'vcryptpp']
from ._sourcepp_python import __author__, __doc__, __version__, gamepp, sourcepp, steampp, vcryptpp, vtfpp
__all__ = ['__author__', '__doc__', '__version__', 'gamepp', 'sourcepp', 'steampp', 'vcryptpp', 'vtfpp']
10 changes: 10 additions & 0 deletions lang/python/src/sourcepp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include "vcryptpp.h"
#endif

#ifdef VTFPP
#include "vtfpp.h"
#endif

PYBIND11_MODULE(_sourcepp_python, m) {
m.doc() = "SourcePP: A Python wrapper around several modern C++20 libraries for sanely parsing Valve's formats.";

Expand All @@ -37,4 +41,10 @@ PYBIND11_MODULE(_sourcepp_python, m) {
#else
m.def_submodule("vcryptpp");
#endif

#ifdef VTFPP
vtfpp::register_python(m);
#else
m.def_submodule("vtfpp");
#endif
}
453 changes: 453 additions & 0 deletions lang/python/src/vtfpp.h

Large diffs are not rendered by default.

0 comments on commit af55ca3

Please sign in to comment.