Skip to content

Commit

Permalink
Multiarch patch: install libraries to OMHOME/lib/<triplet>/omc
Browse files Browse the repository at this point in the history
- This will allow users to install multiple versions of the simulation libraries at the same time


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25841 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Apr 30, 2015
1 parent f521cf9 commit 7fdfaed
Show file tree
Hide file tree
Showing 20 changed files with 120 additions and 97 deletions.
2 changes: 1 addition & 1 deletion Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -9560,7 +9560,7 @@ algorithm
isLinux := stringEq("linux",System.os());
target := Flags.getConfigString(Flags.TARGET);
// please, take care about ordering these libraries, the most specific should have the highest priority
libs2 := str::platform2::platform1::(Settings.getHomeDir(false)+"/.openmodelica/binaries/"+Absyn.pathFirstIdent(path))::(Settings.getInstallationDirectoryPath() + "/lib/omc")::(Settings.getInstallationDirectoryPath() + "/lib/")::{};
libs2 := str::platform2::platform1::(Settings.getHomeDir(false)+"/.openmodelica/binaries/"+Absyn.pathFirstIdent(path))::(Settings.getInstallationDirectoryPath() + "/lib/" + System.getTriple() + "/omc")::(Settings.getInstallationDirectoryPath() + "/lib/")::{};
libs := List.fold2(libs2, generateExtFunctionLibraryDirectoryFlags2, isLinux, target, libs);
then (libs, listReverse(libs2), SOME(resourcesStr));
else (inLibs, {}, NONE());
Expand Down
10 changes: 5 additions & 5 deletions Compiler/Template/CodegenC.tpl
Expand Up @@ -4305,7 +4305,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
# /MD - link with MSVCRT.LIB
# /link - [linker options and libraries]
# /LIBPATH: - Directories where libs can be found
LDFLAGS=/MD /link /NODEFAULTLIB:libcmt /STACK:0x2000000 /pdb:"<%fileNamePrefix%>.pdb" /LIBPATH:"<%makefileParams.omhome%>/lib/omc/msvc/" /LIBPATH:"<%makefileParams.omhome%>/lib/omc/msvc/release/" <%dirExtra%> <%libsPos1%> <%libsPos2%> f2c.lib initialization.lib libexpat.lib math-support.lib meta.lib results.lib simulation.lib solver.lib sundials_kinsol.lib sundials_nvecserial.lib util.lib lapack_win32_MT.lib lis.lib gc-lib.lib user32.lib pthreadVC2.lib wsock32.lib cminpack.lib umfpack.lib amd.lib
LDFLAGS=/MD /link /NODEFAULTLIB:libcmt /STACK:0x2000000 /pdb:"<%fileNamePrefix%>.pdb" /LIBPATH:"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/msvc/" /LIBPATH:"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/msvc/release/" <%dirExtra%> <%libsPos1%> <%libsPos2%> f2c.lib initialization.lib libexpat.lib math-support.lib meta.lib results.lib simulation.lib solver.lib sundials_kinsol.lib sundials_nvecserial.lib util.lib lapack_win32_MT.lib lis.lib gc-lib.lib user32.lib pthreadVC2.lib wsock32.lib cminpack.lib umfpack.lib amd.lib

