Skip to content

Commit 137694b

Browse files
authored
Merge pull request #22 from Kvixen/license_clarification
Clarifying license of FMU generated by Simulix
2 parents 7860854 + c07d0d3 commit 137694b

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

content-builder.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,12 @@ def xmlgen(data):
8888
ET.ElementTree(root).write(path.join('modelDescription.xml'),
8989
encoding='utf-8', xml_declaration=True, method='xml', pretty_print=True)
9090

91-
def dllgen(dst, src, data):
91+
def dllgen(dst, data):
9292

93-
template_replace = {
93+
src = path.join(path.dirname(path.realpath(__file__)), 'templates/')
9494

95-
}
95+
template_replace = {
9696

97-
causality_dict = {
98-
'input':'U',
99-
'output':'Y',
100-
'parameter':'P'
10197
}
10298

10399
template_replace['numReal'] = int(data['numReal'])
@@ -106,8 +102,6 @@ def dllgen(dst, src, data):
106102
template_replace['stepSize'] = data['StepSize']
107103
template_replace['modelName'] = data['Model']
108104
template_replace['GUID'] = data['GUID']
109-
model_name = data['Model']
110-
model_nameS = model_name[:29]
111105

112106
real_string = ""
113107
int_string = ""
@@ -125,14 +119,16 @@ def dllgen(dst, src, data):
125119
template_replace['intString'] = int_string
126120
template_replace['booleanString'] = boolean_string
127121
with open(path.join(dst, 'Simulix_dllmain.c'), 'w') as dllmain:
128-
with open(src, 'r') as dllmainTemplate:
122+
with open(path.join(src, "Simulix_cg_license.txt"), 'r') as license_text:
123+
dllmain.write(license_text.read())
124+
with open(path.join(src, "Simulix_dllmain_template.c"), 'r') as dllmainTemplate:
129125
dllmain.write(dllmainTemplate.read().format(**template_replace))
130126

131-
def main(dst, src):
127+
def main(dst):
132128
data = read_json_file("ModelOutputs.json")
133129
data["GUID"] = str(uuid.uuid4())
134130

135-
dllgen(dst, src, data)
131+
dllgen(dst, data)
136132
# remove index and offset keys that must not be known to xmlgen
137133
index_list = list(map(lambda d: d.pop('index'), data['ModelVariables'][0]['ScalarVariable']))
138134
offset_list = list(map(lambda d: d.pop('offset'), data['ModelVariables'][0]['ScalarVariable']))
@@ -141,6 +137,5 @@ def main(dst, src):
141137
if __name__ == '__main__':
142138
parser = argparse.ArgumentParser(description="Generate a C file for a FMU",prog="dllgen",usage="%(prog)s [options]")
143139
parser.add_argument('-o', help='Path to Simulix_dllmain.c output', default=getcwd())
144-
parser.add_argument('-t', help='Path to template file', default=path.join(path.dirname(path.realpath(__file__)), 'templates/Simulix_dllmain_template.c'))
145140
args = parser.parse_args()
146-
main(args.o, args.t)
141+
main(args.o)

licenses/simulix_license.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Simulix generates an FMU from a simulink model source code.
2+
3+
Copyright (C) 2018 Scania CV AB and Simulix contributors
4+
5+
This program is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>.

templates/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ if(PC_DEFINITIONS MATCHES "^SIMULIX" OR PC_DEFINITIONS MATCHES ";SIMULIX")
106106
"fmuTemplate.c"
107107
"fmuTemplate.h"
108108
)
109-
message(STATUS "GENERATED_FILES_PATH: ${{GENERATED_FILES_PATH}}")
110109
foreach(FILE_NAME ${{LIBRARY_SOURCES}})
111110
configure_file("${{GENERATED_FILES_PATH}}/libraryincludes/${{FILE_NAME}}" "${{FMU_PATH}}/sources" COPYONLY)
112111
endforeach()
113-
configure_file("${{GENERATED_FILES_PATH}}/libraryincludes/fmusdk_license.txt" "${{FMU_PATH}}/documentation")
112+
configure_file("${{GENERATED_FILES_PATH}}/licenses/fmusdk_license.txt" "${{FMU_PATH}}/documentation")
113+
configure_file("${{GENERATED_FILES_PATH}}/licenses/simulix_license.txt" "${{FMU_PATH}}/documentation")
114114

115115
if(UNIX)
116116
target_link_libraries(

unpack.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,23 +168,12 @@ def handle_extension(extension_path, src, dst):
168168
def copy_directories(src, dst):
169169
copy_directory(path.join(src, 'includes'), path.join(dst, 'includes'))
170170
copy_directory(path.join(src, 'libraryincludes'), path.join(dst, 'libraryincludes'))
171+
copy_directory(path.join(src, 'licenses'), path.join(dst, 'licenses'))
171172

172173
def generate_files(src, dst, zip_path, zip_name, extension_path, temp_path):
173174
"""
174175
Extracts content from zip in zip_path
175176
Generates and copies neccesary files
176-
177-
178-
Parameters:
179-
src:
180-
Source of template files, should be
181-
{path_to_cgen.py}/includes unless specified otherwise.
182-
183-
dst:
184-
Destination of generated file(s).
185-
186-
zip_path:
187-
Path to generated Zip.
188177
"""
189178
environ['SIMX_EXE'] = "1"
190179
TEMPLATE_REPLACE['path'] = path.dirname(path.realpath(__file__)).replace('\\', '/')

0 commit comments

Comments
 (0)