Browse Source

added code to pack the SA generated fmus into FMU zips

Kenneth Lausdahl 3 years ago
parent
commit
55a6159544

+ 1 - 0
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp.tests/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/tests/CgCppBasicTest.xtend

@@ -207,6 +207,7 @@ class CgCppBasicTest extends AbstractSemanticAdaptationTest {
 			})
 			Assert.assertTrue("Expected cmake to parse", cmake.generate(saRootDir));
 			Assert.assertTrue("Expected no make errors", cmake.make(saRootDir));
+			Assert.assertTrue("Failed to pack the FMU", cmake.make(saRootDir,"pack"));
 		}
 	}
 

+ 8 - 0
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/generation/CMakeListsGenerator.xtend

@@ -243,6 +243,14 @@ class CMakeListsGenerator {
 				set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc  -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic")
 			endif() 
 			
+			
+			add_custom_target(pack COMMAND
+			    ${CMAKE_COMMAND} -E tar "cfv" ${PROJECT_NAME}.fmu --format=zip
+			       "${CMAKE_CURRENT_SOURCE_DIR}/modelDescription.xml"
+			       "${CMAKE_CURRENT_SOURCE_DIR}/resources"
+			        "${FMI_BIN_DIR}"
+			)
+			
 		'''
 	}