Commit 38e4e896 authored by Guillaume Pasero's avatar Guillaume Pasero

Merge branch 'ci_merge_ubuntus' into 'develop'

CI Merge Ubuntus

See merge request !507
parents 01260cbb 964f1c33
Pipeline #1718 passed with stages
in 5 minutes and 37 seconds
......@@ -70,17 +70,6 @@ debian-build:
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=debian-unstable-gcc
ubuntu-llvm:
extends: .common-build
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-native:18.04
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm
artifacts:
paths:
- build/CookBook-*-html.tar.gz
- build/Documentation/Cookbook/latex/CookBook-*.pdf
- build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2
.common-prepare:
extends: .general
only: [merge_requests]
......@@ -108,10 +97,15 @@ ubuntu-superbuild-build:
extends: .common-build
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm-xdk
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -VV -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base
dependencies:
- ubuntu-superbuild-prepare
artifacts:
paths:
- build/CookBook-*-html.tar.gz
- build/Documentation/Cookbook/latex/CookBook-*.pdf
- build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2
## CentOS superbuild
centos-superbuild-prepare:
......
......@@ -51,8 +51,9 @@ OTB_USE_QWT:BOOL=ON
OTB_USE_SHARK:BOOL=ON
OTB_USE_SIFTFAST:BOOL=ON
OTB_USE_SPTW:BOOL=ON
OTB_USE_SSE_FLAGS:BOOL=ON
OTB_MPIEXEC_OPT:STRING=--allow-run-as-root")
OTB_USE_SSE_FLAGS:BOOL=ON")
# Usefull if MPI is ON : OTB_MPIEXEC_OPT:STRING=--allow-run-as-root
set (otb_wrap_option
"OTB_WRAP_PYTHON:BOOL=ON")
......@@ -65,6 +66,19 @@ set (cmake_configure_option
"CMAKE_BUILD_TYPE=${CTEST_BUILD_CONFIGURATION}
CMAKE_INSTALL_PREFIX:PATH=${CTEST_INSTALL_DIRECTORY}")
# extra options for XDK builds
if(XDK_PATH)
set(cmake_configure_option
"${cmake_configure_option}
CMAKE_PREFIX_PATH=${XDK_PATH}")
# DiapOTBModule disabled until documentation can build it
foreach(remote_module OTBTemporalGapFilling Mosaic SertitObject)#otbGRM #Mosaic # #SertitObject #DiapOTBModule
set(cmake_configure_option
"${cmake_configure_option}
Module_${remote_module}:BOOL=ON")
endforeach()
endif()
if((CTEST_SITE) AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/${CTEST_SITE}.cmake")
# will set its output in 'site_option'
include("${CMAKE_CURRENT_LIST_DIR}/${CTEST_SITE}.cmake")
......
......@@ -51,3 +51,70 @@ macro( set_dash_build_name )
endif()
endmacro()
# Download and extract an XDK (needs OTB_SOURCE_DIR, and the file sb_branch.txt in it)
macro(get_xdk)
# How to get md5sum:
# * concatenate all source files in one
# * add configure result from previous job ${OTB_SOURCE_DIR}/build/CMakeCache.txt
file(STRINGS "${OTB_SOURCE_DIR}/sb_branch.txt" BRANCH_NAME LIMIT_COUNT 1 REGEX "^([A-Za-z0-9]|/|-|_|\\.)+" )
# Look for a GIT command-line client.
find_program(CTEST_GIT_COMMAND NAMES git git.cmd)
# Download xdk :
# git clone $REPOSITORY_URL --branch $BRANCH_NAME --depth 1 superbuild-artifact
set ( REMOTE "https://gitlab.orfeo-toolbox.org/gbonnefille/superbuild-artifact.git")
execute_process(
COMMAND ${CTEST_GIT_COMMAND} "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)
message( "Command : COMMAND ${CTEST_GIT_COMMAND} clone ${REMOTE} --branch ${BRANCH_NAME} \
--depth 1 superbuild-artifact")
message( "Result :")
message( "clone_res = ${clone_res}" )
message( "clone_out = ${clone_out}" )
message( "clone_err = ${clone_err}" )
message( FATAL_ERROR "Problem in retreiving the archive")
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} "-E" "tar" "xf"
"${OTB_SOURCE_DIR}/superbuild-artifact/SuperBuild_Install.tar"
RESULT_VARIABLE tar_res
OUTPUT_VARIABLE tar_out
ERROR_VARIABLE tar_err
WORKING_DIRECTORY ${OTB_SOURCE_DIR}
)
if ( DEBUG )
message( "${CMAKE_COMMAND} -E tar xf ${OTB_SOURCE_DIR}/superbuild-artifact/SuperBuild_Install.tar")
message( "tar_res: '${clone_res}'" )
message( "tar_out: '${tar_out}'" )
message( "tar_err: '${tar_err}'" )
endif()
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}")
message("The branch was ${BRANCH_NAME}")
endif()
endif()
endmacro()
......@@ -87,7 +87,7 @@ set (CONFIGURE_OPTIONS "")
include ( "${CMAKE_CURRENT_LIST_DIR}/configure_options.cmake" )
# Sources are already checked out : do nothing for update
set(CTEST_GIT_UPDATE_CUSTOM echo No update)
set(CTEST_GIT_UPDATE_CUSTOM "${CMAKE_COMMAND}" "-E" "echo" "No update")
# Look for a GIT command-line client.
find_program(CTEST_GIT_COMMAND NAMES git git.cmd)
......@@ -99,12 +99,18 @@ ctest_start (Experimental TRACK CI_Build)
ctest_update()
# --------------------------- Configure ----------------------------------------
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}"
SOURCE "${OTB_SOURCE_DIR}"
OPTIONS "${CONFIGURE_OPTIONS}"
RETURN_VALUE _configure_rv
CAPTURE_CMAKE_ERROR _configure_error
)
# Configure log
file ( WRITE
"${OTB_SOURCE_DIR}/log/configure_return_value_log.txt" "${_configure_rv}")
file ( WRITE
"${OTB_SOURCE_DIR}/log/configure_cmake_error_log.txt" "${_configure_error}")
if ( NOT _configure_rv EQUAL 0 )
# stop processing here
......@@ -112,15 +118,30 @@ if ( NOT _configure_rv EQUAL 0 )
message( FATAL_ERROR "An error occurs during ctest_configure.")
endif()
# ------------------------------ Build -----------------------------------------
if(ci_skip_install)
message(STATUS "Skip install")
set(CTEST_BUILD_TARGET)
else()
set(CTEST_BUILD_TARGET install)
endif()
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}"
RETURN_VALUE _build_rv
CAPTURE_CMAKE_ERROR _build_error
)
# Build log
file ( WRITE
"${OTB_SOURCE_DIR}/log/build_return_value_log.txt" "${_build_rv}")
file ( WRITE
"${OTB_SOURCE_DIR}/log/build_cmake_error_log.txt" "${_build_error}")
if ( NOT _build_rv EQUAL 0 )
message( SEND_ERROR "An error occurs during ctest_build.")
endif()
# ----------------------------- Test -------------------------------------------
if(ci_skip_testing)
message(STATUS "Skip testing")
set(_test_rv 0)
......@@ -129,16 +150,22 @@ else()
RETURN_VALUE _test_rv
CAPTURE_CMAKE_ERROR _test_error
)
# Test log
file ( WRITE
"${OTB_SOURCE_DIR}/log/test_return_value_log.txt" "${_test_rv}")
file ( WRITE
"${OTB_SOURCE_DIR}/log/test_cmake_error_log.txt" "${_test_error}")
endif()
if ( NOT _test_rv EQUAL 0 )
message( SEND_ERROR "An error occurs during ctest_test.")
endif()
# ----------------------------- Submit -----------------------------------------
ctest_submit()
# ---------------------------- Doxygen -----------------------------------------
if(ENABLE_DOXYGEN)
# compile doxygen
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}"
TARGET Documentation
RETURN_VALUE _doxy_rv
......
......@@ -22,125 +22,15 @@
include( "${CMAKE_CURRENT_LIST_DIR}/macros.cmake" )
set (ENV{LANG} "C") # Only ascii output
get_filename_component(OTB_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} DIRECTORY)
get_filename_component(OTB_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
set ( DEBUG "1" )
###########################################################################
###########################################################################
# 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)
message( SEND_ERROR "Problem in retreiving the archive")
message( "Command : COMMAND ${GIT} clone ${REMOTE} --branch ${BRANCH_NAME} \
--depth 1 superbuild-artifact")
message( "Result :")
message( "clone_res = ${clone_res}" )
message( "clone_out = ${clone_out}" )
message( "clone_err = ${clone_err}" )
return()
endif()
set (CMAKE_COMMAND "cmake")
execute_process(
COMMAND ${CMAKE_COMMAND} "-E" "tar" "xf"
"${OTB_SOURCE_DIR}/superbuild-artifact/SuperBuild_Install.tar"
RESULT_VARIABLE tar_res
OUTPUT_VARIABLE tar_out
ERROR_VARIABLE tar_err
WORKING_DIRECTORY ${OTB_SOURCE_DIR}
)
if ( DEBUG )
message( "${CMAKE_COMMAND} -E tar xf ${OTB_SOURCE_DIR}/superbuild-artifact/SuperBuild_Install.tar")
message( "tar_res: '${clone_res}'" )
message( "tar_out: '${tar_out}'" )
message( "tar_err: '${tar_err}'" )
endif()
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}")
message("The branch was ${BRANCH_NAME}")
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/" )
# install in same directory as xdk to be able to produce
# package afterwards
set ( CTEST_INSTALL_DIRECTORY "${XDK_PATH}" )
set ( PROJECT_SOURCE_DIR "${OTB_SOURCE_DIR}" )
# retrieve XDK
get_xdk()
set (CONFIGURE_OPTIONS "")
include ( "${CMAKE_CURRENT_LIST_DIR}/configure_options.cmake" )
# For superbuild we need remote module
foreach(remote_module DiapOTBModule OTBTemporalGapFilling Mosaic SertitObject)#otbGRM #Mosaic # #SertitObject
set ( CONFIGURE_OPTIONS
"${CONFIGURE_OPTIONS}-DModule_${remote_module}:BOOL=ON;")
endforeach()
# SuperBuild case : one more configure option
set ( CONFIGURE_OPTIONS
"${CONFIGURE_OPTIONS}-DCMAKE_PREFIX_PATH=${XDK_PATH};")
set( INSTALL_DIR "${XDK_PATH}" )
# FIX ME this part might platform dependent
set( GDAL_DATA "${XDK_PATH}/share/gdal" )
......@@ -154,88 +44,4 @@ set( CTEST_ENVIRONMENT
# 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()
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}"
SOURCE "${OTB_SOURCE_DIR}"
OPTIONS "${CONFIGURE_OPTIONS}"
RETURN_VALUE _configure_rv
CAPTURE_CMAKE_ERROR _configure_error
)
# Configure log
file ( WRITE
"${OTB_SOURCE_DIR}/log/configure_return_value_log.txt" "${_configure_rv}")
file ( WRITE
"${OTB_SOURCE_DIR}/log/configure_cmake_error_log.txt" "${_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
)
# Build log
file ( WRITE
"${OTB_SOURCE_DIR}/log/build_return_value_log.txt" "${_build_rv}")
file ( WRITE
"${OTB_SOURCE_DIR}/log/build_cmake_error_log.txt" "${_build_error}")
# SEND_ERROR if build error
# FATAL_ERROR if 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
)
# Test log
file ( WRITE
"${OTB_SOURCE_DIR}/log/test_return_value_log.txt" "${_test_rv}")
file ( WRITE
"${OTB_SOURCE_DIR}/log/test_cmake_error_log.txt" "${_test_error}")
if ( NOT _test_rv EQUAL 0 )
message( WARNING "Some tests have failed.")
endif()
ctest_submit()
# We need to install OTB for package purposes
set ( MAKE_COMMAND "make")
execute_process(
COMMAND ${MAKE_COMMAND} "install"
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}
RESULT_VARIABLE install_rv
OUTPUT_VARIABLE install_out
ERROR_VARIABLE install_err
)
if ( DEBUG )
message( "Install output")
message( "install_res = ${install_res}" )
message( "install_out = ${install_out}" )
message( "install_err = ${install_err}" )
endif()
# Install log
file ( WRITE
"${OTB_SOURCE_DIR}/log/install_out_log.txt" "${install_out}")
file ( WRITE
"${OTB_SOURCE_DIR}/log/install_error_log.txt" "${install_err}")
if ( NOT install_rv EQUAL 0 )
message( SEND_ERROR "Install have failed.")
endif()
include( "${CMAKE_CURRENT_LIST_DIR}/main_ci.cmake" )
......@@ -33,3 +33,5 @@ OTB_USE_SHARK:BOOL=OFF
BUILD_EXAMPLES:BOOL=OFF")
set(ci_skip_testing ON)
set(ci_skip_install ON)
#
# 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.
#
# Configuration options for ubuntu-18.04-llvm-xdk
set(site_option
"CMAKE_C_COMPILER:STRING=clang
CMAKE_CXX_COMPILER:STRING=clang++
CMAKE_EXE_LINKER_FLAGS:STRING=-fuse-ld=lld
CMAKE_MODULE_LINKER_FLAGS:STRING=-fuse-ld=lld
CMAKE_SHARED_LINKER_FLAGS:STRING=-fuse-ld=lld
")
if(NOT ${ci_do_cookbook} EQUAL -1)
set(site_option
"${site_option}
BUILD_COOKBOOK:BOOL=ON")
endif()
if(NOT ${ci_do_doxygen} EQUAL -1)
set(site_option
"${site_option}
BUILD_DOCUMENTATION:BOOL=ON
OTB_DOXYGEN_ITK_TAGFILE:FILEPATH=${CTEST_BINARY_DIRECTORY}/InsightDoxygenDocTag-4.13.0
OTB_DOXYGEN_ITK_DOXYGEN_URL:STRING=\"https://itk.org/Doxygen413/html\"
")
set (ENABLE_DOXYGEN ON)
# The ITK doxygen tag file needs to be patched before being used for OTB
# See otb-devutils/Scripts/tagfile_fix.py
message(STATUS "Get resources for Doxygen build ...")
execute_process(COMMAND wget https://www.orfeo-toolbox.org/packages/archives/Doxygen/InsightDoxygenDocTag-4.13.0.gz
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY})
execute_process(COMMAND gzip -d InsightDoxygenDocTag-4.13.0.gz
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY})
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