Skip to content

Repository files navigation

OpenModelicaSetup

OpenModelica Windows installer based on NSIS.

Dependencies

Build Windows installer

Environment variables

You'll need to export all tools to PATH environment variable in your MSYS2 UCRT64 shell %OMDEV%\tools\msys\ucrt64.exe:

export PATH=$PATH:/c/Program\ Files/Git/bin
export PATH=$PATH:/c/Program\ Files\ \(x86\)/NSIS/Bin

Also make sure to set environment variables

  • OMDEV, e.g. c:\\OMDev
  • OPENMODELICAHOME, e.g. d:\\path\\to\\OpenModelica\\build_cmake\\install_cmake
  • OPENMODELICALIBRARY, e.g. d:\\path\\to\\OpenModelica\\build_cmake\\install_cmake\\lib\\omlibrary

with Windows style paths using \.

Build:

  • OpenModelica
  • OpenModelica libraries
  • OMPython
  • OMSimulator
  • OMSens

Download the HTML and PDF versions of OpenModelica User's Guide:

cd ${OPENMODELICAHOME}/share/doc/omc
wget --no-check-certificate https://openmodelica.org/doc/openmodelica-doc-latest.tar.xz
tar -xJf openmodelica-doc-latest.tar.xz --strip-components=2
rm openmodelica-doc-latest.tar.xz
wget --no-check-certificate https://openmodelica.org/doc/OpenModelicaUsersGuide/OpenModelicaUsersGuide-latest.pdf

Run NSIS

Start %OMDEV%\tools\msys\ucrt64.exe or %OMDEV%\tools\msys\mingw64.exe and run:

export PLATFORM="64"        # 64 or 32 bit
export OPENMODELICA_SOURCE_DIR="d:\\path\\to\\OpenModelica"
export REVISION_SHORT=`cd $OPENMODELICA_SOURCE_DIR; git describe --match "v*.*" --always --abbrev=0`
export PRODUCT_VERSION="${REVISION_SHORT:1}"
# make a valid VIProductVersion by stripping everything after "-"
BEGIN=${PRODUCT_VERSION/-*/}
PRODUCT_VERSION=${PRODUCT_VERSION::${#BEGIN}}
PRODUCT_VERSION=${PRODUCT_VERSION}.0

# derive MSYSRUNTIME from MSYSTEM (set by the MSYS2 shell you're running in)
MSYSRUNTIME="mingw"
if [ "${MSYSTEM}" = "UCRT64" ]; then
  MSYSRUNTIME="ucrt"
fi

# generate the list of files for the installer from your CMake install directory
python GenerateFilesList.py --MSYSRUNTIME="${MSYSRUNTIME}" --PLATFORMVERSION="${PLATFORM}" \
       --OPENMODELICAHOME="${OPENMODELICAHOME}" --OPENMODELICASOURCEDIR="${OPENMODELICA_SOURCE_DIR}"

makensis //DMSYSRUNTIME="${MSYSRUNTIME}" \
         //DPLATFORMVERSION="${PLATFORM}" \
         //DOMVERSION="${REVISION_SHORT}" \
         //DPRODUCTVERSION="${PRODUCT_VERSION}" \
         OpenModelicaSetup.nsi

Note

PRODUCT_VERSION needs to be in X.X.X.X format.

Warning

OpenModelicaSetup.nsi compresses with SetCompressor /FINAL LZMA, NSIS's slowest but best-ratio compressor. It single-threads through the entire MSYS2 toolchain plus your OpenModelica install (tens of thousands of files, several GB), so a full makensis run can easily take over an hour.

Optional: Sign the installer

To sign the installer you'll need a code-signing certificate (SPC). See the doc for more information.

export SIGNTOOL=`find /c/Program\ Files\ \(x86\)/Windows\ Kits/10/ -wholename "*${XPREFIX}/signtool.exe" | tail -1`
"${SIGNTOOL}" sign /n "Me" /f MySPC.pfx /tr "http://timestamp.globalsign.com/tsa/r6advanced1" /a /td SHA256 /v OpenModelica.exe

Bug Reports

About

OpenModelica Windows installer based on NSIS

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages