glviskit 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- glviskit-0.0.1/.clang-format +5 -0
- glviskit-0.0.1/.clang-tidy +32 -0
- glviskit-0.0.1/.github/workflows/build_wheels_linux.yml +36 -0
- glviskit-0.0.1/.github/workflows/build_wheels_macos.yml +38 -0
- glviskit-0.0.1/.github/workflows/build_wheels_win.yml +36 -0
- glviskit-0.0.1/.gitignore +268 -0
- glviskit-0.0.1/CMakeLists.txt +46 -0
- glviskit-0.0.1/PKG-INFO +5 -0
- glviskit-0.0.1/cmake/Demo.cmake +22 -0
- glviskit-0.0.1/cmake/GL.cmake +37 -0
- glviskit-0.0.1/cmake/Python.cmake +42 -0
- glviskit-0.0.1/cmake/SDL3.cmake +10 -0
- glviskit-0.0.1/cmake/Static.cmake +21 -0
- glviskit-0.0.1/cmake/Web.cmake +32 -0
- glviskit-0.0.1/examples/example.py +91 -0
- glviskit-0.0.1/include/KHR/khrplatform.h +311 -0
- glviskit-0.0.1/include/camera.hpp +127 -0
- glviskit-0.0.1/include/gl/buffer_object.hpp +59 -0
- glviskit-0.0.1/include/gl/buffer_stack.hpp +104 -0
- glviskit-0.0.1/include/gl/gl.hpp +28 -0
- glviskit-0.0.1/include/gl/instance.hpp +16 -0
- glviskit-0.0.1/include/gl/program.hpp +141 -0
- glviskit-0.0.1/include/gl/vao.hpp +41 -0
- glviskit-0.0.1/include/glad/gl.h +2135 -0
- glviskit-0.0.1/include/glad/gles2.h +1629 -0
- glviskit-0.0.1/include/glviskit.hpp +33 -0
- glviskit-0.0.1/include/primitive/anchor.hpp +171 -0
- glviskit-0.0.1/include/primitive/line.hpp +181 -0
- glviskit-0.0.1/include/primitive/point.hpp +196 -0
- glviskit-0.0.1/include/render_buffer.hpp +239 -0
- glviskit-0.0.1/include/renderer.hpp +100 -0
- glviskit-0.0.1/include/sdl/manager.hpp +158 -0
- glviskit-0.0.1/include/sdl/sdl.hpp +25 -0
- glviskit-0.0.1/include/sdl/sdl_ptr.hpp +41 -0
- glviskit-0.0.1/include/sdl/window.hpp +104 -0
- glviskit-0.0.1/pyproject.toml +34 -0
- glviskit-0.0.1/src/bindings.cpp +201 -0
- glviskit-0.0.1/src/gl.c +956 -0
- glviskit-0.0.1/src/gles2.c +697 -0
- glviskit-0.0.1/src/glviskit.pyi +182 -0
- glviskit-0.0.1/src/main.cpp +124 -0
- glviskit-0.0.1/src/main_wasm.cpp +141 -0
- glviskit-0.0.1/web/shell_minimal.html +74 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Enable checks all except the ones explicitly disabled
|
|
3
|
+
|
|
4
|
+
Checks: >
|
|
5
|
+
-*,
|
|
6
|
+
bugprone-*,
|
|
7
|
+
cert-*,
|
|
8
|
+
clang-analyzer-*,
|
|
9
|
+
hicpp-*,
|
|
10
|
+
modernize-*,
|
|
11
|
+
performance-*,
|
|
12
|
+
portability-*,
|
|
13
|
+
readability-*,
|
|
14
|
+
misc-*,
|
|
15
|
+
-readability-magic-numbers,
|
|
16
|
+
-readability-identifier-length,
|
|
17
|
+
-bugprone-easily-swappable-parameters,
|
|
18
|
+
-hicpp-signed-bitwise,
|
|
19
|
+
|
|
20
|
+
# Treat all warnings as errors
|
|
21
|
+
WarningsAsErrors: '*'
|
|
22
|
+
|
|
23
|
+
# Check options
|
|
24
|
+
CheckOptions:
|
|
25
|
+
- key: readability-identifier-naming.ClassCase
|
|
26
|
+
value: CamelCase
|
|
27
|
+
- key: readability-identifier-naming.MethodCase
|
|
28
|
+
value: CamelCase
|
|
29
|
+
- key: readability-identifier-naming.VariableCase
|
|
30
|
+
value: lower_case
|
|
31
|
+
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
|
|
32
|
+
value: 1
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Build Wheels Linux
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
build-wheels:
|
|
8
|
+
name: Build wheels on ${{ matrix.os }}
|
|
9
|
+
runs-on: ${{ matrix.os }}
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
os: [ubuntu-latest]
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
|
+
|
|
17
|
+
- uses: actions/setup-python@v6
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.13"
|
|
20
|
+
|
|
21
|
+
- name: Set up QEMU
|
|
22
|
+
if: runner.os == 'Linux'
|
|
23
|
+
uses: docker/setup-qemu-action@v3
|
|
24
|
+
with:
|
|
25
|
+
platforms: all
|
|
26
|
+
|
|
27
|
+
- name: Install cibuildwheel
|
|
28
|
+
run: python -m pip install "cibuildwheel>=3.0.0"
|
|
29
|
+
|
|
30
|
+
- name: Build wheels
|
|
31
|
+
run: python -m cibuildwheel --output-dir wheelhouse
|
|
32
|
+
|
|
33
|
+
- uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
36
|
+
path: ./wheelhouse/*.whl
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Build Wheels MacOS
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
build-wheels:
|
|
8
|
+
name: Build wheels on ${{ matrix.os }}
|
|
9
|
+
runs-on: ${{ matrix.os }}
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
os: [macos-latest]
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
|
+
|
|
17
|
+
- uses: actions/setup-python@v6
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.13"
|
|
20
|
+
|
|
21
|
+
- name: Set up QEMU
|
|
22
|
+
if: runner.os == 'Linux'
|
|
23
|
+
uses: docker/setup-qemu-action@v3
|
|
24
|
+
with:
|
|
25
|
+
platforms: all
|
|
26
|
+
|
|
27
|
+
- name: Install cibuildwheel
|
|
28
|
+
run: python -m pip install "cibuildwheel>=3.0.0"
|
|
29
|
+
|
|
30
|
+
- name: Build wheels
|
|
31
|
+
run: python -m cibuildwheel --output-dir wheelhouse
|
|
32
|
+
env:
|
|
33
|
+
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
|
34
|
+
|
|
35
|
+
- uses: actions/upload-artifact@v4
|
|
36
|
+
with:
|
|
37
|
+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
38
|
+
path: ./wheelhouse/*.whl
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Build Wheels Windows
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
build-wheels:
|
|
8
|
+
name: Build wheels on ${{ matrix.os }}
|
|
9
|
+
runs-on: ${{ matrix.os }}
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
os: [windows-latest]
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
|
+
|
|
17
|
+
- uses: actions/setup-python@v6
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.13"
|
|
20
|
+
|
|
21
|
+
- name: Set up QEMU
|
|
22
|
+
if: runner.os == 'Linux'
|
|
23
|
+
uses: docker/setup-qemu-action@v3
|
|
24
|
+
with:
|
|
25
|
+
platforms: all
|
|
26
|
+
|
|
27
|
+
- name: Install cibuildwheel
|
|
28
|
+
run: python -m pip install "cibuildwheel>=3.0.0"
|
|
29
|
+
|
|
30
|
+
- name: Build wheels
|
|
31
|
+
run: python -m cibuildwheel --output-dir wheelhouse
|
|
32
|
+
|
|
33
|
+
- uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
|
36
|
+
path: ./wheelhouse/*.whl
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Prerequisites
|
|
2
|
+
*.d
|
|
3
|
+
|
|
4
|
+
# Compiled Object files
|
|
5
|
+
*.slo
|
|
6
|
+
*.lo
|
|
7
|
+
*.o
|
|
8
|
+
*.obj
|
|
9
|
+
|
|
10
|
+
# Precompiled Headers
|
|
11
|
+
*.gch
|
|
12
|
+
*.pch
|
|
13
|
+
|
|
14
|
+
# Linker files
|
|
15
|
+
*.ilk
|
|
16
|
+
|
|
17
|
+
# Debugger Files
|
|
18
|
+
*.pdb
|
|
19
|
+
|
|
20
|
+
# Compiled Dynamic libraries
|
|
21
|
+
*.so
|
|
22
|
+
*.dylib
|
|
23
|
+
*.dll
|
|
24
|
+
|
|
25
|
+
# Fortran module files
|
|
26
|
+
*.mod
|
|
27
|
+
*.smod
|
|
28
|
+
|
|
29
|
+
# Compiled Static libraries
|
|
30
|
+
*.lai
|
|
31
|
+
*.la
|
|
32
|
+
*.a
|
|
33
|
+
*.lib
|
|
34
|
+
|
|
35
|
+
# Executables
|
|
36
|
+
*.exe
|
|
37
|
+
*.out
|
|
38
|
+
*.app
|
|
39
|
+
|
|
40
|
+
# debug information files
|
|
41
|
+
*.dwo
|
|
42
|
+
|
|
43
|
+
# folder to put stuff
|
|
44
|
+
other/
|
|
45
|
+
|
|
46
|
+
# build folder
|
|
47
|
+
build/
|
|
48
|
+
|
|
49
|
+
# cache files
|
|
50
|
+
.cache/
|
|
51
|
+
|
|
52
|
+
# Byte-compiled / optimized / DLL files
|
|
53
|
+
__pycache__/
|
|
54
|
+
*.py[codz]
|
|
55
|
+
*$py.class
|
|
56
|
+
|
|
57
|
+
# C extensions
|
|
58
|
+
*.so
|
|
59
|
+
|
|
60
|
+
# Distribution / packaging
|
|
61
|
+
.Python
|
|
62
|
+
build/
|
|
63
|
+
develop-eggs/
|
|
64
|
+
dist/
|
|
65
|
+
downloads/
|
|
66
|
+
eggs/
|
|
67
|
+
.eggs/
|
|
68
|
+
lib/
|
|
69
|
+
lib64/
|
|
70
|
+
parts/
|
|
71
|
+
sdist/
|
|
72
|
+
var/
|
|
73
|
+
wheels/
|
|
74
|
+
share/python-wheels/
|
|
75
|
+
*.egg-info/
|
|
76
|
+
.installed.cfg
|
|
77
|
+
*.egg
|
|
78
|
+
MANIFEST
|
|
79
|
+
|
|
80
|
+
# PyInstaller
|
|
81
|
+
# Usually these files are written by a python script from a template
|
|
82
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
83
|
+
*.manifest
|
|
84
|
+
*.spec
|
|
85
|
+
|
|
86
|
+
# Installer logs
|
|
87
|
+
pip-log.txt
|
|
88
|
+
pip-delete-this-directory.txt
|
|
89
|
+
|
|
90
|
+
# Unit test / coverage reports
|
|
91
|
+
htmlcov/
|
|
92
|
+
.tox/
|
|
93
|
+
.nox/
|
|
94
|
+
.coverage
|
|
95
|
+
.coverage.*
|
|
96
|
+
.cache
|
|
97
|
+
nosetests.xml
|
|
98
|
+
coverage.xml
|
|
99
|
+
*.cover
|
|
100
|
+
*.py.cover
|
|
101
|
+
.hypothesis/
|
|
102
|
+
.pytest_cache/
|
|
103
|
+
cover/
|
|
104
|
+
|
|
105
|
+
# Translations
|
|
106
|
+
*.mo
|
|
107
|
+
*.pot
|
|
108
|
+
|
|
109
|
+
# Django stuff:
|
|
110
|
+
*.log
|
|
111
|
+
local_settings.py
|
|
112
|
+
db.sqlite3
|
|
113
|
+
db.sqlite3-journal
|
|
114
|
+
|
|
115
|
+
# Flask stuff:
|
|
116
|
+
instance/
|
|
117
|
+
.webassets-cache
|
|
118
|
+
|
|
119
|
+
# Scrapy stuff:
|
|
120
|
+
.scrapy
|
|
121
|
+
|
|
122
|
+
# Sphinx documentation
|
|
123
|
+
docs/_build/
|
|
124
|
+
|
|
125
|
+
# PyBuilder
|
|
126
|
+
.pybuilder/
|
|
127
|
+
target/
|
|
128
|
+
|
|
129
|
+
# Jupyter Notebook
|
|
130
|
+
.ipynb_checkpoints
|
|
131
|
+
|
|
132
|
+
# IPython
|
|
133
|
+
profile_default/
|
|
134
|
+
ipython_config.py
|
|
135
|
+
|
|
136
|
+
# pyenv
|
|
137
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
138
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
139
|
+
# .python-version
|
|
140
|
+
|
|
141
|
+
# pipenv
|
|
142
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
143
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
144
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
145
|
+
# install all needed dependencies.
|
|
146
|
+
# Pipfile.lock
|
|
147
|
+
|
|
148
|
+
# UV
|
|
149
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
150
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
151
|
+
# commonly ignored for libraries.
|
|
152
|
+
# uv.lock
|
|
153
|
+
|
|
154
|
+
# poetry
|
|
155
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
156
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
157
|
+
# commonly ignored for libraries.
|
|
158
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
159
|
+
# poetry.lock
|
|
160
|
+
# poetry.toml
|
|
161
|
+
|
|
162
|
+
# pdm
|
|
163
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
164
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
165
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
166
|
+
# pdm.lock
|
|
167
|
+
# pdm.toml
|
|
168
|
+
.pdm-python
|
|
169
|
+
.pdm-build/
|
|
170
|
+
|
|
171
|
+
# pixi
|
|
172
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
173
|
+
# pixi.lock
|
|
174
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
175
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
176
|
+
.pixi
|
|
177
|
+
|
|
178
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
179
|
+
__pypackages__/
|
|
180
|
+
|
|
181
|
+
# Celery stuff
|
|
182
|
+
celerybeat-schedule
|
|
183
|
+
celerybeat.pid
|
|
184
|
+
|
|
185
|
+
# Redis
|
|
186
|
+
*.rdb
|
|
187
|
+
*.aof
|
|
188
|
+
*.pid
|
|
189
|
+
|
|
190
|
+
# RabbitMQ
|
|
191
|
+
mnesia/
|
|
192
|
+
rabbitmq/
|
|
193
|
+
rabbitmq-data/
|
|
194
|
+
|
|
195
|
+
# ActiveMQ
|
|
196
|
+
activemq-data/
|
|
197
|
+
|
|
198
|
+
# SageMath parsed files
|
|
199
|
+
*.sage.py
|
|
200
|
+
|
|
201
|
+
# Environments
|
|
202
|
+
.env
|
|
203
|
+
.envrc
|
|
204
|
+
.venv
|
|
205
|
+
env/
|
|
206
|
+
venv/
|
|
207
|
+
ENV/
|
|
208
|
+
env.bak/
|
|
209
|
+
venv.bak/
|
|
210
|
+
|
|
211
|
+
# Spyder project settings
|
|
212
|
+
.spyderproject
|
|
213
|
+
.spyproject
|
|
214
|
+
|
|
215
|
+
# Rope project settings
|
|
216
|
+
.ropeproject
|
|
217
|
+
|
|
218
|
+
# mkdocs documentation
|
|
219
|
+
/site
|
|
220
|
+
|
|
221
|
+
# mypy
|
|
222
|
+
.mypy_cache/
|
|
223
|
+
.dmypy.json
|
|
224
|
+
dmypy.json
|
|
225
|
+
|
|
226
|
+
# Pyre type checker
|
|
227
|
+
.pyre/
|
|
228
|
+
|
|
229
|
+
# pytype static type analyzer
|
|
230
|
+
.pytype/
|
|
231
|
+
|
|
232
|
+
# Cython debug symbols
|
|
233
|
+
cython_debug/
|
|
234
|
+
|
|
235
|
+
# PyCharm
|
|
236
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
237
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
238
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
239
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
240
|
+
# .idea/
|
|
241
|
+
|
|
242
|
+
# Abstra
|
|
243
|
+
# Abstra is an AI-powered process automation framework.
|
|
244
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
245
|
+
# Learn more at https://abstra.io/docs
|
|
246
|
+
.abstra/
|
|
247
|
+
|
|
248
|
+
# Visual Studio Code
|
|
249
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
250
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
251
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
252
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
253
|
+
# .vscode/
|
|
254
|
+
|
|
255
|
+
# Ruff stuff:
|
|
256
|
+
.ruff_cache/
|
|
257
|
+
|
|
258
|
+
# PyPI configuration file
|
|
259
|
+
.pypirc
|
|
260
|
+
|
|
261
|
+
# Marimo
|
|
262
|
+
marimo/_static/
|
|
263
|
+
marimo/_lsp/
|
|
264
|
+
__marimo__/
|
|
265
|
+
|
|
266
|
+
# Streamlit
|
|
267
|
+
.streamlit/secrets.toml
|
|
268
|
+
build_wasm/
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.15)
|
|
2
|
+
|
|
3
|
+
# set cmake options
|
|
4
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
5
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
6
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
+
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
8
|
+
|
|
9
|
+
# define the project
|
|
10
|
+
project(glviskit
|
|
11
|
+
VERSION 1.0
|
|
12
|
+
LANGUAGES CXX C
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
# possible versions
|
|
16
|
+
set(GLVISKIT_GL_TYPE "AUTO" CACHE STRING "Type of OpenGL backend to use (AUTO, GLAD_GL, GLAD_GLES2, NATIVE_GL, NATIVE_GLES2, NONE)")
|
|
17
|
+
|
|
18
|
+
# enable clang-tidy if available
|
|
19
|
+
find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
|
|
20
|
+
# if(CLANG_TIDY_EXE)
|
|
21
|
+
# set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}")
|
|
22
|
+
# endif()
|
|
23
|
+
|
|
24
|
+
# fetch glm, it will be used for all targets
|
|
25
|
+
include(FetchContent)
|
|
26
|
+
FetchContent_Declare(glm
|
|
27
|
+
GIT_REPOSITORY https://github.com/g-truc/glm.git
|
|
28
|
+
GIT_TAG 1.0.2
|
|
29
|
+
)
|
|
30
|
+
FetchContent_MakeAvailable(glm)
|
|
31
|
+
set_target_properties(glm PROPERTIES CXX_CLANG_TIDY "")
|
|
32
|
+
|
|
33
|
+
# check for emscripten, python or normal build
|
|
34
|
+
if(EMSCRIPTEN)
|
|
35
|
+
message(STATUS "Emscripten build detected")
|
|
36
|
+
|
|
37
|
+
include(${CMAKE_CURRENT_LIST_DIR}/cmake/Web.cmake)
|
|
38
|
+
elseif(SKBUILD)
|
|
39
|
+
message(STATUS "SKBuild detected")
|
|
40
|
+
|
|
41
|
+
include(${CMAKE_CURRENT_LIST_DIR}/cmake/Python.cmake)
|
|
42
|
+
else()
|
|
43
|
+
message(STATUS "Normal build detected")
|
|
44
|
+
|
|
45
|
+
include(${CMAKE_CURRENT_LIST_DIR}/cmake/Demo.cmake)
|
|
46
|
+
endif()
|
glviskit-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# fetch SDL3
|
|
2
|
+
include(${CMAKE_CURRENT_LIST_DIR}/SDL3.cmake)
|
|
3
|
+
|
|
4
|
+
# handle GL source files
|
|
5
|
+
include(${CMAKE_CURRENT_LIST_DIR}/GL.cmake)
|
|
6
|
+
|
|
7
|
+
# create the demo executable
|
|
8
|
+
add_executable(glviskit_demo
|
|
9
|
+
"src/main.cpp"
|
|
10
|
+
"${GLVISKIT_GL_SOURCES}"
|
|
11
|
+
)
|
|
12
|
+
# include and link
|
|
13
|
+
target_include_directories(glviskit_demo PRIVATE
|
|
14
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
15
|
+
)
|
|
16
|
+
target_link_libraries(glviskit_demo PRIVATE
|
|
17
|
+
SDL3::SDL3-static
|
|
18
|
+
glm::glm
|
|
19
|
+
)
|
|
20
|
+
# set static flags
|
|
21
|
+
# include(${CMAKE_CURRENT_LIST_DIR}/Static.cmake)
|
|
22
|
+
# apply_static_flags(glviskit_demo)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# determine which OpenGL backend to use
|
|
2
|
+
if(NOT DEFINED GLVISKIT_GL_TYPE)
|
|
3
|
+
set(GLVISKIT_GL_TYPE "AUTO")
|
|
4
|
+
endif()
|
|
5
|
+
|
|
6
|
+
message(STATUS "GLVISKIT_GL_TYPE is set to ${GLVISKIT_GL_TYPE}")
|
|
7
|
+
|
|
8
|
+
# auto mode
|
|
9
|
+
if(GLVISKIT_GL_TYPE STREQUAL "AUTO")
|
|
10
|
+
if(EMSCRIPTEN)
|
|
11
|
+
set(GLVISKIT_GL_TYPE "NATIVE_GLES2")
|
|
12
|
+
else()
|
|
13
|
+
set(GLVISKIT_GL_TYPE "GLAD_GL")
|
|
14
|
+
endif()
|
|
15
|
+
endif()
|
|
16
|
+
|
|
17
|
+
message(STATUS "Using GLVISKIT_GL_TYPE: ${GLVISKIT_GL_TYPE}")
|
|
18
|
+
|
|
19
|
+
# set flags accordingly
|
|
20
|
+
if(GLVISKIT_GL_TYPE STREQUAL "GLAD_GL")
|
|
21
|
+
add_compile_definitions(GLVISKIT_USE_GLAD_GL=1)
|
|
22
|
+
elseif(GLVISKIT_GL_TYPE STREQUAL "GLAD_GLES2")
|
|
23
|
+
add_compile_definitions(GLVISKIT_USE_GLAD_GLES2=1)
|
|
24
|
+
elseif(GLVISKIT_GL_TYPE STREQUAL "NATIVE_GL")
|
|
25
|
+
add_compile_definitions(GLVISKIT_USE_GL_NATIVE=1)
|
|
26
|
+
elseif(GLVISKIT_GL_TYPE STREQUAL "NATIVE_GLES2")
|
|
27
|
+
add_compile_definitions(GLVISKIT_USE_GLES_NATIVE=1)
|
|
28
|
+
else()
|
|
29
|
+
message(FATAL_ERROR "Unknown GLVISKIT_GL_TYPE: ${GLVISKIT_GL_TYPE}")
|
|
30
|
+
endif()
|
|
31
|
+
|
|
32
|
+
# set source file variable
|
|
33
|
+
if(GLVISKIT_GL_TYPE STREQUAL "GLAD_GL")
|
|
34
|
+
list(APPEND GLVISKIT_GL_SOURCES "src/gl.c")
|
|
35
|
+
elseif(GLVISKIT_GL_TYPE STREQUAL "GLAD_GLES2")
|
|
36
|
+
list(APPEND GLVISKIT_GL_SOURCES "src/gles2.c")
|
|
37
|
+
endif()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# fetch SDL3
|
|
2
|
+
include(${CMAKE_CURRENT_LIST_DIR}/SDL3.cmake)
|
|
3
|
+
|
|
4
|
+
# handle GL source files
|
|
5
|
+
include(${CMAKE_CURRENT_LIST_DIR}/GL.cmake)
|
|
6
|
+
|
|
7
|
+
# setup nanobind python module
|
|
8
|
+
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
|
|
9
|
+
find_package(nanobind CONFIG REQUIRED)
|
|
10
|
+
|
|
11
|
+
# create the python module
|
|
12
|
+
nanobind_add_module(glviskit
|
|
13
|
+
NB_STATIC LTO
|
|
14
|
+
NB_DOMAIN "glviskit"
|
|
15
|
+
STABLE_ABI
|
|
16
|
+
"src/bindings.cpp"
|
|
17
|
+
"src/gl.c"
|
|
18
|
+
)
|
|
19
|
+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/py.typed" "")
|
|
20
|
+
|
|
21
|
+
# include and link
|
|
22
|
+
target_include_directories(glviskit PRIVATE
|
|
23
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
24
|
+
)
|
|
25
|
+
target_link_libraries(glviskit PRIVATE
|
|
26
|
+
SDL3::SDL3-static
|
|
27
|
+
glm::glm
|
|
28
|
+
)
|
|
29
|
+
set_target_properties(glviskit PROPERTIES OUTPUT_NAME "glviskit")
|
|
30
|
+
|
|
31
|
+
# set static flags, we dont want any dynamic dependencies
|
|
32
|
+
# include(${CMAKE_CURRENT_LIST_DIR}/Static.cmake)
|
|
33
|
+
# apply_static_flags(glviskit)
|
|
34
|
+
|
|
35
|
+
# needed for python module
|
|
36
|
+
install(TARGETS glviskit LIBRARY DESTINATION .)
|
|
37
|
+
# install the stub file too
|
|
38
|
+
install(FILES
|
|
39
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/src/glviskit.pyi"
|
|
40
|
+
"${CMAKE_CURRENT_BINARY_DIR}/py.typed"
|
|
41
|
+
DESTINATION .
|
|
42
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# fetch SDL3
|
|
2
|
+
include(FetchContent)
|
|
3
|
+
FetchContent_Declare(SDL3
|
|
4
|
+
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
|
|
5
|
+
GIT_TAG release-3.2.28
|
|
6
|
+
)
|
|
7
|
+
set(SDL_SHARED OFF CACHE BOOL "" FORCE)
|
|
8
|
+
set(SDL_STATIC ON CACHE BOOL "" FORCE)
|
|
9
|
+
set(SDL_TEST OFF CACHE BOOL "" FORCE)
|
|
10
|
+
FetchContent_MakeAvailable(SDL3)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# macro to apply static linking flags and hidden visibility
|
|
2
|
+
macro(apply_static_flags TARGET_NAME)
|
|
3
|
+
if(WIN32 AND MINGW)
|
|
4
|
+
target_link_libraries(${TARGET_NAME} PRIVATE
|
|
5
|
+
"-static-libgcc"
|
|
6
|
+
"-static-libstdc++"
|
|
7
|
+
"-Wl,-Bstatic"
|
|
8
|
+
"-lwinpthread"
|
|
9
|
+
"-Wl,-Bdynamic"
|
|
10
|
+
)
|
|
11
|
+
endif()
|
|
12
|
+
|
|
13
|
+
if(UNIX AND NOT APPLE)
|
|
14
|
+
target_link_options(${TARGET_NAME} PRIVATE
|
|
15
|
+
-static-libgcc
|
|
16
|
+
-static-libstdc++
|
|
17
|
+
)
|
|
18
|
+
endif()
|
|
19
|
+
|
|
20
|
+
set_target_properties(${TARGET_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
|
21
|
+
endmacro()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# handle GL source files
|
|
2
|
+
include(${CMAKE_CURRENT_LIST_DIR}/GL.cmake)
|
|
3
|
+
|
|
4
|
+
# create the demo wasm target
|
|
5
|
+
add_executable(glviskit_wasm
|
|
6
|
+
"src/main_wasm.cpp"
|
|
7
|
+
"${GLVISKIT_GL_SOURCES}"
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
# output html by default
|
|
11
|
+
set_target_properties(glviskit_wasm PROPERTIES SUFFIX ".html")
|
|
12
|
+
|
|
13
|
+
# include directories and compile/link options
|
|
14
|
+
target_include_directories(glviskit_wasm PRIVATE
|
|
15
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
16
|
+
)
|
|
17
|
+
target_compile_options(glviskit_wasm PRIVATE
|
|
18
|
+
"-sUSE_SDL=3"
|
|
19
|
+
)
|
|
20
|
+
target_link_options(glviskit_wasm PRIVATE
|
|
21
|
+
"-sUSE_SDL=3"
|
|
22
|
+
"-sMIN_WEBGL_VERSION=2"
|
|
23
|
+
"-sMAX_WEBGL_VERSION=2"
|
|
24
|
+
"-sWASM=1"
|
|
25
|
+
"-sALLOW_MEMORY_GROWTH=1"
|
|
26
|
+
"--shell-file" "${CMAKE_CURRENT_SOURCE_DIR}/web/shell_minimal.html"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# link libraries
|
|
30
|
+
target_link_libraries(glviskit_wasm PRIVATE
|
|
31
|
+
glm::glm
|
|
32
|
+
)
|