diff --git a/CMakeLists.txt b/CMakeLists.txt index 73099e3f..513bd6ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ set(BUILD_UNIT_TESTS OFF CACHE BOOL "Build unit tests") set(TEST_COVERAGE OFF CACHE BOOL "Compute test coverage") set(ASAN OFF CACHE BOOL "Compile with AddressSanitizer") set(PLATFORM "POSIX" CACHE STRING "Platform to target") +set(SCHEDULER "DYNAMIC" CACHE STRING "Scheduler to use") set(EVENT_QUEUE_SIZE 32 CACHE STRING "Static size of the event queue") set(REACTION_QUEUE_SIZE 32 CACHE STRING "Static size of the reaction queue") set(NETWORK_CHANNEL_TCP_POSIX OFF CACHE BOOL "Use POSIX TCP NetworkChannel") @@ -68,9 +69,13 @@ else () message(FATAL_ERROR "No valid platform specified") endif () + # Add compile definitions for platform and network channel specifics. target_compile_definitions(reactor-uc PRIVATE "PLATFORM_${PLATFORM}") +# Add compile definition for scheduler used +target_compile_definitions(reactor-uc PRIVATE "SCHEDULER_${SCHEDULER}") + # Add compile definitions for event and reaction queue sizes. Has to be PUBLIC because they are used in the header files. target_compile_definitions(reactor-uc PUBLIC EVENT_QUEUE_SIZE=${EVENT_QUEUE_SIZE}) target_compile_definitions(reactor-uc PUBLIC REACTION_QUEUE_SIZE=${REACTION_QUEUE_SIZE}) diff --git a/include/reactor-uc/scheduler.h b/include/reactor-uc/scheduler.h index 61a7dc4e..66a7c072 100644 --- a/include/reactor-uc/scheduler.h +++ b/include/reactor-uc/scheduler.h @@ -52,12 +52,4 @@ struct Scheduler { tag_t (*current_tag)(Scheduler *self); }; -#define SCHEDULER_DYNAMIC - -#if defined(SCHEDULER_DYNAMIC) -#include "schedulers/dynamic/scheduler.h" -#else -#include "schedulers/static/scheduler.h" -#endif - #endif diff --git a/src/scheduler.c b/src/scheduler.c index d99df96e..8cec05c3 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1,4 +1,9 @@ -#include "schedulers/static/instructions.c" -#include "schedulers/dynamic/dynamic.c" + +#if defined(SCHEDULER_DYNAMIC) +#include "./schedulers/dynamic/scheduler.c" +#elif defined(SCHEDULER_STATIC) #include "schedulers/static/scheduler.c" +#include "schedulers/static/instructions.c" +#else +#endif diff --git a/src/schedulers/dynamic/dynamic.c b/src/schedulers/dynamic/scheduler.c similarity index 100% rename from src/schedulers/dynamic/dynamic.c rename to src/schedulers/dynamic/scheduler.c