Commit 12059084 authored by pieper's avatar pieper
Browse files

ENH: new launcher mechanism based on tclkit (same as slicer2) to provide fast...

ENH: new launcher mechanism based on tclkit (same as slicer2) to provide fast feedback to users during launch process

git-svn-id: 3bd1e089-480b-0410-8dfb-8563597acbee
parent 4124a6f7
......@@ -193,6 +193,9 @@ ENDIF (Slicer3_BUILD_TESTING)
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
# Launcher for slicer
# Package slicer
......@@ -208,7 +211,6 @@ ENDIF(BUILD_DOCUMENTATION)
......@@ -11,14 +11,14 @@ IF(${launcher_platform} MATCHES Windows)
ENDIF(${launcher_platform} MATCHES Windows)
STRING ( TOLOWER "${launcher_platform}" launcher_platform )
SET (launcher_name "Slicer3-${launcher_platform}")
SET (launcher_name "Slicer3-${launcher_platform}${CMAKE_EXECUTABLE_SUFFIX}")
MESSAGE ( "launcher name is ${launcher_name}" )
SET ( launcher_binary
CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/Slicer3Launchers/${launcher_name}"
Slicer3 Launcher info - sp 2007-02-09
Important files:
slicer3.vfs/main.tcl --- controls the launch processes
make-launcers.tcl --- regenerates the toplevel executables
This launcher code addresses a long-standing issue about
just how to conveniently have different slicer versions
in arbitrary directories. The old method was to set the SLICER_HOME
variable in the script (either slicer or slicer.bat) and let
it be overridden by an environment variable, but this was
confusing to users and prone to error.
This method uses the tcl-plus-script-in-a-binary method so there's
a single entry point to slicer that automatically sets the SLICER_HOME
variable before launching the appropriate shell or batch script.
Ultimately, we can put more and more of the functionality of the shell
and batch script into the startup script in the launcher, but for now it's
just a simple dialog and passing the args.
The linux and solaris versions use the brand new "starpack" concept
(see and can be generated using the make-launcher.tcl
script. These are build by running make-launchers.tcl on any platform.
The incorporate slicer3.vfs/main.tcl into the newly created executable.
Be sure to run tclkitsh where available (windows) to avoid entering into
an infinite loop in the tk event loop.
Note: this code is ported from slicer2.
# slicer3.vfs/main.tcl
# This is the first entry point for slicer3. This is run from a "starpack"
# which is STand Alone Runtime version of tcl. (see
# The purpose is the this script to determine where the executable is located
# and set the environment variable SLICER_HOME accordingly; all other slicer
# files should be found relative to that dir.
# We then source the launch.tcl script from the lib directory of top level of SLICER_HOME
# which does the rest from there.
package require Tk
wm withdraw .
# follow links to find "real" install dir
set cmdname [file dir [info script]]
while { [file type $cmdname] == "link" } {
set cmdname [file readlink $cmdname]
set env(SLICER_HOME) [file dir $cmdname]
source $env(SLICER_HOME)/lib/launch.tcl
# \
exec tclkitsh "$0" ${1+"$@"}
# make-launchers.tcl
set __comment {
This script creates the stand-alone executables
(starpacks) to startup slicer from an arbitrary directory.
See for info about starkits and starpacks.
* you'll need to have tclkitsh in your path somewhere
* the tclkitsh you use to generate the launcher cannot be the same one as the
-runtime argument (cannot be circular).
* this can be run on any platform to generate launchers for all the platforms
* the 32 bit linux launcher can be used for both 32 and 64 bit installs
(probably the same for win32 and win64)
* solaris has been dropped from this list for now, but presumably solaris,
irix, aix, and other 'old' systems can be added if needed.
cd [file dirname [info script]]
puts "making linux..."
exec tclkitsh tclkits/sdx.kit wrap slicer3 -runtime tclkits/tclkit-linux-x86
file rename -force slicer3 slicer3launchers/slicer3-linux-x86
puts "making win32..."
exec tclkitsh tclkits/sdx.kit wrap slicer3 -runtime tclkits/tclkit-win32.exe
file rename -force slicer3 slicer3launchers/slicer3-win32.exe
puts "making darwin-ppc..."
exec tclkitsh tclkits/sdx.kit wrap slicer3 -runtime tclkits/tclkit-darwin-ppc
file rename -force slicer3 slicer3launchers/slicer3-darwin-ppc
puts "making darwin-x86..."
exec tclkitsh tclkits/sdx.kit wrap slicer3 -runtime tclkits/tclkit-darwin-x86
file rename -force slicer3 slicer3launchers/slicer3-darwin-x86
Note: as of 2006-03-31 the x86_64 version of tclkit has an unresolved
dependency on a version that is not present on some
linux machines.
To get around this, the x86_64 executable is actually the same as the
x86 executable, since that version runs fine on both architectures.
The reason it exists is simply to give people a path with the correct
extension to match the build type. The actual machine architecture is
determined at run time.
......@@ -35,6 +35,7 @@ set ::env(SANDBOX_BIN_DIR) ""
set ::env(TCL_LIB_DIR) [file dirname $::env(TCL_LIBRARY)]
set ::env(TEEM_DIR) @TEEM_DIR@
set ::BATCH "false"
......@@ -127,8 +128,8 @@ proc launch_SetPaths {} {
set ::env(LD_LIBRARY_PATH) $::env(VTK_DIR)/bin:$::env(LD_LIBRARY_PATH)
set ::env(LD_LIBRARY_PATH) $::env(KWWidgets_DIR)/bin:$::env(LD_LIBRARY_PATH)
set ::env(LD_LIBRARY_PATH) $::env(ITK_DIR)/bin:$::env(LD_LIBRARY_PATH)
set ::env(LD_LIBRARY_PATH) $::env(SANDBOX_BIN_DIR)/../Distributions/bin:$::env(LD_LIBRARY_PATH)
#set ::env(LD_LIBRARY_PATH) $::env(SANDBOX_BIN_DIR)/../Distributions/bin:$::env(LD_LIBRARY_PATH)
set ::env(LD_LIBRARY_PATH) $::env(SLICER_HOME)/Base/builds/$::env(BUILD)/bin:$::env(LD_LIBRARY_PATH)
set ::env(LD_LIBRARY_PATH) $::env(TCL_LIB_DIR):$::env(LD_LIBRARY_PATH)
set ::env(LD_LIBRARY_PATH) $::env(TEEM_DIR):$::env(LD_LIBRARY_PATH)
......@@ -137,8 +138,8 @@ proc launch_SetPaths {} {
set ::env(DYLD_LIBRARY_PATH) $::env(VTK_DIR)/bin:$::env(DYLD_LIBRARY_PATH)
set ::env(DYLD_LIBRARY_PATH) $::env(KWWidgets_DIR)/bin:$::env(DYLD_LIBRARY_PATH)
set ::env(DYLD_LIBRARY_PATH) $::env(ITK_DIR)/bin:$::env(DYLD_LIBRARY_PATH)
set ::env(DYLD_LIBRARY_PATH) $::env(SANDBOX_BIN_DIR)/../Distributions/bin:$::env(DYLD_LIBRARY_PATH)
#set ::env(DYLD_LIBRARY_PATH) $::env(SANDBOX_BIN_DIR)/../Distributions/bin:$::env(DYLD_LIBRARY_PATH)
set ::env(DYLD_LIBRARY_PATH) $::env(SLICER_HOME)/Base/builds/$::env(BUILD)/bin:$::env(DYLD_LIBRARY_PATH)
......@@ -147,8 +148,8 @@ proc launch_SetPaths {} {
set ::env(Path) $::env(VTK_DIR)/bin/$::env(VTK_BUILD_SUBDIR)\;$::env(Path)
set ::env(Path) $::env(KWWidgets_DIR)/bin/$::env(VTK_BUILD_SUBDIR)\;$::env(Path)
set ::env(Path) $::env(ITK_DIR)/bin/$::env(VTK_BUILD_SUBDIR)\;$::env(Path)
set ::env(Path) $::env(SANDBOX_BIN_DIR)/$::env(VTK_BUILD_SUBDIR)\;$::env(Path)
set ::env(Path) $::env(SANDBOX_BIN_DIR)/../Distributions/bin/$::env(VTK_BUILD_SUBDIR)\;$::env(Path)
#set ::env(Path) $::env(SANDBOX_BIN_DIR)/$::env(VTK_BUILD_SUBDIR)\;$::env(Path)
#set ::env(Path) $::env(SANDBOX_BIN_DIR)/../Distributions/bin/$::env(VTK_BUILD_SUBDIR)\;$::env(Path)
set ::env(Path) $::env(SLICER_HOME)/Base/builds/$::env(BUILD)/bin/$::env(VTK_BUILD_SUBDIR)\;$::env(Path)
set ::env(Path) $::env(TEEM_DIR)\;$::env(Path)
} else {
......@@ -181,6 +182,18 @@ proc launch_SetPaths {} {
set ::env(TCLLIBPATH) "$::env(SLICER_HOME)/Base/Wrapping/Tcl/vtkSlicerBase $::env(TCLLIBPATH)"
# optional - show splash screen
proc launch_SplashScreen {} {
toplevel .splash
label .splash.l -text starting...
pack .splash.l
after 1000 "destroy .splash.l"
# optional - show dialog
......@@ -340,6 +353,8 @@ launch_InitEnvironment
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment