blob: 92831f687bdf7b9ab223f5c6e2974abefcf5d0ce [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.IDiscreteValueDeviation
import org.eclipse.app4mc.slg.config.ConfigModel
import org.eclipse.app4mc.slg.commons.m2t.CustomObjectsStore
import org.eclipse.app4mc.slg.commons.m2t.generators.TicksUtilsTranslationUnit
import org.eclipse.app4mc.transformation.util.OutputBuffer
@Singleton
class TicksUtilsTransformer extends SynteticTransformer<TicksUtilsTranslationUnit> {
@Inject OutputBuffer outputBuffer
@Inject CustomObjectsStore customObjsStore
def TicksUtilsTranslationUnit generate(IDiscreteValueDeviation value) {
return generateIntern(value.class) // hash according to class not instance
}
def create new TicksUtilsTranslationUnit(outputBuffer, customObjsStore.getInstance(ConfigModel), valueClass)
generateIntern(Object valueClass) {
}
override getCache() { return this._createCache_generateIntern }
def write() {
createCMake()
}
def createCMake() {
outputBuffer.appendTo("OTHER", TicksUtilsTranslationUnit.makeFilePathStatic, toCMake())
}
def String toCMake() '''
# «TicksUtilsTranslationUnit.getLibName» ################################################################
####
add_library(«TicksUtilsTranslationUnit.getLibName()» STATIC
«FOR srcFile : srcFiles»
${CMAKE_CURRENT_LIST_DIR}/_src/«srcFile»
«ENDFOR»
)
target_include_directories(«TicksUtilsTranslationUnit.getLibName()»
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/_inc/
)
'''
}