From b6f7e6d503fe7f767759bbbfcf5640669e30f994 Mon Sep 17 00:00:00 2001 From: Michael Wheeler Date: Thu, 9 Jul 2020 20:12:47 +1000 Subject: [PATCH] Add in cross compiling and github releases --- .travis.yml | 51 ++++++++++++++++++++++-------------------- mingw-w64-x86_64.cmake | 16 +++++++++++++ 2 files changed, 43 insertions(+), 24 deletions(-) create mode 100644 mingw-w64-x86_64.cmake diff --git a/.travis.yml b/.travis.yml index 161a86b..63f68d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,33 +1,36 @@ env: - global: - - GCC_BASE=gcc-arm-none-eabi-8-2018-q4-major - - GCC_SHORT=8-2018q4 sudo: required language: generic dist: xenial +os: + - linux + - osx addons: apt: - packages: libc6-i386 sox python3-numpy valgrind fonts-freefont-otf - libspeexdsp-dev libsamplerate0-dev portaudio19-dev - libasound2-dev libao-dev libgsm1-dev libsndfile-dev - -cache: - directories: - - "$HOME/$GCC_BASE" + packages: libc6-i386 sox python3-numpy valgrind fonts-freefont-otf libspeexdsp-dev + libsamplerate0-dev portaudio19-dev libasound2-dev libao-dev libgsm1-dev libsndfile-dev + mingw-w64 install: -- export GCC_DIR=$HOME/$GCC_BASE -- export GCC_ARCHIVE=$HOME/$GCC_BASE-linux.tar.bz2 -- export GCC_URL=https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/$GCC_SHORT/$GCC_BASE-linux.tar.bz2 -- if [ ! -e $GCC_DIR/bin/arm-none-eabi-g++ ]; then wget -q $GCC_URL -O $GCC_ARCHIVE; - tar xfj $GCC_ARCHIVE -C $HOME; fi -- export HABLIBDIR=${PWD} -- export MAKEFLAGS=-j2 - + - export HABLIBDIR=${PWD} + - export MAKEFLAGS=-j2 script: + - cd ${HABLIBDIR} && mkdir -p build_linux && cd build_linux + - cmake $HABLIBDIR && make -j4 + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install sox; fi + - ctest --output-on-failure + - cd ${HABLIBDIR} && mkdir -p build_windows/src && cd build_windows + - if [ "$TRAVIS_OS_NAME" != "osx" ]; then cmake $HABLIBDIR -DCMAKE_TOOLCHAIN_FILE=$HABLIBDIR/mingw-w64-x86_64.cmake && make -j4 ; fi -# build hablib ------------------------- -- cd ${HABLIBDIR} && mkdir -p build_linux && cd build_linux -- cmake $HABLIBDIR && make -j4 -# Now run all the ctests -- ctest --output-on-failure - +before_deploy: + - cd ${HABLIBDIR} +deploy: + provider: releases + api_key: + secure: #Use travis setup releases to configure this + file: + - build_linux/src/libhorus.so # we might want to cross compile an arm version as well :) + - build_linux/src/libhorus.dylib + - build_windows/src/libhorus.dll + on: + repo: projecthorus/horusdemodlib + skip_cleanup: 'true' diff --git a/mingw-w64-x86_64.cmake b/mingw-w64-x86_64.cmake new file mode 100644 index 0000000..94e97c6 --- /dev/null +++ b/mingw-w64-x86_64.cmake @@ -0,0 +1,16 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) + +# cross compilers to use for C, C++ and Fortran +set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) +set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran) +set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) + +# target environment on the build host system +set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) + +# modify default behavior of FIND_XXX() commands +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file