Browse Source

Added an optional argument to the ADD_ACTION macro that defines the class from which the action class is derived.

interpolate
Michael Uleysky 10 months ago
parent
commit
9e1f686ba6
  1. 6
      include/actiondep.h
  2. 4
      src/CMakeLists.txt

6
include/actiondep.h

@ -9,10 +9,10 @@
using michlib::MDateTime;
#if defined GENACTIONLIST
#define ADD_ACTION(actclass, actname, suptest) ADD ACTION CLASS: actclass
#define ADD_ACTION(actclass, actname, suptest, ...) ADD ACTION CLASS: actclass
#else
#define ADD_ACTION(actclass, actname, suptest) \
class Action##actclass \
#define ADD_ACTION(actclass, actname, suptest, ...) \
class Action##actclass __VA_OPT__( : public) __VA_ARGS__ \
{ \
public: \
static constexpr const char* name = #actname; \

4
src/CMakeLists.txt

@ -37,6 +37,10 @@ string(REPLACE ";" "," actclist "${actlist}")
file(WRITE ${ACTIONLISTINC} "#define ACTLIST ${actclist}\n")
foreach(actfile ${actfilelist})
string(REGEX REPLACE "\.h$" ".cpp" actcpp "${actfile}")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${actcpp} )
target_sources(${EXENAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${actcpp})
endif()
file(APPEND ${ACTIONLISTINC} "#include \"${actfile}\"\n")
endforeach(actfile)
# End generation of actions list

Loading…
Cancel
Save