From b12aca62cdb13b43e610d74a18befe56d808f582 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Thu, 10 Dec 2015 19:27:33 +0000 Subject: [PATCH] #1041 get jenkins_daily.sh to work on Mac/Cygwin/MSVC/Linux and publish builds on userContent/builds { daily/weekly/monthly} --- CMakeLists.txt | 11 ---- CMake_msvc.txt | 4 ++ jenkins_daily.sh | 114 ++++++++++++++++++++++++++++++++--------- samples/CMakeLists.txt | 5 -- 4 files changed, 94 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7376414e..a1325532 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,8 +26,6 @@ if( POLICY CMP0042 ) else() SET(CMAKE_MACOSX_RPATH 1) endif() -#SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") - SET( PACKAGE_COPYRIGHT "Andreas Huggel" ) SET( PACKAGE_BUGREPORT "ahuggel@gmx.net" ) @@ -94,16 +92,8 @@ endif() INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src/ ${CMAKE_SOURCE_DIR}/include/ ${CMAKE_SOURCE_DIR}/include/exiv2/) if( MSVC ) - # cmake_policy(SET CMP0008) - - include(CMake_msvc.txt) - msvc_runtime_report() - msvc_runtime_configure(${EXIV2_ENABLE_SHARED}) - msvc_runtime_report() - ADD_DEFINITIONS(-DPSAPI_VERSION=1) # to be compatible with <= WinVista (#905) - endif( MSVC ) IF( EXIV2_ENABLE_XMP ) @@ -118,7 +108,6 @@ SET( INSTALL_TARGET_STANDARD_ARGS LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -#SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") ## # add sources from XMPSDK directory diff --git a/CMake_msvc.txt b/CMake_msvc.txt index 8af2fc07..f44b8c6e 100644 --- a/CMake_msvc.txt +++ b/CMake_msvc.txt @@ -1,3 +1,7 @@ +#if (MSVC) +# set_property(TARGET tgt PROPERTY CXX_STANDARD 11) +#endif() + ## # msvc tuning macros macro(msvc_runtime_set_static_ignores bDynamic) diff --git a/jenkins_daily.sh b/jenkins_daily.sh index 7f037718..a59e7b16 100755 --- a/jenkins_daily.sh +++ b/jenkins_daily.sh @@ -2,50 +2,66 @@ ## # jenkins_daily.sh -# At the moment, this performs a CMake/msvc build -## ## -# environment -# JENKINS : URL of jenkins server. Default http://exiv2.dyndns.org:8080 -if [ -z "$JENKINS" ]; then export JENKINS=http://exiv2.dyndns.org:8080; fi - -## -# configure the build +# configure the build (only used for msvc builds) arch=x64 mode=dll config=Release vs=2013 +result=0 + ## # determine location of the build and source directories -exiv2=$(cygpath -aw .) -build=$(cygpath -aw .\\build) - dist=$(cygpath -au .\\build\\dist\\$vs\\$arch\\$mode\\$config\\bin) - di32=$(cygpath -au .\\build\\dist\\$vs\\Win32\\$mode\\$config\\bin) - di64=$(cygpath -au .\\build\\dist\\$vs\\x64\\$mode\\$config\\bin) - msvc=$(cygpath -aw ./contrib/cmake/msvc) +if [ "$PLATFORM" == "msvc" ]; then + exiv2=$(cygpath -aw .) + build=$(cygpath -aw .\\build) + dist=$(cygpath -au .\\build\\dist\\$vs\\$arch\\$mode\\$config\\bin) + msvc=$(cygpath -aw ./contrib/cmake/msvc) + exe=.exe + bin='' +else + exiv2=$PWD + build=$PWD/build + dist=$PWD/build/dist/$PLATFORM + exe='' + bin=bin + if [ -e $exiv2/CMakeCache.txt ]; then rm -rf $exiv2/CMakeCache.txt ; fi +fi ## # create a clean directory for an out-of-source build rm -rf $dist mkdir -p $dist +echo "---- dist = $dist ------" +echo "---- build = $build ------" + ## -# get windows cmd.exe to perform the build -# use a sub-shell to temporarily set path for svn/7z/cmake/cmd -( - PATH="$msvc:c:\\Program Files\\csvn\\bin:c:\\Program Files\\7-zip:c:\\Program Files (x86)\\cmake\\bin:$PATH:/cygdrive/c/Windows/System32" - result=0 - cmd.exe /c "cd $build && vcvars $vs $arch && cmakeBuild --rebuild --exiv2=$exiv2 $*" - result=$? -) +# perform the build +if [ "$PLATFORM" == "msvc" ]; then + ## + # get windows cmd.exe to perform the build + # use a sub-shell to temporarily set path for svn/7z/cmake/cmd + ( + PATH="$msvc:c:\\Program Files\\csvn\\bin:c:\\Program Files (x86)\\WANdisco\\Subversion:\\csvn\\bin:c:\\Program Files\\7-zip:c:\\Program Files (x86)\\cmake\\bin:$PATH:/cygdrive/c/Windows/System32" + cmd.exe /c "cd $build && vcvars $vs $arch && cmakeBuild --rebuild --exiv2=$exiv2 $*" + result=$? + ) +else + pushd $build + cmake -DCMAKE_INSTALL_PREFIX=$dist $exiv2 + make + cmake --build . --target install + popd +fi ## # test the build -if [ -e $dist/exiv2.exe ]; then +if [ -e $dist/$bin/exiv2$exe ]; then pushd test - export EXIV2_BINDIR=$dist + export EXIV2_BINDIR=$dist/$bin for test in addmoddel.sh \ bugfixes-test.sh \ exifdata-test.sh \ @@ -71,9 +87,59 @@ if [ -e $dist/exiv2.exe ]; then ls -alt $EXIV2_BINDIR $EXIV2_BINDIR/exiv2 -vV -g date -g time -g version ls -alt $EXIV2_BINDIR/exiv2.exe + + ## + # store the build for users to collect + mmHD="" + if [ $PLATFORM == "linux" ]; then mmHD=/media/psf/mmHD ; fi + if [ $PLATFORM == "msvc" -o $PLATFORM == 'cygwin' ]; then + mmHD="/cygdrive/z" + fi + jpubl=$mmHD/Users/Shared/Jenkins/Home/userContent/builds + + daily=$jpubl/daily + weely=$jpubl/weekly + monly=$jpubl/monthly + if [ ! -e $jpubl ]; then mkdir -p $jpubl ; fi + if [ ! -e $daily ]; then mkdir -p $daily ; fi + if [ ! -e $weely ]; then mkdir -p $weely ; fi + if [ ! -e $monly ]; then mkdir -p $monly ; fi + + if [ -e $jpubl ]; then + # parse output of date: Thu 10 Dec 2015 14:02:51 GMT + dow=$(date|cut -d' ' -f 1) # Thu day of the week + dom=$(date|cut -d' ' -f 2) # 10 day of the month + mon=$(date|cut -d' ' -f 2) # Dec month + svn=$($dist/exiv2.exe -vVg|grep -e ^svn | cut -d= -f 2) + date=$(date +'%Y-%m-%d+%H-%M-%S') + b="${PLATFORM}-svn-${svn}-date-${date}.tar.gz" + echo build = "$b" + + # create the bundle + pushd build + if [ -e "$b" ]; then rm -rf "$b"; fi + tar czf "$b" dist/ + ls -alt + mv $b .. + popd + + # clean userContent/build directories + # daily > 50 days; weekly more than 1 year; monthly more than 5 years + if [ -e $daily ]; then find $daily -type f -ctime +50 -exec rm -rf {} \; ; fi + if [ -e $weely ]; then find $weely -type f -ctime +365 -exec rm -rf {} \; ; fi + if [ -e $monly ]; then find $monty -type f -ctime $((366 * 5)) -exec rm -rf {} \; ; fi + + # store the build + cp $b $daily + if [ "$dow" == "Mon" ]; then cp $b $weely; fi + if [ "$dom" == "1" ]; then cp $b $monly; fi + + echo '***' build = $b '***' + fi else echo "" echo "**** no build created ****" + result=1 echo "" fi diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 24a9d355..f283144b 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -9,11 +9,6 @@ if ( NOT MSVC ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) endif() -if (MSVC) - include(../CMake_msvc.txt) - msvc_runtime_configure(${EXIV2_ENABLE_SHARED}) - # include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../include ${CMAKE_CURRENT_SOURCE_DIR}/../msvc64/include ) -endif() include_directories("${CMAKE_SOURCE_DIR}/include" "${CMAKE_SOURCE_DIR}/src") SET( SAMPLES addmoddel.cpp