use Python's architecture to give cmake a clue to generate the right config

This commit is contained in:
Ehsan Azarnasab 2015-08-23 10:53:13 -07:00
parent 8e2ec4cc6a
commit e469105178
1 changed files with 8 additions and 1 deletions

View File

@ -326,6 +326,13 @@ class build(_build):
platform_arch = platform.architecture()[0] platform_arch = platform.architecture()[0]
log.info("Detected Python architecture: %s" % platform_arch) log.info("Detected Python architecture: %s" % platform_arch)
# make sure build artifacts are generated for the version of Python currently running
cmake_extra_arch = []
if platform_arch == '64bit':
cmake_extra_arch = ['-DCMAKE_SIZEOF_VOID_P=8']
elif platform_arch == '32bit':
cmake_extra_arch = ['-DCMAKE_SIZEOF_VOID_P=4']
build_dir = os.path.join(script_dir, "./tools/python/build") build_dir = os.path.join(script_dir, "./tools/python/build")
if os.path.exists(build_dir): if os.path.exists(build_dir):
log.info('Removing build directory %s' % build_dir) log.info('Removing build directory %s' % build_dir)
@ -342,7 +349,7 @@ class build(_build):
cmake_cmd = [ cmake_cmd = [
cmake_path, cmake_path,
"..", "..",
] + cmake_extra ] + cmake_extra + cmake_extra_arch
if run_process(cmake_cmd): if run_process(cmake_cmd):
raise DistutilsSetupError("cmake configuration failed!") raise DistutilsSetupError("cmake configuration failed!")