Skip to content

Commit

Permalink
Do not hardcode OPENMODELICAHOME in OMEdit
Browse files Browse the repository at this point in the history
This resolves ticket:5640.
  • Loading branch information
sjoelund authored and adeas31 committed May 7, 2020
1 parent 7c442bd commit 5d1022e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
6 changes: 6 additions & 0 deletions OMCompiler/Compiler/runtime/settingsimpl.h
Expand Up @@ -30,6 +30,12 @@

#ifndef SETTINGSIMPL__H_
#define SETTINGSIMPL__H_
#ifdef __cplusplus
extern "C" {
#endif
extern const char* SettingsImpl__getInstallationDirectoryPath();
extern const char* SettingsImpl__getTempDirectoryPath();
#ifdef __cplusplus
}
#endif
#endif
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/OMEditGUI.unix.config.pri.in
Expand Up @@ -7,7 +7,7 @@ QMAKE_LINK = @CXX@
OPENMODELICAHOME = @OPENMODELICAHOME@
host_short = @host_short@

LIBS += -L@OPENMODELICAHOME@/lib/$$host_short/omc -lOMPlot -lomqwt -lfmilib_shared -L$$OMEDIT_ROOT/OMEditLIB/Debugger/Parser -lGDBMIParser -lomantlr3 @RPATH_QMAKE@ -lOpenModelicaCompiler -lOpenModelicaRuntimeC -lomcgc -L@OMBUILDDIR@/lib/$$host_short/omc @LIBOSG@ -lomopcua -L@OMBUILDDIR@/lib -lOMSimulator -lqjson @LIB_BOOST_REGEX@
LIBS += -L@OPENMODELICAHOME@/lib/$$host_short/omc -lOMPlot -lomqwt -lfmilib_shared -L$$OMEDIT_ROOT/OMEditLIB/Debugger/Parser -lGDBMIParser -lomantlr3 @RPATH_QMAKE@ -lOpenModelicaCompiler -lOpenModelicaRuntimeC -lomcruntime -lomcgc -L@OMBUILDDIR@/lib/$$host_short/omc @LIBOSG@ -lomopcua -L@OMBUILDDIR@/lib -lOMSimulator -lqjson @LIB_BOOST_REGEX@

QMAKE_CXXFLAGS_RELEASE -= -O1
QMAKE_CXXFLAGS_RELEASE -= -O2
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/OMEditGUI.win.config.pri
Expand Up @@ -62,6 +62,6 @@ CONFIG(release, debug|release) { # release
}
LIBS += -L$$OMEDIT_ROOT/OMEditLIB/Debugger/Parser -lGDBMIParser \
-L$$(OMBUILDDIR)/lib/omc -lomantlr3 -lOMPlot -lomqwt -lomopcua \
-lOpenModelicaCompiler -lOpenModelicaRuntimeC -lfmilib -lModelicaExternalC -lomcgc -lpthread -lshlwapi \
-lOpenModelicaCompiler -lomcruntime -lOpenModelicaRuntimeC -lfmilib -lModelicaExternalC -lomcgc -lpthread -lshlwapi \
-lws2_32 \
-L$$(OMBUILDDIR)/bin -lOMSimulator -lqjson
8 changes: 3 additions & 5 deletions OMEdit/OMEditLIB/OMEditApplication.cpp
Expand Up @@ -40,6 +40,8 @@
#include <locale.h>
#include <QMessageBox>

#include "../../OMCompiler/Compiler/runtime/settingsimpl.h"

/*!
* \class OMEditApplication
* \brief It is a subclass for QApplication so that we can handle QFileOpenEvent sent by OSX at startup.
Expand All @@ -65,17 +67,13 @@ OMEditApplication::OMEditApplication(int &argc, char **argv, threadData_t* threa
setAttribute(Qt::AA_DontShowIconsInMenus, false);
// Localization
//*a.severin/ add localization
const char *omhome = getenv("OPENMODELICAHOME");
#ifdef WIN32
const char *omhome = SettingsImpl__getInstallationDirectoryPath();
if (!omhome) {
QMessageBox::critical(0, QString(Helper::applicationName).append(" - ").append(Helper::error),
GUIMessages::getMessage(GUIMessages::OPENMODELICAHOME_NOT_FOUND), Helper::ok);
quit();
exit(1);
}
#else /* unix */
omhome = omhome ? omhome : CONFIG_DEFAULT_OPENMODELICAHOME;
#endif
QSettings *pSettings = Utilities::getApplicationSettings();
QLocale settingsLocale = QLocale(pSettings->value("language").toString());
settingsLocale = settingsLocale.name() == "C" ? pSettings->value("language").toLocale() : settingsLocale;
Expand Down

0 comments on commit 5d1022e

Please sign in to comment.