# /MDd link with MSVCRTD.LIB debug lib
# lib names should not be appended with a d just switch to lib/omc/msvc/debug
Expand Down Expand Up @@ -4356,11 +4356,11 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
CFLAGS_BASED_ON_INIT_FILE=<%extraCflags%>
DEBUG_FLAGS=<% if boolOr(acceptMetaModelicaGrammar(), Flags.isSet(Flags.GEN_DEBUG_SYMBOLS)) then "-O0 -g"%>
CFLAGS=$(CFLAGS_BASED_ON_INIT_FILE) $(DEBUG_FLAGS) <%makefileParams.cflags%> <%match sopt case SOME(s as SIMULATION_SETTINGS(__)) then '<%s.cflags%> ' /* From the simulate() command */%>
<% if stringEq(Config.simCodeTarget(),"JavaScript") then 'OMC_EMCC_PRE_JS=<%makefileParams.omhome%>/lib/omc/emcc/pre.js<%\n%>'
<% if stringEq(Config.simCodeTarget(),"JavaScript") then 'OMC_EMCC_PRE_JS=<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/emcc/pre.js<%\n%>'
%>CPPFLAGS=<%makefileParams.includes ; separator=" "%> -I"<%makefileParams.omhome%>/include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME<% if stringEq(Config.simCodeTarget(),"JavaScript") then " -DOMC_EMCC"%>
LDFLAGS=<%dirExtra%> <%
if stringEq(Config.simCodeTarget(),"JavaScript") then <<-L'<%makefileParams.omhome%>/lib/omc/emcc' -lblas -llapack -lexpat -lSimulationRuntimeC -s TOTAL_MEMORY=805306368 -s OUTLINING_LIMIT=20000 --pre-js $(OMC_EMCC_PRE_JS)>>
else <<-L"<%makefileParams.omhome%>/lib/omc" -L"<%makefileParams.omhome%>/lib" -Wl,<% if stringEq(makefileParams.platform, "win32") then "--stack,16777216,"%>-rpath,"<%makefileParams.omhome%>/lib/omc" -Wl,-rpath,"<%makefileParams.omhome%>/lib" <%ParModelicaExpLibs%> <%ParModelicaAutoLibs%> <%makefileParams.ldflags%> <%makefileParams.runtimelibs%> >>
if stringEq(Config.simCodeTarget(),"JavaScript") then <<-L'<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/emcc' -lblas -llapack -lexpat -lSimulationRuntimeC -s TOTAL_MEMORY=805306368 -s OUTLINING_LIMIT=20000 --pre-js $(OMC_EMCC_PRE_JS)>>
else <<-L"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc" -L"<%makefileParams.omhome%>/lib" -Wl,<% if stringEq(makefileParams.platform, "win32") then "--stack,16777216,"%>-rpath,"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc" -Wl,-rpath,"<%makefileParams.omhome%>/lib" <%ParModelicaExpLibs%> <%ParModelicaAutoLibs%> <%makefileParams.ldflags%> <%makefileParams.runtimelibs%> >>
%>
MAINFILE=<%fileNamePrefix%>.c
MAINOBJ=<%fileNamePrefix%>.o
Expand Down Expand Up @@ -4610,7 +4610,7 @@ case FUNCTIONCODE(makefileParams=MAKEFILE_PARAMS(__)) then
DLLEXT=<%makefileParams.dllext%>
DEBUG_FLAGS=<% if boolOr(acceptMetaModelicaGrammar(), Flags.isSet(Flags.GEN_DEBUG_SYMBOLS)) then " -g"%>
CFLAGS= -I"<%makefileParams.omhome%>/include/omc/c" <%makefileParams.includes ; separator=" "%> $(DEBUG_FLAGS) <%makefileParams.cflags%>
LDFLAGS= -L"<%makefileParams.omhome%>/lib/omc" -Wl,-rpath,'<%makefileParams.omhome%>/lib/omc' <%ParModelicaExpLibs%> <%makefileParams.ldflags%> <%makefileParams.runtimelibs%>
LDFLAGS= -L"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc" -Wl,-rpath,'<%makefileParams.omhome%>/lib/<%getTriple()%>/omc' <%ParModelicaExpLibs%> <%makefileParams.ldflags%> <%makefileParams.runtimelibs%>
PERL=perl
MAINFILE=<%name%>.c

