Commit 0887d40e authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: add otbcli and otbgui, use the same scripts for build and install

parent f65406d3
......@@ -13,7 +13,7 @@ macro(otb_create_application)
# Do not output in the standard lib folder where all shared libs goes.
# This is to avoid the application factory to look into each and every shared lib
# for itkLoad symbol
set_property(TARGET ${APPLICATION_TARGET_NAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${OTB_BINARY_DIR}/lib/otb/applications)
set_property(TARGET ${APPLICATION_TARGET_NAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/otb/applications)
# Remove the usual 'lib' prefix to make it clear it is a plugin
# and not a shared library to link against
......@@ -50,11 +50,11 @@ macro(otb_create_application)
if (WIN32)
set(SCRIPT_CLI_SOURCE ${OTB_SOURCE_DIR}/CMake/otbcli_app.bat.in)
set(SCRIPT_CLI_INTERMEDIATE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/otbcli_${APPLICATION_NAME}.bat)
set(SCRIPT_CLI_INSTALLABLE ${APPLICATION_BINARY_PATH}/otbcli_${APPLICATION_NAME}.bat)
set(SCRIPT_CLI_INSTALLABLE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/otbcli_${APPLICATION_NAME}.bat)
else()
set(SCRIPT_CLI_SOURCE ${OTB_SOURCE_DIR}/CMake/otbcli_app.sh.in)
set(SCRIPT_CLI_INTERMEDIATE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/otbcli_${APPLICATION_NAME})
set(SCRIPT_CLI_INSTALLABLE ${APPLICATION_BINARY_PATH}/otbcli_${APPLICATION_NAME})
set(SCRIPT_CLI_INSTALLABLE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/otbcli_${APPLICATION_NAME})
endif()
if (EXISTS ${SCRIPT_CLI_SOURCE})
......@@ -65,7 +65,7 @@ macro(otb_create_application)
# Copy it next to the application shared lib, and give executable rights
file(COPY ${SCRIPT_CLI_INTERMEDIATE}
DESTINATION ${APPLICATION_BINARY_PATH}
DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# Install a version of this script if we are inside the OTB build
......@@ -77,11 +77,11 @@ macro(otb_create_application)
if (WIN32)
set(SCRIPT_GUI_SOURCE ${OTB_SOURCE_DIR}/CMake/otbgui_app.bat.in)
set(SCRIPT_GUI_INTERMEDIATE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/otbgui_${APPLICATION_NAME}.bat)
set(SCRIPT_GUI_INSTALLABLE ${APPLICATION_BINARY_PATH}/otbgui_${APPLICATION_NAME}.bat)
set(SCRIPT_GUI_INSTALLABLE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/otbgui_${APPLICATION_NAME}.bat)
else()
set(SCRIPT_GUI_SOURCE ${OTB_SOURCE_DIR}/CMake/otbgui_app.sh.in)
set(SCRIPT_GUI_INTERMEDIATE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/otbgui_${APPLICATION_NAME})
set(SCRIPT_GUI_INSTALLABLE ${APPLICATION_BINARY_PATH}/otbgui_${APPLICATION_NAME})
set(SCRIPT_GUI_INSTALLABLE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/otbgui_${APPLICATION_NAME})
endif()
if (EXISTS ${SCRIPT_GUI_SOURCE})
......@@ -92,7 +92,7 @@ macro(otb_create_application)
# Copy it next to the application shared lib, and give executable rights
file(COPY ${SCRIPT_GUI_INTERMEDIATE}
DESTINATION ${APPLICATION_BINARY_PATH}
DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# Install a version of this script if we are inside the OTB build
......
@echo off
::
:: Autogenerated by OTB installation process
:: DO NOT MODIFY
::
set CURRENT_SCRIPT_DIR=%~dp0
if exist %CURRENT_SCRIPT_DIR%otbApplicationLauncherCommandLine.exe (
:: Prefer using the launcher inside the script dir
set OTB_CLI_LAUNCHER=%CURRENT_SCRIPT_DIR%otbApplicationLauncherCommandLine.exe
) else (
:: Use the one from the PATH
set OTB_CLI_LAUNCHER=otbApplicationLauncherCommandLine.exe
)
:: works for build dir
if exist @APPLICATION_BINARY_PATH@ (
set ITK_AUTOLOAD_PATH=@APPLICATION_BINARY_PATH@;%ITK_AUTOLOAD_PATH%
)
:: start the application
%OTB_CLI_LAUNCHER% %*
#!/bin/bash
#
# Autogenerated by OTB installation process
# DO NOT MODIFY
#
CURRENT_SCRIPT_DIR=`dirname $0`
if [ -e $CURRENT_SCRIPT_DIR/otbApplicationLauncherCommandLine ]
then
# Prefer using the launcher inside the script dir
OTB_CLI_LAUNCHER=$CURRENT_SCRIPT_DIR/otbApplicationLauncherCommandLine
else
# Use the one from the PATH
OTB_CLI_LAUNCHER=otbApplicationLauncherCommandLine
fi
# works for build dir
if [ -d @APPLICATION_BINARY_PATH@ ]
then
ITK_AUTOLOAD_PATH=@APPLICATION_BINARY_PATH@:$ITK_AUTOLOAD_PATH
fi
# export it to make it available to otbApplicationLauncherCommandLine environment
export ITK_AUTOLOAD_PATH
# start the application
$OTB_CLI_LAUNCHER "$@"
@echo off
::
:: Autogenerated by OTB installation process
:: DO NOT MODIFY
::
set CURRENT_SCRIPT_DIR=%~dp0
if exist %CURRENT_SCRIPT_DIR%otbApplicationLauncherQt.exe (
:: Prefer using the launcher inside the script dir
set OTB_GUI_LAUNCHER=%CURRENT_SCRIPT_DIR%otbApplicationLauncherQt.exe
) else (
:: Use the one from the PATH
set OTB_GUI_LAUNCHER=otbApplicationLauncherQt.exe
)
:: works for build dir
if exist @APPLICATION_BINARY_PATH@ (
set ITK_AUTOLOAD_PATH=@APPLICATION_BINARY_PATH@;%ITK_AUTOLOAD_PATH%
)
set LC_NUMERIC=C
:: start the application
%OTB_GUI_LAUNCHER% %*
#!/bin/bash
#
# Autogenerated by OTB installation process
# DO NOT MODIFY
#
CURRENT_SCRIPT_DIR=`dirname $0`
if [ -e $CURRENT_SCRIPT_DIR/otbApplicationLauncherQt ]
then
# Prefer using the launcher inside the script dir
OTB_GUI_LAUNCHER=$CURRENT_SCRIPT_DIR/otbApplicationLauncherQt
else
# Use the one from the PATH
OTB_GUI_LAUNCHER=otbApplicationLauncherQt
fi
# use the buildtree path to applications
if [ -d @APPLICATION_BINARY_PATH@ ]
then
ITK_AUTOLOAD_PATH=@APPLICATION_BINARY_PATH@:$ITK_AUTOLOAD_PATH
fi
# export it to make it available to otbApplicationLauncherCommandLine environment
export ITK_AUTOLOAD_PATH
# avoid numerical issues caused by locale
export LC_NUMERIC=C
# start the application
$OTB_GUI_LAUNCHER "$@"
......@@ -14,3 +14,38 @@ otb_module_target(OTBCommandLine)
add_executable(otbApplicationLauncherCommandLine otbApplicationLauncherCommandLine.cxx)
target_link_libraries(otbApplicationLauncherCommandLine OTBCommandLine)
otb_module_target(otbApplicationLauncherCommandLine)
# Where we will install the script in the build tree
get_target_property(CLI_OUPUT_DIR otbApplicationLauncherCommandLine RUNTIME_OUTPUT_DIRECTORY)
# Generate a script in the build dir, next to the cli launcher
# Need a two-step process since configure_file don't support permissions
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Scripts)
if (WIN32)
configure_file( ${CMAKE_SOURCE_DIR}/CMake/otbcli.bat.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Scripts/otbcli.bat
@ONLY )
file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Scripts/otbcli.bat
DESTINATION ${CLI_OUPUT_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# TODO : test if NO_INSTALL is set
install(PROGRAMS ${CLI_OUPUT_DIR}/otbcli.bat
DESTINATION ${OTBCommandLine_INSTALL_RUNTIME_DIR}
COMPONENT Runtime)
else()
configure_file( ${CMAKE_SOURCE_DIR}/CMake/otbcli.sh.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Scripts/otbcli
@ONLY )
file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Scripts/otbcli
DESTINATION ${CLI_OUPUT_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# TODO : test if NO_INSTALL is set
install(PROGRAMS ${CLI_OUPUT_DIR}/otbcli
DESTINATION ${OTBCommandLine_INSTALL_RUNTIME_DIR}
COMPONENT Runtime)
endif()
......@@ -89,3 +89,39 @@ target_link_libraries(otbApplicationLauncherQt
${OTBQt4_LIBRARIES}
)
otb_module_target(otbApplicationLauncherQt)
# Where we will install the script in the build tree
get_target_property(GUI_OUPUT_DIR otbApplicationLauncherQt RUNTIME_OUTPUT_DIRECTORY)
# Generate a script in the build dir, next to the gui launcher
# Need a two-step process since configure_file don't support permissions
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Scripts)
if (WIN32)
configure_file( ${CMAKE_SOURCE_DIR}/CMake/otbgui.bat.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Scripts/otbgui.bat
@ONLY )
file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Scripts/otbgui.bat
DESTINATION ${GUI_OUPUT_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# TODO : test if NO_INSTALL is set
install(PROGRAMS ${GUI_OUPUT_DIR}/otbgui.bat
DESTINATION ${OTBQtWidget_INSTALL_RUNTIME_DIR}
COMPONENT Runtime)
else()
configure_file( ${CMAKE_SOURCE_DIR}/CMake/otbgui.sh.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Scripts/otbgui
@ONLY )
file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Scripts/otbgui
DESTINATION ${GUI_OUPUT_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# TODO : test if NO_INSTALL is set
install(PROGRAMS ${GUI_OUPUT_DIR}/otbgui
DESTINATION ${OTBQtWidget_INSTALL_RUNTIME_DIR}
COMPONENT Runtime)
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