From 6f9b25c3e4ecbba90879b681d014e8b6570dc346 Mon Sep 17 00:00:00 2001 From: Andre Rummler Date: Sat, 20 Aug 2016 12:16:29 +0200 Subject: [PATCH] Summary commit to bring master up to date with v17 with regard to CI: - 0b91e48ee064db9da4feca8c08fde7b2f84eaf89 Update TravisCI: build master, but omit OS X since I still haven't figured out what goes wrong on the Travis machine, somehow the compiler flags are selected wrongly... - 697f0391465331d727ed8fb5a295754aeacb3179 TravisCI: try moving to Trusty which provides ROOT and a recent GCC - 8828506e33ba8198b075878739363d3613e6db06 Try to fix missing packages with preventive apt-get update - cd010aedc1919e2df60653bfbe1ac3c026aacb17 Add additional CMake hint for ROOT package installed on Trusty platforms - ced60a6cb080dab9ef3a0b49b0cf72babacdd0da The packaged ROOT is lacking "TPaletteAxis.h" for some reason. I'm getting a bit angry and am turning off the OnlineMon build for now. - 412e994debef33acf2d62b9fb78c2fdc27372a80 Added appveyor.yml for automatized Windows build on appyevor: https://ci.appveyor.com Needs just a registration of the repository similar as Travis and both of them should be able to run at the same time: https://github.com/blog/1935-see-results-from-all-pull-request-status-checks - d92746acf9fc123aa985acca489085aef0342363 Changed .travis.yml in a way that instead of using the root-system from the Ubuntu repository which is traditionally a bit strange the precompiled version from the CERN root web site is loaded. Now the OnlineMon is reanbled for the Linux build. - 047810bbcbd3ecce25b363cc9a98aa84dcc40015 Wrong branch name in appveyor.yml - 638fd78ae2e7ee92ffc6682233d1de42a5b3793e With the removal of the hand assigned compiler flags (relying on cmake) it also compiles again on OSX. Added modern cmake 3.4 as the provided one is too old: 2.8. + b405426b8098c3df8a6ef5cd25757cfe39bca2f1 Add qt to OSX. + 106c5b2c110d28d3eb9e0f3de658ff11c34596c3 Switched CI settings from v1.5-dev branch to v1.6-dev as 1.6 release has been published. + 21f589b394764982e02f620c1929bc203a693fb4 Fixed CI badges for v1.6-dev + 1ae0ffa5d64aaa15ed0675fbb481f2504ba30476 Formatting README.md v1.6-dev got lost + 8466bfea47ebcc1fa45ac32351c8c1e5c44e5527 Forgot to change hard coded version for 1.6 + 3dc0a9b1cf216ea560bef68fd806ceb41c890776 Forgot to change hard coded version for 1.6 + e897f4ee904f80bf65f535c964e83ca93dbce626 Reduce noise in appveyor build (see http://help.appveyor.com/discussions/problems/4569-the-target-_convertpdbfiles-listed-in-a-beforetargets-attribute-at-c-does-not-exist-in-the-project-and-will-be-ignored). + 99376b96d066329957f7d76e54ef669ef3b68b45 Appveyor CI: Updated appveyor to ROOT 5.34.36 (still for MSVC 2012 but it seems to work...) and Qt 5.6/MSVC 2015. + 4b702dc6b22c667ee92b0cab67ced6ded567f59d Travis CI: Updated travis ROOT to 5.34.36 + 906dc5d24bd0333126eec4edfbe045eb2fd5b797 Travis CI: Creating option branches + 0ffb506d232f31383f006cf53ba5333bac7f5ad4 Travis CI: Corrected the file permissions of helper scripts + f2cc2ec7a8085a166a2fe5feb3cd90cf792d416e Travis CI: More progress on travis options. Renamed travis env variable. Travis env context + dbdf7cf69804b2ee7888fe42d65231e9aba9313a Travis CI: QT5 added + 92372ddd73879a1567e1ffd888d289ed074d7ba0 Travis CI: Install python3 on travis for modern option + a4ce2d885d2c07e1d161056ebca7a87b1643bdf4 Travis CI: Switch on all producers + bc37bf9668284a4dec2c0c1d17e7729796fc7618 Travis CI: Do not build palpidefs on travis as it requires external dependencies + 9ae0e934d39e8a718f257212cb9e864c8193d07b Travis CI: Adding openafs to travis + 070798624e43268df63928d96836d5a5c3e0b3ed Travis CI: Added more producers + 3cf1509c5cbf2a579fffb26df259d039919fede1 Travis CI: Removed pixelman producer from travis build and checking why afs not recognized + b6a6ddf0119571c0c70f42a8592fdcba3b33b517 Travis CI: Added kernel headers for OpenAFS module + 50dbc4167c28839af7581e93f886f5a4d9f27f78 Travis CI: Added openafs repo to travis linux + ea949f18798e8f90386b23f3856c1ef40e965cb3 Travis CI: Start openafs after module installation + d19ae7dbe9ed47d79f68e0095cf472b11968d655 Travis CI: Added libusb to travis + 5904a5818fb72cdc849b16a5a0191de3e45ffc6d Travis CI: For travis download only necessary parts of ZestSC, otherwise awfully slow. + 639fd8b372fdf84f65ba166e14fad686dd8937ec Cmake syntax error + 7b6a31c0190bc8f27de8173d359db969980e5b39 Travis CI: Removed pybar from travis as it seems to be no longer in 1.6 and following + 4857c1aae6596614a7506e697e1ad8f5cb7a09fd Travis CI: Removing Altro from build due to known issues + 7a2b4770ebcedb7b21a22981573326d99d0cac8e Travis CI: Removing mvd from travis build due to known issues + 613b6691c03ab1abecde9f93e79f7020ac5a000c Travis CI: Removing calice from the travis build until it is fixed + a16e29e2ddc722397c435bc1442959a99b3c0afa Removing depfet from travis build as it fails. + 3b3d24c7d6f0b7f2aff090c13f46b20b0aeae76c Travis CI: Readding depfet to travis after Simon's fix + e618a866cd0b0dae00db66d6ad886478c10c859a Travis CI: Install OpenAFS on Mac + e96e656f3304e8709707c0038d46f91a31e4cc65 Travis CI: Reenable calice option + 7bccc9a92cecd9c76aff2ba38f3190684183bde1 Travis CI: Disable eudrb as it is only supposed to run on single board computers + 2c00b5c27c6b534054207843a8122f6fa0f5c017 Appveyor CI: Install OpenAFS on Windows + 5bb53e4741520cfd4e840d5e8d92a33951044f3d Travis CI: Changing cmake flags + e6fb0c42859943dff5785b18f29686689682c15e Travis CI: Compile manual on linux + ad242e64753025c295140826620d759dfd4a245a Appveyor CI: Remove remote desktop conenction (only for debugging, leave it commented) + 6f5b10e051a1e1ffd033d2f97544cbc804dfbe0e Travis CI: Change cmake parametres + d9401705fc88b6242a164544e755712fa45e1955 Travis CI: Change python handling + bbc3553a0b37f0e86e2cf92927b66c3da17e25c8 Fix problem with cmake on mac (framework version mismatch): https://github.com/usnistgov/REFPROP-wrappers/blob/master/cmake/FindPythonLibsNew.cmake https://github.com/pybind/pybind11/issues/99 http://stackoverflow.com/questions/30470628/os-x-cmake-cant-find-pythonlibs-3-4 https://github.com/Homebrew/legacy-homebrew/issues/10393#issuecomment-4108011 + d7fa3d14dfab5c90e1b126c137463e74ec7f5285 Travis CI: Updated root 6 version + 71d005786f5940a0cd8ff58e53b822facc347c1b Travis CI more work on python installation for mac and linux. + 4fe72ea098db0a06e534af54095baf77416e52cb Appveyor CI: Installation of supporter programs, openafs, ... + 8bb32e51859e5317c7515c4a1c968acfdc950efb Appveyor CI: Install python including numpy + c52c1e8ee65807f430ee2bbc538784c6575287d3 - Solved openafs problem on travis CI - Updated hard coded version to 1.7 - General clean up of CI oriented files - Reverted FINDLIBusb.cmake test output as it is no longer necessary after debugging - Prepared travis and appveyor githb release upload; needs to be tested after merge + b76f64a76ebe58000e417895dfd14eb477d3413f Appveyor CI: Repair syntax error in yml file. + ceb7d9e5c9ba01784df4d2386034ffd418d8b23b Appveyor CI: Fixing artefact generation + 39ae10909e74fdbfedfb685a5728e2a9a9d137bb CI: Changing branch name for symbols in README.me (show on the top page of github) --- .gitignore | 3 + .travis.yml | 165 ++++++++++++++++++------ .travis/before_install.sh | 150 ++++++++++++++++++++++ .travis/install.sh | 98 +++++++++++++++ .travis/install_pxar.sh | 29 +++++ appveyor.yml | 148 +++++++++++++++++++--- appveyor/dev-requirements.txt | 3 + appveyor/download.ps1 | 39 ++++++ appveyor/install_python.ps1 | 229 ++++++++++++++++++++++++++++++++++ cmake/FindZestSC1.cmake | 110 ++++++++++++++++ 10 files changed, 921 insertions(+), 53 deletions(-) create mode 100755 .travis/before_install.sh create mode 100755 .travis/install.sh create mode 100755 .travis/install_pxar.sh create mode 100644 appveyor/dev-requirements.txt create mode 100644 appveyor/download.ps1 create mode 100644 appveyor/install_python.ps1 create mode 100644 cmake/FindZestSC1.cmake diff --git a/.gitignore b/.gitignore index d1eaced3e0..f51483ed94 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,9 @@ conf/* .project .cproject +# Ignore path to library necessary for cmspixel option +extern/pxar + # Ignore binary data file folders downloaded for TLU producer: extern/ZestSC1 extern/tlufirmware diff --git a/.travis.yml b/.travis.yml index 2f04a677f2..4612aa282a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,56 +4,143 @@ sudo: required dist: trusty -compiler: - - gcc - branches: only: - master - - v1.6-dev - -os: - - linux - - osx + - v1.7-dev + +# set here versions / file paths +env: + global: + - ROOT5_FILENAME_LINUX=root_v5.34.36.Linux-ubuntu14-x86_64-gcc4.8.tar.gz + - ROOT5_FILENAME_MAC=root_v5.34.36.macosx64-10.9-clang60.tar.gz + - ROOT6_FILENAME_LINUX=root_v6.06.06.Linux-ubuntu14-x86_64-gcc4.8.tar.gz + - ROOT6_FILENAME_MAC=root_v6.06.06.macosx64-10.9-clang60.tar.gz + + - CMAKE_DOWNLOAD_PATH=https://cmake.org/files/v3.5 + - CMAKE_FILENAME_LINUX=cmake-3.5.2-Linux-x86_64.tar.gz + - CMAKE_FILENAME_MAC=cmake-3.5.2-Darwin-x86_64.tar.gz + + - OPENAFS_DOWNLOAD_PATH_MAC=http://www.openafs.org/dl/openafs/1.6.6/macos-10.9 + - OPENAFS_FILENAME_MAC=OpenAFS-1.6.6-Mavericks.dmg + + - PYTHON_VERSION_MODERN=3.5.1 + - PYTHON_VERSION_OLD=2.7.10 + + - BUILD_AHCAL=OFF + - BUILD_BIFAHCAL=OFF + - BUILD_TESTING=OFF + - BUILD_WITH_QT4=OFF + - BUILD_allproducer=OFF + - BUILD_altro=OFF + - BUILD_altroUSB=OFF + - BUILD_apixct=OFF + - BUILD_calice=ON + - BUILD_ccpdlf=OFF + - BUILD_clicpix=OFF + - BUILD_cmspixel=ON + - BUILD_depfet=ON + - BUILD_eudrb=OFF + - BUILD_example=OFF + - BUILD_explorer=ON + - BUILD_fortis=ON + - BUILD_gui=ON + - BUILD_main=OFF + - BUILD_manual=OFF + - BUILD_mimoroma=ON + - BUILD_mimosa32=ON + - BUILD_miniTLU=OFF + - BUILD_mupix=OFF + - BUILD_mvd=OFF + - BUILD_ni=ON + - BUILD_nreader=OFF + - BUILD_offlinemon=OFF + - BUILD_onlinemon=ON + - BUILD_palpidefs=OFF + - BUILD_palpidess=OFF + - BUILD_pixelmanproducer=OFF + - BUILD_pybar=OFF + - BUILD_python=ON + - BUILD_root=OFF + - BUILD_taki=OFF + - BUILD_timepixdummy=OFF + - BUILD_tlu=ON + - BUILD_usbpix=OFF + + +# possible options: +# Linux/Mac +# gcc/clang +# ROOT 5/6 +# QT 4/5 +# Python 2/3 not realized yet + +# in order to reduce options: +# Linux/Mac +# gcc/clang +# modern (ROOT 6, QT 5, Python 3) / old (ROOT 5, QT 4, Python 2) +# results in 8 combinations +# documentation to be "compiled" in maximum one option + +# cmspixel: +# requires pxar download and installation which is done +# disabled for mac, old, gcc and clang as pxar can be installed but during eudaq compilation is fails to include properly the defines from api.h +# the reason for this behaviour is unclear + +matrix: + include: + - os: linux + compiler: gcc + env: OPTION=modern BUILD_manual=ON + - os: linux + compiler: gcc + env: OPTION=old + - os: linux + compiler: clang + env: OPTION=modern + - os: linux + compiler: clang + env: OPTION=old + - os: osx + compiler: gcc + env: OPTION=modern + - os: osx + compiler: gcc + env: OPTION=old BUILD_cmspixel=OFF + - os: osx + compiler: clang + env: OPTION=modern + - os: osx + compiler: clang + env: OPTION=old BUILD_cmspixel=OFF before_install: - - $CXX --version - - $CC --version - - - if [ $TRAVIS_OS_NAME == linux ]; then wget https://root.cern.ch/download/root_v5.34.34.Linux-ubuntu14-x86_64-gcc4.8.tar.gz && tar -xvf root_v5.34.34.Linux-ubuntu14-x86_64-gcc4.8.tar.gz && source root/bin/thisroot.sh; fi - - - if [ $TRAVIS_OS_NAME == osx ]; then wget https://root.cern.ch/download/root_v5.34.34.macosx64-10.9-clang60.tar.gz && tar -xvf root_v5.34.34.macosx64-10.9-clang60.tar.gz && source root/bin/thisroot.sh; fi - - - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get -qq update; fi - - # OS X: update brew cache: - - if [ $TRAVIS_OS_NAME == osx ]; then brew update; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" && "$CC" == "gcc" ]]; then CC=gcc-4.9; fi - - if [ $TRAVIS_OS_NAME == "osx" ]; then wget https://cmake.org/files/v3.4/cmake-3.4.3-Darwin-x86_64.tar.gz && tar xfz cmake-3.4.3-Darwin-x86_64.tar.gz && export PATH="`pwd`/cmake-3.4.3-Darwin-x86_64/CMake.app/Contents/bin":$PATH:; fi - - if [ $TRAVIS_OS_NAME == "osx" ]; then echo $PATH; fi - - + - source .travis/before_install.sh + - if [ $BUILD_cmspixel == "ON" ]; then source .travis/install_pxar.sh; fi + install: - # Install package dependencies for Linux: - - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y libusb-1.0-0 libusb-1.0-0-dev python2.7 python-numpy cmake qt4-dev-tools; fi - - # Install package dependencies for Mac OS X: - - if [ $TRAVIS_OS_NAME == osx ]; then brew unlink cmake; fi - - if [ $TRAVIS_OS_NAME == osx ]; then brew install python libusb qt; fi - # Install numpy via pip: - - if [ $TRAVIS_OS_NAME == osx ]; then easy_install pip && pip install numpy; fi + - source .travis/install.sh before_script: - - # For Mac OS X we still need to source the root environment: - # - if [ $TRAVIS_OS_NAME == osx ]; then source $(brew --prefix root)/libexec/thisroot.sh; fi - - $CXX --version - $CC --version - - - cd build + - echo $PATH + - echo $LD_LIBRARY_PATH script: - - cmake -DBUILD_onlinemon=ON .. + - cd build + - cmake -DBUILD_AHCAL=$BUILD_AHCAL -DBUILD_BIFAHCAL=$BUILD_BIFAHCAL -DBUILD_TESTING=$BUILD_TESTING -DBUILD_WITH_QT4=$BUILD_WITH_QT4 -DBUILD_allproducer=$BUILD_allproducer -DBUILD_altro=$BUILD_altro -DBUILD_altroUSB=$BUILD_altroUSB -DBUILD_apixct=$BUILD_apixct -DBUILD_calice=$BUILD_calice -DBUILD_ccpdlf=$BUILD_ccpdlf -DBUILD_clicpix=$BUILD_clicpix -DBUILD_cmspixel=$BUILD_cmspixel -DBUILD_depfet=$BUILD_depfet -DBUILD_eudrb=$BUILD_eudrb -DBUILD_example=$BUILD_example -DBUILD_explorer=$BUILD_explorer -DBUILD_fortis=$BUILD_fortis -DBUILD_gui=$BUILD_gui -DBUILD_main=$BUILD_main -DBUILD_manual=$BUILD_manual -DBUILD_mimoroma=$BUILD_mimoroma -DBUILD_mimosa32=$BUILD_mimosa32 -DBUILD_miniTLU=$BUILD_miniTLU -DBUILD_mupix=$BUILD_mupix -DBUILD_mvd=$BUILD_mvd -DBUILD_ni=$BUILD_ni -DBUILD_nreader=$BUILD_nreader -DBUILD_offlinemon=$BUILD_offlinemon -DBUILD_onlinemon=$BUILD_onlinemon -DBUILD_palpidefs=$BUILD_palpidefs -DBUILD_palpidess=$BUILD_palpidess -DBUILD_pixelmanproducer=$BUILD_pixelmanproducer -DBUILD_pybar=$BUILD_pybar -DBUILD_python=$BUILD_python -DBUILD_root=$BUILD_root -DBUILD_taki=$BUILD_taki -DBUILD_timepixdummy=$BUILD_timepixdummy -DBUILD_tlu=$BUILD_tlu -DBUILD_usbpix=$BUILD_usbpix .. - make install +before_deploy: + - source .travis/before_deploy.sh + +deploy: + provider: releases + api_key: "Vl1KT9zHLc/d3oBKQuS1PyD849kXOZe8mvP+BW2ocvh/SjyyFrFoPUw/0GvsO+cbqH1+HYIki5N3Tkeb5AZtehqc7oqPCLPQI6fxk3eEYugcR0wYgBprlQB5PyvobZgR8Eq9R95tlJgX1ukOlpINmENF9b9/cPzEqCUhbW0+kwdcsalxb7NsDZUBFeu3cBeTqrIDzv1eO582uUk3MssHJ+18jt7rdaQGhY2lyNdpsXTUEuYdiE2TJ4xr7Yk2akN5PSvi0PHeq+LB7t07olan2yi6EqLJHHF2Th28Qgf4YT5BUjpF4kQy2xQzRwyQIg6X0Z34OuB+Q74Ku/vcvqi/oS+oiciIaGoGKQ5TK4tDRZIs0XvyamXafXKSqYahoDD92rPQ2ewZHvb/ivKjYLAED3sB4M5EMGxrwWUlAYEj3QSYZRDugjz2FhMPIswnCiMeSxFTaWQs54hymP5xLo9gNiXrInM4HIhwYjv12uH9X3YrBi8+7As1MOsP21vDhU7VegM2/L1jQkYj+E1nEtBzG3Z3hpc4dav0opT6pGjQ6M/CKyusyIBeHAdTLU3i0JWLD0SdJQemsLd1dx0LlXPZe3Z7svww8VVX3w6xlgjRFYYtlTHyElTanxg//dcVpZBEEZNZBbArgDNtZxNjY7qgYankxitUT9Kj3DWNjnynzjo=" + file_glob: true + file: "${FILE_TO_UPLOAD_1}" + skip_cleanup: true + on: + tags: true + condition: "$BUILD_manual = ON" diff --git a/.travis/before_install.sh b/.travis/before_install.sh new file mode 100755 index 0000000000..f8c04a0f54 --- /dev/null +++ b/.travis/before_install.sh @@ -0,0 +1,150 @@ +#!/bin/bash + +echo $CXX --version +echo $CC --version + +if [[ $TRAVIS_OS_NAME == 'osx' ]]; then + + # OS X: update brew cache: + brew update || brew update + brew outdated openssl || brew upgrade openssl + + brew unlink cmake python python3 + + if [[ "$CC" == "gcc" ]]; then CC=gcc-4.9; fi + + if [[ $OPTION == 'modern' ]]; then + export ROOT_FILENAME=${ROOT6_FILENAME_MAC} + # install pyenv + # https://github.com/pyca/cryptography/blob/master/.travis/install.sh + git clone https://github.com/yyuu/pyenv.git ~/.pyenv + PYENV_ROOT="$HOME/.pyenv" + PATH="$PYENV_ROOT/bin:$PATH" + eval "$(pyenv init -)" + + pyenv install ${PYTHON_VERSION_MODERN} + pyenv global ${PYTHON_VERSION_MODERN} + + pyenv rehash + python -m pip install --user virtualenv + + python -m virtualenv ~/.venv + source ~/.venv/bin/activate + + pip install --upgrade pip + pip install -q numpy + + else + export ROOT_FILENAME=${ROOT5_FILENAME_MAC} + # install pyenv + # https://github.com/pyca/cryptography/blob/master/.travis/install.sh + git clone https://github.com/yyuu/pyenv.git ~/.pyenv + PYENV_ROOT="$HOME/.pyenv" + PATH="$PYENV_ROOT/bin:$PATH" + eval "$(pyenv init -)" + + pyenv install ${PYTHON_VERSION_OLD} + pyenv global ${PYTHON_VERSION_OLD} + + pyenv rehash + python -m pip install --user virtualenv + + python -m virtualenv ~/.venv + source ~/.venv/bin/activate + + pip install --upgrade pip + pip install -q numpy + fi + export CMAKE_FILENAME=${CMAKE_FILENAME_MAC} + + echo "Installing root now" + wget https://root.cern.ch/download/$ROOT_FILENAME + tar -xvf $ROOT_FILENAME + source root/bin/thisroot.sh + + echo "Installing cmake now" + wget ${CMAKE_DOWNLOAD_PATH}/$CMAKE_FILENAME + tar xfz $CMAKE_FILENAME + export PATH="`pwd`/${CMAKE_FILENAME%%.tar.gz}/CMake.app/Contents/bin":$PATH: + echo $PATH + + echo "Installing openafs now" + wget ${OPENAFS_DOWNLOAD_PATH_MAC}/$OPENAFS_FILENAME_MAC + sudo hdiutil attach $OPENAFS_FILENAME_MAC + #ls /Volumes/OpenAFS/ + sudo installer -package /Volumes/OpenAFS/OpenAFS.pkg -target / + sudo hdiutil detach /Volumes/OpenAFS + sudo launchctl start org.openafs.filesystems.afs + #tar xfz $OPENAFS_FILENAME_MAC + #export PATH="`pwd`/${CMAKE_FILENAME%%.tar.gz}/CMake.app/Contents/bin":$PATH: + #echo $PATH + +else + if [[ $OPTION == 'modern' ]]; then + export ROOT_FILENAME=${ROOT6_FILENAME_LINUX} + + export PIP_REQUIRE_VIRTUALENV=true + + pyenv install ${PYTHON_VERSION_MODERN} + pyenv global ${PYTHON_VERSION_MODERN} + pyenv versions + + git clone https://github.com/yyuu/pyenv-pip-rehash.git ~/.pyenv/plugins/pyenv-pip-rehash + git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv + #eval "$(pyenv init -)" + #eval "$(pyenv virtualenv-init -)" + pyenv init + pyenv virtualenv-init + #pyenv virtualenv-init - + + pyenv virtualenv ${PYTHON_VERSION_MODERN} my-virtual-env + pyenv virtualenvs + pyenv activate my-virtual-env + + + pip install --upgrade pip + #pip install virtualenvwrapper + #pyvenv venv + #pyenv virtualenvs + #source venv/bin/activate + #pyenv activate venv + pip install -q numpy + #pyenv rehash + else + export ROOT_FILENAME=${ROOT5_FILENAME_LINUX} + + pyenv install ${PYTHON_VERSION_OLD} + pyenv global ${PYTHON_VERSION_OLD} + pyenv versions + + git clone https://github.com/yyuu/pyenv-pip-rehash.git ~/.pyenv/plugins/pyenv-pip-rehash + git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv + pyenv init + pyenv virtualenv-init + #pyenv virtualenv-init - + + pyenv virtualenv ${PYTHON_VERSION_OLD} my-virtual-env + pyenv virtualenvs + pyenv activate my-virtual-env + + + pip install --upgrade pip + pip install virtualenvwrapper + #pyvenv venv + #pyenv virtualenvs + #source venv/bin/activate + #pyenv activate venv + pip install -q numpy + #pyenv rehash + fi + + echo "Installing root now" + wget https://root.cern.ch/download/$ROOT_FILENAME + tar -xvf $ROOT_FILENAME + source root/bin/thisroot.sh + + #workaround as openafs in the normal is broken in the moment - kernel module does not compile + sudo add-apt-repository -y ppa:openafs/stable + sudo apt-get -qq update +fi + diff --git a/.travis/install.sh b/.travis/install.sh new file mode 100755 index 0000000000..38506b9267 --- /dev/null +++ b/.travis/install.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +if [[ $TRAVIS_OS_NAME == 'osx' ]]; then + if [[ $OPTION == 'modern' ]]; then + # Install package dependencies for Mac OS X: + #brew update + brew unlink cmake python python3 + brew install libusb qt5 libusb-compat + + #brew install python3 + #brew linkapps python3 + #export python_workaround = cmake -DPYTHON_LIBRARY=$(python-config --prefix)/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=$(python-config --prefix)/include/python2.7 + #export OVERRIDE_PYTHON_INTERPRETER=-DPYTHON_EXECUTABLE:FILEPATH=$(python-config --prefix)"/bin/python3" + #export OVERRIDE_PYTHON_LIBRARY_PATH=-DPYTHON_LIBRARY=$(python-config --prefix)"/lib/libpython3.4.dylib" + + export CMAKE_PREFIX_PATH=/usr/local/opt/qt5 + # Install numpy via pip: + #sudo pip install --upgrade pip + #sudo pip install -q numpy + else + # Install package dependencies for Mac OS X: + #brew update + brew unlink cmake python python3 + brew install libusb qt libusb-compat + + #brew install python + #brew linkapps python + #export OVERRIDE_PYTHON_INTERPRETER=-DPYTHON_EXECUTABLE:FILEPATH=$(python-config --prefix)"/bin/python" + #export OVERRIDE_PYTHON_LIBRARY_PATH=-DPYTHON_LIBRARY=$(python-config --prefix)"/lib/libpython2.7.dylib" + + # Install numpy via pip: + #sudo pip install --upgrade pip + #sudo pip install -q numpy + fi + +else + + if [[ $OPTION == 'modern' ]]; then + # Install package dependencies for Linux: + sudo add-apt-repository -y ppa:openafs/stable + sudo apt-get update + sudo apt-get install --force-yes -y libusb-dev libusb-1.0-0 libusb-1.0-0-dev cmake qt5-default linux-generic linux-headers-$(uname -r) openafs-client openafs-krb5 + + # creating ThisCell file --> since some update it seems to be absolutely necessary, otherwise start up fails with + # "afsd: some file missing or bad in /etc/openafs" + # content does not matter for our purposes + touch ~/ThisCell + echo "cern.ch" >> ~/ThisCell + echo "" >> ~/ThisCell + sudo cp ~/ThisCell /etc/openafs + sudo service openafs-client start + + #sudo cat /var/log/syslog + #sudo pip install -U setuptools + #sudo pip install -U virtualenvwrapper + #sudo virtualenv /opt/python/3.5.0 + #source /opt/python/3.5.0/activate + #sudo pip install -q numpy + #export OVERRIDE_PYTHON_INTERPRETER="-DPYTHON_EXECUTABLE:FILEPATH=/opt/python/3.5.0/bin/python" + #export OVERRIDE_PYTHON_LIBRARY_PATH="-DPYTHON_LIBRARY=/opt/python/3.5.0/lib/libpython3.4m.so.1" + #export OVERRIDE_PYTHON_INCLUDE_DIR="-DPYTHON_INCLUDE_DIR=/opt/python/3.5.0/include" + #PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g") + #PATH=/opt/python/3.5.0/bin:$PATH + + else + # Install package dependencies for Linux: + sudo add-apt-repository -y ppa:openafs/stable + sudo apt-get update + sudo apt-get install --force-yes -y libusb-dev libusb-1.0-0 libusb-1.0-0-dev cmake qt4-dev-tools linux-generic linux-headers-$(uname -r) openafs-client openafs-krb5 + + # creating ThisCell file --> since some update it seems to be absolutely necessary, otherwise start up fails with + # "afsd: some file missing or bad in /etc/openafs" + # content does not matter for our purposes + touch ~/ThisCell + echo "cern.ch" >> ~/ThisCell + echo "" >> ~/ThisCell + sudo cp ~/ThisCell /etc/openafs + sudo service openafs-client start + + #sudo cat /var/log/syslog + #sudo pip install --upgrade pip + #sudo pip install -q numpy + #pyenv rehash + #export OVERRIDE_PYTHON_INTERPRETER="-DPYTHON_EXECUTABLE:FILEPATH=/opt/python/2.7.10/bin/python" + #export OVERRIDE_PYTHON_LIBRARY_PATH="-DPYTHON_LIBRARY=/opt/python/2.7.10/lib/libpython2.7.so" + #export OVERRIDE_PYTHON_INCLUDE_DIR="-DPYTHON_LIBRARY=/opt/python/2.7.10/include" + #PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g") + #PATH=/opt/python/2.7.10/bin:$PATH + fi + + if [[ $BUILD_manual == 'ON' ]]; then + echo "Installing texlive as manual will be build..." + sudo apt-get install -y texlive texlive-latex-extra + fi + +fi + + diff --git a/.travis/install_pxar.sh b/.travis/install_pxar.sh new file mode 100755 index 0000000000..107e9c9249 --- /dev/null +++ b/.travis/install_pxar.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# This package is necessary for the CMS pixel option + +export temporary_path=`pwd` + +if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update && sudo apt-get install -y libusb-1.0-0 libusb-1.0-0-dev libftdi1 libftdi-dev; fi + +if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install libusb libftdi; fi + +cd -- + +git clone https://github.com/simonspa/pxar.git + +cd pxar + +git checkout testbeam-2016 + +mkdir build + +cd build + +cmake .. + +make install + +export PXARPATH=~/pxar + +cd $temporary_path \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 90e430af22..cee65a94bc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,34 +1,154 @@ -version: 2.0.{build} +version: 1.7.0.{build} + pull_requests: do_not_increment_build_number: true + branches: only: - master - - v1.6-dev + - v1.7-dev os: Visual Studio 2015 + configuration: Release +# - x64 +platform: x86 + environment: ROOTSYS: C:\root - PATH: '%ROOTSYS%\bin;C:\Qt\5.5\msvc2013;C:\Python35;C:\Miniconda35;C:\Miniconda35\\Scripts;%PATH%' -before_build: + PATH: '%ROOTSYS%\bin;C:\Qt\5.6\msvc2015;C:\Python35;C:\Miniconda35;C:\Miniconda35\\Scripts;%PATH%' + BUILD_AHCAL: OFF + BUILD_BIFAHCAL: OFF + BUILD_TESTING: OFF + BUILD_WITH_QT4: OFF + BUILD_allproducer: OFF + BUILD_altro: OFF + BUILD_altroUSB: OFF + BUILD_apixct: OFF + BUILD_calice: ON + BUILD_ccpdlf: OFF + BUILD_clicpix: OFF + BUILD_cmspixel: OFF + BUILD_depfet: OFF + BUILD_eudrb: OFF + BUILD_example: OFF + BUILD_explorer: OFF + BUILD_fortis: OFF + BUILD_gui: ON + BUILD_main: OFF + BUILD_manual: OFF + BUILD_mimoroma: OFF + BUILD_mimosa32: ON + BUILD_miniTLU: OFF + BUILD_mupix: OFF + BUILD_mvd: OFF + BUILD_ni: ON + BUILD_nreader: OFF + BUILD_offlinemon: OFF + BUILD_onlinemon: ON + BUILD_palpidefs: OFF + BUILD_palpidess: OFF + BUILD_pixelmanproducer: OFF + BUILD_pybar: OFF + BUILD_python: ON + BUILD_root: OFF + BUILD_taki: OFF + BUILD_timepixdummy: OFF + BUILD_tlu: ON + BUILD_usbpix: OFF + PYTHON: "C:\\Python35" + PYTHON_VERSION: "3.5.2" + PYTHON_ARCH: "32" + +cache: + - '%APPVEYOR_BUILD_FOLDER%\extern\ZestSC1' + - '%APPVEYOR_BUILD_FOLDER%\extern\tlufirmware' + - '%APPVEYOR_BUILD_FOLDER%\extern\libusb-win32' + +init: +# The following line enables the remote desktop connection and show the connection information. +#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + +install: +# This is a workaround for a whole lot of annoying warnings about non-existing targets. +- cmd: del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets" + +# Install Python (from the official .msi of http://python.org) and pip when not already installed. +# This was copied from +- ps: if (-not(Test-Path($env:PYTHON))) { & appveyor\install_python.ps1 } +# Prepend newly installed Python to the PATH of this build (this cannot be +# done from inside the powershell script as it would require to restart +# the parent CMD process). +- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" +# Check that we have the expected version and architecture for Python +- "python --version" +- "python -c \"import struct; print(struct.calcsize('P') * 8)\"" +# Upgrade to the latest version of pip to avoid it displaying warnings +# about it being out of date. +- "pip install --disable-pip-version-check --user --upgrade pip" +# Install the build dependencies of the project. If some dependencies contain +# compiled extensions and are not provided as pre-built wheel packages, +# pip will build them from source using the MSVC compiler matching the +# target Python version and architecture +- "%CMD_IN_ENV% pip install -r appveyor\\dev-requirements.txt" + +before_build: - cmd: >- - conda config --set always_yes yes --set changeps1 no + + powershell -command "$clnt = new-object System.Net.WebClient; $clnt.DownloadFile(\"https://root.cern.ch/download/root_v5.34.36.win32.vc12.zip\",\"C:\\root_v5.34.36.win32.vc12.zip\")" + + 7z -y x C:\\root_v5.34.36.win32.vc12.zip -oC:\ - conda info -a + powershell -command "$clnt = new-object System.Net.WebClient; $clnt.DownloadFile(\"https://www.secure-endpoints.com/binaries/heimdal/Heimdal-AMD64-full-1-6-2-0.msi\",\"C:\\Heimdal-AMD64-full-1-6-2-0.msi\")" + + powershell -command "msiexec /i \"C:\\Heimdal-AMD64-full-1-6-2-0.msi\" /quiet /qn /norestart /log install.log ADDLOCAL=ALL" + + powershell -command "$clnt = new-object System.Net.WebClient; $clnt.DownloadFile(\"http://dl.openafs.org/dl/openafs/1.7.31/winxp/openafs-en_US-64bit-1-7-3100.msi\",\"C:\\openafs-en_US-64bit-1-7-3100.msi\")" + + powershell -command "msiexec /i \"C:\\openafs-en_US-64bit-1-7-3100.msi\" /quiet /qn /norestart /log install.log ADDLOCAL=ALL" + + powershell -command "$clnt = new-object System.Net.WebClient; $clnt.DownloadFile(\"http://dl.openafs.org/dl/openafs/1.7.31/winxp/openafs-32bit-tools-en_US-1-7-3100.msi\",\"C:\\openafs-32bit-tools-en_US-1-7-3100.msi\")" + + powershell -command "msiexec /i \"C:\\openafs-32bit-tools-en_US-1-7-3100.msi\" /quiet /qn /norestart /log install.log ADDLOCAL=ALL" + + powershell -command "Restart-Computer -Force" + + powershell -command "Start-Sleep -s 10" - conda create -q -n test-environment numpy +build_script: +- ps: If (Test-Path ("${env:APPVEYOR_BUILD_FOLDER}" + "\extern\ZestSC1")) {Write-Host ("Reusing cached ZestSC1 " + "${env:APPVEYOR_BUILD_FOLDER}" + "\extern\ZestSC1" + " instead of copying from AFS")} Else {Write-Host "Copying ZestSC1 from AFS"; Copy-item "\\afs\desy.de\group\telescopes\tlu\ZestSC1" -destination ("${env:APPVEYOR_BUILD_FOLDER}" + "\extern\ZestSC1") -recurse} - activate test-environment +- ps: If (Test-Path ("${env:APPVEYOR_BUILD_FOLDER}" + "\extern\tlufirmware")) {Write-Host ("Reusing cached tlufirmware " + "${env:APPVEYOR_BUILD_FOLDER}" + "\extern\tlufirmware" + " instead of copying from AFS")} Else {Write-Host "Copying tlufirmware from AFS"; Copy-item "\\afs\desy.de\group\telescopes\tlu\tlufirmware" -destination ("${env:APPVEYOR_BUILD_FOLDER}" + "\extern\tlufirmware") -recurse} - powershell -command "$clnt = new-object System.Net.WebClient; $clnt.DownloadFile(\"https://root.cern.ch/download/root_v5.34.34.win32.vc12.zip\",\"C:\\root_v5.34.34.win32.vc12.zip\")" +- ps: If (Test-Path ("${env:APPVEYOR_BUILD_FOLDER}" + "\extern\libusb-win32")) {Write-Host ("Reusing cached libusb-win32 " + "${env:APPVEYOR_BUILD_FOLDER}" + "\extern\libusb-win32" + " instead of downloading from sourcefourge (which can be sometimes unreliable...)")} Else {Write-Host "Downloading libusb-win32 from sourceforge"; appveyor\download.ps1 -downloadLocation 'https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip' -storageLocation 'C:\\libusb-win32-bin-1.2.6.0.zip'; $zipargument = ("-o" + "${env:APPVEYOR_BUILD_FOLDER}" + "\extern\"); 7z -y x C:\\libusb-win32-bin-1.2.6.0.zip $zipargument; Rename-Item -path ("${env:APPVEYOR_BUILD_FOLDER}" + "\extern\libusb-win32-bin-1.2.6.0") -newName ("${env:APPVEYOR_BUILD_FOLDER}" + "\extern\libusb-win32")} - 7z -y x C:\\root_v5.34.34.win32.vc12.zip -oC:\ +#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - cd build +- cd %APPVEYOR_BUILD_FOLDER%\build - cmake -DBUILD_onlinemon=ON -DBUILD_python=OFF .. -build_script: -- msbuild INSTALL.vcxproj +- cmd: echo -DBUILD_AHCAL=%BUILD_AHCAL% -DBUILD_BIFAHCAL=%BUILD_BIFAHCAL% -DBUILD_TESTING=%BUILD_TESTING% -DBUILD_WITH_QT4=%BUILD_WITH_QT4% -DBUILD_allproducer=%BUILD_allproducer% -DBUILD_altro=%BUILD_altro% -DBUILD_altroUSB=%BUILD_altroUSB% -DBUILD_apixct=%BUILD_apixct% -DBUILD_calice=%BUILD_calice% -DBUILD_ccpdlf=%BUILD_ccpdlf% -DBUILD_clicpix=%BUILD_clicpix% -DBUILD_cmspixel=%BUILD_cmspixel% -DBUILD_depfet=%BUILD_depfet% -DBUILD_eudrb=%BUILD_eudrb% -DBUILD_example=%BUILD_example% -DBUILD_explorer=%BUILD_explorer% -DBUILD_fortis=%BUILD_fortis% -DBUILD_gui=%BUILD_gui% -DBUILD_main=%BUILD_main% -DBUILD_manual=%BUILD_manual% -DBUILD_mimoroma=%BUILD_mimoroma% -DBUILD_mimosa32=%BUILD_mimosa32% -DBUILD_miniTLU=%BUILD_miniTLU% -DBUILD_mupix=%BUILD_mupix% -DBUILD_mvd=%BUILD_mvd% -DBUILD_ni=%BUILD_ni% -DBUILD_nreader=%BUILD_nreader% -DBUILD_offlinemon=%BUILD_offlinemon% -DBUILD_onlinemon=%BUILD_onlinemon% -DBUILD_palpidefs=%BUILD_palpidefs% -DBUILD_palpidess=%BUILD_palpidess% -DBUILD_pixelmanproducer=%BUILD_pixelmanproducer% -DBUILD_pybar=%BUILD_pybar% -DBUILD_python=%BUILD_python% -DBUILD_root=%BUILD_root% -DBUILD_taki=%BUILD_taki% -DBUILD_timepixdummy=%BUILD_timepixdummy% -DBUILD_tlu=%BUILD_tlu% -DBUILD_usbpix=%BUILD_usbpix% .. + +- cmd: cmake -DBUILD_AHCAL=%BUILD_AHCAL% -DBUILD_BIFAHCAL=%BUILD_BIFAHCAL% -DBUILD_TESTING=%BUILD_TESTING% -DBUILD_WITH_QT4=%BUILD_WITH_QT4% -DBUILD_allproducer=%BUILD_allproducer% -DBUILD_altro=%BUILD_altro% -DBUILD_altroUSB=%BUILD_altroUSB% -DBUILD_apixct=%BUILD_apixct% -DBUILD_calice=%BUILD_calice% -DBUILD_ccpdlf=%BUILD_ccpdlf% -DBUILD_clicpix=%BUILD_clicpix% -DBUILD_cmspixel=%BUILD_cmspixel% -DBUILD_depfet=%BUILD_depfet% -DBUILD_eudrb=%BUILD_eudrb% -DBUILD_example=%BUILD_example% -DBUILD_explorer=%BUILD_explorer% -DBUILD_fortis=%BUILD_fortis% -DBUILD_gui=%BUILD_gui% -DBUILD_main=%BUILD_main% -DBUILD_manual=%BUILD_manual% -DBUILD_mimoroma=%BUILD_mimoroma% -DBUILD_mimosa32=%BUILD_mimosa32% -DBUILD_miniTLU=%BUILD_miniTLU% -DBUILD_mupix=%BUILD_mupix% -DBUILD_mvd=%BUILD_mvd% -DBUILD_ni=%BUILD_ni% -DBUILD_nreader=%BUILD_nreader% -DBUILD_offlinemon=%BUILD_offlinemon% -DBUILD_onlinemon=%BUILD_onlinemon% -DBUILD_palpidefs=%BUILD_palpidefs% -DBUILD_palpidess=%BUILD_palpidess% -DBUILD_pixelmanproducer=%BUILD_pixelmanproducer% -DBUILD_pybar=%BUILD_pybar% -DBUILD_python=%BUILD_python% -DBUILD_root=%BUILD_root% -DBUILD_taki=%BUILD_taki% -DBUILD_timepixdummy=%BUILD_timepixdummy% -DBUILD_tlu=%BUILD_tlu% -DBUILD_usbpix=%BUILD_usbpix% .. + +- cmd: msbuild INSTALL.vcxproj + +after_build: +- cmd: 7z a eudaq_win32_%EUDAQ_LIB_VERSION%.zip %APPVEYOR_BUILD_FOLDER% + +artifacts: + - path: eudaq_win32_%EUDAQ_LIB_VERSION%.zip + name: Releases +deploy: + provider: GitHub + auth_token: + secure: "FXNTEGEjMMl3FZLCp4cXO0Szn3CVs4lEf+pPxz6vbb9q/PHkD5N2gAgOR+zljtll" + artifact: eudaq_win32_%EUDAQ_LIB_VERSION%.zip + draft: false + prerelease: false + on: + appveyor_repo_tag: true + +on_finish: +#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/appveyor/dev-requirements.txt b/appveyor/dev-requirements.txt new file mode 100644 index 0000000000..c8e09565d7 --- /dev/null +++ b/appveyor/dev-requirements.txt @@ -0,0 +1,3 @@ +numpy + + diff --git a/appveyor/download.ps1 b/appveyor/download.ps1 new file mode 100644 index 0000000000..433075a711 --- /dev/null +++ b/appveyor/download.ps1 @@ -0,0 +1,39 @@ +# Script to download file on several trials +# Based on python install script by +# Authors: Olivier Grisel, Jonathan Helmus, Kyle Kastner, and Alex Willmer +# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ +[CmdletBinding()] +Param( + [Parameter(Mandatory=$True,Position=1)] + [string]$downloadLocation, + + [Parameter(Mandatory=$True)] + [string]$storageLocation +) + +function Download ($url, $filename) { + $webclient = New-Object System.Net.WebClient + + # Download and retry up to 5 times in case of network transient errors. + Write-Host "Downloading " $url + $retry_attempts = 4 + for ($i = 0; $i -lt $retry_attempts; $i++) { + try { + $webclient.DownloadFile($url, $filename) + break + } + Catch [Exception]{ + Write-Host "Download attempt " $i " of " $retry_attempts " failed." + Start-Sleep 1 + } + } + if (Test-Path $filename) { + Write-Host "File saved at" $filename + } else { + # Retry once to get the error message if any at the last try + $webclient.DownloadFile($url, $filename) + } + return $filename +} + +Download $downloadLocation $storageLocation diff --git a/appveyor/install_python.ps1 b/appveyor/install_python.ps1 new file mode 100644 index 0000000000..160ba55c07 --- /dev/null +++ b/appveyor/install_python.ps1 @@ -0,0 +1,229 @@ +# Sample script to install Python and pip under Windows +# Authors: Olivier Grisel, Jonathan Helmus, Kyle Kastner, and Alex Willmer +# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ + +$MINICONDA_URL = "http://repo.continuum.io/miniconda/" +$BASE_URL = "https://www.python.org/ftp/python/" +$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py" +$GET_PIP_PATH = "C:\get-pip.py" + +$PYTHON_PRERELEASE_REGEX = @" +(?x) +(?\d+) +\. +(?\d+) +\. +(?\d+) +(?[a-z]{1,2}\d+) +"@ + + +function Download ($filename, $url) { + $webclient = New-Object System.Net.WebClient + + $basedir = $pwd.Path + "\" + $filepath = $basedir + $filename + if (Test-Path $filename) { + Write-Host "Reusing" $filepath + return $filepath + } + + # Download and retry up to 3 times in case of network transient errors. + Write-Host "Downloading" $filename "from" $url + $retry_attempts = 2 + for ($i = 0; $i -lt $retry_attempts; $i++) { + try { + $webclient.DownloadFile($url, $filepath) + break + } + Catch [Exception]{ + Start-Sleep 1 + } + } + if (Test-Path $filepath) { + Write-Host "File saved at" $filepath + } else { + # Retry once to get the error message if any at the last try + $webclient.DownloadFile($url, $filepath) + } + return $filepath +} + + +function ParsePythonVersion ($python_version) { + if ($python_version -match $PYTHON_PRERELEASE_REGEX) { + return ([int]$matches.major, [int]$matches.minor, [int]$matches.micro, + $matches.prerelease) + } + $version_obj = [version]$python_version + return ($version_obj.major, $version_obj.minor, $version_obj.build, "") +} + + +function DownloadPython ($python_version, $platform_suffix) { + $major, $minor, $micro, $prerelease = ParsePythonVersion $python_version + + if (($major -le 2 -and $micro -eq 0) ` + -or ($major -eq 3 -and $minor -le 2 -and $micro -eq 0) ` + ) { + $dir = "$major.$minor" + $python_version = "$major.$minor$prerelease" + } else { + $dir = "$major.$minor.$micro" + } + + if ($prerelease) { + if (($major -le 2) ` + -or ($major -eq 3 -and $minor -eq 1) ` + -or ($major -eq 3 -and $minor -eq 2) ` + -or ($major -eq 3 -and $minor -eq 3) ` + ) { + $dir = "$dir/prev" + } + } + + if (($major -le 2) -or ($major -le 3 -and $minor -le 4)) { + $ext = "msi" + if ($platform_suffix) { + $platform_suffix = ".$platform_suffix" + } + } else { + $ext = "exe" + if ($platform_suffix) { + $platform_suffix = "-$platform_suffix" + } + } + + $filename = "python-$python_version$platform_suffix.$ext" + $url = "$BASE_URL$dir/$filename" + $filepath = Download $filename $url + return $filepath +} + + +function InstallPython ($python_version, $architecture, $python_home) { + Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home + if (Test-Path $python_home) { + Write-Host $python_home "already exists, skipping." + return $false + } + if ($architecture -eq "32") { + $platform_suffix = "" + } else { + $platform_suffix = "amd64" + } + $installer_path = DownloadPython $python_version $platform_suffix + $installer_ext = [System.IO.Path]::GetExtension($installer_path) + Write-Host "Installing $installer_path to $python_home" + $install_log = $python_home + ".log" + if ($installer_ext -eq '.msi') { + InstallPythonMSI $installer_path $python_home $install_log + } else { + InstallPythonEXE $installer_path $python_home $install_log + } + if (Test-Path $python_home) { + Write-Host "Python $python_version ($architecture) installation complete" + } else { + Write-Host "Failed to install Python in $python_home" + Get-Content -Path $install_log + Exit 1 + } +} + + +function InstallPythonEXE ($exepath, $python_home, $install_log) { + $install_args = "/quiet InstallAllUsers=1 TargetDir=$python_home" + RunCommand $exepath $install_args +} + + +function InstallPythonMSI ($msipath, $python_home, $install_log) { + $install_args = "/qn /log $install_log /i $msipath TARGETDIR=$python_home" + $uninstall_args = "/qn /x $msipath" + RunCommand "msiexec.exe" $install_args + if (-not(Test-Path $python_home)) { + Write-Host "Python seems to be installed else-where, reinstalling." + RunCommand "msiexec.exe" $uninstall_args + RunCommand "msiexec.exe" $install_args + } +} + +function RunCommand ($command, $command_args) { + Write-Host $command $command_args + Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru +} + + +function InstallPip ($python_home) { + $pip_path = $python_home + "\Scripts\pip.exe" + $python_path = $python_home + "\python.exe" + if (-not(Test-Path $pip_path)) { + Write-Host "Installing pip..." + $webclient = New-Object System.Net.WebClient + $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) + Write-Host "Executing:" $python_path $GET_PIP_PATH + & $python_path $GET_PIP_PATH + } else { + Write-Host "pip already installed." + } +} + + +function DownloadMiniconda ($python_version, $platform_suffix) { + if ($python_version -eq "3.4") { + $filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe" + } else { + $filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe" + } + $url = $MINICONDA_URL + $filename + $filepath = Download $filename $url + return $filepath +} + + +function InstallMiniconda ($python_version, $architecture, $python_home) { + Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home + if (Test-Path $python_home) { + Write-Host $python_home "already exists, skipping." + return $false + } + if ($architecture -eq "32") { + $platform_suffix = "x86" + } else { + $platform_suffix = "x86_64" + } + $filepath = DownloadMiniconda $python_version $platform_suffix + Write-Host "Installing" $filepath "to" $python_home + $install_log = $python_home + ".log" + $args = "/S /D=$python_home" + Write-Host $filepath $args + Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru + if (Test-Path $python_home) { + Write-Host "Python $python_version ($architecture) installation complete" + } else { + Write-Host "Failed to install Python in $python_home" + Get-Content -Path $install_log + Exit 1 + } +} + + +function InstallMinicondaPip ($python_home) { + $pip_path = $python_home + "\Scripts\pip.exe" + $conda_path = $python_home + "\Scripts\conda.exe" + if (-not(Test-Path $pip_path)) { + Write-Host "Installing pip..." + $args = "install --yes pip" + Write-Host $conda_path $args + Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru + } else { + Write-Host "pip already installed." + } +} + +function main () { + InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON + InstallPip $env:PYTHON +} + +main diff --git a/cmake/FindZestSC1.cmake b/cmake/FindZestSC1.cmake new file mode 100644 index 0000000000..ca277b91b0 --- /dev/null +++ b/cmake/FindZestSC1.cmake @@ -0,0 +1,110 @@ +# - Try to find ZestSC1 driver package needed for accessing the TLU +# Once done this will define +# ZESTSC1_FOUND - System has ZestSC1 +# ZESTSC1_INCLUDE_DIRS - The ZestSC1 include directories +# ZESTSC1_LIBRARIES - The libraries needed to use ZestSC1 +# ZESTSC1_DEFINITIONS - Compiler switches required for using ZestSC1 + +macro(find_zestsc1_in_extern arg) +# disable a warning about changed behaviour when traversing directories recursively (wrt symlinks) +IF(COMMAND cmake_policy) + CMAKE_POLICY(SET CMP0009 NEW) + CMAKE_POLICY(SET CMP0011 NEW) # disabling a warning about policy changing in this scope +ENDIF(COMMAND cmake_policy) +# determine path to zestsc1 package in ./extern folder +file(GLOB_RECURSE extern_file ${PROJECT_SOURCE_DIR}/extern/*ZestSC1.h) +if (extern_file) + # should have found multiple files of that name, take root of folder (no 'windows*7/inc' string) + FOREACH (this_file ${extern_file}) + IF( (NOT "${this_file}" MATCHES ".*windows.?7/Inc/") AND (NOT "${this_file}" MATCHES ".*windows/Inc/") AND (NOT "${this_file}" MATCHES ".*macosx/Inc/") AND (NOT "${this_file}" MATCHES ".*linux/Inc/")) + SET(zest_inc_path "${this_file}") + ENDIF() + ENDFOREACH(this_file) + IF (zest_inc_path) + # strip the file and 'Inc' path away: + get_filename_component(extern_lib_path "${zest_inc_path}" PATH) + get_filename_component(extern_lib_path "${extern_lib_path}" PATH) + MESSAGE(STATUS "Found ZestSC1 package in 'extern' subfolder: ${extern_lib_path}") + ENDIF() +endif(extern_file) + +IF(WIN32) + find_path(ZESTSC1_INCLUDE_DIR ZestSC1.h + HINTS "${extern_lib_path}/windows_7/Inc" + "${extern_lib_path}/windows 7/Inc" + "${extern_lib_path}/Inc" + ${arg} + ) +ELSE(WIN32) + find_path(ZESTSC1_INCLUDE_DIR ZestSC1.h + HINTS "${extern_lib_path}/Inc" ${arg}) +ENDIF(WIN32) + +if (WIN32) + if (${EX_PLATFORM} EQUAL 64) + find_library(ZESTSC1_LIBRARY NAMES ZestSC1 SetupAPI Ws2_32 + HINTS "${extern_lib_path}/Lib/amd64" + "${extern_lib_path}/windows_7/Lib/amd64" + "${extern_lib_path}/windows 7/Lib/amd64" + ${arg} + ) + else() #32bit + find_library(ZESTSC1_LIBRARY NAMES ZestSC1 SetupAPI Ws2_32 + HINTS "${extern_lib_path}/Lib/x86" + "${extern_lib_path}/windows_7/Lib/x86" + "${extern_lib_path}/windows 7/Lib/x86" + ${arg}) + endif(${EX_PLATFORM} EQUAL 64) + elseif (UNIX) + MESSAGE(STATUS "UNIX OS found. extern_lib_path = ${extern_lib_path}" ) + + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + find_library(ZESTSC1_LIBRARY NAMES ZestSC1 + HINTS "${extern_lib_path}/macosx/Lib" ${arg}) + else() + find_library(ZESTSC1_LIBRARY NAMES ZestSC1 + HINTS "${extern_lib_path}/Lib" + "${extern_lib_path}/linux/Lib" + ${arg}) + endif() + else() + MESSAGE( "WARNING: Platform not defined in FindZestSC1.txt -- assuming Unix/Linux (good luck)." ) + find_library(ZESTSC1_LIBRARY NAMES ZestSC1 + HINTS "${extern_lib_path}/linux" ${arg}) + endif() +endmacro() + +find_zestsc1_in_extern("") + +# could not find the package at the usual locations -- try to copy from AFS if accessible +if (NOT ZESTSC1_LIBRARY) + IF (EXISTS "/afs/desy.de/group/telescopes/tlu/ZestSC1") + MESSAGE(STATUS "Could not find ZestSC1 driver package required by tlu producer; downloading it now via AFS to ./extern ....") + if(DEFINED ENV{TRAVIS}) + MESSAGE(STATUS "Running on travis and therefore downloading only the absolutely necessary part of the ZestSC1 driver.") + file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/extern/ZestSC1) + copy_files("/afs/desy.de/group/telescopes/tlu/ZestSC1/Inc" ${PROJECT_SOURCE_DIR}/extern/ZestSC1) + if("$ENV{TRAVIS_OS_NAME}" STREQUAL "linux") + copy_files("/afs/desy.de/group/telescopes/tlu/ZestSC1/linux" ${PROJECT_SOURCE_DIR}/extern/ZestSC1) + else() + copy_files("/afs/desy.de/group/telescopes/tlu/ZestSC1/macosx" ${PROJECT_SOURCE_DIR}/extern/ZestSC1) + endif() + else() + copy_files("/afs/desy.de/group/telescopes/tlu/ZestSC1" ${PROJECT_SOURCE_DIR}/extern) + endif() + find_zestsc1_in_extern(NO_DEFAULT_PATH) + ELSE() + MESSAGE(WARNING "Could not find ZestSC1 driver package required by tlu producer. Please refer to the documentation on how to obtain the software.") + ENDIF() +endif() + +set(ZESTSC1_LIBRARIES ${ZESTSC1_LIBRARY} ) +set(ZESTSC1_INCLUDE_DIRS ${ZESTSC1_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set ZESTSC1_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(ZestSC1 DEFAULT_MSG + ZESTSC1_LIBRARY ZESTSC1_INCLUDE_DIR) + +mark_as_advanced(ZESTSC1_INCLUDE_DIR ZESTSC1_LIBRARY )