DaisySP icon indicating copy to clipboard operation
DaisySP copied to clipboard

Fix cmake build on windows

Open Segfault1602 opened this issue 2 years ago • 1 comments

CMake build was broken on windows due to M_E being undeclared. Fix is to define _USE_MATH_DEFINES on windows when building the library.

Segfault1602 avatar Dec 15 '23 22:12 Segfault1602

found this, and one other thing on my attempt to build msvc. in ladder.cpp

__attribute__((optimize("unroll-loops"))) void
void LadderFilter::ProcessBlock(float* buf, size_t size)
{
    for(size_t i = 0; i < size; i++)
    {
        buf[i] = Process(buf[i]);
    }
}

attribute is gcc-specific, causes msvc to not compile, and will be ignored on clang. alternatives:

  • put unroll-loops in a macro that is empty on non-gcc platforms
  • take size as a template parameter to reliably unroll the loop at compile time, example: https://stackoverflow.com/q/67599943

Alloyed avatar Jun 22 '24 18:06 Alloyed