Adding Windows compilation support
- Automatically determining build arch from running Python shell * Should work across all platforms
This commit is contained in:
2
.github/workflows/pythonpackage.yml
vendored
2
.github/workflows/pythonpackage.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
# Some asyncio commands require 3.7+
|
# Some asyncio commands require 3.7+
|
||||||
# It may be possible to use 3.6 and maybe 3.5; however, this will take some patching to get examples to work
|
# It may be possible to use 3.6 and maybe 3.5; however, this will take some patching to get examples to work
|
||||||
python-version: [3.7]
|
python-version: [3.7]
|
||||||
os: [ubuntu-latest, macOS-latest]
|
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import struct
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def build_libcapnp(bundle_dir, build_dir, verbose=False):
|
def build_libcapnp(bundle_dir, build_dir):
|
||||||
'''
|
'''
|
||||||
Build capnproto
|
Build capnproto
|
||||||
'''
|
'''
|
||||||
@@ -27,7 +28,18 @@ def build_libcapnp(bundle_dir, build_dir, verbose=False):
|
|||||||
if shutil.which('ninja'):
|
if shutil.which('ninja'):
|
||||||
build_type = ['-G', 'Ninja']
|
build_type = ['-G', 'Ninja']
|
||||||
|
|
||||||
# TODO Determine VS version
|
# Determine python shell architecture
|
||||||
|
python_arch = 8 * struct.calcsize("P")
|
||||||
|
build_arch = []
|
||||||
|
if os.name == 'nt':
|
||||||
|
if python_arch == 64:
|
||||||
|
build_arch_flag = "x64"
|
||||||
|
elif python_arch == 32:
|
||||||
|
build_arch_flag = "Win32"
|
||||||
|
else:
|
||||||
|
raise RuntimeError('Unknown windows build arch')
|
||||||
|
build_arch = ['-A', build_arch_flag]
|
||||||
|
print('Building module for {}'.format(python_arch))
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
'cmake',
|
'cmake',
|
||||||
@@ -38,6 +50,7 @@ def build_libcapnp(bundle_dir, build_dir, verbose=False):
|
|||||||
capnp_dir,
|
capnp_dir,
|
||||||
]
|
]
|
||||||
args.extend(build_type)
|
args.extend(build_type)
|
||||||
|
args.extend(build_arch)
|
||||||
conf = subprocess.Popen(args, cwd=tmp_dir, stdout=sys.stdout)
|
conf = subprocess.Popen(args, cwd=tmp_dir, stdout=sys.stdout)
|
||||||
returncode = conf.wait()
|
returncode = conf.wait()
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user