Skip to content

Commit

Permalink
Add build --sdl3 flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ankith26 committed Oct 19, 2024
1 parent b874952 commit b505553
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build-sdl3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,8 @@ jobs:
cmake --build . --config Release --parallel
sudo cmake --install . --config Release
- name: Make sdist and install it
run: >
python3 -m pip install . -v -Csetup-args=-Dsdl_api=3
-Csetup-args=-Dimage=disabled
-Csetup-args=-Dmixer=disabled
-Csetup-args=-Dfont=disabled
- name: Build with SDL3
run: python3 dev.py build --sdl3

# - name: Run tests
# env:
Expand Down
23 changes: 22 additions & 1 deletion dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
venv_path = source_tree / VENV_NAME
pyproject_path = source_tree / "pyproject.toml"

SDL3_ARGS = [
"-Csetup-args=-Dsdl_api=3",
"-Csetup-args=-Dimage=disabled",
"-Csetup-args=-Dmixer=disabled",
"-Csetup-args=-Dfont=disabled",
]


class Colors(Enum):
RESET = "\033[0m"
Expand Down Expand Up @@ -176,8 +183,14 @@ def cmd_build(self):
editable = not self.args.get("install", True)
debug = self.args.get("debug", False)
lax = self.args.get("lax", False)
sdl3 = self.args.get("sdl3", False)

build_suffix = "-sdl3" if sdl3 else ""
install_args = [
"--no-build-isolation",
f"-Cbuild-dir=.mesonpy-build{build_suffix}",
]

install_args = ["--no-build-isolation", "-Cbuild-dir=.mesonpy-build"]
if editable:
install_args.append("--editable")

Expand All @@ -190,6 +203,9 @@ def cmd_build(self):
# use the same flags as CI
install_args.extend(get_cibw_setup_args())

if sdl3:
install_args.extend(SDL3_ARGS)

pprint(f"Building pygame (with {editable=}, {debug=}, and {lax=})")
pip_install(self.py, install_args)

Expand Down Expand Up @@ -286,6 +302,11 @@ def parse_args(self):
action="store_true",
help="Be lax about build warnings, allow the build to succeed with them",
)
build_parser.add_argument(
"--sdl3",
action="store_true",
help="Build against SDL3 instead of the default SDL2",
)

# Docs command
docs_parser = subparsers.add_parser("docs", help="Generate docs")
Expand Down

0 comments on commit b505553

Please sign in to comment.