]> gerrit.simantics Code Review - simantics/fmil.git/blobdiff - org.simantics.fmil.core/README.md
Pending status can be returns from FMU to Native C to Java
[simantics/fmil.git] / org.simantics.fmil.core / README.md
index 0539e376bfe08783ae6eac636e34543028a54d43..e1036be3e198b05f256c4365de8de790859e4559 100644 (file)
@@ -11,31 +11,51 @@ 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
+
+On Windows the library must be manually downloaded and unzipped to the *native* directory.
+The build can then be performed by executing the batch file *./windowsbuild.bat* in the same directory.
+
+The build steps are:
+1. Download the desired FMILibrary source .zip from https://jmodelica.org/fmil/FMILibrary-2.0.3-src.zip
+2. Unzip the package to the *native* directory.
+3. Open terminal with development tools configured
+    * Visual Studio: Use the *"Developer Command Prompt for VS 2017"* start menu entry
+4. Execute build script
+    * Linux: `docker build -f Dockerfile -t fmilibrary:build .`, then `docker run -v /path/to/org.simantics.fmil.linux64/libraries:/output fmilibrary:build`
+    * Windows: `cd native`, then `windowsbuild.bat`
+
+Automated steps:
+1. Replace *fmi_util.c* file under *"<path to FMILibrary>/src/Util/src/FMI/fmi_util.c"* with contents of *fmi_util.c.txt*, located
+under */native/FMUSimulator/fmi_util.c.txt*.
+2. Change directory to where you want to build the output
+3. 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
+     * Windows: Specify build tools and target architecture with
+       * `cmake -G "Visual Studio 15"` (32-bit) or
+       * `cmake -G "Visual Studio 15 Win64"` (64-bit)
+4. Use the generated makefiles/project files to perform the build
+    * Linux: In both debug and normal case, run "make" and "make install test" to verify the installation
+    * Windows: Execute the command `msbuild FMILibrary.sln /p:Configuration=<Debug/Release> /p:Platform=<Win32/x64>` 
 
 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
+### Windows-build with Visual Studio
 
-1) Open a terminal
-2) Navigate to org.simantics.fmil.core/native/FMUSimulator
-3) Run "msbuild.exe"
+On Windows, cmake needs to be run separately for 32-bit and 64-bit builds. See the Windows batch file *update_fmilibrary.bat*, which performs both automatically.
 
-## Building on linux
+### Building on linux
        
 When building the libfmilib_shared.so, we need to replace fmi_util.c file under "<path to FMILibrary>/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.
\ No newline at end of file
+## FMUSimulator
+
+When you have the Visual Studio files:
+Build from command-line our FMUSimulator.dll
+
+1) Open a VS development terminal
+2) Navigate to org.simantics.fmil.core/native
+3) Run "windowsbuildsim.bat"