Definition at line 26 of file setup.py.
◆ build_extension()
def setup.CMakeBuildExt.build_extension |
( |
|
self, |
|
|
|
ext |
|
) |
| |
Definition at line 45 of file setup.py.
45 def build_extension(self, ext):
47 extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
49 '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
50 '-DPYTHON_EXECUTABLE=' + sys.executable,
54 cfg =
'Debug' if self.debug
else 'Release'
55 build_args = [
'--config', cfg]
57 if platform.system() ==
"Windows":
59 '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)
61 if sys.maxsize > 2**32:
62 cmake_args += [
'-A',
'x64']
63 build_args += [
'--',
'/m']
65 cmake_args += [
'-DCMAKE_BUILD_TYPE=' + cfg]
66 build_args += [
'--',
'-j%d' % multiprocessing.cpu_count()]
69 if not os.path.exists(self.build_temp):
70 os.makedirs(self.build_temp)
72 if "CUDA_ROOT" in os.environ:
73 if os.path.isfile(
'{}/bin/gcc'.format(os.environ[
"CUDA_ROOT"])):
75 '-DCMAKE_C_COMPILER={}/bin/gcc'.format(os.environ[
"CUDA_ROOT"])
77 if os.path.isfile(
'{}/bin/g++'.format(os.environ[
"CUDA_ROOT"])):
79 '-DCMAKE_CXX_COMPILER={}/bin/g++'.format(os.environ[
"CUDA_ROOT"])
82 cmake_args += [
'-DVERSION_INFO={}'.format(self.distribution.get_version())]
83 cmake_args += [
'-Ddo_half=OFF']
85 subprocess.check_call([
'cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp)
86 subprocess.check_call([
'cmake',
'--build',
'.'] + build_args,
94 version=shesha_version,
100 ext_modules=[CMakeExtension(
'compass-sim')],
101 cmdclass={
'build_ext': CMakeBuildExt},
◆ run()
def setup.CMakeBuildExt.run |
( |
|
self | ) |
|
Definition at line 28 of file setup.py.
30 out = subprocess.check_output([
'cmake',
'--version'])
33 "CMake must be installed to build the following extensions: " +
34 ", ".join(e.name
for e
in self.extensions))
36 if platform.system() ==
"Windows":
37 cmake_version = LooseVersion(
38 re.search(
r'version\s*([\d.]+)', out.decode()).group(1))
39 if cmake_version <
'3.1.0':
40 raise RuntimeError(
"CMake >= 3.1.0 is required on Windows")
42 for ext
in self.extensions:
43 self.build_extension(ext)
The documentation for this class was generated from the following file: