Commit 5eac2934 authored by jcfr's avatar jcfr
Browse files

COMP: Application/SlicerQT/CMakeLists.txt - Forwarded executable is not built anymore

The name of the executable is still SlicerQT-real so that existing
launcher can still refer to it.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15644 3bd1e089-480b-0410-8dfb-8563597acbee
parent a8bd5a1a
PROJECT(SlicerQT)
# --------------------------------------------------------------------------
# Enable shared link forwarding support if needed.
#
# get_filename_component(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH)
# get_filename_component(TCL_DIR "${TCL_LIBRARY_PATH}" PATH)
# get_filename_component(INCR_TCL_LIBRARY_PATH "${INCR_TCL_LIBRARY}" PATH)
# get_filename_component(INCR_TK_LIBRARY_PATH "${INCR_TK_LIBRARY}" PATH)
SET(SlicerQT_EXE_SUFFIX)
SET(SlicerQT_EXE_INSTALL ${Slicer_INSTALL_BIN_DIR})
IF(BUILD_SHARED_LIBS)
SET(SlicerQT_NEED_SHARED_FORWARD 1)
SET(SlicerQT_EXE_SUFFIX -real)
SET(SlicerQT_EXE_INSTALL ".")
SET(SlicerQT_FORWARD_DIR_BUILD "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
SET(SlicerQT_FORWARD_DIR_INSTALL "${SlicerQT_EXE_INSTALL}")
if(WIN32)
#Nota: Removed the following
#\"${KWWidgets_RUNTIME_DIRS}\" CONFIG_DIR_POST,
#\"${TCL_DIR}/bin\",
#\"${INCR_TCL_LIBRARY_PATH}\",
#\"${INCR_TK_LIBRARY_PATH}\"
SET(SlicerQT_FORWARD_PATH_BUILD
"\"${SlicerQT_FORWARD_DIR_BUILD}\" CONFIG_DIR_POST, \\
\"${VTK_DIR}/bin\" CONFIG_DIR_POST, \\
\"${ITK_DIR}/bin\" CONFIG_DIR_POST, \\
\"${Teem_DIR}/bin\" CONFIG_DIR_POST")
#SET(SlicerQT_FORWARD_PATH_INSTALL
# "\"../lib/TclTk/bin\",
# \"../lib/TclTk/lib/itcl${INCR_TCL_VERSION_DOT}\",
# \"../lib/TclTk/lib/itk${INCR_TCL_VERSION_DOT}\"")
IF(Slicer_BUILD_QTLOADABLEMODULES)
SET(SlicerQT_FORWARD_PATH_BUILD
"${SlicerQT_FORWARD_PATH_BUILD}, \\
\"${Slicer_HOME}/${Slicer_INSTALL_QTLOADABLEMODULES_BIN_DIR}\" CONFIG_DIR_POST")
SET(SlicerQT_FORWARD_PATH_INSTALL
"\"../${Slicer_INSTALL_QTLOADABLEMODULES_BIN_DIR}\"")
# Since ModuleLogic are in Slicer_INSTALL_MODULES_BIN_DIR, let's add it
SET(Slicer_FORWARD_PATH_BUILD
"${Slicer_FORWARD_PATH_BUILD}, \\
\"${Slicer_HOME}/${Slicer_INSTALL_MODULES_BIN_DIR}\" CONFIG_DIR_POST")
ENDIF(Slicer_BUILD_QTLOADABLEMODULES)
#IF(Slicer_BUILD_MODULES)
# SET(Slicer_FORWARD_PATH_BUILD
# "${Slicer_FORWARD_PATH_BUILD},\"${Slicer_HOME}/${Slicer_INSTALL_MODULES_BIN_DIR}\" CONFIG_DIR_POST")
#ENDIF(Slicer_BUILD_MODULES)
IF(Slicer_BUILD_CLI)
SET(SlicerQT_FORWARD_PATH_BUILD
"${SlicerQT_FORWARD_PATH_BUILD}, \\
\"${Slicer_HOME}/${Slicer_INSTALL_PLUGINS_BIN_DIR}\" CONFIG_DIR_POST")
ENDIF(Slicer_BUILD_CLI)
ELSE(WIN32)
#Nota: Removed the following
#\"${KWWidgets_RUNTIME_DIRS}\",
#\"${TCL_DIR}/bin\",
#\"${INCR_TCL_LIBRARY_PATH}\",
#\"${INCR_TK_LIBRARY_PATH}\",
SET(SlicerQT_FORWARD_PATH_BUILD
"\"${Slicer_FORWARD_DIR_BUILD}\", \\
\"${VTK_DIR}/bin\", \\
\"${ITK_DIR}/bin\", \\
\"${Teem_DIR}/bin\", \\
\"${OPENGL_gl_LIBRARY_PATH}\"")
# Nota: Removed the following
#\"../lib/KWWidgets\",\"../lib/InsightToolkit\",
#\"../lib/TclTk/lib\",
#\"../lib/TclTk/lib/itcl${INCR_TCL_VERSION_DOT}\",
#\"../lib/TclTk/lib/itk${INCR_TCL_VERSION_DOT}\",
SET(SlicerQT_FORWARD_PATH_INSTALL
"\"../${Slicer_INSTALL_LIB_DIR}\", \\
\"../lib/vtk-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}\", \\
\"../lib/Teem-${Teem_VERSION_MAJOR}.${Teem_VERSION_MINOR}\", \\
\"../lib/FreeSurfer\", \\
\"../lib/IGT\", \\
\"../lib/ITKCommandIO\", \\
\"../lib/LoadableModule\", \\
\"../lib/MGHImageIO\", \\
\"../lib/MRML\", \\
\"../lib/MRMLCLI\", \\
\"../lib/MRMLLogic\", \\
\"../lib/MRMLDisplayableManager\", \\
\"../lib/ModuleDescriptionParser\", \\
\"../lib/MRMLIDImageIO\", \\
\"../lib/Qdec\", \\
\"../lib/RemoteIO\", \\
\"../lib/SlicerIO\", \\
\"../lib/tclap\", \\
\"../lib/vtkITK\", \\
\"../lib/vtkTeem\"")
IF(Slicer_BUILD_QTLOADABLEMODULES)
SET(SlicerQT_FORWARD_PATH_BUILD
"${SlicerQT_FORWARD_PATH_BUILD}, \\
\"${Slicer_HOME}/${Slicer_INSTALL_QTLOADABLEMODULES_BIN_DIR}\"")
SET(SlicerQT_FORWARD_PATH_INSTALL
"${SlicerQT_FORWARD_PATH_INSTALL}, \\
\"../${Slicer_INSTALL_QTLOADABLEMODULES_BIN_DIR}\"")
# Since ModuleLogic are in Slicer_INSTALL_MODULES_BIN_DIR, let's add it
SET(Slicer_FORWARD_PATH_BUILD
"${Slicer_FORWARD_PATH_BUILD}, \\
\"${Slicer_HOME}/${Slicer_INSTALL_MODULES_BIN_DIR}\"")
ENDIF(Slicer_BUILD_QTLOADABLEMODULES)
#IF(Slicer_BUILD_MODULES)
# SET(Slicer_FORWARD_PATH_BUILD
# "${Slicer_FORWARD_PATH_BUILD},\"${Slicer_HOME}/${Slicer_INSTALL_MODULES_BIN_DIR}\"")
#ENDIF(Slicer_BUILD_MODULES)
IF(Slicer_BUILD_CLI)
SET(SlicerQT_FORWARD_PATH_BUILD
"${SlicerQT_FORWARD_PATH_BUILD}, \\
\"${Slicer_HOME}/${Slicer_INSTALL_PLUGINS_BIN_DIR}\"")
ENDIF(Slicer_BUILD_CLI)
ENDIF(WIN32)
# IF(Slicer_BUILD_MODULES)
# SET(Slicer_FORWARD_PATH_INSTALL
# "${Slicer_FORWARD_PATH_INSTALL},\"../${Slicer_INSTALL_MODULES_BIN_DIR}\"")
# ENDIF(Slicer_BUILD_MODULES)
IF(Slicer_BUILD_CLI)
SET(SlicerQT_FORWARD_PATH_INSTALL
"${SlicerQT_FORWARD_PATH_INSTALL},\"../${Slicer_INSTALL_PLUGINS_BIN_DIR}\"")
ENDIF(Slicer_BUILD_CLI)
ENDIF(BUILD_SHARED_LIBS)
# --------------------------------------------------------------------------
#MESSAGE(STATUS SlicerQT_FORWARD_DIR_BUILD:${SlicerQT_FORWARD_DIR_BUILD})
#MESSAGE(STATUS SlicerQT_FORWARD_PATH_BUILD:${SlicerQT_FORWARD_PATH_BUILD})
#MESSAGE(STATUS SlicerQT_FORWARD_PATH_INSTALL:${SlicerQT_FORWARD_PATH_INSTALL})
#MESSAGE(STATUS SlicerQT_FORWARD_DIR_BUILD:${SlicerQT_FORWARD_DIR_BUILD})
#MESSAGE(STATUS SlicerQT_FORWARD_DIR_INSTALL:${SlicerQT_FORWARD_DIR_INSTALL})
# Add main server executables.
SET(SlicerQT_EXE_LIST SlicerQT)
# Add shared link forwarding executables if necessary.
IF(SlicerQT_NEED_SHARED_FORWARD)
FOREACH(slicer_exe ${SlicerQT_EXE_LIST})
SET(SlicerQT_FORWARD_EXE ${slicer_exe}${SlicerQT_EXE_SUFFIX})
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/SlicerQT-forward.c.in
${CMAKE_CURRENT_BINARY_DIR}/${slicer_exe}-forward.c
@ONLY)
ADD_EXECUTABLE(${slicer_exe} WIN32
${CMAKE_CURRENT_BINARY_DIR}/${slicer_exe}-forward.c)
ADD_DEPENDENCIES(${slicer_exe} ${SlicerQT_FORWARD_EXE})
SET_TARGET_PROPERTIES(${slicer_exe} PROPERTIES LABELS SlicerQT)
INSTALL(TARGETS ${slicer_exe}
DESTINATION ${Slicer_INSTALL_BIN_DIR}
COMPONENT Runtime)
ENDFOREACH(slicer_exe)
ENDIF(SlicerQT_NEED_SHARED_FORWARD)
# --------------------------------------------------------------------------
# Sources
# --------------------------------------------------------------------------
......@@ -270,6 +103,7 @@ install(TARGETS ${lib_name}
# Build the executable
# --------------------------------------------------------------------------
SET(SlicerQT_EXE_SUFFIX -real)
ADD_EXECUTABLE(SlicerQT${SlicerQT_EXE_SUFFIX}
Main.cxx)
SET_TARGET_PROPERTIES(SlicerQT${SlicerQT_EXE_SUFFIX} PROPERTIES LABELS SlicerQT)
......
/*==============================================================================
Program: 3D Slicer
Copyright (c) 2010 Kitware Inc.
See Doc/copyright/copyright.txt
or http://www.slicer.org/copyright/copyright.txt for details.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
and was partially funded by NIH grant 3P41RR013218-12S1
==============================================================================*/
#if defined(_WIN32)
# if defined(CMAKE_INTDIR)
# define vtksys_SHARED_FORWARD_CONFIG_NAME CMAKE_INTDIR
# define CONFIG_DIR_PRE CMAKE_INTDIR "/"
# define CONFIG_DIR_POST "/" CMAKE_INTDIR
# else
# define CONFIG_DIR_PRE ""
# define CONFIG_DIR_POST ""
# endif
#endif
#define vtksys_SHARED_FORWARD_DIR_BUILD "@SlicerQT_FORWARD_DIR_BUILD@"
#define vtksys_SHARED_FORWARD_PATH_BUILD @SlicerQT_FORWARD_PATH_BUILD@
#define vtksys_SHARED_FORWARD_PATH_INSTALL @SlicerQT_FORWARD_PATH_INSTALL@
#if defined(_WIN32)
# define vtksys_SHARED_FORWARD_EXE_BUILD CONFIG_DIR_PRE "@SlicerQT_FORWARD_EXE@"
#else
# define vtksys_SHARED_FORWARD_EXE_BUILD "@SlicerQT_FORWARD_DIR_BUILD@/@SlicerQT_FORWARD_EXE@"
#endif
#define vtksys_SHARED_FORWARD_EXE_INSTALL "@SlicerQT_FORWARD_DIR_INSTALL@/@SlicerQT_FORWARD_EXE@"
#define vtksys_SHARED_FORWARD_OPTION_PRINT "--print"
#define vtksys_SHARED_FORWARD_OPTION_LDD "--ldd"
#include <vtksys/SharedForward.h>
int Launcher_main(int argc, char** argv)
{
return vtksys_shared_forward_to_real(argc, argv);
}
#ifdef _WIN32
#include <windows.h>
int __stdcall WinMain(HINSTANCE h1, HINSTANCE h2, LPSTR lpCmdLine, int i1)
{
int argc;
char **argv;
int ret;
size_t lpCmdLine_len;
size_t i;
int j;
size_t pos;
int argc_idx = 1;
if (!lpCmdLine)
{
return 1;
}
// A space delimites an argument except when it is inside a quote
argc = 1;
lpCmdLine_len = strlen(lpCmdLine);
for (i = 0; i < lpCmdLine_len; i++)
{
while (isspace(lpCmdLine[i]) && i < lpCmdLine_len)
{
i++;
}
if (i < lpCmdLine_len)
{
if (lpCmdLine[i] == '\"')
{
i++;
while (lpCmdLine[i] != '\"' && i < lpCmdLine_len)
{
i++;
}
argc++;
}
else
{
while (!isspace(lpCmdLine[i]) && i < lpCmdLine_len)
{
i++;
}
argc++;
}
}
}
argv = (char**)malloc(sizeof(char*) * (argc + 1));
argv[argc] = NULL;
// Set the first arg to be the exec name
argv[0] = (char*)malloc(sizeof(char)* 1024);
#ifdef _WIN32
GetModuleFileName(0, argv[0], 1024);
#else
argv[0][0] = '\0';
#endif
// Allocate the others
for (j = 1; j < argc; j++)
{
argv[j] = (char*)malloc(sizeof(char)*(lpCmdLine_len + 10));
}
// Grab the args
for (i = 0; i < lpCmdLine_len; i++)
{
while (isspace(lpCmdLine[i]) && i < lpCmdLine_len)
{
i++;
}
if (i < lpCmdLine_len)
{
if (lpCmdLine[i] == '\"')
{
i++;
pos = i;
while (lpCmdLine[i] != '\"' && i < lpCmdLine_len)
{
i++;
}
memcpy(argv[argc_idx], &lpCmdLine[pos], i - pos);
argv[argc_idx][i - pos] = '\0';
argc_idx++;
}
else
{
pos = i;
while (!isspace(lpCmdLine[i]) && i < lpCmdLine_len)
{
i++;
}
memcpy(argv[argc_idx], &lpCmdLine[pos], i - pos);
argv[argc_idx][i - pos] = '\0';
argc_idx++;
}
}
}
ret = Launcher_main(argc, argv);
for (i = 0; i < (size_t)argc; i++) { free( argv[i] ); }
free( argv );
return ret;
}
int main(int argc, char *argv[])
{
return Launcher_main(argc, argv);
}
#else
int main(int argc, char *argv[])
{
return Launcher_main(argc, argv);
}
#endif
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