Skip to content

Commit

Permalink
Building with ClangCL on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Jul 18, 2023
1 parent 06e8f56 commit 449672b
Show file tree
Hide file tree
Showing 20 changed files with 86 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
include:
- os: ubuntu-latest
cmake_args: "-DCMAKE_CXX_COMPILER=g++-11"
- os: windows-2019
cmake_args: ""
- os: windows-2022
cmake_args: "-G\"Visual Studio 17 2022\" -TClangCL -A x64"
- os: macos-latest
cmake_args: "-DCMAKE_BUILD_TYPE=Release"

Expand Down
35 changes: 34 additions & 1 deletion modules/cmake/WarningFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,44 @@ add_library(warning_flags INTERFACE)

if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(STATUS "Setting Clang compiler flags")
message(STATUS "Setting ClangCL compiler flags")
target_compile_options(warning_flags INTERFACE
-Wall
-Wno-pessimizing-move
-Wno-missing-field-initializers
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-exit-time-destructors
-Wno-old-style-cast
-Wno-undef
-Wno-unused-macros
-Wno-nonportable-system-include-path
-Wno-reserved-macro-identifier
-Wno-documentation
-Wno-documentation-unknown-command
-Wno-double-promotion
-Wno-global-constructors
-Wno-suggest-override
-Wno-suggest-destructor-override
-Wno-non-virtual-dtor
-Wno-extra-semi-stmt
-Wno-cast-qual
-Wno-float-equal
-Wno-covered-switch-default
-Wno-unused-template
-Wno-undefined-func-template
-Wno-missing-variable-declarations
-Wno-ctad-maybe-unsupported
-Wno-missing-noreturn
-Wno-reserved-identifier
-Wno-undefined-reinterpret-cast
-Wno-disabled-macro-expansion
-Wno-deprecated
-Wno-newline-eof
-Wno-date-time
-Wno-cast-function-type
-Wno-range-loop-bind-reference
-Wno-sign-conversion
)
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"))
message(STATUS "Setting MSVC compiler flags")
Expand Down
2 changes: 2 additions & 0 deletions src/BYOD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ static const clap_preset_discovery_factory byod_preset_discovery_factory {
.create = preset_discovery::create,
};

JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wmissing-prototypes")
const void* JUCE_CALLTYPE clapJuceExtensionCustomFactory (const char* factory_id)
{
if (strcmp (factory_id, CLAP_PRESET_DISCOVERY_FACTORY_ID) == 0)
Expand All @@ -159,4 +160,5 @@ const void* JUCE_CALLTYPE clapJuceExtensionCustomFactory (const char* factory_id
}
return nullptr;
}
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
#endif
2 changes: 1 addition & 1 deletion src/gui/utils/ErrorMessageView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ErrorMessageView::ErrorMessageView()
addAndMakeVisible (custom2Button);
}

