-
Antoine Regimbeau authorede69f836b
## Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)## This file is part of Orfeo Toolbox## https://www.orfeo-toolbox.org/## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## 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 script is a prototype for the future CI, it may evolve rapidly in a near futureinclude( "${CMAKE_CURRENT_LIST_DIR}/macros.cmake" )set (ENV{LANG} "C") # Only ascii outputget_filename_component(OTB_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)####################################################################################################################################################### Download xkd####################################################################################################################################################### How to get md5sum:# * concatenate all source files in one# * add configure result from previous job ${OTB_SOURCE_DIR}/build/CMakeCache.txt###########################file(READ "${OTB_SOURCE_DIR}/sb_branch.txt" BRANCH_NAME)##################################### git clone $REPOSITORY_URL --branch $BRANCH_NAME --depth 1 superbuild-artifact###############################################################################set ( REMOTE "https://gitlab.orfeo-toolbox.org/gbonnefille/superbuild-artifact.git")# set ( BRANCH_NAME "${IMAGE_NAME}/${SB_MD5}")# Look for a GIT command-line client.find_program(CTEST_GIT_COMMAND NAMES git git.cmd)# FIXME: Replace ${GIT} variable with $[CTEST_GIT_COMMAND}"set( GIT "${CTEST_GIT_COMMAND}" )execute_process( COMMAND ${GIT} "clone" "${REMOTE}" "--branch" "${BRANCH_NAME}" "--depth" "1" "superbuild-artifact" WORKING_DIRECTORY ${OTB_SOURCE_DIR} RESULT_VARIABLE clone_res OUTPUT_VARIABLE clone_out ERROR_VARIABLE clone_err )if ( DEBUG ) message( "Clone") message( "clone_res = ${clone_res}" ) message( "clone_out = ${clone_out}" ) message( "clone_err = ${clone_err}" )endif()if (clone_res)7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
message( SEND_ERROR "Problem in retreiving the archive")
return()
endif()
set (CMAKE_COMMAND "cmake")
execute_process(
COMMAND ${CMAKE_COMMAND} "-E" "tar" "xf"
"${OTB_SOURCE_DIR}/superbuild-artifact/SuperBuild_Install.tar"
WORKING_DIRECTORY ${OTB_SOURCE_DIR}
)
set( XDK_PATH "${OTB_SOURCE_DIR}/xdk")
if ( DEBUG )
if ( EXISTS "${XDK_PATH}")
message("Xdk folder exists at ${XDK_PATH}")
else()
message("Something went wrong no folder in ${XDK_PATH}")
endif()
endif()
###########################################################################
###########################################################################
# Building OTB
###########################################################################
###########################################################################
set ( CTEST_BUILD_CONFIGURATION "Release" )
set ( CTEST_CMAKE_GENERATOR "Unix Makefiles" )
set ( CTEST_BUILD_FLAGS "-j8" )
set ( CTEST_SITE "${IMAGE_NAME}" )
# Find the build name and CI profile
set_dash_build_name()
# Directory variable
set ( CTEST_SOURCE_DIRECTORY "${OTB_SOURCE_DIR}" )
set ( CTEST_BINARY_DIRECTORY "${OTB_SOURCE_DIR}/build/" )
set ( CTEST_INSTALL_DIRECTORY "${OTB_SOURCE_DIR}/install/" )
set ( PROJECT_SOURCE_DIR "${OTB_SOURCE_DIR}" )
set (CONFIGURE_OPTIONS "")
include ( "${CMAKE_CURRENT_LIST_DIR}/configure_option.cmake" )
# SuperBuild case : one more configure option
set ( CONFIGURE_OPTIONS
"${CONFIGURE_OPTIONS}-DCMAKE_PREFIX_PATH=${XDK_PATH};")
# Hack because there is no more superbuild available (LIBKML)
set ( CONFIGURE_OPTIONS
"${CONFIGURE_OPTIONS}-DOTB_USE_LIBKML:BOOL=OFF;" )
# FIX ME this part might platform dependent
set( GDAL_DATA "${XDK_PATH}/share/gdal" )
set( GEOTIFF_CSV "${XDK_PATH}/share/epsg_csv" )
set( PROJ_LIB "${XDK_PATH}/share" )
set( CTEST_ENVIRONMENT
"PATH=${XDK_PATH}/lib:${XDK_PATH}/bin:$ENV{PATH}
")
# It seems that we do not need that
# GDAL_DATA= GDAL_DATA
# GEOTIFF_CSV= GEOTIFF_CSV
# PROJ_LIB= PROJ_LIB
# Sources are already checked out : do nothing for update
set(CTEST_GIT_UPDATE_CUSTOM echo No update)
ctest_start (Experimental TRACK CI_Build)
ctest_update()
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}"
SOURCE "${OTB_SOURCE_DIR}"
OPTIONS "${CONFIGURE_OPTIONS}"
RETURN_VALUE _configure_rv
CAPTURE_CMAKE_ERROR _configure_error
)
if ( NOT _configure_rv EQUAL 0 )
ctest_submit()
message( FATAL_ERROR "An error occurs during ctest_configure.")
endif()
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}"
RETURN_VALUE _build_rv
CAPTURE_CMAKE_ERROR _build_error
)
if ( NOT _build_rv EQUAL 0 )
message( SEND_ERROR "An error occurs during ctest_build.")
endif()
# Uncomment when ready for test
ctest_test(PARALLEL_LEVEL 8
RETURN_VALUE _test_rv
CAPTURE_CMAKE_ERROR _test_error
)
if ( NOT _test_rv EQUAL 0 )
message( WARNING "Some tests have failed.")
endif()
ctest_submit()