Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Can openmodelica build from source on Windows?

Can openmodelica build from source on Windows?

I find the source code of OpenModelica is currently being migrated from subversion to git.
But on github I only find the way to build under linux or osx.
Is it available to build with the source from github?
Or if I need to build from source on windows, I must use the source from svn repo with OMDev?

Re: Can openmodelica build from source on Windows?

Yes, you can build from the source on Windows. This is how we do it in Hudson: https://test.openmodelica.org/hudson/job/OM_Win/
You need to have OMDev in C:\OMDev and a lot of stuff in your PATH, see below on export PATH current/smile
You don't need the source code, just git and this script will get it.
You can put this in a .bat script and run it.
For the msvc parts you need to have Visual Studio Express installed current/smile
For the QT clients you need to have Qt 4.8.0 SDK installed.
TortoiseSVN + command line clients is needed to update OMDev.

Code:


set OMDEV=C:\OMDev
REM WORKSPACE is where the source code will be downloaded and build. It needs to exist!
set WORKSPACE=C:\dev\
echo on
(
echo #!/bin/sh -xe
echo #
echo # script to build the OpenModelica windows build
echo # expects to have these things installed:
echo #   python 2.7.x - you need to run easy_install joblib simplejson requests in the cmd line in python/Scripts
echo #   nsis installer
echo #   TortoiseSVN command line tools
echo #   Qt 4.8.0
echo #   jdk
echo #   git - put it last in the path
echo #   OMDev in c:/OMDev
echo #
echo #
echo # set the path to our tools
echo export PATH=/c/bin/python273:/c/Program\ Files/TortoiseSVN/bin/:/c/bin/jdk170/bin:/c/bin/nsis/:/c/bin/QtSDK/Desktop/Qt/4.8.0/mingw/bin:$PATH:/c/bin/git/bin
echo #
echo # set the OPENMODELICAHOME and OPENMODELICALIBRARY
echo export OPENMODELICAHOME="${WORKSPACE}\\OM\\build"
echo export OPENMODELICALIBRARY="${WORKSPACE}\\OM\\build\\lib\\omlibrary"
echo # have OMDEV in Msys version
echo export OMDEV=/c/OMDev/
echo # update OMDev
echo cd /c/OMDev/
echo svn up . --accept theirs-full
echo # get back to our workspace
echo cd ${WORKSPACE}/
echo # check if we have OM already
echo if test ! -d OM; then
echo git clone --recursive https://github.com/OpenModelica/OpenModelica.git OM
echo fi
echo # update OM
echo cd OM
echo git reset --hard origin/master ^&^& git checkout master ^&^& git pull --recurse-submodules ^&^& git fetch --tags || exit 1
echo # checkout the specific revision given to us
echo git checkout $REVISION
echo git submodule update --init --recursive --force || exit 1
echo git submodule foreach --recursive  "git fetch --tags && git clean -fdxq -e /git -e /svn" || exit 1
echo git clean -fdxq || exit 1
echo git submodule status --recursive
echo cd ${WORKSPACE}/OM
echo make -r -f Makefile.omdev.mingw -j3 clean clean-qtclients
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw -j2
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw -j2 omlibrary-core
echo cd ${WORKSPACE}/OM
echo make -r -f Makefile.omdev.mingw -j2 qtclients
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw simulationruntimecmsvc
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw runtimeCPPmsvcinstall
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw runtimeCPPinstall
echo cd ${WORKSPACE}/OM
echo make -f Makefile.omdev.mingw -j5 testlogwindows
echo cd ${WORKSPACE}/OM
echo # delete the libraries as Hudson is stupid
echo #rm -rf build/omc/omlibrary
) > buildWindows.sh

%OMDEV%\tools\msys\bin\sh --login -i -c "cd ${WORKSPACE} && chmod +x buildWindows.sh && ./buildWindows.sh && rm -f ./buildWindows.sh"

Re: Can openmodelica build from source on Windows?

Thanks for your reply  current/smile  , and I am running .bat these days, it runs well except spent a little long time, after  I remove the testlogwindows option, it finished faster.
Actually, I am interested in the qt clients of openmodelica especially the OMEdit. So now I try to run the OMEditGUI.pro in Qtcreator, and I was successed with the code from svn repo, but I failed to do so with the code from github.
I find there is some changes in OMEdit.pro, it uses some environment variables to point include path instead of relative path in svn version.After I add OPENMODELICAHOME and OPENMODELICALIBRARY and OMBUILDDIR environment variables, it starts to build in Qtcreator.
But it stops with error: [../generatedfiles/moc/moc_Component.cpp] Error 1
I use Qt 4.8.0 with mingw in OMDev, am I miss something or get some steps wrong?

I would also like to do some develop on OMEdit, but now I am messed up with its huge structure. I'd like to know can I get some guide of OMEdit's code structure just like OMNotebook and OMShell what is introduced in OpenModelicaSystem.pdf ?

There are 0 guests and 0 other users also viewing this topic
You are here: