Skip to content

Commit

Permalink
- [gexxo] Fix issues with building
Browse files Browse the repository at this point in the history
 - [gekko] Fix build issues with Optional<T> replacement
 - [gekko] Upgrade to C++17, partially
  • Loading branch information
hbirchtree committed Apr 5, 2020
1 parent b967937 commit 8990d9e
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ secrets:
appveyor: 6ME8msH/BDLiEde9wCb9+GQRN4rcAzyu1Vx/wP5yHejedO3vPlrOXHiWqhjNqXrQ
template_location: toolchain/cmake/Templates
version:
hotfix: 4
hotfix: 5
major: 4
minor: 4
patch: 12
Expand Down
2 changes: 1 addition & 1 deletion src/coffee/graphics/apis/gx/private/gexxo_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ void GXAPI::Draw(

for(auto i : stl_types::Range<>(data.elements()))
{
u16 idx = *baseIndex.at(i * indexStride).as<u16 const>()[0];
u16 idx = (*baseIndex.at(i * indexStride)).as<u16 const>()[0];
indexMap(desc.attribs, idx);
}
} else
Expand Down
60 changes: 56 additions & 4 deletions src/peripheral/include/peripherals/stl/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -761,42 +761,94 @@ using bad_optional_access = undefined_behavior;
template<typename T>
struct Optional
{
constexpr
Optional() : valid(false)
{
}
Optional(T&& value) : m_value(value), valid(true)
constexpr
Optional(T&& value) : m_value(std::move(value)), valid(true)
{
}

T& operator->() const
constexpr
T& operator->() &
{
if(!valid)
Throw(bad_optional_access("invalid optional"));

return m_value;
}

T& operator*() const
constexpr
T const& operator->() const&
{
if(!valid)
Throw(bad_optional_access("invalid optional"));

return m_value;
}

constexpr
T& operator*() &
{
if(!valid)
Throw(bad_optional_access("invalid optional"));

return m_value;
}

constexpr
T const& operator*() const&
{
if(!valid)
Throw(bad_optional_access("invalid optional"));

return m_value;
}

constexpr
T&& operator*() &&
{
if(!valid)
Throw(bad_optional_access("invalid optional"));

return std::move(m_value);
}

constexpr
T const&& operator*() const&&
{
if(!valid)
Throw(bad_optional_access("invalid optional"));

return std::move(m_value);
}

constexpr
operator bool() const
{
return valid;
}

T& value()
constexpr
T const& value() const&
{
if(!valid)
Throw(bad_optional_access("invalid optional"));

return m_value;
}

constexpr
T& value() &
{
if(!valid)
Throw(bad_optional_access("invalid optional"));

return m_value;
}

constexpr
Optional& operator=(T&& v)
{
m_value = std::move(v);
Expand Down
2 changes: 0 additions & 2 deletions toolchain/makers/Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,6 @@ gamecube: FORCE
-DBUILD_AUDIO=OFF \
-DBUILD_BINARIES=$(GENERATE_PROGRAMS) \
-DBUILD_BLAM=OFF \
-DBUILD_CPP14=ON \
-DBUILD_GLEAM=OFF \
-DBUILD_GRAPHICS_COMMON=OFF \
-DBUILD_GX=ON \
Expand Down Expand Up @@ -1543,7 +1542,6 @@ gamecube.shell: FORCE
-DBUILD_AUDIO=OFF \
-DBUILD_BINARIES=$(GENERATE_PROGRAMS) \
-DBUILD_BLAM=OFF \
-DBUILD_CPP14=ON \
-DBUILD_GLEAM=OFF \
-DBUILD_GRAPHICS_COMMON=OFF \
-DBUILD_GX=ON \
Expand Down
1 change: 0 additions & 1 deletion toolchain/makers/coffee-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ gamecube.*:
- -DBUILD_GRAPHICS_COMMON=OFF
- -DBUILD_BLAM=OFF
- -DBUILD_GX=ON
- -DBUILD_CPP14=ON
.*maemo.*:
+cmake-opts:
- -DBUILD_SDL2=OFF
Expand Down

0 comments on commit 8990d9e

Please sign in to comment.