Commit 33000a88 authored by Rashad Kanavath's avatar Rashad Kanavath

TEST: fix build_examples.cmake script (unix)

parent 3b757052
if(NOT SRC_DIR)
message(FATAL_ERROR "SRC_DIR=${SRC_DIR}")
message(FATAL_ERROR "SRC_DIR is not set")
endif()
if(NOT MAKE_PROGRAM)
message(FATAL_ERROR "MAKE_PROGRAM is not set")
endif()
set(PKG_DIR)
......@@ -16,6 +20,7 @@ endif()
message("TEST_DIR=${TEST_DIR}")
message("PKG_DIR=${PKG_DIR}")
message("SRC_DIR=${SRC_DIR}")
message("MAKE_PROGRAM=${MAKE_PROGRAM}")
# if( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
# find_program(GREP grep)
......@@ -44,10 +49,15 @@ execute_process(
)
if( configure_rv )
message(FATAL_ERROR "Configure test failed.\nconfigure_ov=${configure_ov}")
message(FATAL_ERROR "Configure FAILED. configure_ov:\n${configure_ov}")
return()
else()
message("Configure PASSED. configure_ov:\n${configure_ov}")
endif()
# If you want to test building a third targert, use foreach.
# the code is written in a way that it is easy to stuff these two
# into a cmake foreach
execute_process(COMMAND ${MAKE_PROGRAM} HelloWorldOTB
WORKING_DIRECTORY ${TEST_DIR}
RESULT_VARIABLE build_HelloWorldOTB_rv
......@@ -56,22 +66,22 @@ execute_process(COMMAND ${MAKE_PROGRAM} HelloWorldOTB
)
if( build_HelloWorldOTB_rv )
message(FATAL_ERROR
"Build test failed.\nbuild_HelloWorldOTB_ov=${build_HelloWorldOTB_ov}")
message(FATAL_ERROR "Build FAILED. build_HelloWorldOTB_ov:\n${build_HelloWorldOTB_ov}")
return()
else()
message("Build PASSED. build_HelloWorldOTB_ov:\n${build_HelloWorldOTB_ov}")
endif()
execute_process(COMMAND ${MAKE_PROGRAM} Pipeline
WORKING_DIRECTORY ${TEST_DIR}
RESULT_VARIABLE build_Pipeline_rv
OUTPUT_VARIABLE build_Pipeline_ov
ERROR_VARIABLE build_Pipeline_ov
)
# execute_process(COMMAND ${MAKE_PROGRAM} Pipeline
# WORKING_DIRECTORY ${TEST_DIR}
# RESULT_VARIABLE build_Pipeline_rv
# OUTPUT_VARIABLE build_Pipeline_ov
# ERROR_VARIABLE build_Pipeline_ov
# )
# if( build_Pipeline_rv )
# message(FATAL_ERROR
# "Build test failed.\nbuild_Pipeline_ov=${build_Pipeline_ov}")
# return()
# endif()
if( build_Pipeline_rv )
message(FATAL_ERROR "Build FAILED. build_Pipeline_ov=${build_Pipeline_ov}")
return()
else()
message("Build PASSED. build_Pipeline_ov=${build_Pipeline_ov}")
endif()
......@@ -30,17 +30,22 @@ OUT_DIR=$(pwd)
PATCH_ELF_EXE="$OUT_DIR/patchelf"
#do not move below 3 lines. it must be before "unset LD_LIBRARY_PATH" code
sed -i "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/setup_python.sh"
chmod +x $OUT_DIR/setup_python.sh
./setup_python.sh
#do not move below block. it must be before "unset LD_LIBRARY_PATH" code
#check if we have any python bindings
set OTB_PYTHON_LIB_PATH=
if [ -f "$OUT_DIR/lib/python/_otbApplication.so" ] ; then
sed -i "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/setup_python.sh"
chmod +x $OUT_DIR/setup_python.sh
. ./setup_python.sh
set OTB_PYTHON_LIB_PATH=$OUT_DIR/lib/python
fi
# No no interference with LD_LIBRARY_PATH
unset LD_LIBRARY_PATH
#RK: We cannot avoid -maxdepth 1 option in find command below because,
# there are files in $OUT_DIR/lib/gtk which we CANNOT add new rpath
BINARY_FILES=$(find $OUT_DIR/lib/python $OUT_DIR/lib $OUT_DIR/bin $OUT_DIR/lib/otb/applications -maxdepth 1 -type f -exec file {} \; | grep -i elf|cut -f1 -d':')
BINARY_FILES=$(find $OTB_PYTHON_LIB_PATH $OUT_DIR/lib $OUT_DIR/bin $OUT_DIR/lib/otb/applications -maxdepth 1 -type f -exec file {} \; | grep -i elf|cut -f1 -d':')
# run patchelf
for bin_file in $BINARY_FILES; do
#echo "adding rpath to $bin_file"
......
......@@ -20,15 +20,6 @@
#
# Setup python environment
#check if we have any python bindings
CUR_DIR_PY="$( cd "$( dirname "$0" )" && pwd )"
if [ ! -f "$CUR_DIR_PY/lib/python/_otbApplication.so" ] ; then
echo "./lib/python/_otbApplication.so does not exists"
echo "THIS MEANS YOU DON'T HAVE PYTHON BINDINGS IN YOUR PACKAGE"
echo "REPORT THIS TO otb-developers@googlegroups.com"
fi
if [ ! -f "$OTB_PYTHON_EXE" ] ; then
OTB_PYTHON_EXE=$(which python)
fi
......
......@@ -103,7 +103,7 @@ macro(installer_files)
endif()
install(FILES
Files/build_example.cmake
Files/build_examples.cmake
DESTINATION ${PKG_STAGE_DIR}/tools)
......
......@@ -46,7 +46,8 @@ add_test(
NAME Tu_build_examples
COMMAND ${CMAKE_COMMAND}
-DSRC_DIR=${CMAKE_SOURCE_DIR}/../Examples
-P ${pkg_extracted_dir}/tools/build_example.cmake
-DMAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-P ${pkg_extracted_dir}/tools/build_examples.cmake
WORKING_DIRECTORY ${testing_dir}
)
......
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