Skip to content

Commit

Permalink
Move binary file output of Release/Debug in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
daquexian committed May 22, 2019
1 parent 8cb4433 commit 845d3e6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tools/onnx2daq/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def build_extension(self, ext):
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
'-DPY_EXT_SUFFIX={}'.format(sysconfig.get_config_var('EXT_SUFFIX') or ''),
'-DDNN_BUILD_PYTHON=ON',
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={}'.format(extdir),
]
if COVERAGE or DEBUG:
# in order to get accurate coverage information, the
Expand Down Expand Up @@ -144,6 +143,21 @@ def build_extension(self, ext):
build_args.extend(['--', '-j', str(multiprocessing.cpu_count())])
subprocess.check_call(build_args)

fullname = self.get_ext_fullname(ext.name)
filename = os.path.basename(self.get_ext_filename(fullname))

lib_path = os.path.join(CMAKE_BUILD_DIR, 'tools', 'onnx2daq')
if os.name == 'nt':
debug_lib_dir = os.path.join(lib_path, "Debug")
release_lib_dir = os.path.join(lib_path, "Release")
if os.path.exists(debug_lib_dir):
lib_path = debug_lib_dir
elif os.path.exists(release_lib_dir):
lib_path = release_lib_dir
src = os.path.join(lib_path, filename)
dst = os.path.join(os.path.realpath(self.build_lib), "onnx2daq", filename)
self.copy_file(src, dst)


cmdclass = {
'build_ext': build_ext,
Expand Down

0 comments on commit 845d3e6

Please sign in to comment.