Skip to content

Windows: make run_xstudio.bat work from the build tree#259

Open
bdeluca wants to merge 1 commit into
AcademySoftwareFoundation:developfrom
bdeluca:pr/windows-dev-launcher-build-tree
Open

Windows: make run_xstudio.bat work from the build tree#259
bdeluca wants to merge 1 commit into
AcademySoftwareFoundation:developfrom
bdeluca:pr/windows-dev-launcher-build-tree

Conversation

@bdeluca
Copy link
Copy Markdown
Contributor

@bdeluca bdeluca commented May 27, 2026

run_xstudio.bat is the CMake-generated dev launcher that lets Windows developers run xstudio.exe straight from the build tree without a cmake --install cycle. Today it only sets PATH to Qt's bin dir; everything else xstudio.exe needs at runtime (XSTUDIO_ROOT, plugin search path, Python home, PYTHONPATH) is missing or pointed at the install-layout locations, so the launcher can only be used after an install has populated ${CMAKE_INSTALL_PREFIX}.

This PR extends run_xstudio.bat to set the rest of the env so xstudio.exe runs against the build tree directly, plus the supporting fixes the build tree needed for that to work:

  • run_xstudio.bat.in — set XSTUDIO_ROOT, XSTUDIO_PLUGIN_PATH, XSTUDIO_PYTHONHOME, PYTHONPATH; add vcpkg's bin to PATH.
  • cmake/macros.cmake — stage preferences to bin/preference on Windows (was share/xstudio/preference), matching the Linux layout XSTUDIO_ROOT expects. The install(FILES ... DESTINATION share/xstudio/preference) rule sits outside the changed branch, so the install target is unaffected on either platform.
  • embedded_python.cpp — Windows now honours an optional XSTUDIO_PYTHONHOME env var, overriding the install-layout-derived path. Unset = previous behaviour.
  • python/CMakeLists.txt — Windows uses cmake -E copy_directory to populate site-packages. setup.py install --prefix=C:/... mangles the drive letter on Windows; the directory copy sidesteps it. New elseif(WIN32) branch; the Linux else() is unchanged.
  • extern/quickfuture / extern/quickpromise — add RUNTIME_OUTPUT_DIRECTORY so the QML plugin DLLs land next to their qmldir at build time. LIBRARY_OUTPUT_DIRECTORY only controls the .lib on Windows.

Linux / macOS impact

None. Every change is either Win32-gated or no-ops on non-Windows (setting RUNTIME_OUTPUT_DIRECTORY on a Linux shared lib has no effect; the XSTUDIO_PYTHONHOME env var is only consulted on Windows; the preference staging change collapses a redundant Win32 branch into the path Linux already used).

run_xstudio.bat now sets PATH, XSTUDIO_ROOT, XSTUDIO_PLUGIN_PATH,
XSTUDIO_PYTHONHOME and PYTHONPATH so xstudio.exe launches from the
build tree without a fresh `cmake --install`. Required follow-on
fixes to the build-tree staging of several resources:

- cmake/macros.cmake: stage preferences to bin/preference on Windows
  (was share/xstudio/preference). Removes the Win32 special case so
  Windows now matches Linux, which already staged there.

- src/embedded_python/src/embedded_python.cpp: Windows now honors an
  optional XSTUDIO_PYTHONHOME env var, overriding the install-layout-
  derived path (xstudio_root/../../bin/python3) which is wrong when
  XSTUDIO_ROOT points at the build tree. Unset = previous behavior.

- python/CMakeLists.txt: Windows uses `cmake -E copy_directory` to
  merge the source xstudio package with the .pyd in site-packages.
  `setup.py install --prefix=C:/...` mangles forward-slash absolute
  paths on Windows (drive letter dropped, rest treated as relative
  to CWD), leaving site-packages with only the .pyd. New elseif(WIN32)
  branch; the Linux else() block is the same as before.

- extern/quickfuture: add RUNTIME_OUTPUT_DIRECTORY so quickfuture.dll
  lands next to its qmldir at build time. LIBRARY_OUTPUT_DIRECTORY
  only controls the .lib on Windows; the DLL was going to
  extern/quickfuture/ where Qt couldn't find it when loading the QML
  module. RUNTIME_OUTPUT_DIRECTORY is a no-op for Linux shared libs.

- extern/quickpromise: same DLL-next-to-qmldir fix, Win32-gated.

All changes are Win32-gated or default to the old behavior when the
new env var is unset. Linux and macOS builds unchanged. Install and
package behavior unchanged.

Signed-off-by: Ben de Luca <bdeluca@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant