Skip to content

Commit

Permalink
Reduce MSVC Warnings (#135)
Browse files Browse the repository at this point in the history
Mostly deal with that deprecated thingy from juce font. Sign.
  • Loading branch information
baconpaul authored Nov 26, 2024
1 parent 55af8e4 commit 70aa8c9
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 206 deletions.
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(SST_JUCEGUI_BUILD_EXAMPLES "Add targets for building and running sst-filters examples" FALSE)

if (${SST_JUCEGUI_BUILD_EXAMPLES})
if (${PROJECT_IS_TOP_LEVEL})
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
message(STATUS "Including reduced MSVC warning flags")
add_compile_options(
/wd4244 # convert float from double
/wd4305 # truncate from double to float
/wd4018 # signed unsigned compare
/wd4996 # don't warn on stricmp vs _stricmp and other posix names
/wd4267 # converting size_t <-> int
/wd4005 # macro redefinition for nominmax
/utf-8
)
endif ()
endif()

message(STATUS "Including SST JUCEGUI Examples")

if (NOT TARGET juce::juce_gui_basics)
Expand Down
3 changes: 1 addition & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
add_subdirectory(component-demo)
add_subdirectory(scxt-wireframes)
add_subdirectory(component-demo)
12 changes: 0 additions & 12 deletions examples/scxt-wireframes/CMakeLists.txt

This file was deleted.

126 changes: 0 additions & 126 deletions examples/scxt-wireframes/MainWindow.h

This file was deleted.

64 changes: 0 additions & 64 deletions examples/scxt-wireframes/SCXTWireframesMain.cpp

This file was deleted.

3 changes: 1 addition & 2 deletions src/sst/jucegui/components/GlyphPainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,10 @@ void paintFromSvg(juce::Graphics &g, const juce::Rectangle<int> &into, const std
auto res = juce::Drawable::createFromImageData(svg.data(), svg.size());
dbls[path] = std::move(res);
}
catch (std::exception &e)
catch (std::exception &)
{
g.setColour(juce::Colours::red);
g.fillRect(into);
// oh well
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/sst/jucegui/style/StyleSheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,17 @@ struct StyleSheetBuiltInImpl : public StyleSheet
const juce::Font &f) override
{
jassert(isValidPair(c, p));

#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4996)
#endif

fonts[c.cname][p.pname] = f;

#if defined(_MSC_VER)
#pragma warning(pop)
#endif
}

void replaceFontsWithTypeface(const juce::Typeface::Ptr &p) override
Expand Down

0 comments on commit 70aa8c9

Please sign in to comment.