Skip to content

Commit 8320f5a

Browse files
committed
WIP
1 parent 8d5bd9d commit 8320f5a

3 files changed

Lines changed: 29 additions & 127 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,8 @@ jobs:
5151
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.3.296.0/windows/VulkanSDK-1.3.296.0-Installer.exe" -OutFile VulkanSDK.exe
5252
# ./VulkanSDK.exe --help
5353
./VulkanSDK.exe --accept-licenses --default-answer --root D:/a/VulkanSDK --confirm-command install
54-
55-
- name: Retrieve submodules
56-
shell: cmd
57-
run: |
58-
5954
python -m pip install pl-build
60-
rem git submodule update --init --recursive ./dependencies/cpython
55+
python -m pip install --upgrade pip twine wheel setuptools
6156
cd ..
6257
git clone https://github.com/PilotLightTech/pilotlight
6358
cd pilotlight-python
@@ -73,10 +68,6 @@ jobs:
7368
build.bat -c deploy
7469
cd ..
7570
76-
- name: Install dependencies
77-
run: |
78-
python -m pip install --upgrade pip twine wheel setuptools
79-
8071
- name: Build Wheel
8172
shell: cmd
8273
run: |

scripts/gen_build.py

Lines changed: 14 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -74,40 +74,6 @@
7474
pl.add_compiler_flags("-Wno-deprecated-declarations", "--debug -g", "-std=c99", "-fmodules", "-ObjC", "-fPIC")
7575
pl.add_link_frameworks("Cocoa", "IOKit", "CoreFoundation")
7676

77-
with pl.configuration("release"):
78-
79-
pl.set_output_binary("glfw")
80-
81-
# win32
82-
with pl.platform("Windows"):
83-
with pl.compiler("msvc"):
84-
pl.add_include_directories("%VULKAN_SDK%\\Include")
85-
pl.add_definitions("UNICODE", "_UNICODE", "_CRT_SECURE_NO_WARNINGS", "_GLFW_VULKAN_STATIC", "_GLFW_WIN32")
86-
pl.add_compiler_flags("-nologo", "-std:c11", "-W3", "-wd5105", "-O2", "-MD", "-Zi", "-permissive")
87-
pl.add_linker_flags("-incremental:no", "-nologo")
88-
89-
# linux
90-
with pl.platform("Linux"):
91-
with pl.compiler("gcc"):
92-
pl.add_definitions("_GLFW_VULKAN_STATIC", "_GLFW_X11")
93-
pl.add_include_directories('$VULKAN_SDK/include', '/usr/include/vulkan', '/usr/include/vulkan')
94-
pl.add_dynamic_link_libraries("xcb", "X11", "X11-xcb", "xkbcommon", "pthread", "xcb-cursor", "vulkan")
95-
pl.add_link_directories('$VULKAN_SDK/lib')
96-
pl.add_compiler_flags("-fPIC", "-std=gnu99")
97-
pl.add_linker_flags("-ldl -lm")
98-
pl.add_source_files("../dependencies/glfw/src/posix_poll.c")
99-
100-
# apple
101-
with pl.platform("Darwin"):
102-
with pl.compiler("clang"):
103-
pl.add_definitions("_GLFW_VULKAN_STATIC", "_GLFW_COCOA")
104-
pl.add_include_directories('$VULKAN_SDK/include', '/usr/include/vulkan', '/usr/include/vulkan')
105-
pl.add_dynamic_link_libraries("spirv-cross-c-shared", "shaderc_shared", "vulkan")
106-
pl.add_link_directories('$VULKAN_SDK/lib', "/usr/local/lib")
107-
pl.add_compiler_flags("-std=c99", "-fmodules", "-ObjC", "-fPIC", "-Wno-deprecated-declarations")
108-
109-
pl.add_link_frameworks("Cocoa", "IOKit", "CoreFoundation")
110-
11177
with pl.configuration("deploy"):
11278

11379
pl.set_output_binary("glfw")
@@ -148,40 +114,31 @@
148114

149115
with pl.target("pl_platform_ext", pl.TargetType.STATIC_LIBRARY, False, False):
150116

151-
152117
pl.add_include_directories(
153118
"../../pilotlight/libs",
154119
"../../pilotlight/extensions",
155-
"../../pilotlight/src",
156-
"../../pilotlight/shaders",
157120
"../../pilotlight/dependencies/stb",
158-
"../../pilotlight/dependencies/cgltf",
159-
"../../pilotlight/dependencies/glfw/include/",
160-
"../dependencies/cpython/",
161-
"../dependencies/cpython/Include/",
162-
"../dependencies/cpython/PC/"
121+
"../../pilotlight/src"
163122
)
164123

