Skip to content

Commit d3fcb40

Browse files
authored
* fix hard-coded path in Windows build. (#174)
1 parent d8e4385 commit d3fcb40

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

BUILDING.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ To build a binary wheel distribution:
8383
pip3 install wheel
8484
python setup.py bdist_wheel
8585

86-
.. TODO::
87-
There's a hardcoded path (to the raylib header files) in `raylib/build.py` you will probably need to edit.
88-
Would be useful if some Windows user could figure out how to auto detect this.
89-
90-
9186
Then install it:
9287

9388
::

raylib/build.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
import sys
2525
import subprocess
2626
import time
27+
from pathlib import Path
28+
29+
THIS_DIR = Path(__file__).resolve().parent
30+
REPO_ROOT = THIS_DIR.parent
31+
2732

2833
RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "Desktop")
2934

@@ -200,13 +205,13 @@ def build_unix():
200205

201206
def build_windows():
202207
print("BUILDING FOR WINDOWS")
203-
ffibuilder.cdef(open("raylib/raylib.h.modified").read())
208+
ffibuilder.cdef((THIS_DIR / "raylib.h.modified").read_text())
204209
if RAYLIB_PLATFORM=="Desktop":
205-
ffibuilder.cdef(open("raylib/glfw3.h.modified").read())
206-
ffibuilder.cdef(open("raylib/rlgl.h.modified").read())
207-
ffibuilder.cdef(open("raylib/raygui.h.modified").read())
208-
ffibuilder.cdef(open("raylib/physac.h.modified").read())
209-
ffibuilder.cdef(open("raylib/raymath.h.modified").read())
210+
ffibuilder.cdef((THIS_DIR / "glfw3.h.modified").read_text())
211+
ffibuilder.cdef((THIS_DIR / "rlgl.h.modified").read_text())
212+
ffibuilder.cdef((THIS_DIR / "raygui.h.modified").read_text())
213+
ffibuilder.cdef((THIS_DIR / "physac.h.modified").read_text())
214+
ffibuilder.cdef((THIS_DIR / "raymath.h.modified").read_text())
210215

211216
ffi_includes = """
212217
#include "raylib.h"
@@ -237,10 +242,10 @@ def build_windows():
237242
extra_compile_args=["/D_CFFI_NO_LIMITED_API"],
238243
py_limited_api=False,
239244
libraries=libraries,
240-
include_dirs=['D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src',
241-
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src\\external\\glfw\\include',
242-
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raygui\\src',
243-
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\physac\\src'],
245+
include_dirs=[str(REPO_ROOT / 'raylib-c/src'),
246+
str(REPO_ROOT / 'raylib-c/src/external/glfw/include'),
247+
str(REPO_ROOT / 'raygui/src'),
248+
str(REPO_ROOT / 'physac/src')],
244249
)
245250

246251

0 commit comments

Comments
 (0)