Skip to content

Commit

Permalink
Fix compilation for Emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
Lecrapouille committed Dec 17, 2023
1 parent 90a3b8f commit 6b8ba66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ VPATH += $(P)/src/Application $(P)/src/Editor $(P)/src/Editor/DearImGui
###################################################
# Inform Makefile where to find header files
#
INCLUDES += -I$(P)/include -I$(P)/src
INCLUDES += -I$(P)/include -I$(P)/src -I$(P)/external

###################################################
# Project defines
Expand Down Expand Up @@ -95,7 +95,7 @@ endif
INCLUDES += -I$(THIRDPART)/imgui -I$(THIRDPART)/imgui/backends -I$(THIRDPART)/imgui/misc/cpp
VPATH += $(THIRDPART)/imgui $(THIRDPART)/imgui/backends $(THIRDPART)/imgui/misc/cpp
DEARIMGUI_OBJS += imgui_widgets.o imgui_draw.o imgui_tables.o imgui.o imgui_stdlib.o
DEARIMGUI_OBJS += imgui_demo.o
# DEARIMGUI_OBJS += imgui_demo.o

###################################################
# Set thirdpart Dear ImGui Plot
Expand All @@ -113,11 +113,13 @@ DEARIMGUI_OBJS += ImGuiFileDialog.o
###################################################
# Set MQTT Library.
#
ifneq ($(ARCHI),Emscripten)
INCLUDES += -I$(THIRDPART) -I$(THIRDPART)/MQTT/include
VPATH += $(THIRDPART)/MQTT/src
DEFINES += -DMQTT_BROKER_ADDR=\"localhost\"
DEFINES += -DMQTT_BROKER_PORT=1883
PKG_LIBS += libmosquitto
endif

###################################################
# Set json Library.
Expand Down
27 changes: 2 additions & 25 deletions src/Net/TimedTokens.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,6 @@ struct TimedToken
//--------------------------------------------------------------------------
TimedToken(Arc& arc_, size_t const tokens_, TypeOfNet const type_);

// I dunno why the code in the #else branch seems to make buggy animations
// with tokens that disapear. Cannot catch it by unit tests.
// https://github.com/Lecrapouille/TimedPetriNetEditor/issues/2
# if 1

//--------------------------------------------------------------------------
//! \brief Hack needed because of references
//--------------------------------------------------------------------------
TimedToken& operator=(const TimedToken& obj)
{
this->~TimedToken(); // destroy
new (this) TimedToken(obj); // copy construct in place
return *this;
}

TimedToken(const TimedToken&) = default;
TimedToken(TimedToken&&) = default;
TimedToken& operator=(TimedToken&&) = default;

#else

//--------------------------------------------------------------------------
//! \brief Hack needed because of references
//--------------------------------------------------------------------------
Expand All @@ -82,14 +61,14 @@ struct TimedToken
//! \brief Needed to remove compilation warnings
//--------------------------------------------------------------------------
TimedToken(TimedToken const& other)
: TimedToken(other.arc, other.tokens)
: TimedToken(other.arc, other.tokens, other.type)
{}

//--------------------------------------------------------------------------
//! \brief Needed to remove compilation warnings
//--------------------------------------------------------------------------
TimedToken(TimedToken&& other)
: TimedToken(other.arc, other.tokens)
: TimedToken(other.arc, other.tokens, other.type)
{}

//--------------------------------------------------------------------------
Expand All @@ -102,8 +81,6 @@ struct TimedToken
return *this;
}

#endif

//--------------------------------------------------------------------------
//! \brief Update position on the screen.
//! \param[in] dt: the delta time (in seconds) from the previous call.
Expand Down

0 comments on commit 6b8ba66

Please sign in to comment.