Skip to content

Commit

Permalink
- use runProcess("cmd /c command") on windows instead of system(comma…
Browse files Browse the repository at this point in the history
…nd) so that no console window appears

- remove some f2c include directories
- enable parallel mark in windows

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24343 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Jan 30, 2015
1 parent e5df72f commit 79a0dea
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Compiler/runtime/Makefile.in
Expand Up @@ -28,7 +28,7 @@ CXX = @CXX@
IDL = @IDLCMD@
IDLPYTHON = @IDLPYTHONCMD@
CXXFLAGS = $(CFLAGS)
CPPFLAGS = @CPPFLAGS@ -I$(top_builddir)/SimulationRuntime/c -I$(top_builddir)/SimulationRuntime/c/simulation/results -I$(top_builddir)/SimulationRuntime/c/simulation/libf2c -I$(top_builddir)/SimulationRuntime/c/util -I$(top_builddir)/SimulationRuntime/c/meta -I$(top_builddir)/SimulationRuntime/c/meta/gc -I$(srcdir) -I. $(CORBAINCL) -I$(FMIINCLUDE) -I$(top_builddir)/3rdParty/gc/include -I$(GRAPHSTREAMINCLUDE) -I$(CJSONINCLUDE)
CPPFLAGS = @CPPFLAGS@ -I$(top_builddir)/SimulationRuntime/c -I$(top_builddir)/SimulationRuntime/c/simulation/results -I$(top_builddir)/SimulationRuntime/c/util -I$(top_builddir)/SimulationRuntime/c/meta -I$(top_builddir)/SimulationRuntime/c/meta/gc -I$(srcdir) -I. $(CORBAINCL) -I$(FMIINCLUDE) -I$(top_builddir)/3rdParty/gc/include -I$(GRAPHSTREAMINCLUDE) -I$(CJSONINCLUDE)

include Makefile.common

Expand Down
6 changes: 3 additions & 3 deletions Compiler/runtime/System_omc.c
Expand Up @@ -385,7 +385,7 @@ void System_setClassnamesForSimulation(const char *class_names)

extern double System_getVariableValue(double _timeStamp, void* _timeValues, void* _varValues)
{
double res;
double res = 0;
if (SystemImpl__getVariableValue(_timeStamp,_timeValues,_varValues,&res))
MMC_THROW();
return res;
Expand Down Expand Up @@ -849,12 +849,12 @@ extern void* System_strtokIncludingDelimiters(const char *str0, const char *deli
/* in the list add only the end */
if (pos == MMC_UNTAGFIXNUM(MMC_CAR(lst)))
{
lst = mmc_mk_cons(mmc_mk_icon((void*)(pos+dlen)), lst);
lst = mmc_mk_cons(mmc_mk_icon((mmc_sint_t)(void*)(pos+dlen)), lst);
}
else /* not in the list, add both */
{
lst = mmc_mk_cons(mmc_mk_icon(pos), lst);
lst = mmc_mk_cons(mmc_mk_icon((void*)(pos+dlen)), lst);
lst = mmc_mk_cons(mmc_mk_icon((mmc_sint_t)(void*)(pos+dlen)), lst);
}
}
/* this means it was not found in the entire string */
Expand Down
34 changes: 31 additions & 3 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -542,6 +542,34 @@ const char* SystemImpl__basename(const char *str)
return res;
}

#if defined(__MINGW32__) || defined(_MSC_VER)
int runProcess(const char* cmd)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
char *c = "cmd /c";
char *command = malloc(strlen(cmd) + strlen(c) + 2);

ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));


sprintf(command, "%s %s", c, cmd);

if (CreateProcessA(NULL, command, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
{
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
free(command);
return 0;
}
free(command);
return 1;
}
#endif

int SystemImpl__systemCall(const char* str, const char* outFile)
{
int status = -1,ret_val = -1;
Expand All @@ -555,10 +583,10 @@ int SystemImpl__systemCall(const char* str, const char* outFile)
if (*outFile) {
char *command = malloc(strlen(str) + strlen(outFile) + 9);
sprintf(command, "%s > %s 2>&1", str, outFile);
status = system(command);
status = runProcess(command);
free((void*)command);
} else {
status = system(str);
status = runProcess(str);
}
#else
pid_t pID = vfork();
Expand Down Expand Up @@ -1306,7 +1334,7 @@ int SystemImpl__lookupFunction(int libIndex, const char *str)
if (lib == NULL)
return -1;

funcptr = (int (*)(type_description*, type_description*)) getFunctionPointerFromDLL(lib->data.lib, str);
funcptr = (int (*)(threadData_t*, type_description*, type_description*)) getFunctionPointerFromDLL(lib->data.lib, str);

if (funcptr == NULL) {
/*fprintf(stderr, "Unable to find `%s': %lu.\n", str, GetLastError());*/
Expand Down
2 changes: 1 addition & 1 deletion Parser/Makefile.common
Expand Up @@ -5,7 +5,7 @@ ANTLRJAR = $(ANTLR)/../tool/antlr-3.2.jar
ANTLRCMD=java -cp $(ANTLRJAR) org.antlr.Tool -Xconversiontimeout 10000 -report

COMPILERHOME=../Compiler/
BUILDINC = -I../Compiler/runtime -I../SimulationRuntime/c/meta -I../SimulationRuntime/c/ -I../SimulationRuntime/c/meta/gc -I../SimulationRuntime/c/util -I../SimulationRuntime/c/simulation/libf2c
BUILDINC = -I../Compiler/runtime -I../SimulationRuntime/c/meta -I../SimulationRuntime/c/ -I../SimulationRuntime/c/meta/gc -I../SimulationRuntime/c/util
RMLINC = -I$(RMLHOME)/include/plain


Expand Down
4 changes: 1 addition & 3 deletions SimulationRuntime/c/math-support/CMakeLists.txt
Expand Up @@ -2,9 +2,7 @@
# CMakefile for compilation of OMC

# Quellen und Header
SET(math_support_sources bigden.c biglag.c dlamch.c lsame.c
nelmead.c newuoa.c newuob.c pivot.c
trsapp.c update.c)
SET(math_support_sources pivot.c)

SET(math_support_headers blaswrap.h)

Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/simulation/CMakeLists.txt
Expand Up @@ -2,7 +2,7 @@
# CMakefile for compilation of OMC

# Subdirectorys
ADD_SUBDIRECTORY(libf2c)
#ADD_SUBDIRECTORY(libf2c)
ADD_SUBDIRECTORY(results)
ADD_SUBDIRECTORY(solver)

Expand Down

0 comments on commit 79a0dea

Please sign in to comment.