Skip to content

Commit

Permalink
Compilation and linking of OMTLMSimulator
Browse files Browse the repository at this point in the history
  • Loading branch information
robbr48 authored and OpenModelica-Hudson committed Apr 3, 2018
1 parent da1d705 commit 084d18f
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ ifeq ($(detected_OS),Darwin)
# MINGW detected => NO SUPPORT FOR BUILDING CERES SOLVER (yet)
CERES := OFF
OMSYSIDENT := OFF
export ABI := MAC64
FEXT=.dylib
else ifeq (MINGW32,$(findstring MINGW32,$(detected_OS)))
BUILD_DIR := build/mingw
INSTALL_DIR := install/mingw
Expand All @@ -23,7 +25,8 @@ else ifeq (MINGW32,$(findstring MINGW32,$(detected_OS)))
CERES := OFF
OMSYSIDENT := OFF
OMFIT := OFF
ABI := WINDOWS32
export ABI := WINDOWS32
FEXT=.dll
else ifeq (MINGW,$(findstring MINGW,$(detected_OS)))
BUILD_DIR := build/mingw
INSTALL_DIR := install/mingw
Expand All @@ -32,11 +35,13 @@ else ifeq (MINGW,$(findstring MINGW,$(detected_OS)))
# MINGW detected => NO SUPPORT FOR BUILDING CERES SOLVER (yet)
CERES := OFF
OMSYSIDENT := OFF
ABI := WINDOWS64
export ABI := WINDOWS64
FEXT=.dll
else
BUILD_DIR := build/linux
INSTALL_DIR := install/linux
ABI := LINUX64
export ABI := LINUX64
FEXT=.so
endif

.PHONY: OMSimulator config-OMSimulator config-fmil config-lua config-cvode config-kinsol config-gflags config-glog config-ceres-solver config-3rdParty distclean testsuite doc doc-html doc-doxygen OMTLMSimulator
Expand All @@ -47,12 +52,17 @@ OMSimulator: OMTLMSimulator
@echo
@echo $(ABI)
@$(MAKE) -C $(BUILD_DIR) install
test ! `uname` = Darwin || (install_name_tool -change MAC64/libomtlmsimulator.dylib "@loader_path/libomtlmsimulator.dylib" $(INSTALL_DIR)/bin/OMSimulator)

OMTLMSimulator:
@echo
@echo "# make OMTLMSimulator"
@echo
@$(MAKE) -C OMTLMSimulator omtlmlib
@$(MKDIR) $(INSTALL_DIR)/lib
@$(MKDIR) $(INSTALL_DIR)/bin
cp OMTLMSimulator/bin/libomtlmsimulator$(FEXT) $(INSTALL_DIR)/lib/
cp OMTLMSimulator/bin/libomtlmsimulator$(FEXT) $(INSTALL_DIR)/bin/

config-3rdParty: config-fmil config-lua config-cvode config-kinsol config-gflags config-glog config-ceres-solver

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ The latest documentation is avilable as [pdf](https://openmodelica.org/doc/OMSim

### Linux / MacOS

1. install libxml2-dev

```bash
sudo apt-get install libxml2-dev
```

1. configure OMSimulator

```bash
Expand Down
32 changes: 31 additions & 1 deletion buildWinVS.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,41 @@ ECHO.
SET VSCMD_START_DIR="%CD%"

IF ["%OMS_VS_TARGET%"]==["VS14-Win32"] @call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86
IF ["%OMS_VS_TARGET%"]==["VS14-Win64"] @call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 8.1
IF ["%OMS_VS_TARGET%"]==["VS14-Win64"] @call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
IF ["%OMS_VS_TARGET%"]==["VS15-Win64"] @call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64

IF NOT DEFINED CMAKE_BUILD_TYPE SET CMAKE_BUILD_TYPE="Release"

mkdir install\win\bin

:: -- building pthread --------------------------------------------------------
ECHO # Building pthread
cd 3rdParty\pthread
call buildWinVS.bat
cd..
cd..
copy /Y 3rdParty\pthread\install\win\lib\pthreadVC2.dll install\win\bin
:: -- building pthread --------------------------------------------------------

:: -- building libxml2 --------------------------------------------------------
ECHO # Building libxml2
cd 3rdParty\libxml2
call buildWinVS.bat
cd..
cd..
copy /Y 3rdParty\libxml2\install\win\bin\libxml2.dll install\win\bin
:: -- building libxml2 --------------------------------------------------------

:: -- build OMTLMSimulator ----------------------------------------------------
ECHO # Building OMTLMSimulator
cd OMTLMSimulator
call buildWinVS.bat
cd..
copy /Y OMTLMSimulator\bin\omtlmsimulator.lib install\win\bin
copy /Y OMTLMSimulator\bin\omtlmsimulator.dll install\win\bin
echo %cd%
:: -- build OMTLMSimulator ----------------------------------------------------

:: -- build OMSimulator -------------------------------------------------------
ECHO # build OMSimulator
msbuild.exe "build\win\INSTALL.vcxproj" /t:Build /p:configuration=%CMAKE_BUILD_TYPE% /maxcpucount
Expand Down
2 changes: 1 addition & 1 deletion configWinVS.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ECHO.
SET VSCMD_START_DIR="%CD%"

IF ["%OMS_VS_TARGET%"]==["VS14-Win32"] @call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86
IF ["%OMS_VS_TARGET%"]==["VS14-Win64"] @call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 8.1
IF ["%OMS_VS_TARGET%"]==["VS14-Win64"] @call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
IF ["%OMS_VS_TARGET%"]==["VS15-Win64"] @call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64

IF NOT DEFINED CMAKE_BUILD_TYPE SET CMAKE_BUILD_TYPE="Release"
Expand Down
3 changes: 2 additions & 1 deletion src/OMSysIdentLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ link_directories(
${Boost_LIBRARY_DIRS}
${CVODELibrary_LIBRARYDIR}
${KINSOLLibrary_LIBRARYDIR}
${OMTLMSIMULATORLIB_LIBRARYDIR}
)

set(OMSYSIDENTLIB_SOURCES OMSysIdent.cpp FitModel.cpp)
set(OMSYSIDENTLIB_LIBRARIES OMSimulatorLib ${FMILibrary_LIBRARY} sundials_cvode sundials_nvecserial ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${CERES_LIBRARIES})
set(OMSYSIDENTLIB_LIBRARIES OMSimulatorLib ${FMILibrary_LIBRARY} sundials_cvode sundials_nvecserial ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${CERES_LIBRARIES} omtlmsimulator)
# set(OMSYSIDENTLIB_LIBS2 OMSimulatorLib_shared fmilib_shared sundials_cvode sundials_nvecserial)

# Shared library version
Expand Down

0 comments on commit 084d18f

Please sign in to comment.