Skip to content

Commit

Permalink
[omsicpp] Merge zeromq extensions for the cpp runtime and the omc c a…
Browse files Browse the repository at this point in the history
…pi library in omsicpp
  • Loading branch information
niklwors authored and adrpo committed Sep 15, 2020
1 parent 89062ef commit d8e7f74
Show file tree
Hide file tree
Showing 18 changed files with 310 additions and 161 deletions.
16 changes: 12 additions & 4 deletions OMCompiler/Compiler/Script/CevalScriptBackend.mo
Expand Up @@ -731,7 +731,7 @@ algorithm
list<tuple<Diff, list<SimpleModelicaParser.ParseTree>>> treeDiffs;
SourceInfo info;
SymbolTable forkedSymbolTable;

SimCode.SimulationSettings simSettings;
case (cache,_,"runScriptParallel",{Values.ARRAY(valueLst=vals),Values.INTEGER(i),Values.BOOL(true)},_)
equation
strs = List.map(vals,ValuesUtil.extractValueString);
Expand Down Expand Up @@ -1493,8 +1493,9 @@ algorithm
if Config.simCodeTarget() == "omsicpp" then

filenameprefix := AbsynUtil.pathString(className);
(cache,simSettings) := calculateSimulationSettings(cache, env, vals, msg);
try
(cache, Values.STRING(str)) := buildModelFMU(cache, env, className, "2.0", "me", "<default>", true, {"static"});
(cache, Values.STRING(str)) := buildModelFMU(cache, env, className, "2.0", "me", "<default>", true, {"static"},SOME(simSettings));
if stringEmpty(str) then
fail();
end if;
Expand Down Expand Up @@ -3721,6 +3722,7 @@ protected function buildModelFMU
input String inFileNamePrefix;
input Boolean addDummy "if true, add a dummy state";
input list<String> platforms = {"static"};
input Option<SimCode.SimulationSettings> inSimSettings = NONE();
output FCore.Cache cache;
output Values.Value outValue;
protected
Expand Down Expand Up @@ -3762,8 +3764,12 @@ algorithm
// The scripting environment from a user's perspective is like that. fmuTargetName is the name of the .fmu in the templates, etc.
filenameprefix := Util.stringReplaceChar(if inFileNamePrefix == "<default>" then AbsynUtil.pathString(className) else inFileNamePrefix, ".", "_");
fmuTargetName := if FMUVersion == "1.0" then filenameprefix else (if inFileNamePrefix == "<default>" then AbsynUtil.pathString(className) else inFileNamePrefix);
defaulSimOpt := buildSimulationOptionsFromModelExperimentAnnotation(className, filenameprefix, SOME(defaultSimulationOptions));
simSettings := convertSimulationOptionsToSimCode(defaulSimOpt);
if isSome(inSimSettings) then
SOME(simSettings) := inSimSettings;
else
defaulSimOpt := buildSimulationOptionsFromModelExperimentAnnotation(className, filenameprefix, SOME(defaultSimulationOptions));
simSettings := convertSimulationOptionsToSimCode(defaulSimOpt);
end if;
FlagsUtil.setConfigBool(Flags.BUILDING_FMU, true);
FlagsUtil.setConfigString(Flags.FMI_VERSION, FMUVersion);
try
Expand Down Expand Up @@ -4000,6 +4006,8 @@ algorithm
stoptime_r = ValuesUtil.valueReal(stoptime_v);
tolerance_r = ValuesUtil.valueReal(tolerance_v);
outSimSettings = SimCodeMain.createSimulationSettings(starttime_r,stoptime_r,interval_i,tolerance_r,method_str,options_str,outputFormat_str,variableFilter_str,cflags);


then
(cache, outSimSettings);
else
Expand Down
4 changes: 2 additions & 2 deletions OMCompiler/Compiler/Template/CodegenCpp.tpl
Expand Up @@ -3181,10 +3181,10 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
CDFLAGS = /ZI
!IF "$(PCH_FILE)" == ""

LDSYSTEMFLAGS= /link /DLL /NOENTRY /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/omsicpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/msvc" /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/msvc/debug" /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)" OMCppSystemBase.lib OMCppExtendedSystem.lib OMCppModelicaUtilities.lib OMCppMath.lib OMCppDataExchange.lib OMCppOMCFactory.lib <%timeMeasureLink%> WSock32.lib Ws2_32.lib
LDSYSTEMFLAGS= /link /DLL /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/omsicpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/msvc" /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/msvc/debug" /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)" OMCppSystemBase.lib OMCppExtendedSystem.lib OMCppModelicaUtilities.lib OMCppMath.lib OMCppDataExchange.lib OMCppOMCFactory.lib <%timeMeasureLink%> WSock32.lib Ws2_32.lib
LDMAINFLAGS=/link /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/omsicpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/msvc" OMCppOMCFactory.lib OMCppModelicaUtilities.lib <%timeMeasureLink%> /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)"
!ELSE
LDSYSTEMFLAGS= /link /DLL /NOENTRY /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/omsicpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/msvc" /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/msvc/debug" /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)" OMCppSystemBase.lib OMCppExtendedSystem.lib OMCppModelicaUtilities.lib OMCppMath.lib OMCppDataExchange.lib OMCppOMCFactory.lib $(PCH_LIB) <%timeMeasureLink%> WSock32.lib Ws2_32.lib
LDSYSTEMFLAGS= /link /DLL /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/omsicpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/msvc" /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/msvc/debug" /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)" OMCppSystemBase.lib OMCppExtendedSystem.lib OMCppModelicaUtilities.lib OMCppMath.lib OMCppDataExchange.lib OMCppOMCFactory.lib $(PCH_LIB) <%timeMeasureLink%> WSock32.lib Ws2_32.lib
LDMAINFLAGS=/link /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/omsicpp/msvc" /LIBPATH:"<%makefileParams.omhome%>/lib/<%Autoconf.triple%>/omc/msvc" OMCppOMCFactory.lib OMCppModelicaUtilities.lib $(PCH_LIB) <%timeMeasureLink%> /LIBPATH:"<%makefileParams.omhome%>/bin" /LIBPATH:"$(BOOST_LIBS)"

!ENDIF
Expand Down
6 changes: 3 additions & 3 deletions OMCompiler/Compiler/Template/CodegenOMSICpp.tpl
Expand Up @@ -93,14 +93,14 @@ template simulationOMSUCPPMainRunScript(SimCode simCode ,Text& extraFuncs,Text&
let libFolder =simulationLibDir(simulationCodeTarget(),simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace)
let binFolder =simulationBinDir(simulationCodeTarget(),simCode )
let libPaths = makefileParams.libPaths |> path => path; separator=";"

let zermMQParams = if getConfigBool(USE_ZEROMQ_IN_SIM) then '-u true -p <%getConfigInt(ZEROMQ_PUB_PORT)%> -s <%getConfigInt(ZEROMQ_SUB_PORT)%> -v <%getConfigString(ZEROMQ_SERVER_ID)%> -c <%getConfigString(ZEROMQ_CLIENT_ID)%> -g <%getConfigString(ZEROMQ_JOB_ID)%>' else ''
match makefileParams.platform
case "linux32"
case "linux64" then
<<
#!/bin/sh
<%preRunCommandLinux%>
<%execCommandLinux%> <%binFolder%>/OMCppOSUSimulation <%execParameters%> <%outputParameter%> $*
<%execCommandLinux%> <%binFolder%>/OMCppOSUSimulation <%execParameters%> <%zermMQParams%> <%outputParameter%> $*
>>
case "win32"
case "win64" then
Expand All @@ -109,7 +109,7 @@ template simulationOMSUCPPMainRunScript(SimCode simCode ,Text& extraFuncs,Text&
<%preRunCommandWindows%>
REM ::export PATH=<%libFolder%>:$PATH REPLACE C: with /C/
SET PATH=<%binFolder%>;<%libFolder%>;<%libPaths%>;%PATH%
OMCppOSUSimulation.exe <%execParameters%> <%outputParameter%>
OMCppOSUSimulation.exe <%execParameters%> <%zermMQParams%> <%outputParameter%>
>>
end match
end match
Expand Down
10 changes: 7 additions & 3 deletions OMCompiler/SimulationRuntime/OMSICpp/CMakeLists.txt
Expand Up @@ -211,13 +211,15 @@ SET(SIMSTER_BUILD OFF)

SET(Boost_USE_MULTITHREADED ON)


#Currently only mingw is supported for the model reduction algorithm
#IF(MINGW)
# SET(REDUCE_DAE ON)
#ELSE()
# SET(REDUCE_DAE OFF)
#ENDIF()


IF(USE_BOOST_REALPATHS)
MESSAGE(STATUS "Using boost real paths")
SET(Boost_REALPATH ON)
Expand Down Expand Up @@ -347,8 +349,8 @@ set(Boost_DEBUG 1)
SET(BOOST_ROOT $ENV{OMDEV}"/lib/3rdParty/boost-1_55/")
endif()
ENDIF(IS_MINGW32)
MESSAGE(STATUS "Boost root:")
MESSAGE(STATUS ${BOOST_ROOT} $ENV{OMDEV})
MESSAGE(STATUS "Boost root for omsicpp runtime:")
MESSAGE(STATUS ${BOOST_ROOT} )
SET(BLAS_blas_LIBRARY $ENV{OMDEV}/lib/3rdParty/Lapack/Lib/blas_win32.dll CACHE FILEPATH "Blas library")
SET(LAPACK_lapack_LIBRARY $ENV{OMDEV}/lib/3rdParty/Lapack/Lib/lapack_win32.dll CACHE FILEPATH "Lapack library")
SET(BLAS_DIRY "$ENV{OMDEV}/lib/3rdParty/Lapack/Lib/" CACHE LOCATION "where was yarp built?")
Expand Down Expand Up @@ -486,7 +488,8 @@ ENDIF(FMU_TARGET AND NOT MSVC)

SET(Boost_LIBRARIES_TMP ${Boost_LIBRARIES_TMP} ${Boost_LIBRARIES})
SET(Boost_LIBRARIES ${Boost_LIBRARIES_TMP})
MESSAGE(STATUS "Boost Libraries")
MESSAGE(STATUS "using boost include for omsicpp runtime: ${Boost_INCLUDE_DIR}")
MESSAGE(STATUS "Boost Libraries for omsicpp runtime")
MESSAGE(STATUS ${Boost_LIBRARIES})

# Find Lapack and Blas
Expand Down Expand Up @@ -928,6 +931,7 @@ IF(ZeroMQ_FOUND AND cppzmq_FOUND)
message (STATUS "Using CPPZMQ Header ${cppzmq_INCLUDE_DIR}" )
ELSE(ZeroMQ_FOUND AND cppzmq_FOUND)
SET(USE_ZEROMQ OFF)
message (STATUS "Using not ZMQ library " )
ENDIF(ZeroMQ_FOUND AND cppzmq_FOUND)

#Write the defines into the ADDITIONAL_DEFINES variable
Expand Down
4 changes: 2 additions & 2 deletions OMCompiler/SimulationRuntime/OMSICpp/Makefile.omdev.mingw
Expand Up @@ -215,8 +215,8 @@ omcCAPIinstall:
mkdir -p Build_CAPI;
(cd ./Build_CAPI; echo "change to Build_CAPI"; \
mkdir -p tmp; \
cmake -G "MSYS Makefiles" -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE -DBUILD_SHARED_LIBS=TRUE -DPLATFORM=$(PLATFORM) -DCMAKE_VERBOSE_MAKEFILE:Bool=ON -DLIB_OMC=$(LIB_OMC) -DOMC_PATH="$(OMBUILDDIR)" -DCMAKE_INSTALL_PREFIX:PATH="./tmp" -DOMCAPI_ROOT="../../Build_CAPI/tmp" MAKE_CXX_COMPILER=g++ ../omcWrapper/; \
$(MAKE) install; )
cmake -G "MSYS Makefiles" -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE $(IS_MINGW32) $(IS_MINGW64) -DCMAKE_BUILD_TYPE=$(BUILDTYPE) -DBUILD_SHARED_LIBS=TRUE -DPLATFORM=$(PLATFORM) -DCMAKE_VERBOSE_MAKEFILE:Bool=ON -DLIB_OMC=$(LIB_OMC) -DOMC_PATH="$(OMBUILDDIR)" -DCMAKE_INSTALL_PREFIX:PATH="./tmp" -DOMCAPI_ROOT="../../Build_CAPI/tmp" MAKE_CXX_COMPILER=g++ ../omcWrapper/; \
$(MAKE) install; )

(cp -puf Build_CAPI/tmp/lib/*.dll* $(OMBUILDDIR)/bin/)
(cp -puf Build_CAPI/tmp/lib/*.dll* $(OMBUILDDIR)/lib/omc/)
Expand Down
Expand Up @@ -17,6 +17,9 @@ INCLUDE(../CMake/CheckCXX11.cmake)



#set OpenModelica include directories
INCLUDE_DIRECTORIES(${OMC_PATH}/include/omc/c)
INCLUDE_DIRECTORIES(${OMC_PATH}/include/omc/)



Expand All @@ -41,14 +44,15 @@ find_package(cppzmq )

#include gc library header
#include_directories ("D:\\OpenModelica\\omc\\omc_x64_cloudsim\\build\\include\\omc\\c")

message (STATUS "zeromq and cppmq found: ${ZeroMQ_FOUND} ${cppzmq_FOUND} ")
IF(ZeroMQ_FOUND AND cppzmq_FOUND)
message (STATUS "zeromq type: ${CMAKE_BUILD_TYPE}")
IF((MSVC) AND (CMAKE_BUILD_TYPE MATCHES Debug))# workarround, find_package(ZeroMQ) fails because wrong filename under windows and VS projects
get_target_property(ZeroMQ_LIB libzmq IMPORTED_IMPLIB_DEBUG)
message (STATUS "Using workarround for ${ZeroMQ_LIB} " )
ELSE((MSVC) AND (CMAKE_BUILD_TYPE MATCHES Debug))
set(ZeroMQ_LIB ${ZeroMQ_LIBRARY})
set(ZeroMQ_LIB ${ZeroMQ_LIBRARY})

ENDIF((MSVC) AND (CMAKE_BUILD_TYPE MATCHES Debug))

message (STATUS "Using ZMQ library ${ZeroMQ_LIBRARY} ${ZeroMQ_LIB} " )
Expand Down
Expand Up @@ -31,9 +31,6 @@ MESSAGE(STATUS "using omc paths")
MESSAGE(STATUS ${OMC_PATH})
MESSAGE(STATUS ${OMC_LIB_PATH})

#set OpenModelica include directories
INCLUDE_DIRECTORIES(${OMC_PATH}/include/omc/c)
INCLUDE_DIRECTORIES(${OMC_PATH}/include/omc/)


INCLUDE_DIRECTORIES(./include)
Expand Down
Expand Up @@ -27,7 +27,7 @@ extern "C"
* \param [out] version string of omc instance
* \return returns a status flag
*/
int OMC_DLL InitOMCWithZeroMQ(data** omcDataPtr, const char* compiler, const char* codetarget, const char* openModelicaHome, const char* zeromqOptions);
int OMC_DLL InitOMCWithZeroMQ(data** omcDataPtr, const char* compiler, const char* codetarget, const char* openModelicaHome, const char* zeromqOptions,int debug);

int OMC_DLL GetOMCVersion(data* omcData, char** result);

Expand Down
Expand Up @@ -34,17 +34,25 @@ void OMC_DLL InitMetaOMC()
mmc_GC_init();

}
int OMC_DLL InitOMCWithZeroMQ(data** omcDataPtr, const char* compiler, const char* codetarget,const char* openModelicaHome, const char* zeromqOptions)
int OMC_DLL InitOMCWithZeroMQ(data** omcDataPtr, const char* compiler, const char* codetarget,const char* openModelicaHome, const char* zeromqOptions,int debug)
{
InitOMC(omcDataPtr, compiler,openModelicaHome);
OMCData* omcData = *omcDataPtr;
std::string options = "--simCodeTarget=Cpp --target=" + std::string(compiler) + std::string(zeromqOptions);


std::string options = "--simCodeTarget=" +std::string(codetarget) + std::string(" --target=") + std::string(compiler) + std::string(" ") + std::string(zeromqOptions);

if(debug==1)
{
std::cout << "set omc options: "<< std::endl;
std::cout << "\t" << options << std::endl;
std::cout << "set OpenModelica home path: " << std::endl;
std::cout << "\t" << openModelicaHome;
}
if (SetCommandLineOptions(omcData, options.c_str()) == -1)
{
char* errorMsg = 0;
GetError(omcData, &errorMsg);
std::cout << "could not set OpenModelica options: " << options <<" "<< *errorMsg <<std::endl;
std::cout << "could not set OpenModelica options with: " << options <<" "<< *errorMsg <<std::endl;
return -1;
}
return 1;
Expand All @@ -62,6 +70,7 @@ int OMC_DLL InitOMCWithZeroMQ(data** omcDataPtr, const char* compiler, const cha
void* args = mmc_mk_nil();
omc_Main_init(threadData, mmc_mk_nil());
CP_TD();

#ifdef WIN32
omc_Main_setWindowsPaths(threadData, mmc_mk_scon(openModelicaHome));
CP_TD();
Expand All @@ -87,7 +96,8 @@ int OMC_DLL InitOMCWithZeroMQ(data** omcDataPtr, const char* compiler, const cha
std::cout << "set OpenModelica home path " << set_openmodelica_home << result << std::endl;
*/

std::string options = "-d=execstat,newInst";

std::string options = "-d=newInst";



Expand Down
Expand Up @@ -4,68 +4,67 @@

project(${OMCZeroMQName} VERSION 0.1)



set(Boost_DEBUG 1)
MESSAGE(STATUS "MINGW:")
MESSAGE(STATUS ${IS_MINGW32})
MESSAGE(STATUS ${IS_MINGW64})


IF(IS_MINGW32)
SET(BOOST_ROOT $ENV{OMDEV}"/tools/mingw32/include")
ELSEIF(IS_MINGW64)
SET(BOOST_ROOT $ENV{OMDEV}"/tools/mingw64/include")
ELSE()
if(MSVC_VERSION GREATER 1800)
MESSAGE(STATUS "USE MSVC 2015 and greater:")
SET(Boost_COMPILER "-vc142")
elseif(MSVC_VERSION GREATER 1700)
SET(BOOST_ROOT $ENV{OMDEV}"/lib/3rdParty/boost-1_59/")
else()
SET(BOOST_ROOT $ENV{OMDEV}"/lib/3rdParty/boost-1_55/")
endif()
ENDIF(IS_MINGW32)
MESSAGE(STATUS "Boost root for omc - zeromq:")
MESSAGE(STATUS ${BOOST_ROOT})
FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options)
MESSAGE(STATUS "using boost include for omc - zeromq: ${Boost_INCLUDE_DIR}")
MESSAGE(STATUS "Boost Libraries for omc - zeromq:")
MESSAGE(STATUS ${Boost_LIBRARIES})
#dynamic link boost
add_definitions( -DBOOST_ALL_NO_LIB )
add_definitions( -DBOOST_ALL_DYN_LINK )
#for msvc the c-api library is not supported therfore the generated import library from the mingw dll is used
IF(MSVC)
message (STATUS "OMC C API Root: ${OMCAPI_ROOT} " )
SET(OMCCAPI_INLCUDE_HOME ${OMCAPI_ROOT}/include/)
SET(OMCCAPI_LIBRARY_RELEASE_HOME ${OMCAPI_ROOT}/lib)
FIND_LIBRARY(OMCCAPIName "libOMCDLL" NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH
PATHS ${OMCCAPI_LIBRARY_RELEASE_HOME} )
message (STATUS "A ${OMCCAPIName} B" )
IF(NOT OMCCAPIName)
MESSAGE(FATAL_ERROR "Could not find omc c- api library ${OMCCAPI_LIBRARY_RELEASE_HOME}")
ENDIF(OMCCAPIName)
ENDIF(MSVC)


MESSAGE(STATUS "omc c api include:")
MESSAGE(STATUS "${OMCCAPI_INLCUDE_HOME}")
MESSAGE(STATUS "omc c api library path:")
#FIND_PATH(OMCCAPI_INCLUDE_DIR OMC.h PATHS ${OMCCAPI_INLCUDE_HOME})
#IF (NOT OMCCAPI_INCLUDE_DIR)
# MESSAGE(FATAL_ERROR "Could not find omc c- api")
#ENDIF(NOT OMCCAPI_INCLUDE_DIR)
MESSAGE(STATUS "omc c api library: ${OMCCAPIName} includ dir: ${OMCCAPI_INCLUDE_DIR} ")


set(Boost_DEBUG 1)
MESSAGE(STATUS "MINGW:")
MESSAGE(STATUS ${IS_MINGW32})
MESSAGE(STATUS ${IS_MINGW64})
IF(IS_MINGW32)
SET(BOOST_ROOT $ENV{OMDEV}"/tools/mingw32/include")
ELSEIF(IS_MINGW64)
SET(BOOST_ROOT $ENV{OMDEV}"/tools/mingw64/include")
ELSE()
if(MSVC_VERSION GREATER 1800)
MESSAGE(STATUS "USE MSVC 2015 and greater:")
SET(Boost_COMPILER "-vc142")
elseif(MSVC_VERSION GREATER 1700)
SET(BOOST_ROOT $ENV{OMDEV}"/lib/3rdParty/boost-1_59/")
else()
SET(BOOST_ROOT $ENV{OMDEV}"/lib/3rdParty/boost-1_55/")
endif()
ENDIF(IS_MINGW32)
MESSAGE(STATUS "Boost root:")
MESSAGE(STATUS ${BOOST_ROOT})
FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options)
MESSAGE(STATUS "using boost include ${Boost_INCLUDE_DIR}")
MESSAGE(STATUS "Boost Libraries")
MESSAGE(STATUS ${Boost_LIBRARIES})
#dynamic link boost
add_definitions( -DBOOST_ALL_NO_LIB )
add_definitions( -DBOOST_ALL_DYN_LINK )
#for msvc the c-api library is not supported therfore the generated import library from the mingw dll is used
IF(MSVC)
message (STATUS "OMC C API Root: ${OMCAPI_ROOT} " )
SET(OMCCAPI_INLCUDE_HOME ${OMCAPI_ROOT}/include/)
SET(OMCCAPI_LIBRARY_RELEASE_HOME ${OMCAPI_ROOT}/lib)
FIND_LIBRARY(OMCCAPIName "libOMCDLL" NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH
PATHS ${OMCCAPI_LIBRARY_RELEASE_HOME} )
message (STATUS "A ${OMCCAPIName} B" )
IF(NOT OMCCAPIName)
MESSAGE(FATAL_ERROR "Could not find omc c- api library ${OMCCAPI_LIBRARY_RELEASE_HOME}")
ENDIF(OMCCAPIName)
ENDIF(MSVC)


MESSAGE(STATUS "omc c api include:")
MESSAGE(STATUS "${OMCCAPI_INLCUDE_HOME}")
MESSAGE(STATUS "omc c api library path:")
#FIND_PATH(OMCCAPI_INCLUDE_DIR OMC.h PATHS ${OMCCAPI_INLCUDE_HOME})
#IF (NOT OMCCAPI_INCLUDE_DIR)
# MESSAGE(FATAL_ERROR "Could not find omc c- api")
#ENDIF(NOT OMCCAPI_INCLUDE_DIR)
MESSAGE(STATUS "omc c api library: ${OMCCAPIName} includ dir: ${OMCCAPI_INCLUDE_DIR} ")

include_directories(${cppzmq_INCLUDE_DIR} ${ZeroMQ_INCLUDE_DIR} ${OMCCAPI_INCLUDE_DIR} ${Boost_INCLUDE_DIR} include/)
ADD_EXECUTABLE(${OMCZeroMQName} src/omc.cpp src/omcZeromqTask.cpp)


include_directories(${cppzmq_INCLUDE_DIR} ${ZeroMQ_INCLUDE_DIR} ${OMCCAPI_INCLUDE_DIR} ${Boost_INCLUDE_DIR} include/)
ADD_EXECUTABLE(${OMCZeroMQName} src/omc.cpp src/omcZeromqTask.cpp)


#link with gc lib
#target_link_libraries(${OMCZeroMQName} ${ZeroMQ_LIB} ${OMCCAPIName} ${Boost_LIBRARIES} ${OMCGC_LIB} )
target_link_libraries(${OMCZeroMQName} ${ZeroMQ_LIB} ${OMCCAPIName} ${Boost_LIBRARIES} )
install(TARGETS ${OMCZeroMQName} DESTINATION bin )
#link with gc lib
#target_link_libraries(${OMCZeroMQName} ${ZeroMQ_LIB} ${OMCCAPIName} ${Boost_LIBRARIES} ${OMCGC_LIB} )
#target_link_libraries(${OMCZeroMQName} ${ZeroMQ_LIBRARY} ${OMCCAPIName} ${Boost_LIBRARIES} )
target_link_libraries(${OMCZeroMQName} libzmq ${OMCCAPIName} ${Boost_LIBRARIES} )
install(TARGETS ${OMCZeroMQName} DESTINATION bin )

Expand Up @@ -10,7 +10,7 @@ typedef struct OMCData;

class omcZeromqTask {
public:
omcZeromqTask(int pub_port, int sub_port, OMCData* omc2, string workingDirectory, string openmodelica_home, string simulation_id, string client_id, string zeromq_options);
omcZeromqTask(int pub_port, int sub_port, OMCData* omc2, string workingDirectory, string openmodelica_home, string simulation_id, string client_id, string zeromq_options,bool debug);

void run();

Expand All @@ -33,5 +33,6 @@ class omcZeromqTask {
string _zeromq_options;
string _simulation_id;
string _client_id;
bool _debug;

};

0 comments on commit d8e7f74

Please sign in to comment.