Skip to content

Commit

Permalink
add some sanity checks for CI/Build MINGW
Browse files Browse the repository at this point in the history
- make sure the compiler can build and simulate a simple model with C, C++ and that an FMU can be build
- check that linearization works (for matlab)
- check that OMEdit can start (not missing any dlls)
- add a script to test the sanity, don't build it on the fly as escaping in Windows is alien technology
- build more stuff in parallel for mingw/msvc (via all-runtimes target)
  • Loading branch information
adrpo committed Jun 6, 2020
1 parent 0dc9748 commit 44e406f
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 29 deletions.
28 changes: 21 additions & 7 deletions .CI/common.groovy
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Makefile.omdev.mingw
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
34 changes: 14 additions & 20 deletions OMCompiler/Makefile.omdev.mingw
Expand Up @@ -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

Expand Down Expand Up @@ -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/
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -398,15 +401,15 @@ 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
mkdir -p $(OMBUILDDIR)/lib/omc/msvc/
# 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'
Expand All @@ -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/)
Expand All @@ -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'
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion OMCompiler/Makefile.omsi.common
Expand Up @@ -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


#############################
Expand Down
17 changes: 17 additions & 0 deletions 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();

0 comments on commit 44e406f

Please sign in to comment.