-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BuildProjects to automatically compile Modelica binaries #1668
Comments
Modified by dietmarw on 27 Feb 2015 12:01 UTC |
Comment by sjoelund.se on 27 Feb 2015 20:29 UTC
This solves the issues that some Modelica tools only partially support the Modelica language (you can include C code in the model, so a C compiler can be assumed to exist). |
Comment by sjoelund.se on 27 Feb 2015 20:35 UTC Library={"system:dbus-1"} // For things that require dbus, regardless of platform
Library={"win32|win64:shlwapi","linux:dl"} // Make the thing before the : a regular expression matching the platform name x86_64-linux or linux64 for example This allows you to specify libraries that are different on each platform. Currently, the spec says you are recommended to link all dependencies. But these are often platform-specific and best practice is to only depend on a single statically linked library instead. |
Comment by dietmarw on 15 Apr 2015 14:33 UTC |
Comment by beutlich on 18 Jan 2017 21:26 UTC |
Comment by hansolsson on 25 Oct 2017 07:41 UTC |
There is use case for specifying the source code (directories) that we had not considered earlier. The case is for generating FMUs containing source code, for models that use external functions. It might be that this should be part of a re-opened #2145 - separate from this ticket. However, they need to be considered together. In this case we need the source code so that we can copy it to the FMU. One proposal to solve this is to have an annotation SourceDirectory (similary as LibraryDirectory and IncludeDirectory) possibly with default "modelica://LibraryName/Resources/Source". That can then be used when building a source code FMU by first copying the contents of that that source-directory to the FMU. It seems best to also copy the build-project to the source code FMU (I assume the build-projects are general enough that they are useful also for the target-system of the FMU), which requires one of the following:
|
Design meeting: Seems that straightforward to standardize on CMake - and have some CMake-variable for ModelicaUtilities.h from tools. |
Shall we push this?
(And the cmake-variable for ModelicaUtilities.h) |
@beutlich just completed modelica/ModelicaStandardLibrary#4093, now a proof of concept is available in the MSL master branch. |
Modified by dietmarw on 27 Feb 2015 12:01 UTC
Since some time we have had a directory Modelica/Resources/BuildProjects to make it easier to compile the binary libraries used by the package. This makes maintenance easier since you do not need to compile and keep svn/git updated with new versions of the library all the time (since the user/tool provider can easily compile the source code).
I propose that this is specified and made automatic by Modelica tools (that support external C). I even made a prototype implementation in OpenModelica.
The following uses the library name ModelicaExternalC2 instead of ModelicaExternalC because OpenModelica itself has ModelicaExternalC pre-compiled:
The prototype works by looking in the usual library directories for a file libmylib.a or libmylib.so (as well as OPENMODELICAHOME/lib/omc OPENMODELICAHOME/lib and ~/.openmodelica/binaries/PACKAGENAME). If no library is found, it tries to look for modelica://M/Resources/BuildProjects/*/autogen.sh. It then tries to run that project using the command below.
The generated library for ModelicaTables is linked against hdf5 if the system has hdf5 installed. If it is not installed, it asks the OS if the hdf5 is available in the package manager, and if it is it asks for admin rights to install it.
[[Image(hdf5-install.png, 100%)]]
Reported by sjoelund.se on 26 Feb 2015 12:41 UTC
Since some time we have had a directory Modelica/Resources/BuildProjects to make it easier to compile the binary libraries used by the package. This makes maintenance easier since you do not need to compile and keep svn/git updated with new versions of the library all the time (since the user/tool provider can easily compile the source code).
I propose that this is specified and made automatic by Modelica tools (that support external C). I even made a prototype implementation in OpenModelica.
The following uses the library name ModelicaExternalC2 instead of ModelicaExternalC because OpenModelica itself has ModelicaExternalC pre-compiled:
The prototype works by looking in the usual library directories for a file libmylib.a or libmylib.so (as well as OPENMODELICAHOME/lib/omc OPENMODELICAHOME/lib and ~/.openmodelica/binaries/PACKAGENAME). If no library is found, it tries to look for modelica://M/Resources/BuildProjects/*/autogen.sh. It then tries to run that project using the command below.
The generated library for ModelicaTables is linked against hdf5 if the system has hdf5 installed. If it is not installed, it asks the OS if the hdf5 is available in the package manager, and if it is it asks for admin rights to install it.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1668
The text was updated successfully, but these errors were encountered: