Skip to content

Commit

Permalink
Merge pull request #1 from tonyroberts/master
Browse files Browse the repository at this point in the history
Update setup.py for Windows
  • Loading branch information
wojciech-graj authored Oct 10, 2023
2 parents 85726f3 + 7ae71b7 commit df221a7
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 16 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: ${{github.workspace}}/cydoomgeneric
run: |
python -m pip install --upgrade pip
python -m pip install numpy cython wheel
- name: Build wheel
working-directory: ${{github.workspace}}/cydoomgeneric
run: |
python setup.py bdist_wheel
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,5 @@ $ python democalc.py

## TODO

- Windows build
- Fix segfault when closing game
- Implement sound
49 changes: 34 additions & 15 deletions cydoomgeneric/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
"""


from setuptools import Extension, setup, find_packages
from setuptools import Extension, setup
from Cython.Build import cythonize
import Cython
import numpy
import sys


doom_src = (
Expand Down Expand Up @@ -102,6 +104,30 @@
)


libraries = []
define_macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
extra_compile_args = []
extra_link_args = []
compiler_directives = {}


if sys.platform == "win32":
libraries.append("user32")
else:
define_macros.extend([
("NORMALUNIX", None),
("LINUX", None),
("_DEFAULT_SOURCE", None)
])
extra_compile_args.append("-Os")
extra_link_args.append("-Wl,--gc-sections")


cython_version = list(map(lambda x: int(x) if x.isdigit() else x, Cython.__version__.split(".")))
if cython_version[0] >= 3:
compiler_directives["legacy_implicit_noexcept"] = True


setup(
name="cydoomgeneric",
description="Easily portable doom for python",
Expand All @@ -121,21 +147,14 @@
"./../doomgeneric",
numpy.get_include()
],
define_macros=[
("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"),
("NORMALUNIX", None),
("LINUX", None),
("_DEFAULT_SOURCE", None),
],
extra_compile_args=[
"-Os",
],
extra_link_args=[
"-Wl,--gc-sections"
],
define_macros=define_macros,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
libraries=libraries
)
],
language_level=2
language_level=2,
compiler_directives=compiler_directives
),
install_requires=['numpy>=1.20'],
install_requires=['numpy>=1.20']
)

0 comments on commit df221a7

Please sign in to comment.