Expand Down
22 changes: 11 additions & 11 deletions Compiler/Template/CodegenCpp.tpl
Expand Up @@ -1538,12 +1538,12 @@ template simulationLibDir(String target, SimCode simCode ,Text& extraFuncs,Text&
case "msvc" then
match simCode
case SIMCODE(makefileParams=MAKEFILE_PARAMS(__)) then
'<%makefileParams.omhome%>/lib/omc/cpp/msvc'
'<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/cpp/msvc'
end match
else
match simCode
case SIMCODE(makefileParams=MAKEFILE_PARAMS(__)) then
'<%makefileParams.omhome%>/lib/omc/cpp/'
'<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/cpp/'
end match
end match
end simulationLibDir;
Expand Down Expand Up @@ -2658,11 +2658,11 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
# /MD - link with MSVCRT.LIB
# /link - [linker options and libraries]
# /LIBPATH: - Directories where libs can be found
#LDFLAGS=/MDd /link /DLL /NOENTRY /LIBPATH:"<%makefileParams.omhome%>/lib/omc/cpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)" OMCppSystem.lib OMCppMath.lib
#LDSYSTEMFLAGS=/MD /Debug /link /DLL /NOENTRY /LIBPATH:"<%makefileParams.omhome%>/lib/omc/cpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)" OMCppSystem.lib OMCppModelicaUtilities.lib OMCppMath.lib OMCppOMCFactory.lib
LDSYSTEMFLAGS= /link /DLL /NOENTRY /LIBPATH:"<%makefileParams.omhome%>/lib/omc/cpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)" OMCppSystem.lib OMCppModelicaUtilities.lib OMCppMath.lib OMCppOMCFactory.lib <%timeMeasureLink%>
#LDMAINFLAGS=/MD /Debug /link /LIBPATH:"<%makefileParams.omhome%>/lib/omc/cpp/msvc" OMCppOMCFactory.lib /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)"
LDMAINFLAGS=/link /LIBPATH:"<%makefileParams.omhome%>/lib/omc/cpp/msvc" OMCppOMCFactory.lib OMCppModelicaUtilities.lib <%timeMeasureLink%> /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)"
#LDFLAGS=/MDd /link /DLL /NOENTRY /LIBPATH:"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/cpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)" OMCppSystem.lib OMCppMath.lib
#LDSYSTEMFLAGS=/MD /Debug /link /DLL /NOENTRY /LIBPATH:"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/cpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)" OMCppSystem.lib OMCppModelicaUtilities.lib OMCppMath.lib OMCppOMCFactory.lib
LDSYSTEMFLAGS= /link /DLL /NOENTRY /LIBPATH:"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/cpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)" OMCppSystem.lib OMCppModelicaUtilities.lib OMCppMath.lib OMCppOMCFactory.lib <%timeMeasureLink%>
#LDMAINFLAGS=/MD /Debug /link /LIBPATH:"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/cpp/msvc" OMCppOMCFactory.lib /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)"
LDMAINFLAGS=/link /LIBPATH:"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/cpp/msvc" OMCppOMCFactory.lib OMCppModelicaUtilities.lib <%timeMeasureLink%> /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)"
# /MDd link with MSVCRTD.LIB debug lib
# lib names should not be appended with a d just switch to lib/omc/cpp

Expand Down Expand Up @@ -2707,8 +2707,8 @@ case "gcc" then
let extraCflags = '<%_extraCflags%><% if Flags.isSet(Flags.GEN_DEBUG_SYMBOLS) then " -g"%>'
let &timeMeasureLink +=
match(getConfigString(PROFILING_LEVEL))
case("all_perf") then ' -Wl,-rpath,"$(OMHOME)/lib/omc/cpp" -lOMCppExtensionUtilities -lOMCppExtensionUtilities_papi -lpapi'
else ' -Wl,-rpath,"$(OMHOME)/lib/omc/cpp" -lOMCppExtensionUtilities'
case("all_perf") then ' -Wl,-rpath,"$(OMHOME)/lib/<%getTriple()%>/omc/cpp" -lOMCppExtensionUtilities -lOMCppExtensionUtilities_papi -lpapi'
else ' -Wl,-rpath,"$(OMHOME)/lib/<%getTriple()%>/omc/cpp" -lOMCppExtensionUtilities'
end match
let CC = if (compileForMPI) then "mpicc" else '<%makefileParams.ccompiler%>'
let CXX = if (compileForMPI) then "mpicxx" else '<%makefileParams.cxxcompiler%>'
Expand All @@ -2733,9 +2733,9 @@ case "gcc" then
CFLAGS_STATIC=$(CFLAGS) <%staticIncludes%>

MODELICA_EXTERNAL_LIBS=-lModelicaExternalC -lModelicaStandardTables -L$(LAPACK_LIBS) $(LAPACK_LIBRARIES)
LDSYSTEMFLAGS=-L"$(OMHOME)/lib/omc/cpp" $(BASE_LIB) -lOMCppOMCFactory -lOMCppSystem -lOMCppModelicaUtilities -lOMCppMath <%additionalLinkerFlags_GCC%> <%timeMeasureLink%> -L"$(BOOST_LIBS)" $(BOOST_LIBRARIES) $(LINUX_LIB_DL)
LDSYSTEMFLAGS=-L"$(OMHOME)/lib/<%getTriple()%>/omc/cpp" $(BASE_LIB) -lOMCppOMCFactory -lOMCppSystem -lOMCppModelicaUtilities -lOMCppMath <%additionalLinkerFlags_GCC%> <%timeMeasureLink%> -L"$(BOOST_LIBS)" $(BOOST_LIBRARIES) $(LINUX_LIB_DL)
LDSYSTEMFLAGS_STATIC=<%staticLibs%> $(LDSYSTEMFLAGS)
LDMAINFLAGS=-L"$(OMHOME)/lib/omc/cpp" -L"$(OMHOME)/bin" -lOMCppOMCFactory -lOMCppModelicaUtilities -L"$(BOOST_LIBS)" $(BOOST_LIBRARIES) $(LINUX_LIB_DL) <%additionalLinkerFlags_GCC%> <%timeMeasureLink%>
LDMAINFLAGS=-L"$(OMHOME)/lib/<%getTriple()%>/omc/cpp" -L"$(OMHOME)/bin" -lOMCppOMCFactory -lOMCppModelicaUtilities -L"$(BOOST_LIBS)" $(BOOST_LIBRARIES) $(LINUX_LIB_DL) <%additionalLinkerFlags_GCC%> <%timeMeasureLink%>
LDMAINFLAGS_STATIC=<%staticLibs%> $(LDMAINFLAGS)
CPPFLAGS = $(CFLAGS) <%extraCppFlags%>
SYSTEMFILE=OMCpp<%fileNamePrefix%><% if acceptMetaModelicaGrammar() then ".conv"%>.cpp
Expand Down
4 changes: 2 additions & 2 deletions Compiler/Template/CodegenFMU.tpl
Expand Up @@ -1750,7 +1750,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
# /MD - link with MSVCRT.LIB
# /link - [linker options and libraries]
# /LIBPATH: - Directories where libs can be found
LDFLAGS=/MD /link /dll /debug /pdb:"<%fileNamePrefix%>.pdb" /LIBPATH:"<%makefileParams.omhome%>/lib/omc/msvc/" /LIBPATH:"<%makefileParams.omhome%>/lib/omc/msvc/release/" <%dirExtra%> <%libsPos1%> <%libsPos2%> f2c.lib initialization.lib libexpat.lib math-support.lib meta.lib results.lib simulation.lib solver.lib sundials_kinsol.lib sundials_nvecserial.lib util.lib lapack_win32_MT.lib lis.lib gc-lib.lib user32.lib pthreadVC2.lib wsock32.lib cminpack.lib umfpack.lib amd.lib
LDFLAGS=/MD /link /dll /debug /pdb:"<%fileNamePrefix%>.pdb" /LIBPATH:"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/msvc/" /LIBPATH:"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/msvc/release/" <%dirExtra%> <%libsPos1%> <%libsPos2%> f2c.lib initialization.lib libexpat.lib math-support.lib meta.lib results.lib simulation.lib solver.lib sundials_kinsol.lib sundials_nvecserial.lib util.lib lapack_win32_MT.lib lis.lib gc-lib.lib user32.lib pthreadVC2.lib wsock32.lib cminpack.lib umfpack.lib amd.lib

