Browse Source

corrected some typos in the generator, and not going to use the git clone stuff to get the framework code.

Cláudio Gomes 3 years ago
parent
commit
470654c55f

+ 3 - 2
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp.tests/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/tests/CgCppBasicTest.xtend

@@ -45,6 +45,7 @@ class CgCppBasicTest extends AbstractSemanticAdaptationTest {
 		__parseNoErrors('test_input/single_folder_spec/window/window_sa_canonical_new.BASE.sa', 'generated', "powerwindow");
 	}
 	
+	@Ignore
 	@Test def lazy_sa_canonical() {
 		__parseNoErrors('test_input/single_folder_spec/lazy/lazy_canonical.sa', 'generated', "lazy");
 	}
@@ -140,7 +141,7 @@ class CgCppBasicTest extends AbstractSemanticAdaptationTest {
 			BuildUtilities.writeToFile(fp, files.value.toString);	
 		}
 		
-		val mainCpp = StaticGenerators.generateMainCppFile(saRootDir.absolutePath.replace("\\","\\\\"));
+		val mainCpp = StaticGenerators.generateMainCppFile(resourcesPath.absolutePath.replace("\\","\\\\"));
 		BuildUtilities.writeToFile(new File(srcGenPath,"main.cpp"), mainCpp);
 		
 		
@@ -149,7 +150,7 @@ class CgCppBasicTest extends AbstractSemanticAdaptationTest {
 			val sinkFile = new File(resourcesPath, rf.name);
 			System.out.println("Copied file to: " + sinkFile);
 			BuildUtilities.copyFile(rf, sinkFile);	
-		}			
+		}
 		
 		
 		BuildUtilities.writeToFile(new File(saRootDir,"CMakeLists.txt"), StaticGenerators.generateCMakeLists(projectName, "framework"));

+ 3 - 1
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/generation/BuildUtilities.java

@@ -1,6 +1,7 @@
 package be.uantwerpen.ansymo.semanticadaptation.cg.cpp.generation;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -28,12 +29,13 @@ public class BuildUtilities {
 		libFiles = new LinkedList<>();
 
 		try {
-			jarfile = this.getClass().getClassLoader().getResourceAsStream("jars/cppFramework.jar");
+			jarfile = new FileInputStream(new File("jars/cppFramework.jar"));
 			jarstream = new JarInputStream(jarfile);
 			filejarentry = jarstream.getNextJarEntry();
 
 			// Extract the framework files
 			while (filejarentry != null) {
+				System.out.println("Extracting file: " + filejarentry.getName());
 				if (!filejarentry.getName().contains("hybridCosimulation-framework") || filejarentry.isDirectory()) {
 					filejarentry = jarstream.getNextJarEntry();
 					continue;

+ 1 - 1
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/generation/ControlConditionSwitch.xtend

@@ -63,7 +63,7 @@ class ControlConditionSwitch extends RulesConditionSwitch {
 		for (ruleStm : object.controlRulestatements) {
 			tempDoSwitchCode += doSwitch(ruleStm).code;
 		}
-		tempDoSwitchCode += System.lineSeparator() + '''return «doSwitch(object.returnstatement).code»;
+		tempDoSwitchCode += System.lineSeparator() + '''return «doSwitch(object.returnstatement.expr).code»;
 		''';
 
 		var functionPrefix = "double ";

+ 0 - 1
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/generation/CppGenerator.xtend

@@ -39,7 +39,6 @@ class CppGenerator extends SemanticAdaptationGenerator {
 		this.fsa = fsa;
 		for (SemanticAdaptation type : resource.allContents.toIterable.filter(SemanticAdaptation)) {
 			type.compile;
-
 		}
 	}
 

+ 4 - 14
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.testframework/src/be/uantwerpen/ansymo/semanticadaptation/testframework/StaticGenerators.xtend

@@ -220,15 +220,7 @@ class StaticGenerators {
 		endif() 
 		
 		
-		# Checkout the hcf sources
-		set(HCF_DIR hcf)
-		if(EXISTS ${HCF_DIR})
-			#execute_process(COMMAND git pull WORKING_DIRECTORY ${HCF_DIR})
-		else()
-			execute_process(COMMAND git clone --depth 1 git@github.com:into-cps/hybridCosimulation-framework.git ${HCF_DIR} )
-			execute_process(COMMAND git submodule update --init --recursive WORKING_DIRECTORY ${HCF_DIR})
-		endif()
-		add_subdirectory(${HCF_DIR}/semantic-adaptation)
+		add_subdirectory(«frameworkPath»)
 		
 		include(CheckCXXCompilerFlag)
 		
@@ -245,8 +237,6 @@ class StaticGenerators {
 		
 		add_definitions(-DFMI_COSIMULATION)
 		
-		include_directories(sources)
-		
 		file(GLOB CPP_FILES sources/*.cpp)
 		
 		file(GLOB CPP_MAIN_FILES sources/main*.cpp)
@@ -290,8 +280,8 @@ class StaticGenerators {
 		#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${FMI_BIN_DIR})
 		
 		
-		add_library(${PROJECT_NAME} SHARED ${CPP_FILES} ${CPP_FILES})
-		target_link_libraries(${PROJECT_NAME} hcf)
+		add_library(${PROJECT_NAME} SHARED ${CPP_FILES})
+		target_link_libraries(${PROJECT_NAME} PUBLIC hcf)
 		set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
 		SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "")
 		
@@ -300,7 +290,7 @@ class StaticGenerators {
 		
 		## Main executable ##
 		add_executable(${PROJECT_NAME}_main ${CPP_MAIN_FILES} ${CPP_FILES})
-		target_link_libraries(${PROJECT_NAME}_main hcf)
+		target_link_libraries(${PROJECT_NAME}_main PUBLIC hcf)
 		
 		
 		# I need this: -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic