Skip to content

Commit

Permalink
- Fix binaries directory of FMU to linux32,linux64 as in the FMI spec…
Browse files Browse the repository at this point in the history
…. We use the openModelicaPlatform() name on unspecified platforms (i.e. darwin-x86_64)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10178 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 20, 2011
1 parent cccd462 commit 222b369
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Compiler/BackEnd/SimCode.mo
Expand Up @@ -2744,7 +2744,7 @@ algorithm
cflags := Debug.bcallret2(RTOpts.debugFlag("openmp"),stringAppend,cflags," -fopenmp",cflags);
ldflags := System.getLDFlags();
senddatalibs := System.getSendDataLibs();
platform := System.platform();
platform := System.modelicaPlatform();
makefileParams := MAKEFILE_PARAMS(ccompiler, cxxcompiler, linker, exeext, dllext,
omhome, cflags, ldflags, senddatalibs, includes, libs, platform);
end createMakefileParams;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/Util/System.mo
Expand Up @@ -828,7 +828,7 @@ public function modelicaPlatform "Returns the standardized platform name accordi
win64 [Microsoft Windows 64 bit]
linux32 [Linux Intel 32 bit]
linux64 [Linux Intel 64 bit]
Else, the empty string is returned
Else, the openModelicaPlatform() is returned
"
output String platform;
external "C" platform=System_modelicaPlatform() annotation(Library = "omcruntime");
Expand Down
21 changes: 5 additions & 16 deletions Compiler/susan_codegen/SimCode/SimCodeFMU.tpl
Expand Up @@ -865,7 +865,7 @@ template getPlatformString2(String platform, String fileNamePrefix, String dirEx
"returns compilation commands for the platform. "
::=
match platform
case "WIN32" then
case "win32" then
<<
<%fileNamePrefix%>_FMU: <%fileNamePrefix%>.def <%fileNamePrefix%>.dll
<%\t%> dlltool -d <%fileNamePrefix%>.def --dllname <%fileNamePrefix%>.dll --output-lib <%fileNamePrefix%>.lib --kill-at
Expand All @@ -879,7 +879,7 @@ match platform
<%\t%> mv <%fileNamePrefix%>_records.c <%fileNamePrefix%>/sources/<%fileNamePrefix%>_records.c
<%\t%> mv modelDescription.xml <%fileNamePrefix%>/modelDescription.xml
<%\t%> cp <%omhome%>/lib/omc/libexec/gnuplot/binary/libexpat-1.dll <%fileNamePrefix%>/binaries/<%platform%>/
<%\t%> cd <%fileNamePrefix%>&& zip -r ../<%fileNamePrefix%>.fmu *
<%\t%> cd <%fileNamePrefix%>&& rm -f ../<%fileNamePrefix%>.fmu&& zip -r ../<%fileNamePrefix%>.fmu *
<%\t%> rm -rf <%fileNamePrefix%>
<%\t%> rm -f <%fileNamePrefix%>.def <%fileNamePrefix%>.o <%fileNamePrefix%>_FMU.libs <%fileNamePrefix%>_FMU.makefile <%fileNamePrefix%>_FMU.o <%fileNamePrefix%>_records.o

Expand All @@ -891,8 +891,7 @@ match platform
<%\t%> "mkdir.exe" -p <%fileNamePrefix%>/binaries/<%platform%>
<%\t%> "mkdir.exe" -p <%fileNamePrefix%>/sources
>>
case "LINUX"
case "Unix" then
else
<<
<%fileNamePrefix%>_FMU: clean <%fileNamePrefix%>_FMU.o <%fileNamePrefix%>.o <%fileNamePrefix%>_records.o
<%\t%> $(CXX) -shared -I. -o <%fileNamePrefix%>$(DLLEXT) <%fileNamePrefix%>_FMU.o <%fileNamePrefix%>.o <%fileNamePrefix%>_records.o $(CPPFLAGS) <%dirExtra%> <%libsPos1%> <%libsPos2%> $(CFLAGS) $(SENDDATALIBS) $(LDFLAGS) <%match System.os() case "OSX" then "-lf2c" else "-Wl,-Bstatic -lf2c -Wl,-Bdynamic"%>
Expand All @@ -911,7 +910,7 @@ match platform
<%\t%> mv <%fileNamePrefix%>_functions.h <%fileNamePrefix%>/sources/<%fileNamePrefix%>_functions.h
<%\t%> mv <%fileNamePrefix%>_records.c <%fileNamePrefix%>/sources/<%fileNamePrefix%>_records.c
<%\t%> mv modelDescription.xml <%fileNamePrefix%>/modelDescription.xml
<%\t%> cd <%fileNamePrefix%>; zip -r ../<%fileNamePrefix%>.fmu *
<%\t%> cd <%fileNamePrefix%>; rm -f ../<%fileNamePrefix%>.fmu && zip -r ../<%fileNamePrefix%>.fmu *
<%\t%> rm -rf <%fileNamePrefix%>
<%\t%> rm -f <%fileNamePrefix%>.def <%fileNamePrefix%>.o <%fileNamePrefix%>_FMU.libs <%fileNamePrefix%>_FMU.makefile <%fileNamePrefix%>_FMU.o <%fileNamePrefix%>_records.o

Expand All @@ -931,7 +930,6 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
'<%if s.measureTime then "-D_OMC_MEASURE_TIME "%> <%match s.method
case "inline-euler" then "-D_OMC_INLINE_EULER"
case "inline-rungekutta" then "-D_OMC_INLINE_RK"%>'
let platfrom = getPlatformString(makefileParams.platform)
let compilecmds = getPlatformString2(makefileParams.platform, fileNamePrefix, dirExtra, libsPos1, libsPos2, makefileParams.omhome)
<<
# Makefile generated by OpenModelica
Expand All @@ -944,7 +942,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
EXEEXT=<%makefileParams.exeext%>
DLLEXT=<%makefileParams.dllext%>
CFLAGS_BASED_ON_INIT_FILE=<%extraCflags%>
PLATLINUX = <%platfrom%>
PLATLINUX = <%makefileParams.platform%>
PLAT34 = <%makefileParams.platform%>
CFLAGS=$(CFLAGS_BASED_ON_INIT_FILE) -I"<%makefileParams.omhome%>/include/omc" <%makefileParams.cflags%> <%match sopt case SOME(s as SIMULATION_SETTINGS(__)) then s.cflags /* From the simulate() command */%>
CPPFLAGS=-I"<%makefileParams.omhome%>/include/omc" -I. <%dirExtra%> <%makefileParams.includes ; separator=" "%>
Expand All @@ -966,15 +964,6 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
>>
end fmuMakefile;

template getPlatformString(String platform)
"returns a string for the platform. "
::=
match platform
case "WIN32" then "win32"
case "LINUX" then "linux"
case "Unix" then "unix"
end getPlatformString;

template fmudeffile(SimCode simCode)
"Generates the def file of the fmu."
::=
Expand Down
6 changes: 5 additions & 1 deletion configure
Expand Up @@ -5383,7 +5383,11 @@ OPENMODELICA_SPEC_PLATFORM=`uname -sm | tr "[:upper:] " "[:lower:]-"`
$as_echo "$OPENMODELICA_SPEC_PLATFORM" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Modelica platform name" >&5
$as_echo_n "checking for Modelica platform name... " >&6; }
if test "$OPENMODELICA_SPEC_PLATFORM" = "linux-x86_64" -o "$OPENMODELICA_SPEC_PLATFORM" = "linux-i.86"; then MODELICA_SPEC_PLATFORM=`echo $OPENMODELICA_SPEC_PLATFORM | sed "s/linux-x86_64/linux64/" | sed "s/linux-i.86/linux32/"`; fi
if test "$OPENMODELICA_SPEC_PLATFORM" = "linux-x86_64" -o "$OPENMODELICA_SPEC_PLATFORM" = "linux-i.86"; then
MODELICA_SPEC_PLATFORM=`echo $OPENMODELICA_SPEC_PLATFORM | sed "s/linux-x86_64/linux64/" | sed "s/linux-i.86/linux32/"`
else
MODELICA_SPEC_PLATFORM=$OPENMODELICA_SPEC_PLATFORM
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MODELICA_SPEC_PLATFORM" >&5
$as_echo "$MODELICA_SPEC_PLATFORM" >&6; }

Expand Down
6 changes: 5 additions & 1 deletion configure.in
Expand Up @@ -522,7 +522,11 @@ AC_MSG_CHECKING([for OpenModelica platform name])
OPENMODELICA_SPEC_PLATFORM=`uname -sm | tr "@<:@:upper:@:>@ " "@<:@:lower:@:>@-"`
AC_MSG_RESULT([$OPENMODELICA_SPEC_PLATFORM])
AC_MSG_CHECKING([for Modelica platform name])
if test "$OPENMODELICA_SPEC_PLATFORM" = "linux-x86_64" -o "$OPENMODELICA_SPEC_PLATFORM" = "linux-i.86"; then MODELICA_SPEC_PLATFORM=`echo $OPENMODELICA_SPEC_PLATFORM | sed "s/linux-x86_64/linux64/" | sed "s/linux-i.86/linux32/"`; fi
if test "$OPENMODELICA_SPEC_PLATFORM" = "linux-x86_64" -o "$OPENMODELICA_SPEC_PLATFORM" = "linux-i.86"; then
MODELICA_SPEC_PLATFORM=`echo $OPENMODELICA_SPEC_PLATFORM | sed "s/linux-x86_64/linux64/" | sed "s/linux-i.86/linux32/"`
else
MODELICA_SPEC_PLATFORM=$OPENMODELICA_SPEC_PLATFORM
fi
AC_MSG_RESULT([$MODELICA_SPEC_PLATFORM])

date=`date "+%Y-%m-%d %H:%M:%S"`
Expand Down

0 comments on commit 222b369

Please sign in to comment.