Skip to content

Commit

Permalink
Support for darwin.
Browse files Browse the repository at this point in the history
  • Loading branch information
cxbrooks committed Aug 25, 2014
1 parent 4b9c439 commit b87b551
Showing 1 changed file with 39 additions and 6 deletions.
45 changes: 39 additions & 6 deletions test/fmu_check.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
#! /bin/sh

case "`uname -s`" in
CYGWIN*) arch=win
sharedLibrarySuffix=dll;;
Darwin) arch=darwin64
sharedLibrarySuffix=dylib;;
Linux) arch=linux
pic=-fPIC
sharedLibrarySuffix=so;;
esac

# Cleaning
rm -rf binaries
rm -f *.fmu

# Is this necessary?
export MODELICAPATH="${HOME}/Code/openmodelica/libraries/Modelica 3.2.1"

# Generating the .cpp files.
omc +s +simCodeTarget=sfmi $1 Modelica
modelFile=$(exec basename $1 | sed 's/\.mo//')
g++ -Wall -g -c -fPIC -I../FMI_for_ModelExchange_and_CoSimulation_v2.0 -o sfmi_runtime.o ../runtime/sfmi_runtime.cpp
g++ -Wall -g -c -fPIC -I../FMI_for_ModelExchange_and_CoSimulation_v2.0 -I../runtime -o ${modelFile}_FMI.o ${modelFile}_FMI.cpp
g++ -shared -Wl,-soname,${modelFile}.so -o ${modelFile}.so sfmi_runtime.o ${modelFile}_FMI.o

# Compile.
case "$arch" in
darwin64)
c++ -dynamiclib -g -I/opt/openmodelica/include -I../FMI_for_ModelExchange_and_CoSimulation_v2.0 -o sfmi_runtime.o -I../runtime -o ${modelFile}.${sharedLibrarySuffix} ${modelFile}_FMI.cpp ../runtime/sfmi_runtime.cpp
;;
linux64)
g++ -Wall -g -c -fPIC -I../FMI_for_ModelExchange_and_CoSimulation_v2.0 -o sfmi_runtime.o ../runtime/sfmi_runtime.cpp
g++ -Wall -g -c -fPIC -I../FMI_for_ModelExchange_and_CoSimulation_v2.0 -I../runtime -o ${modelFile}_FMI.o ${modelFile}_FMI.cpp
g++ -shared -Wl,-soname,${modelFile}.so -o ${modelFile}.so sfmi_runtime.o ${modelFile}_FMI.o
;;
*)
echo "$0: Do not know about arch $arch"
exit -2
esac

# Create the FMU.
mkdir binaries
mkdir binaries/linux64
mv ${modelFile}.so binaries/linux64
mkdir binaries/${arch}
mv ${modelFile}.${sharedLibrarySuffix} binaries/${arch}
zip -r ${modelFile}.fmu modelDescription.xml binaries
fmuCheck.linux64 -l 5 -f ${modelFile}.fmu > ${modelFile}.dat

# Run the FMU Checker.
fmuCheck.${arch} -l 5 -f ${modelFile}.fmu > ${modelFile}.dat

0 comments on commit b87b551

Please sign in to comment.