Refactor xmake.lua and make some warnings as errors
This commit is contained in:
parent
445ed93fbb
commit
97f1c2c56c
|
|
@ -215,7 +215,8 @@ namespace Nz
|
|||
}
|
||||
else
|
||||
{
|
||||
constexpr std::size_t blockSize = 4 * 1024;
|
||||
// File size isn't know, read it block by block until the end of stream
|
||||
constexpr std::size_t blockSize = 4u * 1024;
|
||||
|
||||
while (!stream.EndOfStream())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,11 +82,11 @@ namespace Nz
|
|||
};
|
||||
|
||||
mutable std::vector<VertexStruct_XYZ_Color_UV> m_vertices;
|
||||
std::vector<Tile> m_tiles;
|
||||
std::vector<Layer> m_layers;
|
||||
Vector2ui m_mapSize;
|
||||
std::vector<Tile> m_tiles;
|
||||
Vector2f m_origin;
|
||||
Vector2f m_tileSize;
|
||||
Vector2ui m_mapSize;
|
||||
bool m_isometricModeEnabled;
|
||||
mutable bool m_shouldRebuildVertices;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <Nazara/Graphics/FrameGraph.hpp>
|
||||
#include <Nazara/Core/Algorithm.hpp>
|
||||
#include <Nazara/Graphics/Graphics.hpp>
|
||||
#include <NazaraUtils/Bitset.hpp>
|
||||
#include <NazaraUtils/StackArray.hpp>
|
||||
#include <stdexcept>
|
||||
#include <unordered_set>
|
||||
|
|
@ -1099,7 +1100,7 @@ namespace Nz
|
|||
void FrameGraph::RemoveDuplicatePasses()
|
||||
{
|
||||
// A way to remove duplicates from a std::vector without sorting it
|
||||
std::vector<bool> seen(m_framePasses.size());
|
||||
Bitset<> seen(m_framePasses.size());
|
||||
|
||||
auto itRead = m_pending.passList.begin();
|
||||
auto itWrite = m_pending.passList.begin();
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ namespace Nz
|
|||
Light::Light(UInt8 lightType) :
|
||||
m_boundingVolume(BoundingVolumef::Null()),
|
||||
m_shadowMapFormat(Graphics::Instance()->GetPreferredDepthFormat()),
|
||||
m_shadowMapSize(512),
|
||||
m_lightType(lightType),
|
||||
m_shadowMapSize(512),
|
||||
m_isShadowCaster(false)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,6 @@ namespace Nz
|
|||
{
|
||||
constexpr MaterialPropertyType PropertyType = TypeToMaterialPropertyType_v<T>;
|
||||
|
||||
using BufferType = typename MaterialPropertyTypeInfo<PropertyType>::BufferType;
|
||||
|
||||
materialInstance.UpdateOptionValue(m_optionHash, MaterialPropertyTypeInfo<PropertyType>::EncodeToOption(arg));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ namespace Nz
|
|||
* \remark The default material is used for every material requested
|
||||
*/
|
||||
Tilemap::Tilemap(const Vector2ui& mapSize, const Vector2f& tileSize, std::size_t materialCount) :
|
||||
m_tiles(mapSize.x* mapSize.y),
|
||||
m_layers(materialCount),
|
||||
m_mapSize(mapSize),
|
||||
m_tileSize(tileSize),
|
||||
m_tiles(mapSize.x* mapSize.y),
|
||||
m_origin(0.f, 0.f),
|
||||
m_tileSize(tileSize),
|
||||
m_mapSize(mapSize),
|
||||
m_isometricModeEnabled(false),
|
||||
m_shouldRebuildVertices(false)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -117,6 +117,12 @@ namespace Nz
|
|||
return false;
|
||||
}
|
||||
|
||||
case WindowBackend::Web:
|
||||
{
|
||||
NazaraError("unsupported creation from a Web handle");
|
||||
return false;
|
||||
}
|
||||
|
||||
case WindowBackend::Cocoa: systemHandle = handle.cocoa.window; break;
|
||||
case WindowBackend::X11: systemHandle = reinterpret_cast<void*>(std::uintptr_t(handle.x11.window)); break;
|
||||
case WindowBackend::Windows: systemHandle = handle.windows.window; break;
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ namespace Nz
|
|||
}
|
||||
|
||||
Window::Window(Window&& window) noexcept :
|
||||
m_cursorController(std::move(window.m_cursorController)),
|
||||
m_cursor(std::move(window.m_cursor)),
|
||||
m_eventHandler(std::move(window.m_eventHandler)),
|
||||
m_icon(std::move(window.m_icon)),
|
||||
m_impl(std::move(window.m_impl)),
|
||||
m_cursorController(std::move(window.m_cursorController)),
|
||||
m_eventHandler(std::move(window.m_eventHandler)),
|
||||
m_closed(window.m_closed),
|
||||
m_closeOnQuit(window.m_closeOnQuit),
|
||||
m_ownsWindow(window.m_ownsWindow),
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ unsigned int BufferField::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 0;
|
||||
case QtNodes::PortType::Out: return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,6 +120,9 @@ unsigned int CastVec<ToComponentCount>::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 1;
|
||||
case QtNodes::PortType::Out: return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ unsigned int ConditionalExpression::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 2;
|
||||
case QtNodes::PortType::Out: return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ unsigned int Discard::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 1;
|
||||
case QtNodes::PortType::Out: return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ unsigned int InputValue::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 0;
|
||||
case QtNodes::PortType::Out: return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ QtNodes::NodeDataType Mat4VecMul::dataType(QtNodes::PortType portType, QtNodes::
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In:
|
||||
{
|
||||
assert(portIndex == 0 || portIndex == 1);
|
||||
|
|
@ -57,6 +60,9 @@ unsigned int Mat4VecMul::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 2;
|
||||
case QtNodes::PortType::Out: return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ unsigned int PositionOutputValue::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 1;
|
||||
case QtNodes::PortType::Out: return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ unsigned int SampleTexture::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 2;
|
||||
case QtNodes::PortType::Out: return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ unsigned int TextureValue::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 0;
|
||||
case QtNodes::PortType::Out: return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ QtNodes::NodeDataType VecDot::dataType(QtNodes::PortType portType, QtNodes::Port
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In:
|
||||
{
|
||||
assert(portIndex == 0 || portIndex == 1);
|
||||
|
|
@ -58,6 +61,9 @@ unsigned int VecDot::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 2;
|
||||
case QtNodes::PortType::Out: return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ QtNodes::NodeDataType VecFloatMul::dataType(QtNodes::PortType portType, QtNodes:
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In:
|
||||
{
|
||||
assert(portIndex == 0 || portIndex == 1);
|
||||
|
|
@ -57,6 +60,9 @@ unsigned int VecFloatMul::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 2;
|
||||
case QtNodes::PortType::Out: return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ unsigned int VecValue<ComponentCount>::nPorts(QtNodes::PortType portType) const
|
|||
{
|
||||
switch (portType)
|
||||
{
|
||||
case QtNodes::PortType::None:
|
||||
break;
|
||||
|
||||
case QtNodes::PortType::In: return 0;
|
||||
case QtNodes::PortType::Out: return 1;
|
||||
}
|
||||
|
|
|
|||
60
xmake.lua
60
xmake.lua
|
|
@ -246,7 +246,7 @@ if has_config("audio") then
|
|||
end
|
||||
|
||||
if has_config("bulletphysics") then
|
||||
add_requires("bullet3")
|
||||
add_requires("bullet3", { configs = { debug = is_mode("debug") }})
|
||||
end
|
||||
|
||||
if has_config("chipmunkphysics") then
|
||||
|
|
@ -254,7 +254,7 @@ if has_config("chipmunkphysics") then
|
|||
end
|
||||
|
||||
if has_config("joltphysics") then
|
||||
add_requires("joltphysics 3", { configs = { debug = is_mode("debug") }})
|
||||
add_requires("joltphysics >=3", { configs = { debug = is_mode("debug") }})
|
||||
add_requires("ordered_map")
|
||||
end
|
||||
|
||||
|
|
@ -332,8 +332,17 @@ set_allowedplats("windows", "mingw", "linux", "macosx", "wasm")
|
|||
set_allowedmodes("debug", "releasedbg", "release", "asan", "tsan", "coverage")
|
||||
set_defaultmode("debug")
|
||||
|
||||
add_includedirs("include")
|
||||
add_sysincludedirs("thirdparty/include")
|
||||
|
||||
set_languages("c89", "cxx17")
|
||||
set_rundir("./bin/$(plat)_$(arch)_$(mode)")
|
||||
set_targetdir("./bin/$(plat)_$(arch)_$(mode)")
|
||||
set_warnings("allextra")
|
||||
|
||||
if is_mode("debug") then
|
||||
add_rules("debug.suffix")
|
||||
add_defines("NAZARA_DEBUG")
|
||||
elseif is_mode("asan") then
|
||||
set_optimize("none") -- by default xmake will optimize asan builds
|
||||
elseif is_mode("tsan") then
|
||||
|
|
@ -347,35 +356,48 @@ elseif is_mode("releasedbg", "release") then
|
|||
add_vectorexts("sse", "sse2", "sse3", "ssse3")
|
||||
end
|
||||
|
||||
add_includedirs("include")
|
||||
add_sysincludedirs("thirdparty/include")
|
||||
|
||||
set_languages("c89", "cxx17")
|
||||
set_rundir("./bin/$(plat)_$(arch)_$(mode)")
|
||||
set_targetdir("./bin/$(plat)_$(arch)_$(mode)")
|
||||
set_warnings("allextra")
|
||||
|
||||
if not is_mode("release") then
|
||||
set_symbols("debug", "hidden")
|
||||
end
|
||||
|
||||
if is_mode("debug") then
|
||||
add_defines("NAZARA_DEBUG")
|
||||
-- Compiler-specific options
|
||||
|
||||
if is_plat("windows") then
|
||||
-- MSVC
|
||||
add_cxxflags("/bigobj", "/permissive-", "/Zc:__cplusplus", "/Zc:externConstexpr", "/Zc:inline", "/Zc:lambda", "/Zc:preprocessor", "/Zc:referenceBinding", "/Zc:strictStrings", "/Zc:throwingNew", {tools = "cl"})
|
||||
add_defines("_CRT_SECURE_NO_WARNINGS", "_ENABLE_EXTENDED_ALIGNED_STORAGE")
|
||||
|
||||
-- Enable the following additional warnings:
|
||||
add_cxflags("/we4062", {tools = "cl"}) -- Switch case not handled (warning as error)
|
||||
add_cxflags("/we4426", {tools = "cl"}) -- Optimization flags changed after including header, may be due to #pragma optimize()
|
||||
add_cxflags("/we5038", {tools = "cl"}) -- Data member will be initialized after data member
|
||||
|
||||
-- Disable the following warnings:
|
||||
add_cxflags("/wd4251", {tools = "cl"}) -- class needs to have dll-interface to be used by clients of class blah blah blah
|
||||
add_cxflags("/wd4275", {tools = "cl"}) -- DLL-interface class 'class_1' used as base for DLL-interface blah
|
||||
else
|
||||
-- GCC-compatible (GCC, Clang, ...)
|
||||
add_cxflags("-pedantic", "-pedantic-errors")
|
||||
add_cxflags("-Wtrampolines")
|
||||
add_cxflags("-Werror=reorder")
|
||||
add_cxflags("-Werror=switch")
|
||||
end
|
||||
|
||||
-- Platform-specific options
|
||||
|
||||
if is_plat("windows") then
|
||||
if has_config("override_runtime") then
|
||||
set_runtimes(is_mode("debug") and "MDd" or "MD")
|
||||
end
|
||||
|
||||
add_defines("_CRT_SECURE_NO_WARNINGS", "_ENABLE_EXTENDED_ALIGNED_STORAGE")
|
||||
add_cxxflags("/bigobj", "/permissive-", "/Zc:__cplusplus", "/Zc:externConstexpr", "/Zc:inline", "/Zc:lambda", "/Zc:preprocessor", "/Zc:referenceBinding", "/Zc:strictStrings", "/Zc:throwingNew")
|
||||
add_cxflags("/w44062") -- Enable warning: switch case not handled
|
||||
add_cxflags("/wd4251") -- Disable warning: class needs to have dll-interface to be used by clients of class blah blah blah
|
||||
add_cxflags("/wd4275") -- Disable warning: DLL-interface class 'class_1' used as base for DLL-interface blah
|
||||
elseif is_plat("mingw") then
|
||||
add_cxflags("-Og", "-Wa,-mbig-obj")
|
||||
-- Use some optimizations even in debug for MinGW to reduce object size
|
||||
if is_mode("debug") then
|
||||
add_cxflags("-Og")
|
||||
end
|
||||
add_cxflags("-Wa,-mbig-obj")
|
||||
add_ldflags("-Wa,-mbig-obj")
|
||||
|
||||
-- Disable -Isystem for external packages as it seems to break Assimp
|
||||
set_policy("package.include_external_headers", false)
|
||||
elseif is_plat("wasm") then
|
||||
add_cxflags("-sNO_DISABLE_EXCEPTION_CATCHING")
|
||||
|
|
|
|||
Loading…
Reference in New Issue