Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
c38c536f
Commit
c38c536f
authored
Apr 19, 2011
by
David Partyka
Browse files
Merge branch 'forwarding-executable-macro' into release
parents
a6c2dc72
309d7aa5
Changes
4
Hide whitespace changes
Inline
Side-by-side
CMake/vtk-forward.c.in
0 → 100644
View file @
c38c536f
/*=========================================================================
Program: VTK
Module: vtk-forward.c.in
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.vtk.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#define vtksys_SHARED_FORWARD_DIR_BUILD "@VTK_FORWARD_DIR_BUILD@"
#define vtksys_SHARED_FORWARD_PATH_BUILD @VTK_FORWARD_PATH_BUILD@
#define vtksys_SHARED_FORWARD_PATH_INSTALL @VTK_FORWARD_PATH_INSTALL@
#define vtksys_SHARED_FORWARD_EXE_BUILD "@VTK_FORWARD_DIR_BUILD@/@VTK_FORWARD_EXE@"
#define vtksys_SHARED_FORWARD_EXE_INSTALL "@VTK_FORWARD_DIR_INSTALL@/@VTK_FORWARD_EXE@"
#define vtksys_SHARED_FORWARD_OPTION_PRINT "--print"
#define vtksys_SHARED_FORWARD_OPTION_LDD "--ldd"
#include <vtksys/SharedForward.h>
int main(int argc, char** argv)
{
return vtksys_shared_forward_to_real(argc, argv);
}
CMake/vtkForwardingExecutable.cmake
0 → 100644
View file @
c38c536f
#----------------------------------------------------------------------------
# Function for adding an executable with support for shared forwarding.
# Typically, one just uses ADD_EXECUTABLE to add an executable target. However
# on linuxes when rpath is off, and shared libararies are on, to over come the
# need for setting the LD_LIBRARY_PATH, we use shared-forwarding. This macro
# makes it easier to employ shared forwarding if needed.
# ARGUMENTS:
# out_real_exe_suffix -- (out) suffix to be added to the exe-target to locate the
# real executable target when shared forwarding is employed.
# This is empty when shared forwarding is not needed.
# exe_name -- (in) exe target name i.e. the first argument to
# ADD_EXECUTABLE.
# Any remaining arguments are simply passed on to the ADD_EXECUTABLE call.
# While writing install rules for this executable. One typically does the
# following.
# INSTALL(TARGETS exe_name
# DESTINATION "bin"
# COMPONENT Runtime)
# IF (vtk_exe_suffix)
# # Shared forwarding enabled.
# INSTALL(TARGETS exe_name${out_real_exe_suffix}
# DESTINATION "lib"
# COMPONENT Runtime)
# ENDIF (vtk_exe_suffix)
#----------------------------------------------------------------------------
FUNCTION
(
vtk_add_executable_with_forwarding
out_real_exe_suffix
exe_name
)
if
(
NOT DEFINED VTK_INSTALL_LIB_DIR_CM24
)
MESSAGE
(
FATAL_ERROR
"VTK_INSTALL_LIB_DIR_CM24 variable must be set before calling add_executable_with_forwarding"
)
endif
(
NOT DEFINED VTK_INSTALL_LIB_DIR_CM24
)
add_executable_with_forwarding2
(
out_var
""
""
${
VTK_INSTALL_LIB_DIR_CM24
}
${
exe_name
}
${
ARGN
}
)
set
(
${
out_real_exe_suffix
}
"
${
out_var
}
"
PARENT_SCOPE
)
ENDFUNCTION
(
add_executable_with_forwarding
)
#----------------------------------------------------------------------------
FUNCTION
(
vtk_add_executable_with_forwarding2
out_real_exe_suffix
extra_build_dirs
extra_install_dirs
install_lib_dir
exe_name
)
SET
(
mac_bundle
)
IF
(
APPLE
)
set
(
largs
${
ARGN
}
)
LIST
(
FIND largs
"MACOSX_BUNDLE"
mac_bundle_index
)
IF
(
mac_bundle_index GREATER -1
)
SET
(
mac_bundle TRUE
)
ENDIF
(
mac_bundle_index GREATER -1
)
ENDIF
(
APPLE
)
SET
(
VTK_EXE_SUFFIX
)
IF
(
BUILD_SHARED_LIBS AND NOT mac_bundle
)
IF
(
NOT WIN32
)
SET
(
exe_output_path
${
EXECUTABLE_OUTPUT_PATH
}
)
IF
(
NOT EXECUTABLE_OUTPUT_PATH
)
SET
(
exe_output_path
${
CMAKE_BINARY_DIR
}
)
ENDIF
(
NOT EXECUTABLE_OUTPUT_PATH
)
SET
(
VTK_EXE_SUFFIX -real
)
SET
(
VTK_FORWARD_DIR_BUILD
"
${
exe_output_path
}
"
)
SET
(
VTK_FORWARD_DIR_INSTALL
"../
${
install_lib_dir
}
"
)
SET
(
VTK_FORWARD_PATH_BUILD
"
\"
${
VTK_FORWARD_DIR_BUILD
}
\"
"
)
SET
(
VTK_FORWARD_PATH_INSTALL
"
\"
${
VTK_FORWARD_DIR_INSTALL
}
\"
"
)
FOREACH
(
dir
${
extra_build_dirs
}
)
SET
(
VTK_FORWARD_PATH_BUILD
"
${
VTK_FORWARD_PATH_BUILD
}
,
\"
${
dir
}
\"
"
)
ENDFOREACH
(
dir
)
FOREACH
(
dir
${
extra_install_dirs
}
)
SET
(
VTK_FORWARD_PATH_INSTALL
"
${
VTK_FORWARD_PATH_INSTALL
}
,
\"
${
dir
}
\"
"
)
ENDFOREACH
(
dir
)
SET
(
VTK_FORWARD_EXE
${
exe_name
}
)
CONFIGURE_FILE
(
${
ParaView_CMAKE_DIR
}
/vtk-forward.c.in
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
exe_name
}
-forward.c
@ONLY IMMEDIATE
)
add_executable
(
${
exe_name
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
exe_name
}
-forward.c
)
set_target_properties
(
${
exe_name
}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/launcher
)
ADD_DEPENDENCIES
(
${
exe_name
}
${
exe_name
}${
VTK_EXE_SUFFIX
}
)
ENDIF
(
NOT WIN32
)
ENDIF
(
BUILD_SHARED_LIBS AND NOT mac_bundle
)
add_executable
(
${
exe_name
}${
VTK_EXE_SUFFIX
}
${
ARGN
}
)
set_target_properties
(
${
exe_name
}${
VTK_EXE_SUFFIX
}
PROPERTIES
OUTPUT_NAME
${
exe_name
}
)
set
(
${
out_real_exe_suffix
}
"
${
VTK_EXE_SUFFIX
}
"
PARENT_SCOPE
)
ENDFUNCTION
(
add_executable_with_forwarding2
)
CMake/vtkTargetExportMacros.cmake
View file @
c38c536f
...
...
@@ -3,11 +3,16 @@ if(NOT VTK_INSTALL_EXPORT_NAME)
endif
()
MACRO
(
VTK_ADD_LIBRARY name
)
ADD_LIBRARY
(
${
name
}
${
ARGN
}
)
SET_PROPERTY
(
GLOBAL APPEND PROPERTY VTK_TARGETS
${
name
}
)
add_library
(
${
name
}
${
ARGN
}
)
set_property
(
GLOBAL APPEND PROPERTY VTK_TARGETS
${
name
}
)
ENDMACRO
(
VTK_ADD_LIBRARY
)
MACRO
(
VTK_ADD_EXECUTABLE name
)
ADD_EXECUTABLE
(
${
name
}
${
ARGN
}
)
SET_PROPERTY
(
GLOBAL APPEND PROPERTY VTK_TARGETS
${
name
}
)
if
(
UNIX AND VTK_BUILD_FORWARDING_EXECUTABLES
)
add_executable_with_forwarding
(
VTK_EXE_SUFFIX
${
name
}
${
ARGN
}
)
set_property
(
GLOBAL APPEND PROPERTY VTK_TARGETS
${
name
}
)
else
()
add_executable
(
${
name
}
${
ARGN
}
)
set_property
(
GLOBAL APPEND PROPERTY VTK_TARGETS
${
name
}
)
endif
()
ENDMACRO
(
VTK_ADD_EXECUTABLE
)
CMakeLists.txt
View file @
c38c536f
...
...
@@ -302,6 +302,15 @@ STRING(REGEX REPLACE "^/" "" VTK_INSTALL_DOC_DIR_CM24 "${VTK_INSTALL_DOC_DIR}")
STRING
(
REGEX REPLACE
"^/"
""
VTK_INSTALL_TCL_DIR_CM24
"
${
VTK_INSTALL_TCL_DIR
}
"
)
STRING
(
REGEX REPLACE
"^/"
""
VTK_INSTALL_JAVA_DIR_CM24
"
${
VTK_INSTALL_JAVA_DIR
}
"
)
#-----------------------------------------------------------------------------
# Provide option to build executables as forwarding executables where by a launcher that
# sets the appropriate environment is installed in /bin/ which then 'launches' the 'real'
# executable under lib.
if
(
UNIX
)
OPTION
(
VTK_BUILD_FORWARDING_EXECUTABLES
"Build forwarding executables for vtk, vtkpython, etc."
OFF
)
MARK_AS_ADVANCED
(
VTK_BUILD_FORWARDING_EXECUTABLES
)
endif
()
#-----------------------------------------------------------------------------
# Save the compiler settings so another project can import them.
CMAKE_EXPORT_BUILD_SETTINGS
(
${
VTK_BINARY_DIR
}
/VTKBuildSettings.cmake
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment