diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a5359f..4144ba5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: runs-on: macos-15-intel strategy: matrix: - python-version: [ '3.12', '3.13', '3.14', 'pypy-3.11' ] + python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', 'pypy-3.11', 'pypy-3.10' ] raylib-platform: ['Desktop', 'SDL'] env: MACOSX_DEPLOYMENT_TARGET: '10.13' @@ -78,7 +78,7 @@ jobs: run: | python -m pip install --upgrade pip - pip3 install --upgrade "cffi>=2.0.0" + pip3 install --upgrade cffi pip3 install --upgrade wheel pip3 install --upgrade setuptools python -m pip install --upgrade build @@ -121,7 +121,7 @@ jobs: runs-on: macos-13 strategy: matrix: - python-version: [ '3.12', '3.13', '3.14'] + python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14'] raylib-platform: ['Desktop', 'SDL'] env: MACOSX_DEPLOYMENT_TARGET: '11' @@ -184,7 +184,7 @@ jobs: run: | python -m pip install --upgrade pip - pip3 install --upgrade "cffi>=2.0.0" + pip3 install --upgrade cffi pip3 install --upgrade wheel pip3 install --upgrade setuptools python -m pip install --upgrade build @@ -236,7 +236,7 @@ jobs: # You can use PyPy versions in python-version. # For example, pypy2 and pypy3 matrix: - python-version: ['python3.12', 'python3.13', 'python3.14', 'pypy3.11'] + python-version: ['python3.7', 'python3.8', 'python3.9', 'python3.10', 'python3.11', 'python3.12', 'python3.13', 'python3.14', 'pypy3.11'] raylib-platform: ['Desktop', 'SDL', 'DRM'] steps: - name: fix node @@ -271,7 +271,7 @@ jobs: PKG_CONFIG_PATH: /usr/local/lib/pkgconfig run: | ${{ matrix.python-version }} -m pip install --upgrade pip - ${{ matrix.python-version }} -m pip install --upgrade "cffi>=2.0.0" + ${{ matrix.python-version }} -m pip install --upgrade cffi ${{ matrix.python-version }} -m pip install --upgrade wheel ${{ matrix.python-version }} -m pip install --upgrade setuptools ${{ matrix.python-version }} -m pip install --upgrade build @@ -311,8 +311,6 @@ jobs: echo "Failed" exit 1 fi - - - name: Upload build Artifact wheel uses: actions/upload-artifact@v4 with: @@ -320,6 +318,207 @@ jobs: path: wheelhouse/* + build-linux32: + runs-on: ubuntu-latest + container: + image: electronstudio/ubuntu16-modern:i386 + options: --user root --platform=linux/386 + volumes: + # override /__e/node20 because GitHub Actions uses a version that requires too-recent glibc + - /tmp:/__e/node20 + strategy: + # You can use PyPy versions in python-version. + # For example, pypy2 and pypy3 + matrix: + python-version: ['python3.7', 'python3.8', 'python3.9', 'python3.10', 'python3.11', 'python3.12', 'python3.13', 'python3.14'] + raylib-platform: ['Desktop', 'SDL', 'DRM'] + steps: + - name: fix node + run: | + ln -s /usr/local/bin /__e/node20/bin + + - uses: actions/checkout@v2 + with: + submodules: recursive + + - name: fix raygui bug + run: | + patch -p0 $new_name" + cp "$wheel" "wheelhouse/$new_name" + fi + fi + done + shell: bash + - name: Test + run: | + ${{ matrix.python-version }} -m pip install --no-deps wheelhouse/*-py3-none-linux_*.whl + # Clean up test wheels + rm -f wheelhouse/*-py3-none-linux_i*.whl + cd / + ${{ matrix.python-version }} -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true + cat /tmp/output + if grep -q "INFO: Initializing raylib" /tmp/output; then + echo "Passed" + else + echo "Failed" + exit 1 + fi + - name: Upload build Artifact wheel + uses: actions/upload-artifact@v4 + with: + name: wheel-linux32-${{ matrix.raylib-platform }}-${{ matrix.python-version }} + path: wheelhouse/* + + build-linux-arm64: + runs-on: ubuntu-22.04-arm + strategy: + matrix: + python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14'] + raylib-platform: [ 'Desktop', 'SDL', 'DRM' ] + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: fix raygui bug + run: | + patch -p0 $new_name" + cp "$wheel" "wheelhouse/$new_name" + fi + fi + done + shell: bash + - name: Test + run: | + python3 -m pip install --no-deps wheelhouse/*-py3-none-linux_aarch64.whl + # Clean up test wheels + rm -f wheelhouse/*-py3-none-linux_aarch64.whl + cd / + python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true + cat /tmp/output + if grep -q "INFO: Initializing raylib" /tmp/output; then + echo "Passed" + else + echo "Failed" + exit 1 + fi + - name: Upload build Artifact wheel + uses: actions/upload-artifact@v4 + with: + name: wheel-linux-arm64-${{ matrix.raylib-platform }}-${{ matrix.python-version }} + path: wheelhouse/* + + + build-windows: # The type of runner that the job will run on runs-on: windows-2022 @@ -327,7 +526,7 @@ jobs: # You can use PyPy versions in python-version. # For example, pypy2 and pypy3 matrix: - python-version: [ '3.12', '3.13', '3.14', 'pypy-3.11' ] + python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', 'pypy-3.11', 'pypy-3.10' ] raylib-platform: ['Desktop', 'SDL'] steps: - uses: actions/checkout@v4 @@ -380,7 +579,7 @@ jobs: copy ${{ runner.temp }}\SDL2\lib\x64\SDL2.lib . copy ${{ runner.temp }}\SDL2\lib\x64\SDL2.dll raylib\ python -m pip install --upgrade pip - pip3 install --upgrade "cffi>=2.0.0" + pip3 install --upgrade "cffi" pip3 install --upgrade wheel pip3 install --upgrade setuptools pip3 install --upgrade build @@ -411,7 +610,101 @@ jobs: with: name: wheel-windows-${{ matrix.raylib-platform }}-${{ matrix.python-version }} path: dist/* - + + build-windows32: + # The type of runner that the job will run on + runs-on: windows-2022 + strategy: + # You can use PyPy versions in python-version. + # For example, pypy2 and pypy3 + matrix: + python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14' ] + raylib-platform: [ 'Desktop', 'SDL' ] + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Download SDL2 + run: curl -L -o SDL2.zip https://github.com/libsdl-org/SDL/releases/download/release-2.32.10/SDL2-devel-2.32.10-VC.zip + + - name: Create extraction directory + run: mkdir ${{ runner.temp }}\SDL2 + + - name: Unzip SDL2 + run: tar -xf SDL2.zip -C ${{ runner.temp }}\SDL2 --strip-components=1 + + - name: Set SDL2_DIR environment variable + run: echo SDL2_DIR=${{ runner.temp }}\SDL2\cmake >> $env:GITHUB_ENV + + - name: Setup Python + uses: actions/setup-python@v5 + with: + # Version range or exact version of a Python version to use, using SemVer's version range syntax. + python-version: ${{ matrix.python-version }} + # The target architecture (x86, x64) of the Python interpreter. + architecture: x86 + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + with: + msbuild-architecture: x86 + + - name: fix raygui bug + run: | + patch -p0 nul 2>&1 + del raylib\dynamic\*.dll >nul 2>&1 + del raylib\dynamic\*.dylib >nul 2>&1 + del raylib\dynamic\32bit\* >nul 2>&1 + python -m build --wheel + shell: cmd + + - name: Test + shell: bash + run: | + pip3 install --no-deps dist/*.whl + cd / + python3 -c 'import pyray; pyray.init_window(100,100,"test")' >/tmp/output 2>&1 || true + cat /tmp/output + if grep -q "INFO: Initializing raylib" /tmp/output; then + echo "Passed" + exit 0 + else + echo "Failed" + exit 1 + fi + + - name: Upload build Artifact wheel + uses: actions/upload-artifact@v4 + with: + name: wheel-windows32-${{ matrix.raylib-platform }}-${{ matrix.python-version }} + path: dist/* + source-distro: runs-on: ubuntu-latest @@ -452,7 +745,7 @@ jobs: - name: Build raylib-python-cffi run: | python -m pip install --upgrade pip - pip3 install --upgrade "cffi>=2.0.0" + pip3 install --upgrade cffi pip3 install --upgrade wheel pip3 install --upgrade setuptools python setup.py sdist @@ -487,7 +780,7 @@ jobs: - name: Build raylib-python-cffi-dynamic run: | python -m pip install --upgrade pip - pip3 install --upgrade "cffi>=2.0.0" + pip3 install --upgrade cffi pip3 install --upgrade wheel pip3 install --upgrade setuptools cd dynamic @@ -500,7 +793,7 @@ jobs: path: dynamic/dist/* merge: - needs: [build-mac-intel, build-mac-arm64, build-windows, build-linux, source-distro, dynamic-distro] + needs: [build-mac-intel, build-mac-arm64, build-windows, build-linux, build-linux-arm64, build-linux32, build-windows32, source-distro, dynamic-distro] runs-on: ubuntu-latest steps: - name: Merge All Artifacts diff --git a/pyproject.toml b/pyproject.toml index 7e386b9..e5fd5f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools", "cffi>=2.0.0"] +requires = ["setuptools", "cffi>=1.15.1"] build-backend = "setuptools.build_meta" diff --git a/raylib/build.py b/raylib/build.py index d6d0823..0649ad1 100644 --- a/raylib/build.py +++ b/raylib/build.py @@ -270,7 +270,6 @@ def build_windows(): ffibuilder.cdef((THIS_DIR / "glfw3.h.modified").read_text()) ffibuilder.cdef((THIS_DIR / "rlgl.h.modified").read_text()) ffibuilder.cdef((THIS_DIR / "raygui.h.modified").read_text()) - ffibuilder.cdef((THIS_DIR / "physac.h.modified").read_text()) ffibuilder.cdef((THIS_DIR / "raymath.h.modified").read_text()) ffi_includes = """ @@ -288,10 +287,16 @@ def build_windows(): #define RAYGUI_IMPLEMENTATION #define RAYGUI_SUPPORT_RICONS #include "raygui.h" - #define PHYSAC_IMPLEMENTATION - #define PHYSAC_NO_THREADS - #include "physac.h" """ + + if platform.architecture()[0] != "32bit": # Physac wont compile on 32bit windows + ffibuilder.cdef((THIS_DIR / "physac.h.modified").read_text()) + ffi_includes += """ + #define PHYSAC_IMPLEMENTATION + #define PHYSAC_NO_THREADS + #include "physac.h" + """ + libraries = ['raylib', 'gdi32', 'shell32', 'user32', 'OpenGL32', 'winmm'] if RAYLIB_PLATFORM=="SDL": libraries += ['SDL2'] diff --git a/setup.py b/setup.py index 1c9eaf7..69f9ade 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ def has_ext_modules(foo): ], packages=["raylib", "pyray"], include_package_data=True, - install_requires=["cffi>=2.0.0"], + install_requires=["cffi>=1.15.1"], distclass=BinaryDistribution, cffi_modules=["raylib/build.py:ffibuilder"] )