# How to build FMUSimulator and FMILibrary ## Base FMILibrary To build the Visual Studio Solution files you need CMake. CMake is also used to build the base native FMILibrary. Note: This is not usually needed, you can use the existing build. Remember to manually delete CMakeCache and CMakeFiles from FMILibrary/build/expatex/-folder Follow the instructions provided by the Linux Dockerfile and linuxbuild.sh. In short: 1) Download the desired FMILibrary source .zip 2) Unzip in a location of your choosing 3) Open terminal 4) Change directory to where you want to build the output 5) Run cmake from command-line and provide as the first argument the path to where you unzipped sources in step 2 Optional) To make a debug version, add -DFMILIB_ENABLE_LOG_LEVEL_DEBUG=ON before the path to source 6) In both debug and normal case, run "make" and "make install test" to verify the installation If the build succeeded, you should have .dll files which you can now copy to your win32 or win64 org.simantics.fmil.* projects. Specifically: fmu1_dll_cs.dll, fmu1_dll_me.dll, fmu2_dll_cs.dll, fmu2_dll_me.sll and fmilib_shared.dll Copy the corresponding "Debug" build files to the sub-directoryn "Debug" in the projects. ## FMUSimulator When you have the Visual Studio files: Build from command-line our FMUSimulator.dll 1) Open a terminal 2) Navigate to org.simantics.fmil.core/native/FMUSimulator 3) Run "msbuild.exe" ## Building on linux When building the libfmilib_shared.so, we need to replace fmi_util.c file under "/src/Util/src/FMI/fmi_util.c" with contents of fmi_util.c.txt, located under /native/FMUSimulator/fmi_util.c.txt. The Dockerfile already does this so if you build the libfmilib_shared.so with that, then you needn't worry about this.