Skip to content

Commit

Permalink
Windows fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanharg committed Mar 5, 2024
1 parent 608c54f commit 5650497
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions binaryen/binaryen_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

host_machine = platform.machine().lower()

if host_platform == "windows" and host_machine == "amd64":
host_machine = "x86_64"

root_path_override = os.environ.get("BINARYEN_PY_ROOT")

print("==== BUILD ====")
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ archs = ["x86_64"]

[tool.cibuildwheel.windows]
archs = ["AMD64"]
# before-build = ["bash scripts/build_libbinaryen.sh"]

[[tool.cibuildwheel.overrides]]
select = "*-musllinux*"
Expand Down
7 changes: 6 additions & 1 deletion scripts/build_libbinaryen.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

arch=$(uname -m)

case "$(uname -sr)" in

Darwin*)
Expand All @@ -12,6 +14,10 @@ Linux*)

CYGWIN* | MINGW* | MINGW32* | MSYS*)
platform='windows'
if [[ "$arch" == "amd-64"]]
then
arch="x86_64"
fi
;;

*)
Expand All @@ -33,7 +39,6 @@ then
wildcards=""
fi

arch=$(uname -m)
lib_path="./binaryen/libbinaryen/$arch-$platform/"
mkdir -p $lib_path

Expand Down
4 changes: 4 additions & 0 deletions scripts/create_cdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

host_machine = platform.machine().lower()

if host_platform == "windows" and host_machine == "amd64":
host_machine = "x86_64"

include_dir = (Path(__file__).parent.parent / f"./binaryen/libbinaryen/{host_machine}-{host_platform}/include")
header_path = (include_dir /"./binaryen-c.h")
output_path =(include_dir / "./binaryen-c.c")
Expand All @@ -32,6 +35,7 @@
)

header = pre_processor.stdout.decode(encoding="utf-8")
header = "\n".join([line.strip() for line in header.splitlines()])

# Clean up build artifacts & comments
header = re.sub(r"//.*\n", "", header)
Expand Down

0 comments on commit 5650497

Please sign in to comment.