diff --git a/.CI/common.groovy b/.CI/common.groovy index a2bb81bee23..6080bf047e1 100644 --- a/.CI/common.groovy +++ b/.CI/common.groovy @@ -171,13 +171,25 @@ void buildOMC(CC, CXX, extraFlags) { echo export OPENMODELICALIBRARY="\${MSYS_WORKSPACE}/build/lib/omlibrary" echo time make -f Makefile.omdev.mingw \${MAKETHREADS} omc omc-diff omlibrary-core echo cd \${MSYS_WORKSPACE} - echo sed -i.bak 's/mingw32-make/..\\..\\usr\\bin\\make/g' build/share/omc/scripts/Compile.bat - echo cd \${MSYS_WORKSPACE} - echo make -f Makefile.omdev.mingw \${MAKETHREADS} BUILDTYPE=Release simulationruntimecmsvc BuildType=Release - echo cd \${MSYS_WORKSPACE} - echo make -f 'Makefile.omdev.mingw' \${MAKETHREADS} BUILDTYPE=Release runtimeCPPmsvcinstall - echo cd \${MSYS_WORKSPACE} - echo make -f 'Makefile.omdev.mingw' \${MAKETHREADS} BUILDTYPE=Release runtimeCPPinstall + echo make -f Makefile.omdev.mingw \${MAKETHREADS} BUILDTYPE=Release all-runtimes + echo echo Check that omc can be started and a model can be build for NF OF with runtimes C Cpp FMU + echo ./build/bin/omc --version + echo mkdir .sanity-check + echo cd .sanity-check + echo cp ../testsuite/sanity-check/testSanity.mos . + echo ../build/bin/omc --linearizationDumpLanguage=matlab testSanity.mos + echo export PATH=\$PATH:../build/bin/:../build/lib/omc/omsicpp:../build/lib/omc/cpp + echo ./M + echo ./M -l=1.0 + echo ls linear_M.m + echo ls M.fmu + echo rm -rf M* OMCppM* linear_M* + echo ../build/bin/omc --simCodeTarget=Cpp testSanity.mos + echo ./M + echo ls M.fmu + echo rm -rf M* OMCppM* + echo cd .. + echo rm -rf .sanity-check ) > buildOMCWindows.sh set MSYSTEM=MINGW64 @@ -221,6 +233,8 @@ void buildGUI(stash, isQt5) { echo export OPENMODELICAHOME="\${MSYS_WORKSPACE}/build" echo export OPENMODELICALIBRARY="\${MSYS_WORKSPACE}/build/lib/omlibrary" echo time make -f Makefile.omdev.mingw \${MAKETHREADS} qtclients + echo echo Check that at least OMEdit can be started + echo ./build/bin/OMEdit --help ) > buildGUIWindows.sh set MSYSTEM=MINGW64 diff --git a/Makefile.omdev.mingw b/Makefile.omdev.mingw index d2c5649827f..34d58908990 100644 --- a/Makefile.omdev.mingw +++ b/Makefile.omdev.mingw @@ -37,7 +37,7 @@ BUILDTYPE=Debug endif -.PHONY: omc omc-diff omlibrary-core omplot omedit omedit-testsuite omsimulator omnotebook omshell omoptim omsens omsens_qt +.PHONY: omc omc-diff omlibrary-core omplot omedit omedit-testsuite omsimulator omnotebook omshell omoptim omsens omsens_qt qtclientsDLLs qtclientsDLLs simulationruntimecmsvc runtimeCPPinstall runtimeCPPmsvcinstall OMSICPPinstall all-runtimes nox all: omc omc-diff omlibrary-core @@ -210,6 +210,9 @@ runtimeCPPinstall: OMSICPPinstall OMSICPPinstall: $(MAKE) -C OMCompiler -f $(defaultMakefileTarget) OMBUILDDIR=$(OMBUILDDIR) BUILDTYPE=$(BUILDTYPE) OMSICPPinstall +all-runtimes: + $(MAKE) -C OMCompiler -f $(defaultMakefileTarget) OMBUILDDIR=$(OMBUILDDIR) BUILDTYPE=$(BUILDTYPE) OMSICPPinstall runtimeCPPmsvcinstall simulationruntimecmsvc + nox: $(MAKE) -C OMCompiler -f $(defaultMakefileTarget) OMBUILDDIR=$(OMBUILDDIR) BUILDTYPE=$(BUILDTYPE) nox diff --git a/OMCompiler/Makefile.omdev.mingw b/OMCompiler/Makefile.omdev.mingw index 19cd345b71d..f242dbb49d8 100644 --- a/OMCompiler/Makefile.omdev.mingw +++ b/OMCompiler/Makefile.omdev.mingw @@ -102,6 +102,8 @@ SEMLA_LIB=semla SEMLA_CLEAN=semla-clean endif +main.PHONY: simulationruntimecmsvc runtimeCPPinstall runtimeCPPmsvcinstall OMSICPPinstall nox getMSVCversion omdev_extra_dlls install-openturns copycppheader copycppmsvcheader boehm-gc-lib fmil_msvc sundials_msvc CMinpack_msvc Umfpack_msvc runtimeOMSIBaseMSVCInstall omcCAPImsvcinstall + include Makefile.common include Makefile.omsi.common @@ -299,7 +301,8 @@ omc: interactive fmil omdev_extra_dlls breakprocess opencl_rt CMinpack metis Cd boehm-gc-lib: $(OMBUILDDIR)/$(LIB_OMC)/libomcgc.a -fmil_msvc: getMSVCversion +fmil_msvc: $(OMBUILDDIR)/bin/msvc/fmilib_shared.dll +$(OMBUILDDIR)/bin/msvc/fmilib_shared.dll: getMSVCversion rm -f $(OMBUILDDIR)/lib/omc/msvc/fmil* rm -rf 3rdParty/FMIL/install_msvc mkdir -p $(OMBUILDDIR)/lib/omc/msvc/ @@ -335,7 +338,8 @@ fmil_msvc: getMSVCversion (cp -puf 3rdParty/FMIL/install_msvc/lib/fmilib_shared.dll $(OMBUILDDIR)/lib/omc/msvc/fmilib_shared.dll) (cp -puf 3rdParty/FMIL/install_msvc/lib/fmilib_shared.lib $(OMBUILDDIR)/lib/omc/msvc/fmilib_shared.lib) -CMinpack_msvc: getMSVCversion +CMinpack_msvc: $(OMBUILDDIR)/lib/omc/msvc/cminpack.lib +$(OMBUILDDIR)/lib/omc/msvc/cminpack.lib: getMSVCversion rm -f $(OMBUILDDIR)/lib/omc/msvc/cminpack.* rm -rf 3rdParty/CMinpack/build_msvc rm -rf 3rdParty/CMinpack/install_msvc @@ -356,15 +360,14 @@ CMinpack_msvc: getMSVCversion echo set MAKE= >> 3rdParty/CMinpack/build_msvc/build.bat echo set MAKEFLAGS= >> 3rdParty/CMinpack/build_msvc/build.bat echo %OMDEV%\\tools\\jom\\jom.exe /f Makefile install >> 3rdParty/CMinpack/build_msvc/build.bat - # Change into directory and run batch file cd ./3rdParty/CMinpack/build_msvc; echo "change to 3rdParty/CMinpack/build_msvc";\ cmd /c build.bat - - # copy dll to bin folder + # copy dll to bin folder (cp -puf 3rdParty/CMinpack/install_msvc/lib/cminpack.lib $(OMBUILDDIR)/lib/omc/msvc/) -Umfpack_msvc: getMSVCversion +Umfpack_msvc: $(OMBUILDDIR)/lib/omc/msvc/umfpack.lib +$(OMBUILDDIR)/lib/omc/msvc/umfpack.lib: getMSVCversion rm -f $(OMBUILDDIR)/lib/omc/msvc/amd.lib rm -f $(OMBUILDDIR)/lib/omc/msvc/umfpack.lib rm -rf $(OMBUILDDIR)/include/omc/msvc/suitesparse @@ -398,7 +401,8 @@ Umfpack_msvc: getMSVCversion (cp -pur 3rdParty/SuiteSparse/install_msvc/include/omc/c/suitesparse/Include/ $(OMBUILDDIR)/include/omc/msvc/suitesparse) # build sundials -sundials_msvc: getMSVCversion 3rdParty/sundials/CMakeLists.txt +sundials_msvc: $(OMBUILDDIR)/lib/omc/msvc/sundials_ida.dll +$(OMBUILDDIR)/lib/omc/msvc/sundials_ida.dll: getMSVCversion 3rdParty/sundials/CMakeLists.txt rm -f $(OMBUILDDIR)/lib/omc/msvc/sundials* rm -f $(OMBUILDDIR)/bin/sundials* rm -rf 3rdParty/sundials/build_msvc @@ -406,7 +410,6 @@ sundials_msvc: getMSVCversion 3rdParty/sundials/CMakeLists.txt # Goto build msvc directory test -d 3rdParty/sundials mkdir -p 3rdParty/sundials/build_msvc - # Create batch file, that builds with CMake and Visual Studio test -f """${VSCOMNTOOLS}/../../VC/vcvarsall.bat""" echo 'Building sundials with MSVC' @@ -419,12 +422,10 @@ sundials_msvc: getMSVCversion 3rdParty/sundials/CMakeLists.txt echo set MAKE= >> 3rdParty/sundials/build_msvc/build.bat echo set MAKEFLAGS= >> 3rdParty/sundials/build_msvc/build.bat echo %OMDEV%\\tools\\jom\\jom.exe /f Makefile install >> 3rdParty/sundials/build_msvc/build.bat - # Change into directory and run batch file cd ./3rdParty/sundials/build_msvc; echo "change to 3rdParty/sundials/build_msvc";\ cmd /c build.bat - - # copy dll to lib and bin folder + # copy dll to lib and bin folder mkdir -p $(OMBUILDDIR)/include/omc/msvc/sundials (cp -pufr 3rdParty/sundials/build_msvc/include/* $(OMBUILDDIR)/include/omc/msvc/sundials) (cp -puf 3rdParty/sundials/build_msvc/lib/* $(OMBUILDDIR)/lib/omc/msvc/) @@ -440,7 +441,6 @@ nox_msvc: getMSVCversion 3rdParty/trilinos-nox/CMakeLists.txt # Goto build msvc directory test -d 3rdParty/trilinos-nox mkdir -p 3rdParty/trilinos-nox/build_msvc - # Create batch file, that builds with CMake and Visual Studio test -f """${VSCOMNTOOLS}/../../VC/vcvarsall.bat""" echo 'Building trilinos-nox with MSVC' @@ -453,28 +453,22 @@ nox_msvc: getMSVCversion 3rdParty/trilinos-nox/CMakeLists.txt echo set MAKE= >> 3rdParty/trilinos-nox/build_msvc/build.bat echo set MAKEFLAGS= >> 3rdParty/trilinos-nox/build_msvc/build.bat echo %OMDEV%\\tools\\jom\\jom.exe /f Makefile install >> 3rdParty/trilinos-nox/build_msvc/build.bat - # Change into directory and run batch file cd ./3rdParty/trilinos-nox/build_msvc; echo "change to 3rdParty/trilinos-nox/build_msvc";\ cmd /c build.bat - - omcCAPImsvcinstall: $(MAKE) -C SimulationRuntime/OMSICpp/ -f Makefile.omdev.mingw omcCAPImsvc OMBUILDDIR=$(OMBUILDDIR) - -runtimeCPPmsvcinstall: CMinpack_msvc copycppmsvcheader OMSIBaseMSVC +runtimeCPPmsvcinstall: getMSVCversion Umfpack_msvc CMinpack_msvc fmil_msvc sundials_msvc OMSIBaseMSVC copycppmsvcheader $(MAKE) -C SimulationRuntime/OMSICpp/ -f Makefile.omdev.mingw runtimeCPPmsvc OMBUILDDIR=$(OMBUILDDIR) cp -p $(BOOST_PATH_MSVC)/lib/*vc*.dll $(OMBUILDDIR)/bin/msvc cp -p $(BOOST_PATH_MSVC)/lib/*vc*.lib $(OMBUILDDIR)/lib/omc/omsicpp/msvc - runtimeOMSIBaseMSVCInstall: $(MAKE) -C SimulationRuntime/OMSI/ -f Makefile.omdev.mingw OMSIBaseMSVC OMBUILDDIR=$(OMBUILDDIR) - -simulationruntimecmsvc: getMSVCversion Umfpack_msvc CMinpack_msvc fmil_msvc sundials_msvc +simulationruntimecmsvc: getMSVCversion Umfpack_msvc CMinpack_msvc fmil_msvc sundials_msvc test -f """${VSCOMNTOOLS}/../../VC/vcvarsall.bat""" mkdir -p $(OMBUILDDIR)/include/omc/msvc/ mkdir -p $(OMBUILDDIR)/lib/omc/msvc/debug diff --git a/OMCompiler/Makefile.omsi.common b/OMCompiler/Makefile.omsi.common index 73d3a2c0448..4563b408c39 100644 --- a/OMCompiler/Makefile.omsi.common +++ b/OMCompiler/Makefile.omsi.common @@ -8,7 +8,7 @@ CMAKE_FLAGS=-DCMAKE_BUILD_TYPE=$(BUILDTYPE) CMAKE_CALL=cmake -G $(CMAKE_TARGET) --build . -DPLATFORM=$(PLATFORM) $(CMAKE_FLAGS) $(IS_MINGW32) $(IS_MINGW64) -DCMAKE_INSTALL_PREFIX:PATH="$(OMBUILDDIR)" -DLIB_OMC=$(LIB_OMC) .. -.PHONY: OMSIBaseClean OMSICClean +.PHONY: OMSIBaseClean OMSICClean OMSIBaseMSVC OMSI OMSIBaseInstall OMSICInstall OMSI-clean OMSICClean OMSICPP OMSICPPinstall ############################# diff --git a/testsuite/sanity-check/testSanity.mos b/testsuite/sanity-check/testSanity.mos new file mode 100644 index 00000000000..76a8f6e0004 --- /dev/null +++ b/testsuite/sanity-check/testSanity.mos @@ -0,0 +1,17 @@ +// script to test the sanity of the OpenModelica compiler + +// load the model +loadString(" +model M + Real x(start=1.0, fixed=true); + parameter Real a = -1.0; +equation + der(x) = a * x; +end M;"); getErrorString(); + +// build and FMU out of the model +buildModelFMU(M); getErrorString(); + +// build an simulation executable out of the model +buildModel(M); getErrorString(); +