diff --git a/CMake/CMakeHelpers.cmake b/CMake/CMakeHelpers.cmake index 4c1466d085d9cc1e1e212921aef93fda6f06cb16..2cc167639343e2d851ad551c9064069ec0ab8146 100644 --- a/CMake/CMakeHelpers.cmake +++ b/CMake/CMakeHelpers.cmake @@ -17,15 +17,31 @@ endmacro() macro ( generate_specializations ) - - foreach ( entry ${EVENT_NAME_LIST} ) + unset ( _EVENT_NAMES ) + foreach ( entry ${EVENT_NAME_LIST} ) set (_EVENT_NAMES "${_EVENT_NAMES}\nSPECIALIZE_MESSAGE_TYPE( ${entry} )" ) endforeach() configure_file( src/nett-python/specializations_template.h specializations.h - @ONLY ) -message ( "successfully generated python_slot specializations" ) + @ONLY ) + + message ( "successfully generated python_slot specializations" ) +endmacro() + + +macro ( generate_includes ) + unset ( _EVENT_NAMES ) + foreach ( entry ${EVENT_NAME_LIST} ) + set (_EVENT_NAMES "${_EVENT_NAMES}\n#include <../schema/${entry}.pb.h>" ) + endforeach() + + configure_file( + src/nett-python/includes_template.h + includes.h + @ONLY ) + + message ( "successfully generated event includes" ) endmacro() \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f2ecab7d114404cd5e50ca15d0bb7bfd803a1e3..996ca4448cd34024ee9f0ff5ca1006e2be3dc517 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ add_event ( nett_python map_string_float_vector_message ${NETT_SCHEMA_DIR} ${PRO add_event ( nett_python population_connectivity_message ${NETT_SCHEMA_DIR} ${PROJECT_BINARY_DIR} ) add_event ( nett_python area_populations_connectivity_message ${NETT_SCHEMA_DIR} ${PROJECT_BINARY_DIR} ) add_event ( nett_python areas_populations_connectivity_message ${NETT_SCHEMA_DIR} ${PROJECT_BINARY_DIR} ) +add_event ( nett_python tick_message ${NETT_SCHEMA_DIR} ${PROJECT_BINARY_DIR} ) add_library (nett_python SHARED ${ProjectSources} ${nett_python_EVENT_SOURCE_FILES}) @@ -84,3 +85,4 @@ add_custom_command( TARGET nett_python endif() generate_specializations() +generate_includes() diff --git a/src/nett-python/includes_template.h b/src/nett-python/includes_template.h new file mode 100644 index 0000000000000000000000000000000000000000..f2a10dee461a33ae1a6278704b2f370a262324ad --- /dev/null +++ b/src/nett-python/includes_template.h @@ -0,0 +1 @@ +@_EVENT_NAMES@ diff --git a/src/nett-python/nett-python.cpp b/src/nett-python/nett-python.cpp index df7f61483ba3ed46d6b677920aafe79dbff76d30..7f956443fda5520ef0238b064cd55ca8a713bc66 100644 --- a/src/nett-python/nett-python.cpp +++ b/src/nett-python/nett-python.cpp @@ -8,20 +8,9 @@ #include <nett/nett.h> #include <memory> +#undef min //oh dear Microsoft: whoever defined min as a macro should be seriously ... -#include <../schema/string_message.pb.h> -#include <../schema/float_message.pb.h> -#include <../schema/string_vector_message.pb.h> -#include <../schema/float_vector_message.pb.h> -#include <../schema/hierarchy_message.pb.h> -#include <../schema/population_rates_message.pb.h> -#include <../schema/flux_message.pb.h> -#include <../schema/connectivity_message.pb.h> -#include <../schema/map_string_float_vector_message.pb.h> -#include <../schema/population_connectivity_message.pb.h> -#include <../schema/area_populations_connectivity_message.pb.h> -#include <../schema/areas_populations_connectivity_message.pb.h> - +#include <includes.h> //include auto-generated header for all events using namespace boost::python;