Skip to content
Snippets Groups Projects
Unverified Commit b477da6d authored by Ririko Nakamura's avatar Ririko Nakamura Committed by GitHub
Browse files

Add support to Visual Studio generators in setup.py (#201)

* Add support to Visual Studio generators in setup.py

* Modifies generator identification pattern
parent 77c87b71
No related branches found
No related tags found
No related merge requests found
......@@ -164,9 +164,22 @@ class BuildCMakeExt(build_ext, object):
os.makedirs(self.build_temp)
self.spawn(['cmake', '-H'+extension.sourcedir, '-B'+self.build_temp]+ cmake_args)
# Check which generator was used and use the correct command line switches.
generator = ''
cmake_cache_file = os.path.join(self.build_temp, 'CMakeCache.txt')
with open(cmake_cache_file, 'r') as cmake_cache:
for line in cmake_cache.readlines():
if line.find('CMAKE_GENERATOR:') != -1:
generator = line[line.find('=') + 1:].strip()
self.announce("Building binaries", level=3)
self.spawn(["cmake", "--build", self.build_temp,
"--config", "Release", '--', '-j8'])
if generator.find('Visual Studio') != -1:
self.spawn(["cmake", "--build", self.build_temp,
"--config", "Release", "--", "-m"])
else:
self.spawn(["cmake", "--build", self.build_temp,
"--config", "Release", "--", "-j8"])
# Build finished, now copy the files into the copy directory
# The copy directory is the parent directory of the extension (.pyd)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment