From 2a2ebf94535b7861e526c3f703732d758ee7cd95 Mon Sep 17 00:00:00 2001 From: cnowke <nowke@vr.rwth-aachen.de> Date: Thu, 27 Oct 2016 17:15:04 +0200 Subject: [PATCH] event includes are now auto-generated --- CMake/CMakeHelpers.cmake | 24 ++++++++++++++++++++---- CMakeLists.txt | 2 ++ src/nett-python/includes_template.h | 1 + src/nett-python/nett-python.cpp | 15 ++------------- 4 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 src/nett-python/includes_template.h diff --git a/CMake/CMakeHelpers.cmake b/CMake/CMakeHelpers.cmake index 4c1466d..2cc1676 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 2f2ecab..996ca44 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 0000000..f2a10de --- /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 df7f614..7f95644 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; -- GitLab