Skip to content
Snippets Groups Projects
Commit 9da55638 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

Merge branch 'pkg_tweaks' into 'develop'

Packaging tweaks

See merge request orfeotoolbox/otb!570
parents fcdfd63c 315e4ee2
No related branches found
No related tags found
3 merge requests!648Ci rcjob,!621Release 7.0 (master),!570Packaging tweaks
Pipeline #2390 passed
......@@ -23,6 +23,8 @@
# OTB before including OTBModuleMacros. This is the preferred way to build an
# OTB module outside of the OTB source tree.
include(GenerateExportHeaderCustom)
macro(otb_module_test)
include(../otb-module.cmake) # Load module meta-data
set(${otb-module-test}_LIBRARIES "")
......
......@@ -38,6 +38,7 @@ endif()
set(CONFIGURE_OPTIONS
"-DCMAKE_INSTALL_PREFIX=${PKG_PREFIX}"
"-DCMAKE_INSTALL_RPATH=${PKG_PREFIX}/lib"
"-DCMAKE_BUILD_TYPE=Release")
if(PYTHON_EXECUTABLE)
list(APPEND CONFIGURE_OPTIONS "-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}")
......
......@@ -18,6 +18,22 @@
# limitations under the License.
#
cat_path()
{
if [ $# -eq 0 ]; then exit 0; fi
if [ $# -eq 1 ]; then echo "$1"; exit 0; fi
cur="$1"
shift 1
next="$(cat_path $@)"
if [ -z "$cur" ]; then
echo "$next"
elif [ -z "$next" ]; then
echo "$cur"
else
echo "$cur:$next"
fi
}
# The below environment variables only affect current shell
# So if you run again from a terminal. you need to run the script again
# see how this is sourced in monteverdi.sh and mapla.sh
......@@ -26,11 +42,11 @@ CURRENT_DIR=$(cd -P -- "$(dirname -- "$BASH_SOURCE")" && printf '%s\n' "$(pwd -P
unset LD_LIBRARY_PATH
PATH=$CURRENT_DIR/bin:$PATH
PATH=$(cat_path "$CURRENT_DIR/bin" "$PATH")
GDAL_DATA=$CURRENT_DIR/share/data
GEOTIFF_CSV=$CURRENT_DIR/share/epsg_csv
PYTHONPATH=$CURRENT_DIR/lib/python:$PYTHONPATH
OTB_APPLICATION_PATH=$CURRENT_DIR/lib/otb/applications
PYTHONPATH=$(cat_path "$CURRENT_DIR/lib/python" "$PYTHONPATH")
OTB_APPLICATION_PATH=$(cat_path "$CURRENT_DIR/lib/otb/applications" "$OTB_APPLICATION_PATH")
GDAL_DRIVER_PATH="disable"
LC_NUMERIC=C
......
......@@ -16,15 +16,31 @@
:: 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.
@echo off
:: Setup environment for OTB package
set CURRENT_SCRIPT_DIR=%~dp0
set PATH=%CURRENT_SCRIPT_DIR%bin;%PATH%
call :prefix_path PATH "%CURRENT_SCRIPT_DIR%bin"
call :prefix_path PYTHONPATH "%CURRENT_SCRIPT_DIR%lib\python"
call :prefix_path OTB_APPLICATION_PATH "%CURRENT_SCRIPT_DIR%lib\otb\applications"
set GDAL_DATA=%CURRENT_SCRIPT_DIR%share\data
set GEOTIFF_CSV=%CURRENT_SCRIPT_DIR%share\epsg_csv
set PYTHONPATH=%CURRENT_SCRIPT_DIR%lib\python;%PYTHONPATH%
set OTB_APPLICATION_PATH=%CURRENT_SCRIPT_DIR%lib\otb\applications
set GDAL_DRIVER_PATH=disable
:: Set numeric locale to C
set LC_NUMERIC=C
goto :eof
:prefix_path
setlocal enabledelayedexpansion
set output=%~2
set var=%1
set content=
if not defined %var% ( goto :prefix_path_testcontent )
set content=!%var%!
:prefix_path_testcontent
if "%content%" == "" ( goto :prefix_path_end )
set output=%output%;%content%
:prefix_path_end
endlocal & set %1=%output%
goto :eof
......@@ -19,6 +19,22 @@
# limitations under the License.
#
cat_path()
{
if [ $# -eq 0 ]; then exit 0; fi
if [ $# -eq 1 ]; then echo "$1"; exit 0; fi
cur="$1"
shift 1
next="$(cat_path $@)"
if [ -z "$cur" ]; then
echo "$next"
elif [ -z "$next" ]; then
echo "$cur"
else
echo "$cur:$next"
fi
}
# The below environment variables only affect current shell
# So if you run again from a terminal. you need to run the script again
# see how this is sourced in monteverdi.sh and mapla.sh
......@@ -27,17 +43,13 @@ CMAKE_PREFIX_PATH=OUT_DIR
export CMAKE_PREFIX_PATH
# check and set OTB_APPLICATION_PATH
if [ -z "$OTB_APPLICATION_PATH" ] || [ "$OTB_APPLICATION_PATH" = "" ]; then
OTB_APPLICATION_PATH=OUT_DIR/lib/otb/applications
else
OTB_APPLICATION_PATH=OUT_DIR/lib/otb/applications:$OTB_APPLICATION_PATH
fi
OTB_APPLICATION_PATH=$(cat_path "OUT_DIR/lib/otb/applications" "$OTB_APPLICATION_PATH")
# Add bin direcotory to system PATH
PATH=OUT_DIR/bin:$PATH
PATH=$(cat_path "OUT_DIR/bin" "$PATH")
# export PYTHONPATH to import otbApplication.py
PYTHONPATH=OUT_DIR/lib/python:$PYTHONPATH
PYTHONPATH=$(cat_path "OUT_DIR/lib/python" "$PYTHONPATH")
# set numeric locale to C
LC_NUMERIC=C
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment