Skip to content

Commit 845d3e6

Browse files
committed
Move binary file output of Release/Debug in Windows
1 parent 8cb4433 commit 845d3e6

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

tools/onnx2daq/python/setup.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ def build_extension(self, ext):
108108
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
109109
'-DPY_EXT_SUFFIX={}'.format(sysconfig.get_config_var('EXT_SUFFIX') or ''),
110110
'-DDNN_BUILD_PYTHON=ON',
111-
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={}'.format(extdir),
112111
]
113112
if COVERAGE or DEBUG:
114113
# in order to get accurate coverage information, the
@@ -144,6 +143,21 @@ def build_extension(self, ext):
144143
build_args.extend(['--', '-j', str(multiprocessing.cpu_count())])
145144
subprocess.check_call(build_args)
146145

146+
fullname = self.get_ext_fullname(ext.name)
147+
filename = os.path.basename(self.get_ext_filename(fullname))
148+
149+
lib_path = os.path.join(CMAKE_BUILD_DIR, 'tools', 'onnx2daq')
150+
if os.name == 'nt':
151+
debug_lib_dir = os.path.join(lib_path, "Debug")
152+
release_lib_dir = os.path.join(lib_path, "Release")
153+
if os.path.exists(debug_lib_dir):
154+
lib_path = debug_lib_dir
155+
elif os.path.exists(release_lib_dir):
156+
lib_path = release_lib_dir
157+
src = os.path.join(lib_path, filename)
158+
dst = os.path.join(os.path.realpath(self.build_lib), "onnx2daq", filename)
159+
self.copy_file(src, dst)
160+
147161

148162
cmdclass = {
149163
'build_ext': build_ext,

0 commit comments

Comments
 (0)