blob: 4a5c5f6455cc2f563834abf07184fc3fa507f718 [file] [log] [blame]
/**
* *******************************************************************************
* Copyright (c) 2020 Robert Bosch GmbH.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Robert Bosch GmbH - initial API and implementation
* *******************************************************************************
*/
package org.eclipse.app4mc.slg.commons.m2t.transformers
import com.google.inject.Inject
import com.google.inject.Singleton
import org.eclipse.app4mc.amalthea.model.Runnable
import org.eclipse.app4mc.slg.commons.m2t.generators.RunnableTranslationUnit
import org.eclipse.app4mc.transformation.util.OutputBuffer
@Singleton
class RunnableTransformer extends SynteticTransformer<RunnableTranslationUnit> {
@Inject OutputBuffer outputBuffer
@Inject ActivityGraphItemTransformer psCallGraphItemTransformer
def create new RunnableTranslationUnit(outputBuffer, psCallGraphItemTransformer, runnable)
transform(Runnable runnable) {
}
override getCache() { return this._createCache_transform }
def createCMake() {
outputBuffer.appendTo("OTHER", RunnableTranslationUnit.makeFilePathStatic, toCMake())
}
def String toCMake() '''
# «RunnableTranslationUnit.libName» ################################################################
####
add_library(«RunnableTranslationUnit.libName» STATIC
«FOR srcFile : getSrcFiles»
${CMAKE_CURRENT_LIST_DIR}/_src/«srcFile»
«ENDFOR»
)
target_include_directories(«RunnableTranslationUnit.libName»
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/_inc
)
target_include_directories(«RunnableTranslationUnit.libName»
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../ticksUtils/_inc
${CMAKE_CURRENT_LIST_DIR}/../labels/_inc
)
target_link_libraries(RUNNABLES_LIB
PRIVATE LABELS_LIB TICKS_UTILS
)
'''
}