workaround for experiment.hpp including generated header
If an experiment's class definition (experiment.hpp) contains a member of a generated type (which is the common case for protobuf messages), it needs to include a generated header. In order to instantiate the experiment in a SimulatorController::initExperiments() hook aspect, the aspect needs to include the experiment's class definition -- and indirectly the generated protobuf header. As the build system does not know about this dependency, building SimulatorController.cc fails regularly, because the header is not generated timely. This commit works around this (currently only for the RAMpage experiment) by delegating experiment instantiation to a separate compilation unit, removing the need to include any headers in the instantiation aspect. git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1691 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
22
src/experiments/instantiate-experiment-indirect.ah.in
Normal file
22
src/experiments/instantiate-experiment-indirect.ah.in
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef __INSTANTIATE_@EXPERIMENT_TYPE@_AH__
|
||||
#define __INSTANTIATE_@EXPERIMENT_TYPE@_AH__
|
||||
|
||||
// Use this indirect variant of experiment instantiation if your experiment.hpp
|
||||
// includes generated headers (e.g., protobuf message definitions) that are not
|
||||
// guaranteed to exist when the aspect is woven.
|
||||
|
||||
// FIXME: cmake does not remove these .ah files when the user configures
|
||||
// another experiment (or even makes "clean"). Currently, this needs to be
|
||||
// worked around by manually removing $BUILDDIR/core/experiments/*/*.ah .
|
||||
|
||||
// You need to provide the implementation of this function in your experiment
|
||||
// directory:
|
||||
void instantiate@EXPERIMENT_TYPE@();
|
||||
|
||||
aspect @EXPERIMENT_TYPE@ExperimentHook {
|
||||
advice execution ("void fail::SimulatorController::initExperiments()") : after () {
|
||||
instantiate@EXPERIMENT_TYPE@();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __INSTANTIATE_@EXPERIMENT_TYPE@_AH__
|
||||
@ -1,6 +1,6 @@
|
||||
set(EXPERIMENT_NAME rampage)
|
||||
set(EXPERIMENT_TYPE RAMpageExperiment)
|
||||
configure_file(../instantiate-experiment.ah.in
|
||||
configure_file(../instantiate-experiment-indirect.ah.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/instantiate-${EXPERIMENT_NAME}.ah @ONLY
|
||||
)
|
||||
|
||||
@ -9,6 +9,7 @@ set(MY_PROTOS
|
||||
)
|
||||
|
||||
set(MY_CAMPAIGN_SRCS
|
||||
instantiateExperiment.cc
|
||||
experimentInfo.hpp
|
||||
experiment.hpp
|
||||
experiment.cc
|
||||
|
||||
8
src/experiments/rampage/instantiateExperiment.cc
Normal file
8
src/experiments/rampage/instantiateExperiment.cc
Normal file
@ -0,0 +1,8 @@
|
||||
#include "experiment.hpp"
|
||||
#include "sal/SALInst.hpp"
|
||||
|
||||
static RAMpageExperiment experiment;
|
||||
void instantiateRAMpageExperiment()
|
||||
{
|
||||
fail::simulator.addFlow(&experiment);
|
||||
}
|
||||
Reference in New Issue
Block a user