* fix hard-coded path in Windows build. (#174)

This commit is contained in:
Baptiste Lepilleur 2025-05-21 13:30:20 +02:00 committed by GitHub
parent d8e4385990
commit d3fcb40408
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 15 deletions

View file

@ -83,11 +83,6 @@ To build a binary wheel distribution:
pip3 install wheel pip3 install wheel
python setup.py bdist_wheel python setup.py bdist_wheel
.. TODO::
There's a hardcoded path (to the raylib header files) in `raylib/build.py` you will probably need to edit.
Would be useful if some Windows user could figure out how to auto detect this.
Then install it: Then install it:
:: ::

View file

@ -24,6 +24,11 @@ import platform
import sys import sys
import subprocess import subprocess
import time import time
from pathlib import Path
THIS_DIR = Path(__file__).resolve().parent
REPO_ROOT = THIS_DIR.parent
RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "Desktop") RAYLIB_PLATFORM = os.getenv("RAYLIB_PLATFORM", "Desktop")
@ -200,13 +205,13 @@ def build_unix():
def build_windows(): def build_windows():
print("BUILDING FOR WINDOWS") print("BUILDING FOR WINDOWS")
ffibuilder.cdef(open("raylib/raylib.h.modified").read()) ffibuilder.cdef((THIS_DIR / "raylib.h.modified").read_text())
if RAYLIB_PLATFORM=="Desktop": if RAYLIB_PLATFORM=="Desktop":
ffibuilder.cdef(open("raylib/glfw3.h.modified").read()) ffibuilder.cdef((THIS_DIR / "glfw3.h.modified").read_text())
ffibuilder.cdef(open("raylib/rlgl.h.modified").read()) ffibuilder.cdef((THIS_DIR / "rlgl.h.modified").read_text())
ffibuilder.cdef(open("raylib/raygui.h.modified").read()) ffibuilder.cdef((THIS_DIR / "raygui.h.modified").read_text())
ffibuilder.cdef(open("raylib/physac.h.modified").read()) ffibuilder.cdef((THIS_DIR / "physac.h.modified").read_text())
ffibuilder.cdef(open("raylib/raymath.h.modified").read()) ffibuilder.cdef((THIS_DIR / "raymath.h.modified").read_text())
ffi_includes = """ ffi_includes = """
#include "raylib.h" #include "raylib.h"
@ -237,10 +242,10 @@ def build_windows():
extra_compile_args=["/D_CFFI_NO_LIMITED_API"], extra_compile_args=["/D_CFFI_NO_LIMITED_API"],
py_limited_api=False, py_limited_api=False,
libraries=libraries, libraries=libraries,
include_dirs=['D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src', include_dirs=[str(REPO_ROOT / 'raylib-c/src'),
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raylib-c\\src\\external\\glfw\\include', str(REPO_ROOT / 'raylib-c/src/external/glfw/include'),
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\raygui\\src', str(REPO_ROOT / 'raygui/src'),
'D:\\a\\raylib-python-cffi\\raylib-python-cffi\\physac\\src'], str(REPO_ROOT / 'physac/src')],
) )