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 1 year 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; using michlib::MDateTime;
#if defined GENACTIONLIST #if defined GENACTIONLIST
#define ADD_ACTION(actclass, actname, suptest) ADD ACTION CLASS: actclass #define ADD_ACTION(actclass, actname, suptest, ...) ADD ACTION CLASS: actclass
#else #else
#define ADD_ACTION(actclass, actname, suptest) \ #define ADD_ACTION(actclass, actname, suptest, ...) \
class Action##actclass \ class Action##actclass __VA_OPT__( : public) __VA_ARGS__ \
{ \ { \
public: \ public: \
static constexpr const char* name = #actname; \ 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") file(WRITE ${ACTIONLISTINC} "#define ACTLIST ${actclist}\n")
foreach(actfile ${actfilelist}) 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") file(APPEND ${ACTIONLISTINC} "#include \"${actfile}\"\n")
endforeach(actfile) endforeach(actfile)
# End generation of actions list # End generation of actions list

Loading…
Cancel
Save