BYODPluginEditor* findTopLevelEditor (Component* currentComponent)
static BYODPluginEditor* findTopLevelEditor (Component* currentComponent)
{
BYODPluginEditor* topLevelEditor = nullptr;
while (currentComponent != nullptr)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/utils/LevelMeterComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void LevelMeterComponent::paint (Graphics& g)
void LevelMeterComponent::timerCallback()
{
bool needsRepaint = false;
for (int ch = 0; ch < 2; ++ch)
for (size_t ch = 0; ch < 2; ++ch)
{
dbLevels[ch] = Decibels::gainToDecibels (levelDetector[ch].processSample (rmsLevels[ch]));

Expand Down
11 changes: 11 additions & 0 deletions src/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,22 @@

// Any other widely used headers that don't change...
#include <FuzzySearchDatabase.hpp>

JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE("-Wzero-as-null-pointer-constant",
"-Wsign-conversion")
#include <RTNeural/RTNeural.h>
JUCE_END_IGNORE_WARNINGS_GCC_LIKE

#include <chowdsp_wdf/chowdsp_wdf.h>
#include <ea_variant/ea_variant.h>
#include <sst/cpputils.h>

JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE("-Wzero-as-null-pointer-constant",
"-Wsign-conversion")
#include <modules/Eigen/Eigen/Dense>
JUCE_END_IGNORE_WARNINGS_GCC_LIKE


// global definitions
using Parameters = std::vector<std::unique_ptr<juce::RangedAudioParameter>>;
using ParamLayout = AudioProcessorValueTreeState::ParameterLayout;
Expand Down
12 changes: 6 additions & 6 deletions src/processors/BaseProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ BaseProcessor::BaseProcessor (const String& name,

outputBuffers.resize (jmax (1, numOutputs));
outputBuffers.fill (nullptr);
outputConnections.resize (numOutputs);
outputConnections.resize ((size_t) numOutputs);

inputBuffers.resize (numInputs);
inputsConnected.resize (0);
portMagnitudes.resize (numInputs);
portMagnitudes.resize ((size_t) numInputs);
}

BaseProcessor::~BaseProcessor() = default;
Expand Down Expand Up @@ -209,7 +209,7 @@ void BaseProcessor::loadPositionInfoFromXML (XmlElement* xml)
void BaseProcessor::addConnection (ConnectionInfo&& info)
{
jassert (info.startProc == this);
outputConnections[info.startPort].add (info);
outputConnections[(size_t) info.startPort].add (info);

// make sure the end processor actually has an input port available that we can connect to!
jassert (info.endProc->inputsConnected.size() + 1 <= info.endProc->numInputs);
Expand All @@ -221,7 +221,7 @@ void BaseProcessor::removeConnection (const ConnectionInfo& info)
{
jassert (info.startProc == this);

auto& connections = outputConnections[info.startPort];
auto& connections = outputConnections[(size_t) info.startPort];
for (int cIdx = 0; cIdx < connections.size(); ++cIdx)
{
if (connections[cIdx].endProc == info.endProc && connections[cIdx].endPort == info.endPort)
Expand Down Expand Up @@ -351,12 +351,12 @@ void BaseProcessor::setEditor (ProcessorEditor* procEditor)

PortType BaseProcessor::getInputPortType (int portIndex) const
{
return inputPortTypes[portIndex];
return inputPortTypes[(size_t) portIndex];
}

PortType BaseProcessor::getOutputPortType (int portIndex) const
{
return outputPortTypes[portIndex];
return outputPortTypes[(size_t) portIndex];
}

void BaseProcessor::setPosition (juce::Point<int> pos, Rectangle<int> parentBounds)
Expand Down
6 changes: 3 additions & 3 deletions src/processors/BaseProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ class BaseProcessor : private JuceProcWrapper
const AudioBuffer<float>& getInputBuffer (int idx = 0) const { return inputBuffers.getReference (idx); }
AudioBuffer<float>& getInputBufferNonConst (int idx = 0) { return inputBuffers.getReference (idx); } // Most derived classes should never use this!
AudioBuffer<float>* getOutputBuffer (int idx = 0) { return outputBuffers[idx]; }
const ConnectionInfo& getOutputConnection (int portIdx, int connectionIdx) const { return outputConnections[portIdx].getReference (connectionIdx); }
const ConnectionInfo& getOutputConnection (int portIdx, int connectionIdx) const { return outputConnections[(size_t) portIdx].getReference (connectionIdx); }

int getNumOutputConnections (int portIdx) const { return outputConnections[portIdx].size(); }
int getNumInputConnections() const { return inputsConnected.size(); };
int getNumOutputConnections (int portIdx) const { return outputConnections[(size_t) portIdx].size(); }
int getNumInputConnections() const { return inputsConnected.size(); }

int incrementNumInputsReady() { return numInputsReady++; }
int getNumInputsReady() const { return numInputsReady; }
Expand Down
2 changes: 1 addition & 1 deletion src/processors/JuceProcWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class JuceProcWrapper : public AudioProcessor
{
public:
explicit JuceProcWrapper (const String& name = String()) : name (name) {}
explicit JuceProcWrapper (const String& _name = String()) : name (_name) {}

const String getName() const override { return name; }

Expand Down
2 changes: 1 addition & 1 deletion src/processors/ProcessorStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ void createProcListFiltered (const ProcessorStore& store, PopupMenu& menu, int&
}
}

void createProcListUnfiltered (const ProcessorStore& store, PopupMenu& menu, int& menuID)
static void createProcListUnfiltered (const ProcessorStore& store, PopupMenu& menu, int& menuID)
{
createProcListFiltered (
store, menu, menuID, [] (auto...)
Expand Down
14 changes: 7 additions & 7 deletions src/processors/drive/GuitarMLAmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ bool GuitarMLAmp::getCustomComponents (OwnedArray<Component>& customComps, chowd
class MainParamSlider : public Slider
{
public:
MainParamSlider (const ModelArch& modelArch,
MainParamSlider (const ModelArch& modelArchitecture,
AudioProcessorValueTreeState& vts,
ModelChangeBroadcaster& modelChangeBroadcaster,
ModelChangeBroadcaster& modelChangeCaster,
chowdsp::HostContextProvider& hcp)
: currentModelArch (modelArch),
: currentModelArch (modelArchitecture),
gainSlider (*getParameterPointer<chowdsp::FloatParameter*> (vts, gainTag), hcp),
conditionSlider (*getParameterPointer<chowdsp::FloatParameter*> (vts, conditionTag), hcp),
gainAttach (vts, gainTag, gainSlider),
Expand All @@ -325,7 +325,7 @@ bool GuitarMLAmp::getCustomComponents (OwnedArray<Component>& customComps, chowd
hcp.registerParameterComponent (gainSlider, gainSlider.getParameter());
hcp.registerParameterComponent (conditionSlider, conditionSlider.getParameter());

modelChangeCallback = modelChangeBroadcaster.connect<&MainParamSlider::updateSliderVisibility> (this);
modelChangeCallback = modelChangeCaster.connect<&MainParamSlider::updateSliderVisibility> (this);

this->setName (conditionTag + "__" + gainTag + "__");
}
Expand Down Expand Up @@ -387,15 +387,15 @@ bool GuitarMLAmp::getCustomComponents (OwnedArray<Component>& customComps, chowd
class ModelChoiceBox : public ComboBox
{
public:
ModelChoiceBox (GuitarMLAmp& processor, ModelChangeBroadcaster& modelChangeBroadcaster)
ModelChoiceBox (GuitarMLAmp& processor, ModelChangeBroadcaster& modelChangeCaster)
{
addItemList (guitarMLModelNames, 1);
addSeparator();
addItem ("Custom", guitarMLModelNames.size() + 1);
setText (processor.getCurrentModelName(), dontSendNotification);

modelChangeCallback = modelChangeBroadcaster.connect ([this, &processor]
{ setText (processor.getCurrentModelName(), dontSendNotification); });
modelChangeCallback = modelChangeCaster.connect ([this, &processor]
{ setText (processor.getCurrentModelName(), dontSendNotification); });

onChange = [this, &processor]
{
Expand Down
3 changes: 0 additions & 3 deletions src/processors/drive/RONN.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#include "RONN.h"

// borrowed from RTNeural's submodules...
#include <modules/Eigen/Eigen/Dense>

namespace
{
int randomSeeds[5] = { 1, 101, 2048, 5005, 9001 };
Expand Down
4 changes: 2 additions & 2 deletions src/processors/drive/Warp.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class Warp : public BaseProcessor
return y;
}

void calcCoefs (float fc, float qVal, float gain, float fs)
void calcCoefs (float fc, float qVal, float gain, float _fs)
{
using namespace chowdsp::ConformalMaps;

const auto wc = MathConstants<float>::twoPi * fc;
const auto K = computeKValue (fc, fs);
const auto K = computeKValue (fc, _fs);

auto kSqTerm = 1.0f / (wc * wc);
auto kTerm = 1.0f / (qVal * wc);
Expand Down
12 changes: 6 additions & 6 deletions src/processors/drive/centaur/GainStageML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ void GainStageML::reset (double sampleRate, int samplesPerBlock)
{
fadeBuffer.setSize (2, samplesPerBlock);

for (int i = 0; i < numModels; ++i)
for (size_t i = 0; i < (size_t) numModels; ++i)
{
for (int ch = 0; ch < 2; ++ch)
for (size_t ch = 0; ch < 2; ++ch)
{
gainStageML[i][ch].prepare (sampleRate, samplesPerBlock);

Expand All @@ -47,7 +47,7 @@ void GainStageML::processModel (AudioBuffer<float>& buffer, ModelPair& model)
for (int ch = 0; ch < buffer.getNumChannels(); ++ch)
{
auto&& channelBlock = block.getSingleChannelBlock ((size_t) ch);
model[ch].process (channelBlock);
model[(size_t) ch].process (channelBlock);
}
}

Expand All @@ -59,13 +59,13 @@ void GainStageML::processBlock (AudioBuffer<float>& buffer)

if (modelIdx == lastModelIdx)
{
processModel (buffer, gainStageML[modelIdx]);
processModel (buffer, gainStageML[(size_t) modelIdx]);
}
else // need to fade between models
{
fadeBuffer.makeCopyOf (buffer, true);
processModel (buffer, gainStageML[lastModelIdx]); // previous model
processModel (fadeBuffer, gainStageML[modelIdx]); // next model
processModel (buffer, gainStageML[(size_t) lastModelIdx]); // previous model
processModel (fadeBuffer, gainStageML[(size_t) modelIdx]); // next model

buffer.applyGainRamp (0, buffer.getNumSamples(), 1.0f, 0.0f);
for (int ch = 0; ch < buffer.getNumChannels(); ++ch)
Expand Down
2 changes: 2 additions & 0 deletions src/processors/drive/neural_utils/RNNAccelerated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#if __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif

#include <RTNeural/RTNeural.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
template <int numIns, int hiddenSize, int RecurrentLayerType>
ResampledRNNAccelerated<numIns, hiddenSize, RecurrentLayerType>::ResampledRNNAccelerated()
{
#if 0 // JUCE_INTEL
#if JUCE_INTEL
if (juce::SystemStats::hasAVX() && juce::SystemStats::hasFMA3())
{
juce::Logger::writeToLog ("Using RNN model with AVX SIMD instructions!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ResampledRNNAccelerated
}
else
{
jassert ((int) condition_data.size() == data.size());
jassert (condition_data.size() == data.size());
model.process_conditioned (data, condition_data, useResiduals);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/processors/drive/waveshaper/SurgeWaveshapers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "SurgeWaveshapers.h"

JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wstrict-aliasing")
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wstrict-aliasing", "-Wmissing-prototypes", "-Wimplicit-int-float-conversion")

namespace SurgeWaveshapers
{
Expand Down
6 changes: 3 additions & 3 deletions src/processors/netlist_helpers/CircuitQuantity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ CircuitQuantity::CircuitQuantity (float defaultVal,
float minVal,
float maxVal,
Type qType,
const std::string& name,
const std::string& _name,
Setter&& setterFunc)
: value (defaultVal),
defaultValue (defaultVal),
minValue (minVal),
maxValue (maxVal),
type (qType),
name (name),
name (_name),
setter (std::move (setterFunc))
{
}
Expand Down Expand Up @@ -66,7 +66,7 @@ juce::String getStringForValue (float value)
return {};
}

juce::String getPostFixForQuantity (CircuitQuantity::Type type)
static juce::String getPostFixForQuantity (CircuitQuantity::Type type)
{
switch (type)
{
Expand Down

0 comments on commit 449672b

Please sign in to comment.