Skip to content

Commit e26d935

Browse files
committed
Generate swpython.bat inside the Windows install branch
1 parent 5d75c7d commit e26d935

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

cmake/InstallBundledPython.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,21 @@ install(CODE "
152152
endif()
153153
" COMPONENT Runtime)
154154

155+
# Install 'swpython.bat' wrapper that launches the bundled Python with
156+
# PYTHONHOME set, and prepends the bundle bin/ to PATH so use case scripts
157+
# can find the shapeworks CLI via shutil.which.
158+
set(_swpython_dir "${CMAKE_BINARY_DIR}/_bundled_python/swpython")
159+
file(MAKE_DIRECTORY "${_swpython_dir}")
160+
file(WRITE "${_swpython_dir}/swpython.bat"
161+
[=[@echo off
162+
set "LOC=%~dp0"
163+
set "PYTHONHOME=%LOC%..\lib\python"
164+
set "PATH=%LOC%;%PATH%"
165+
set "PYTHONPATH="
166+
"%PYTHONHOME%\python.exe" %*
167+
]=])
168+
install(PROGRAMS "${_swpython_dir}/swpython.bat" DESTINATION bin)
169+
155170
message(STATUS "InstallBundledPython: will install bundled Python to ${_python_dest}")
156171
return()
157172
endif() # WIN32

0 commit comments

Comments
 (0)