diff --git a/.appveyor-vcpkg.yml b/.appveyor-vcpkg.yml index 6576b7a3..b579ac20 100644 --- a/.appveyor-vcpkg.yml +++ b/.appveyor-vcpkg.yml @@ -38,7 +38,7 @@ install: build_script: - mkdir build - cd build - - cmake -G "%generator%" -T "%toolset%" -Denable-pkgconfig=0 -DCMAKE_TOOLCHAIN_FILE=c:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake .. + - cmake -G "%generator%" -T "%toolset%" -Denable-pkgconfig=0 -DCMAKE_TOOLCHAIN_FILE=c:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DNO_GUI=1 .. - cmake --build . --config Release # build libfluidsynth and fluidsynth exec - cmake --build . --config Release --target check # build and exec unittests diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 49b7e2d7..00b983a2 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -15,7 +15,7 @@ jobs: - script: | mkdir build && cd build export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" - cmake -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 .. + cmake -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 .. make displayName: 'Compile fluidsynth' @@ -70,7 +70,7 @@ jobs: SET "PATH=d:\deps\bin;%PATH%" pkg-config --list-all mkdir build && cd build || exit -1 - cmake -A $(platform) -T $(toolset) -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -Denable-readline=0 -Denable-floats=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 .. || exit -1 + cmake -A $(platform) -T $(toolset) -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -Denable-readline=0 -Denable-floats=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 .. || exit -1 cmake --build . --config Release || exit -1 displayName: 'Compile fluidsynth' - script: | @@ -142,7 +142,7 @@ jobs: @ECHO ON SET "PATH=d:\deps\bin;%PATH%" mkdir build && cd build || exit -1 - cmake -A x64 -DCMAKE_BUILD_TYPE=$(CMAKE_CONFIG) -DCMAKE_VERBOSE_MAKEFILE=1 $(CMAKE_FLAGS) .. || exit -1 + cmake -A x64 -DCMAKE_BUILD_TYPE=$(CMAKE_CONFIG) -DCMAKE_VERBOSE_MAKEFILE=1 $(CMAKE_FLAGS) -DNO_GUI=1 .. || exit -1 cmake --build . --config $(CMAKE_CONFIG) || exit -1 displayName: 'Compile fluidsynth' - script: | @@ -204,7 +204,7 @@ jobs: set PATH=%PATH:C:\Program Files\Git\usr\bin;=% pkg-config --list-all mkdir build && cd build || exit -1 - cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) $(CMAKE_FLAGS) -Denable-readline=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 .. || exit -1 + cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) $(CMAKE_FLAGS) -Denable-readline=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 .. || exit -1 mingw32-make.exe all || exit -1 displayName: 'Compile fluidsynth' - script: | diff --git a/.cirrus.yml b/.cirrus.yml index 43dc0911..3fbb355c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -4,7 +4,7 @@ freebsd_instance: task: install_script: pwd && ls -la && pkg install -y cmake glib alsa-lib ladspa portaudio pulseaudio pkgconf sdl2 - compile_script: pwd && ls -la && mkdir $HOME/fluidsynth_install/ && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=0 .. && make -j4 && make check && make install + compile_script: pwd && ls -la && mkdir $HOME/fluidsynth_install/ && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=0 -DNO_GUI=1 .. && make -j4 && make check && make install diff --git a/.travis.yml b/.travis.yml index b9cf86d0..2cbd5e1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,7 +59,7 @@ before_script: - mkdir build && cd build script: - - cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install ${CMAKE_FLAGS} -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=1 .. + - cmake -DCMAKE_INSTALL_PREFIX=$HOME/fluidsynth_install ${CMAKE_FLAGS} -Denable-portaudio=1 -Denable-ladspa=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 .. - make -j4 - make check - if [ $TRAVIS_OS_NAME = linux ]; then make install; fi # install only on linux, as CMAKE_INSTALL_PREFIX is ignored for frameworks on macosx and I cant tell whether that's correct or a bug. diff --git a/src/config.cmake b/src/config.cmake index 50b5bf12..1f8c8ec7 100644 --- a/src/config.cmake +++ b/src/config.cmake @@ -154,6 +154,9 @@ /* Define to enable network support */ #cmakedefine NETWORK_SUPPORT @NETWORK_SUPPORT@ +/* Defined when fluidsynth is build in an automated enviornment, where no MSVC++ Runtime Debug Assertion dialogs should pop up */ +#cmakedefine NO_GUI @NO_GUI@ + /* libinstpatch for DLS and GIG */ #cmakedefine LIBINSTPATCH_SUPPORT @LIBINSTPATCH_SUPPORT@ diff --git a/test/test.h b/test/test.h index 2df1ebe6..5661d14b 100644 --- a/test/test.h +++ b/test/test.h @@ -1,10 +1,29 @@ #pragma once +#include "config.h" #include #include -#define TEST_ASSERT(COND) do { if (!(COND)) { fprintf(stderr, __FILE__ ":%d assertion (%s) failed\n", __LINE__, #COND); abort(); } } while (0) +/* + * We call abort() because on Linux this sends a signal to the process and causes the debugger to break. + * + * MSVC++ runtime opens a dialog when abort() is called, saying that abort() has been called and you can + * click "Retry" to make the debugger break. + * When executed by CI build however, the dialog causes the unit tests to be stuck forever. + * Thus suppress the dialog on windows. + * MinGW however requires explicit linking against MSVCRT >= 8.0 for _set_abort_behavior(). + * It's not worth the hassle to implement this with cmake... + */ +#if defined(NO_GUI) && defined(MINGW32) +#define TEST_ABORT exit(EXIT_FAILURE); +#elif defined(NO_GUI) && defined(WIN32) +#define TEST_ABORT _set_abort_behavior(0, _WRITE_ABORT_MSG); abort() +#else +#define TEST_ABORT abort() +#endif + +#define TEST_ASSERT(COND) do { if (!(COND)) { fprintf(stderr, __FILE__ ":%d assertion (%s) failed\n", __LINE__, #COND); TEST_ABORT; } } while (0) /* macro to test whether a fluidsynth function succeeded or not */ #define TEST_SUCCESS(FLUID_FUNCT) TEST_ASSERT((FLUID_FUNCT) != FLUID_FAILED)