# # This is a sample project that can # be used to compile a shared lib out of a prelude program. # This shared library will be usable by SchedMCore toolset. # cmake_minimum_required(VERSION 2.6.2) project(Rosace2 C) if (NOT CMAKE_BUILD_TYPE) message(STATUS "No build type selected, default to Debug") set(CMAKE_BUILD_TYPE "Debug") endif(NOT CMAKE_BUILD_TYPE) # Lustre compiler generated C file needs c99 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") include(../schedmcore-helpers.cmake) # Find the dot executable find_program(DOT_EXECUTABLE NAMES dot) # Change this parameter to toggle dot output format set(DOT_OUTPUT_FORMAT svg) set(PRELUDE_PATH_HINT "${LSMC_INSTALL_PATH}/prelude-1.4") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") find_package(Prelude REQUIRED) find_package(Lustre REQUIRED) include_directories(${CMAKE_CURRENT_BINARY_DIR}) Lustre_Compile(LUS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/fullrosace_bloc.lus ${CMAKE_CURRENT_SOURCE_DIR}/fullrosace.lusi LIBNAME Rosace2) #The Lustre_Compile command provide you with the variable # LUSTRE_GENERATED_C_FILES_Rosace2 which contains the list of the generated C files #message("LUSTRE_GENERATED_C_FILES_Rosace2 = ${LUSTRE_GENERATED_C_FILES_biomass}") # The wrapper directory contains the wrapper C files necessary # to wrap Lustre generated C files to be used with Prelude. set(WRAPPER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wrapper") include_directories(${WRAPPER_DIR}) set(WRAPPER_SOURCES ${WRAPPER_DIR}/fullrosace_assemblage_includes_sensors_actuators.c ${WRAPPER_DIR}/fullrosace_assemblage_includes_sensors_actuators.h ${WRAPPER_DIR}/fullrosace_assemblage_includes_lustre_wrapper.c ${WRAPPER_DIR}/fullrosace_assemblage_includes.h ${WRAPPER_DIR}/utils.h ${WRAPPER_DIR}/utils.c) Prelude_Compile(NODE fullrosace_assemblage PLU_FILES fullrosace_assemblage.plu USER_C_FILES ${WRAPPER_SOURCES} ${LUSTRE_GENERATED_C_FILES_Rosace2} NOENCODING REAL_IS_DOUBLE BOOL_IS_STDBOOL TRACING no ) target_link_libraries(fullrosace_assemblage-noencoding Rosace2) if (LSMC_RUNNER_EXECUTABLE) set(NATIVE_OUTPUT_FILE_NAME "lsmc_run-nort-results-fullrosace_assemblage.txt") add_custom_target(NativeRun-fullrosace_assemblage ${CMAKE_COMMAND} -DNATIVE_RUNNER=${LSMC_RUNNER_EXECUTABLE} -DNATIVE_LIB=$ -DNATIVE_OUTPUT_FILE_NAME=${CMAKE_BINARY_DIR}/${NATIVE_OUTPUT_FILE_NAME} -P ${CMAKE_SOURCE_DIR}/../NativeRun.cmake COMMENT "Native Run with full ROSACE assemblage (result in ${NATIVE_OUTPUT_FILE_NAME})") endif() if (LSMC_SIM_EXECUTABLE) set(NATIVE_OUTPUT_FILE_NAME "lsmc_sim-results-fullrosace_assemblage.txt") add_custom_target(NativeSim-fullrosace_assemblage ${CMAKE_COMMAND} -DNATIVE_SIM=${LSMC_SIM_EXECUTABLE} -DNATIVE_LIB=$ -DNATIVE_OUTPUT_FILE_NAME=${CMAKE_BINARY_DIR}/${NATIVE_OUTPUT_FILE_NAME} -P ${CMAKE_SOURCE_DIR}/../NativeSim.cmake COMMENT "Native Simulation with full ROSACE assemblage (result in ${NATIVE_OUTPUT_FILE_NAME})") endif() # Rules for creating dependency graph of the Prelude tasks # Can only do that if dot tool (from graphviz is installed) if (DOT_EXECUTABLE) set(GRAPH_OUTPUT_FILE_NAME "DependencyGraph-fullrosace") if(LSMC_CONVERTER_VERSION VERSION_GREATER "1.2") set(CONVERTER_OPT "-m;dot;-o") else() set(CONVERTER_OPT "--taskset-output-fmt=dot;--taskset-output-file=") endif() add_custom_target(Graph-fullrosace ${LSMC_CONVERTER_EXECUTABLE} -v0 -l $ ${CONVERTER_OPT}${GRAPH_OUTPUT_FILE_NAME}.dot COMMAND ${DOT_EXECUTABLE} -T${DOT_OUTPUT_FORMAT} -o ${GRAPH_OUTPUT_FILE_NAME}.${DOT_OUTPUT_FORMAT} ${GRAPH_OUTPUT_FILE_NAME}.dot COMMENT "Create a dependency graph for fullrosace (result in ${GRAPH_OUTPUT_FILE_NAME}.${DOT_OUTPUT_FORMAT})") set_property(DIRECTORY . APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${GRAPH_OUTPUT_FILE_NAME}.${DOT_OUTPUT_FORMAT};${GRAPH_OUTPUT_FILE_NAME}.dot") add_dependencies(Graph-fullrosace fullrosace_assemblage-noencoding) endif()