Adapt code and fix cmake script for Travis build

This commit is contained in:
redtide 2019-12-01 21:29:22 +01:00
parent 22ac4942f7
commit 375945d372
7 changed files with 55 additions and 39 deletions

View file

@ -3,11 +3,11 @@ language: cpp
matrix:
include:
- os: linux
dist: xenial
dist: bionic
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:ubuntu-toolchain-r/test'
packages:
- gcc-8
- g++-8

View file

@ -8,18 +8,4 @@ chmod +x send.sh
./send.sh success $WEBHOOK_URL
# Deploy
export VERSION=$(git describe --tags)
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
export DEPLOYFILE=Sfizz-$VERSION-x86_64.AppImage
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
chmod +x linuxdeploy-x86_64.AppImage
for size in 16 32 48 128 256; do dirname="sfizz/usr/share/icons/hicolor/${size}x${size}/apps"; mkdir -p $dirname; cp ./resources/icons/icon_${size}px.png ./${dirname}/sfizz.png; done
./linuxdeploy-x86_64.AppImage --appdir=sfizz --desktop-file=./resources/linux/sfizz.desktop --executable=./build/clients/sfizz_jack --output=appimage
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
export DEPLOYFILE=sfizz-$VERSION.dmg
mkdir ./output
cp -r /build/* ./output/
cp ./resources/icons/icon.icns ./output/sfizz.app/Contents/Resources/
hdiutil create /tmp/tmp.dmg -ov -volname "sfizz-$VERSION" -fs HFS+ -srcfolder "./output/"
hdiutil convert /tmp/tmp.dmg -format UDZO -o ./$DEPLOYFILE;
fi
./deploy.sh

19
.travis/deploy.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
set -e
export VERSION=$(git describe --tags)
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
export DEPLOYFILE=Sfizz-$VERSION-x86_64.AppImage
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
chmod +x linuxdeploy-x86_64.AppImage
for size in 16 32 48 128 256; do dirname="sfizz/usr/share/icons/hicolor/${size}x${size}/apps"; mkdir -p $dirname; cp ./resources/icons/icon_${size}px.png ./${dirname}/sfizz.png; done
./linuxdeploy-x86_64.AppImage --appdir=sfizz --desktop-file=./resources/linux/sfizz.desktop --executable=./build/clients/sfizz_jack --output=appimage
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
export DEPLOYFILE=sfizz-$VERSION.dmg
mkdir ./output
cp -r /build/* ./output/
cp ./resources/icons/icon.icns ./output/sfizz.app/Contents/Resources/
hdiutil create /tmp/tmp.dmg -ov -volname "sfizz-$VERSION" -fs HFS+ -srcfolder "./output/"
hdiutil convert /tmp/tmp.dmg -format UDZO -o ./$DEPLOYFILE;
fi

View file

@ -7,7 +7,9 @@ if [ "$TRAVIS_OS_NAME" = "linux" ]; then
gcc -v && g++ -v && cmake --version && /usr/local/bin/cmake --version && $SHELL --version
mkdir build && cd build
/usr/local/bin/cmake ..
# FIXME: lto error in build when enabled
/usr/local/bin/cmake -D CMAKE_BUILD_TYPE=Release -D ENABLE_LTO=OFF ..
make -j$(nproc)
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
mkdir build && cd build

View file

@ -8,13 +8,13 @@ else()
if (${output})
message (WARNING "\nIPO disabled: ${output}")
else()
message (WARNING "\nIPO was disabled, not in a Release build?")
message (WARNING "\nIPO was disabled or not in a Release build.")
endif()
set (ENABLE_LTO OFF)
endif()
function (SFIZZ_ENABLE_LTO_IF_NEEDED TARGET)
if (ENABLE_LTO)
if (${ENABLE_LTO})
message(STATUS "Enabling LTO on ${TARGET}")
set_property (TARGET ${TARGET} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()

View file

@ -1,9 +1,5 @@
project (lv2plugin)
# Dependencies check
find_package (PkgConfig)
pkg_check_modules (LV2 lv2>=1.10.0 REQUIRED)
# CMAKE_PROJECT_NAME is the top level project name, not the current one
set (LV2PLUGIN_PRJ_NAME "${CMAKE_PROJECT_NAME}_lv2")
@ -27,9 +23,22 @@ set (LV2PLUGIN_TTL_SRC_FILES
${CMAKE_PROJECT_NAME}.ttl.in
)
add_library (${LV2PLUGIN_PRJ_NAME} SHARED ${CMAKE_PROJECT_NAME}.c ${LV2PLUGIN_TTL_SRC_FILES})
target_include_directories (${LV2PLUGIN_PRJ_NAME} PRIVATE ${LV2_INCLUDE_DIRS})
target_link_libraries (${LV2PLUGIN_PRJ_NAME} ${CMAKE_PROJECT_NAME}::${CMAKE_PROJECT_NAME})
# Fetch required LV2 include files
include(FetchContent)
FetchContent_Declare(
lv2
GIT_REPOSITORY https://gitlab.com/lv2/lv2.git
GIT_TAG v1.16.0
)
FetchContent_GetProperties(lv2)
if(NOT lv2_POPULATED)
FetchContent_Populate(lv2)
target_include_directories(${LV2PLUGIN_PRJ_NAME} PRIVATE ${lv2_SOURCE_DIR})
endif()
# Enable LTO if available
if (ENABLE_LTO)
set_property (TARGET ${LV2PLUGIN_PRJ_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()

View file

@ -25,20 +25,20 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <lv2/lv2plug.in/ns/ext/atom/forge.h>
#include <lv2/lv2plug.in/ns/ext/atom/util.h>
#include <lv2/lv2plug.in/ns/ext/buf-size/buf-size.h>
#include <lv2/lv2plug.in/ns/lv2core/lv2.h>
#include <lv2/lv2plug.in/ns/lv2core/lv2_util.h>
#include <lv2/lv2plug.in/ns/ext/midi/midi.h>
#include <lv2/lv2plug.in/ns/ext/options/options.h>
#include <lv2/lv2plug.in/ns/ext/parameters/parameters.h>
#include <lv2/lv2plug.in/ns/ext/patch/patch.h>
#include <lv2/lv2plug.in/ns/ext/state/state.h>
#include <lv2/lv2plug.in/ns/ext/urid/urid.h>
#include <lv2/lv2plug.in/ns/ext/worker/worker.h>
#include <lv2/lv2plug.in/ns/ext/log/logger.h>
#include <lv2/lv2plug.in/ns/ext/log/log.h>
#include <lv2/atom/forge.h>
#include <lv2/atom/util.h>
#include <lv2/buf-size/buf-size.h>
#include <lv2/core/lv2.h>
#include <lv2/core/lv2_util.h>
#include <lv2/midi/midi.h>
#include <lv2/options/options.h>
#include <lv2/parameters/parameters.h>
#include <lv2/patch/patch.h>
#include <lv2/state/state.h>
#include <lv2/urid/urid.h>
#include <lv2/worker/worker.h>
#include <lv2/log/logger.h>
#include <lv2/log/log.h>
#include <math.h>
#include <sfizz.h>