# /MDd link with MSVCRTD.LIB debug lib
# lib names should not be appended with a d just switch to lib/omc/msvc/debug
Expand Down Expand Up @@ -1823,7 +1823,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
PLAT34 = <%makefileParams.platform%>
CFLAGS=$(CFLAGS_BASED_ON_INIT_FILE) <%makefileParams.cflags%> <%match sopt case SOME(s as SIMULATION_SETTINGS(__)) then s.cflags /* From the simulate() command */%>
CPPFLAGS=-I"<%makefileParams.omhome%>/include/omc/c" <%if isFMIVersion20(FMUVersion) then '-I"<%makefileParams.omhome%>/include/omc/c/fmi2"' else '-I"<%makefileParams.omhome%>/include/omc/c/fmi1"'%> -I. <%makefileParams.includes ; separator=" "%>
LDFLAGS=-L"<%makefileParams.omhome%>/lib/omc" -Wl,-rpath,'<%makefileParams.omhome%>/lib/omc' -lSimulationRuntimeC <%makefileParams.ldflags%> <%makefileParams.runtimelibs%> <%dirExtra%>
LDFLAGS=-L"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc" -Wl,-rpath,'<%makefileParams.omhome%>/lib/<%getTriple()%>/omc' -lSimulationRuntimeC <%makefileParams.ldflags%> <%makefileParams.runtimelibs%> <%dirExtra%>
PERL=perl
MAINFILE=<%fileNamePrefix%>_FMU.c
MAINOBJ=<%fileNamePrefix%>_FMU.o
Expand Down
8 changes: 4 additions & 4 deletions Compiler/Template/CodegenFMUCpp.tpl
Expand Up @@ -612,7 +612,7 @@ match platform
<%\t%> cp <%fileNamePrefix%>_functions.h <%fileNamePrefix%>/sources/<%fileNamePrefix%>_functions.h
<%\t%> cp <%fileNamePrefix%>_records.c <%fileNamePrefix%>/sources/<%fileNamePrefix%>_records.c
<%\t%> cp modelDescription.xml <%fileNamePrefix%>/modelDescription.xml
<%\t%> cp <%omhome%>/lib/omc/libexec/gnuplot/binary/libexpat-1.dll <%fileNamePrefix%>/binaries/<%platform%>/
<%\t%> cp <%omhome%>/lib/<%getTriple()%>/omc/libexec/gnuplot/binary/libexpat-1.dll <%fileNamePrefix%>/binaries/<%platform%>/
<%\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 Down Expand Up @@ -692,7 +692,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
# /MD - link with MSVCRT.LIB
# /link - [linker options and libraries]
# /LIBPATH: - Directories where libs can be found
LDFLAGS=/MD /link /DLL /NOENTRY /LIBPATH:"<%makefileParams.omhome%>/lib/omc/cpp/" /LIBPATH:"<%makefileParams.omhome%>/bin" OMCppSystem.lib OMCppBase.lib OMCppMath.lib OMCppModelicaExternalC.lib
LDFLAGS=/MD /link /DLL /NOENTRY /LIBPATH:"<%makefileParams.omhome%>/lib/<%getTriple()%>/omc/cpp/" /LIBPATH:"<%makefileParams.omhome%>/bin" OMCppSystem.lib OMCppBase.lib OMCppMath.lib OMCppModelicaExternalC.lib

# /MDd link with MSVCRTD.LIB debug lib
# lib names should not be appended with a d just switch to lib/omc/cpp
Expand Down Expand Up @@ -741,7 +741,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula

CFLAGS=$(CFLAGS_BASED_ON_INIT_FILE) -Winvalid-pch $(SYSTEM_CFLAGS) -I"$(OMHOME)/include/omc/cpp" -I"$(UMFPACK_INCLUDE)" -I"$(OMHOME)/include/omc/cpp/Core" -I"$(OMHOME)/include/omc/cpp/SimCoreFactory" -I"$(BOOST_INCLUDE)" <%makefileParams.includes ; separator=" "%>
CPPFLAGS = $(CFLAGS)
LDFLAGS=-L"$(OMHOME)/lib/omc/cpp" -L"$(BOOST_LIBS)"
LDFLAGS=-L"$(OMHOME)/lib/<%getTriple()%>/omc/cpp" -L"$(BOOST_LIBS)"
PLATFORM="<%platformstr%>"

CALCHELPERMAINFILE=OMCpp<%fileNamePrefix%>CalcHelperMain.cpp
Expand All @@ -752,7 +752,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
ALGLOOPSMAINFILE=OMCpp<%fileNamePrefix%>AlgLoopMain.cpp

OMCPP_LIBS= -lOMCppSystem_FMU -lOMCppDataExchange_static -lOMCppOMCFactory -lOMCppMath_static
OMCPP_SOLVER_LIBS=-Wl,-rpath,"$(OMHOME)/lib/omc/cpp"
OMCPP_SOLVER_LIBS=-Wl,-rpath,"$(OMHOME)/lib/<%getTriple()%>/omc/cpp"
MODELICA_EXTERNAL_LIBS=-lModelicaExternalC -lModelicaStandardTables -L$(LAPACK_LIBS) $(LAPACK_LIBRARIES)
BOOST_LIBRARIES = -lboost_system -lboost_filesystem -lboost_program_options
LIBS= $(OMCPP_LIBS) $(OMCPP_SOLVER_LIBS) $(MODELICA_EXTERNAL_LIBS) $(BASE_LIB) $(BOOST_LIBRARIES) $(LINUX_LIB_DL)
Expand Down
5 changes: 5 additions & 0 deletions Compiler/Template/SimCodeTV.mo
Expand Up @@ -1137,6 +1137,11 @@ package System
input String outFile;
output Boolean success;
end covertTextFileToCLiteral;

function getTriple "For example x86_64-linux-gnu; used to determine the location of lib-files"
output String outString;
end getTriple;

end System;


Expand Down
6 changes: 6 additions & 0 deletions Compiler/Util/System.mo
Expand Up @@ -252,6 +252,12 @@ public function getDllExt
external "C" outString=System_getDllExt() annotation(Library = "omcruntime");
end getDllExt;

public function getTriple "For example x86_64-linux-gnu; used to determine the location of lib-files"
output String outString;

external "C" outString=System_getTriple() annotation(Library = "omcruntime");
end getTriple;

public function loadLibrary
input String inLib;
input Boolean inPrintDebug;
Expand Down
8 changes: 4 additions & 4 deletions Compiler/boot/Makefile.common
Expand Up @@ -125,22 +125,22 @@ $(GEN_DIR)_main_omc.c: $(GEN_DIR)_main.c
$(GEN_DIR)_main_omc.o: $(GEN_DIR)_main_omc.c
$(CC) -c $(GEN_DIR)_main_omc.c -o $(GEN_DIR)_main_omc.o $(CFLAGS) $(CPPFLAGS)

$(OMHOME)/lib/omc/libOpenModelicaCompiler$(SHREXT): $(ALL_OBJECTS) $(OMHOME)/lib/omc/libomcruntime.a $(OMHOME)/lib/omc/libomparse.a $(GEN_DIR)_main_omc.o
$(OMHOME)/$(LIB_OMC)/libOpenModelicaCompiler$(SHREXT): $(ALL_OBJECTS) $(OMHOME)/$(LIB_OMC)/libomcruntime.a $(OMHOME)/$(LIB_OMC)/libomparse.a $(GEN_DIR)_main_omc.o
@test ! -z "`echo $(ALL_OBJECTS)`" || (echo Empty dependencies for $@ ; false)
$(CC) -shared $(RPATH) $(INSTALL_NAME) -o $@ $^ $(LDFLAGS)
test ! "$(SHREXT)" = ".dylib" || install_name_tool -id @rpath/libOpenModelicaCompiler.dylib $@

ifeq ($(STATIC),)
#shared
$(GEN_DIR)omc$(EXE_EXT): $(OMHOME)/lib/omc/libOpenModelicaCompiler$(SHREXT) $(GEN_DIR)_main_omc.o $(GEN_DIR)_main.o
$(GEN_DIR)omc$(EXE_EXT): $(OMHOME)/$(LIB_OMC)/libOpenModelicaCompiler$(SHREXT) $(GEN_DIR)_main_omc.o $(GEN_DIR)_main.o
$(CC) $(GEN_DIR)_main.o $(RPATH) $(CFLAGS) $(CPPFLAGS) -o $@ $(LDFLAGS) -lOpenModelicaCompiler
install: $(GEN_DIR)omc$(EXE_EXT) install-interface
cp -a $< $(OMHOME)/bin/
cp -a $(OMHOME)/lib/omc/libOpenModelicaCompiler$(SHREXT) $(OMHOME)/bin/
cp -a $(OMHOME)/$(LIB_OMC)/libOpenModelicaCompiler$(SHREXT) $(OMHOME)/bin/

else
#static
$(GEN_DIR)omc$(EXE_EXT): $(ALL_OBJECTS) $(GEN_DIR)_main.o $(GEN_DIR)_main_omc.o $(OMHOME)/lib/omc/libomcruntime.a $(OMHOME)/lib/omc/libomparse.a
$(GEN_DIR)omc$(EXE_EXT): $(ALL_OBJECTS) $(GEN_DIR)_main.o $(GEN_DIR)_main_omc.o $(OMHOME)/$(LIB_OMC)/libomcruntime.a $(OMHOME)/$(LIB_OMC)/libomparse.a
@test ! -z "`echo $(ALL_OBJECTS)`" || (echo Empty dependencies for $@ ; false)
$(CC) $(GEN_DIR)_main.o $(RPATH) $(CFLAGS) $(CPPFLAGS) -o $@ $(GEN_DIR)_main_omc.o $(ALL_OBJECTS) $(LDFLAGS)
install: $(GEN_DIR)omc$(EXE_EXT) install-interface
Expand Down
3 changes: 2 additions & 1 deletion Compiler/boot/Makefile.in
Expand Up @@ -8,7 +8,8 @@ CFLAGS=@CFLAGS@
TOP_DIR=@abs_top_builddir@
OMHOME=@abs_top_builddir@/build

LDFLAGS=-L. -L$(GEN_DIR) -L"$(OMHOME)/lib/omc" -lomparse -lomcruntime -lOpenModelicaRuntimeC -lModelicaExternalC -lantlr3 $(CORBALIBS) $(FMILIB) $(GSLIB) @RT_LDFLAGS@ @LIBSOCKET@ @LIBLPSOLVE55@ @OMC_LIBS@ @GRAPHLIB@ -lexpat
LIB_OMC=lib/@host_short@/omc
LDFLAGS=-L. -L$(GEN_DIR) -L"$(OMHOME)/$(LIB_OMC)" -lomparse -lomcruntime -lOpenModelicaRuntimeC -lModelicaExternalC -lantlr3 $(CORBALIBS) $(FMILIB) $(GSLIB) @RT_LDFLAGS@ @LIBSOCKET@ @LIBLPSOLVE55@ @OMC_LIBS@ @GRAPHLIB@ -lexpat
ifeq (@WITH_FMIL@,yes)
FMILIB = -L$(TOP_DIR)/3rdParty/FMIL/install/lib -lfmilib
endif
Expand Down
2 changes: 1 addition & 1 deletion Compiler/runtime/Makefile.common
Expand Up @@ -29,7 +29,7 @@ OMC_OBJ = Error_omc.o Print_omc.o System_omc.o Settings_omc.o \
all: install
.PHONY: all install
install: libomcruntime.a
cp libomcruntime.a $(builddir_lib)/omc/
cp libomcruntime.a $(builddir_lib)/$(TRIPLE)/omc/
libomcruntime.a : $(OMC_OBJ)
rm -f $@
$(AR) -s -r $@ $(OMC_OBJ)
Expand Down

0 comments on commit 7fdfaed

Please sign in to comment.