Update leenkx/blender/lnx/make.py

This commit is contained in:
Onek8 2025-04-10 10:12:22 +00:00
parent 55fb300901
commit 979dfc605d

View File

@ -694,8 +694,8 @@ def build_success():
if wrd.lnx_audio == 'Disabled': if wrd.lnx_audio == 'Disabled':
cmd.append('--nosound') cmd.append('--nosound')
elif state.target.startswith(('windows-hl', 'linux-hl', 'macos-hl', 'Hashlink')): elif state.target.startswith(('windows-hl', 'linux-hl', 'macos-hl')):
log.info(f"Attempting to run Hashlink/C target: {state.target}") log.info(f"Runtime Hashlink/C target: {state.target}")
hl_build_dir, _, _ = lnx.utils.hashlink_paths(state.target) hl_build_dir, _, _ = lnx.utils.hashlink_paths(state.target)
@ -763,7 +763,6 @@ def build_success():
if not compile_success: if not compile_success:
return return
# Path is typically: <build_dir>/<Platform>/<Configuration>/<ProjectName>.exe
exe_path = os.path.join(hl_build_dir, platform, build_mode, proj_name + '.exe') exe_path = os.path.join(hl_build_dir, platform, build_mode, proj_name + '.exe')
if not os.path.isfile(exe_path): if not os.path.isfile(exe_path):
exe_path = os.path.join(hl_build_dir, build_mode, proj_name + '.exe') exe_path = os.path.join(hl_build_dir, build_mode, proj_name + '.exe')
@ -772,10 +771,17 @@ def build_success():
return return
log.info(f"Found compiled executable: {exe_path}") log.info(f"Found compiled executable: {exe_path}")
cmd = [exe_path]
exe_dir = os.path.dirname(exe_path) dest_exe_name = proj_name + '.exe'
log.info(f"Changing CWD to: {exe_dir}") base_build_dir = lnx.utils.get_fp_build()
os.chdir(exe_dir) dest_dir = os.path.join(base_build_dir, state.target)
dest_path = os.path.join(dest_dir, dest_exe_name)
try:
shutil.move(exe_path, dest_path)
cmd = [dest_path]
except Exception as e:
cmd = [exe_path]
os.chdir(dest_dir)
elif state.target in ('linux-hl', 'macos-hl'): elif state.target in ('linux-hl', 'macos-hl'):
log.error(f"Compilation for {state.target} is not yet implemented in build_success.") log.error(f"Compilation for {state.target} is not yet implemented in build_success.")
@ -784,15 +790,6 @@ def build_success():
log.error(f"Running logic for target {state.target} is not defined (expected Krom or Hashlink/C).") log.error(f"Running logic for target {state.target} is not defined (expected Krom or Hashlink/C).")
return return
if cmd:
log.info(f"Executing final command: {' '.join(cmd)}")
try:
state.proc_play = run_proc(cmd, play_done)
except Exception:
traceback.print_exc()
else:
log.error("No command generated to run.")
try: try:
state.proc_play = run_proc(cmd, play_done) state.proc_play = run_proc(cmd, play_done)
except Exception: except Exception: