Adding Windows 32-bit and 64-bit builds

- Basic tests are working
- May need some adjustments to get all tests working
- Cleaned up bundling to take Python arch into account when building
with multiple architectures
This commit is contained in:
Jacob Alexander
2019-10-17 00:20:03 -07:00
parent 063522d308
commit 8062e6f401
9 changed files with 33 additions and 23 deletions

View File

@@ -13,7 +13,7 @@ def build_libcapnp(bundle_dir, build_dir):
bundle_dir = os.path.abspath(bundle_dir)
capnp_dir = os.path.join(bundle_dir, 'capnproto-c++')
build_dir = os.path.abspath(build_dir)
tmp_dir = os.path.join(capnp_dir, 'build')
tmp_dir = os.path.join(capnp_dir, 'build{}'.format(8 * struct.calcsize("P")))
# Clean the tmp build directory every time
if os.path.exists(tmp_dir):
@@ -31,6 +31,7 @@ def build_libcapnp(bundle_dir, build_dir):
# Determine python shell architecture
python_arch = 8 * struct.calcsize("P")
build_arch = []
build_flags = []
if os.name == 'nt':
if python_arch == 64:
build_arch_flag = "x64"
@@ -39,8 +40,12 @@ def build_libcapnp(bundle_dir, build_dir):
else:
raise RuntimeError('Unknown windows build arch')
build_arch = ['-A', build_arch_flag]
build_flags = ['--config', 'Release']
print('Building module for {}'.format(python_arch))
if not shutil.which('cmake'):
raise RuntimeError('Could not find cmake in your path!')
args = [
'cmake',
'-DCMAKE_POSITION_INDEPENDENT_CODE=1',
@@ -57,13 +62,15 @@ def build_libcapnp(bundle_dir, build_dir):
raise RuntimeError('CMake failed {}'.format(returncode))
# Run build through cmake
build = subprocess.Popen([
args = [
'cmake',
'--build',
'.',
'--target',
'install',
], cwd=tmp_dir, stdout=sys.stdout)
]
args.extend(build_flags)
build = subprocess.Popen(args, cwd=tmp_dir, stdout=sys.stdout)
returncode = build.wait()
if cxxflags is None:
del os.environ['CXXFLAGS']