code: def build_extension(self, ext):
      print("Building " + ext.name)
  
      outdir = osp.abspath(osp.dirname(self.get_ext_fullpath(ext.name)))
      args = ["-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + outdir]
      if not osp.isdir(outdir):
          os.makedirs(outdir)
      args += ["-DGPU_RESAMPLING_CONFIGFILE_DIR=" + outdir]
      args += [
          "-DCMAKE_BUILD_TYPE=" + ("Debug" if self.debug else "Release")
      ]
  
      if platform.system() == "Linux" and any(
          dist in platform.dist() for dist in ("Debian", "Ubuntu")
      ):
          # Need to find compilers that play nice with nvcc;
          # this assumes compatible versions have been linked to
          # /PATH/TO/cuda/bin/cc and /PATH/TO/cuda/bin/c++, and
          # that they appear first on the search path.
          if not "CMAKE_C_COMPILER" in __CMAKE_OVERRIDE_FLAGS__:
              args += ["-DCMAKE_C_COMPILER=" + which("cc")]
          if not "CMAKE_CXX_COMPILER" in __CMAKE_OVERRIDE_FLAGS__:
              args += ["-DCMAKE_CXX_COMPILER=" + which("c++")]
  
      for key, val in __CMAKE_OVERRIDE_FLAGS__.items():
          args += ["-D" + key + "=" + val]
  
      args += [
          osp.join(
              osp.dirname(osp.abspath(__file__)),
              "niftyreg_gpu_resampler",
          )
      ]
  
      if not osp.isdir(self.build_temp):
          os.makedirs(self.build_temp)
  
      print(
          "Building in "
          + str(self.build_temp)
          + ": cmake "
          + " ".join(args)
      )
      sp.call(["cmake"] + args, cwd=self.build_temp)
      sp.call(["cmake"] + args, cwd=self.build_temp)
      sp.call(["cmake", "--build", self.build_temp])
  
imports: from __future__ import print_function
  import os
  import os.path
  import platform
  from setuptools import setup, Extension, Command
  from setuptools.command.build_ext import build_ext
  from shutil import which
  import subprocess
  import sys
label_desc: Use image node_id 2 for calling the CMakeBuildExt obj's underlying member method code with example usage: obj.build_extension(ext) without return types