165124
pl.set_output_binary("pl_platform_ext")
166125

167126
with pl.configuration("debug"):
168127

169-
# win32
170-
with pl.platform("Windows"):
171-
with pl.compiler("msvc"):
172-
pl.add_definitions("Py_PYTHON_H")
173-
pl.add_source_files("../../pilotlight/extensions/pl_platform_win32_ext.c")
174-
pl.add_static_link_libraries("ucrtd", "user32", "Ole32")
175-
pl.add_compiler_flags("-std:c11", "-nologo")
128+
pl.add_include_directories(
129+
"../dependencies/cpython/",
130+
"../dependencies/cpython/Include/"
131+
)
176132

177-
with pl.configuration("release"):
178-
179133
# win32
180134
with pl.platform("Windows"):
135+
136+
pl.add_include_directories("../dependencies/cpython/PC/")
137+
181138
with pl.compiler("msvc"):
182139
pl.add_definitions("Py_PYTHON_H")
183140
pl.add_source_files("../../pilotlight/extensions/pl_platform_win32_ext.c")
184-
pl.add_static_link_libraries("ucrt", "user32", "Ole32")
141+
pl.add_static_link_libraries("ucrtd", "user32", "Ole32")
185142
pl.add_compiler_flags("-std:c11", "-nologo")
186143

187144
with pl.configuration("deploy"):
@@ -197,16 +154,8 @@
197154
with pl.target("pilotlight_python", pl.TargetType.EXECUTABLE, False):
198155

199156
pl.add_include_directories(
200-
"../../pilotlight/libs",
201-
"../../pilotlight/extensions",
202-
"../../pilotlight/src",
203-
"../../pilotlight/shaders",
204-
"../../pilotlight/dependencies/stb",
205-
"../../pilotlight/dependencies/cgltf",
206-
"../../pilotlight/dependencies/glfw/include/",
207157
"../dependencies/cpython/",
208158
"../dependencies/cpython/Include/",
209-
"../dependencies/cpython/PC/"
210159
)
211160

212161
pl.add_source_files("../sandbox/main.c")
@@ -216,17 +165,20 @@
216165

217166
# win32
218167
with pl.platform("Windows"):
168+
169+
pl.add_include_directories(
170+
"../dependencies/cpython/PC/",
171+
"%VULKAN_SDK%\\Include")
172+
219173
with pl.compiler("msvc"):
220174
pl.add_definitions("PL_VULKAN_BACKEND")
221-
pl.add_include_directories("%VULKAN_SDK%\\Include")
222175
pl.add_static_link_libraries("user32", "Shell32", "Ole32", "gdi32", "ucrtd", "pl_platform_ext")
223176
pl.add_static_link_libraries("shaderc_combined", "spirv-cross-c-shared", "vulkan-1", "glfwd")
224177
pl.add_link_directories("../dependencies/cpython/PCbuild/amd64/", '%VULKAN_SDK%\\Lib')
225178
pl.add_linker_flags("-noimplib", "-noexp", "-incremental:no", "-nodefaultlib:MSVCRT", "-nodefaultlib:LIBCMT")
226179
pl.add_compiler_flags("-Zc:preprocessor", "-nologo", "-std:c11", "-W4", "-WX", "-wd4201",
227180
"-wd4100", "-wd4996", "-wd4505", "-wd4189", "-wd5105", "-wd4115",
228181
"-permissive-", "-Od", "-MDd", "-Zi")
229-
# pl.set_post_target_build_step('@copy "%VULKAN_SDK%\\bin\\spirv-cross-c-shared.dll" "..\\out\\" >nul\n')
230182

231183

232184
#-----------------------------------------------------------------------------
@@ -271,27 +223,6 @@
271223
"-permissive-", "-Od", "-MDd", "-Zi")
272224
pl.set_post_target_build_step('@copy "%VULKAN_SDK%\\bin\\spirv-cross-c-shared.dll" "..\\pilotlight\\" >nul\n')
273225

274-
with pl.configuration("release"):
275-
276-
pl.set_output_binary("pilotlight")
277-
pl.set_output_directory("../pilotlight")
278-
279-
# win32
280-
with pl.platform("Windows"):
281-
with pl.compiler("msvc"):
282-
pl.add_definitions("PL_VULKAN_BACKEND")
283-
pl.add_include_directories("%VULKAN_SDK%\\Include")
284-
pl.set_output_binary_extension(".pyd")
285-
pl.add_static_link_libraries("shaderc_combined", "spirv-cross-c-shared", "vulkan-1", "glfw")
286-
pl.add_static_link_libraries("user32", "Shell32", "Ole32", "gdi32", "ucrt", "pl_platform_ext")
287-
pl.add_link_directories("../dependencies/cpython/PCbuild/amd64/")
288-
pl.add_link_directories("../dependencies/cpython/PCbuild/amd64/", '%VULKAN_SDK%\\Lib')
289-
pl.add_linker_flags("-noimplib", "-noexp", "-incremental:no", "-nodefaultlib:LIBCMT")
290-
pl.add_compiler_flags("-Zc:preprocessor", "-nologo", "-std:c11", "-W4", "-WX", "-wd4201",
291-
"-wd4100", "-wd4996", "-wd4505", "-wd4189", "-wd5105", "-wd4115",
292-
"-permissive-", "-Od", "-MD", "-Zi")
293-
pl.set_post_target_build_step('@copy "%VULKAN_SDK%\\bin\\spirv-cross-c-shared.dll" "..\\pilotlight\\" >nul\n')
294-
295226
with pl.configuration("deploy"):
296227

297228
pl.set_output_binary("pilotlight")

setup.py

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
from setuptools import setup, find_packages, Distribution
1+
from setuptools import setup, Distribution
22
from setuptools.command import build_py
33
import distutils.cmd
4-
from codecs import open
54
import os
6-
from os import path
7-
import textwrap
85
import sys
9-
import shutil
10-
import subprocess
116

127
wip_version = "0.1.0"
138

@@ -29,25 +24,6 @@ class BinaryDistribution(Distribution):
2924
def has_ext_modules(var):
3025
return True
3126

32-
class DPGBuildCommand(distutils.cmd.Command):
33-
34-
description = 'DPG Build Command'
35-
user_options = []
36-
37-
def initialize_options(self):
38-
pass
39-
40-
def finalize_options(self):
41-
pass
42-
43-
def run(self):
44-
pass
45-
46-
class BuildPyCommand(build_py.build_py):
47-
def run(self):
48-
self.run_command('dpg_build')
49-
build_py.build_py.run(self)
50-
5127
def setup_package():
5228

5329
src_path = os.path.dirname(os.path.abspath(__file__))
@@ -67,11 +43,10 @@ def setup_package():
6743
license = 'MIT',
6844
python_requires='>=3.14',
6945
classifiers=[
70-
'Development Status :: 5 - Production/Stable',
46+
'Development Status :: 3 - Alpha',
7147
'Intended Audience :: Education',
7248
'Intended Audience :: Developers',
7349
'Intended Audience :: Science/Research',
74-
'License :: OSI Approved :: MIT License',
7550
'Operating System :: Microsoft :: Windows :: Windows 10',
7651
'Programming Language :: Python :: 3.14',
7752
'Programming Language :: Python :: Implementation :: CPython',
@@ -81,15 +56,21 @@ def setup_package():
8156
],
8257
packages=['pilotlight'],
8358
package_data={},
84-
distclass=BinaryDistribution,
85-
cmdclass={
86-
'dpg_build': DPGBuildCommand,
87-
'build_py': BuildPyCommand,
88-
},
59+
distclass=BinaryDistribution
8960
)
9061

9162
if get_platform() == "Windows":
92-
metadata['package_data']['pilotlight'] = ["__init__.py", "pilotlight.pyd", "pilotlight.pyi", "pl_core.py", "pl_draw_ext.py", "pl_starter_ext.py", "pl_ui_ext.py", "pl_vfs_ext.py", "spirv-cross-c-shared.dll"]
63+
metadata['package_data']['pilotlight'] = [
64+
"__init__.py",
65+
"pilotlight.pyd",
66+
"pilotlight.pyi",
67+
"pl_core.py",
68+
"pl_draw_ext.py",
69+
"pl_starter_ext.py",
70+
"pl_ui_ext.py",
71+
"pl_vfs_ext.py",
72+
"spirv-cross-c-shared.dll"
73+
]
9374

9475
if "--force" in sys.argv:
9576
sys.argv.remove('--force')
@@ -103,4 +84,3 @@ def setup_package():
10384

10485
if __name__ == '__main__':
10586
setup_package()
106-

0 commit comments

Comments
 (0)