Skip to content

Commit

Permalink
add CMakefile to build generated Modelica System
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8756 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
niklwors committed Apr 29, 2011
1 parent bbf48c8 commit ff321a5
Show file tree
Hide file tree
Showing 41 changed files with 1,293 additions and 354 deletions.
250 changes: 0 additions & 250 deletions SimulationRuntime/cpp/Build/Makefile

This file was deleted.

18 changes: 15 additions & 3 deletions SimulationRuntime/cpp/Readme.txt
Expand Up @@ -23,6 +23,7 @@ Please delete all binaries files in the Binaries folder before you compile all l
To build the cpp solver interface you need cmake (http://www.cmake.org/) you can download it for your operation system
from here: http://www.cmake.org/cmake/resources/software.html

Cpp Simulation runtime installation:
In the file trunk/SimulationRuntime/cpp/Source/CMakeLists.txt at the beginning the used 3rdPary libraries are configured.
For Windows Boost, Lapack and Blas are from the OMDEV folder used else the installed versions are used.
The cpp solver interface uses the additional boost.extension header files which are not
Expand All @@ -33,12 +34,23 @@ files to you boost header files folder.
To generate the build files for out-of-source build call cmake from the build folder: trunk/SimulationRuntime/cpp/build :
cmake -G "your generator" -D CMAKE_INSTALL_PREFIX:PATH="Insall directory" MAKE_CXX_COMPILER=g++ folder to project source dir

e.g for MinGW and Windwos:
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX:PATH="OpenModelica/build" MAKE_CXX_COMPILER=g++ OpenModelica/SimulationRuntime/cpp/Source
e.g for MinGW and Windwos (you need the mingw/bin dir in you path environment variable)
cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX:PATH="C:/OpenModelica/build" MAKE_CXX_COMPILER=g++ C:/OpenModelica/SimulationRuntime/cpp/Source
after that you can call
make install
e.g
e.g.
mingw32-make install
This copies all shared libs and needed header files to build the Modelica System to installation directory

Modelica System installation:
Change to the build/bin director where the generated Modelica system files are located.
e.g. C:/OpenModelica/build/bin
To generate the build files for the Modelica System use
cmake -G "your generator" -D MAKE_CXX_COMPILER=g++ folder to project source dir where generate Modelica system files are located
e.g.
cmake -G "MinGW Makefiles" -D MAKE_CXX_COMPILER=g++ C:/OpenModelica/build/bin
after that you can call
make


In the Binaries folder is after the build the Simulation.exe
Expand Down
14 changes: 13 additions & 1 deletion SimulationRuntime/cpp/Source/CMakeLists.txt
Expand Up @@ -12,6 +12,8 @@ ENDIF( WIN32 )
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME OFF)
SET(MODELICA_MODEL "ModelicaSystem")

find_package(Boost 1.45.0 COMPONENTS serialization REQUIRED )
find_package( Lapack REQUIRED)

Expand All @@ -33,20 +35,30 @@ add_subdirectory (SettingsFactory/Implementation)
#add simmanager project
add_subdirectory (SimManager)
#add system default implementation project

add_subdirectory (System/Implementation)

add_subdirectory (System/Modelica)
#include_directories ("${PROJECT_SOURCE_DIR}/System/Modelica/Implementation")



GET_TARGET_PROPERTY(libEuler Euler LOCATION)
GET_FILENAME_COMPONENT(libEulerName ${libEuler} NAME)

GET_TARGET_PROPERTY(libSetFactory SettingsFactory LOCATION)
GET_FILENAME_COMPONENT(libSetFactoryName ${libSetFactory} NAME)

GET_TARGET_PROPERTY(libModelica Modelica LOCATION)
GET_FILENAME_COMPONENT(libModelicaName ${libModelica} NAME)
set (EULER_LIB ${libEulerName})
set (SETTINGSFACTORY_LIB ${libSetFactoryName})
set (MODELICASYSTEM_LIB ${libModelicaName})
# configure a header file to pass some library names
# to the source code which are used to dynamic load and instantiate
configure_file (
"${PROJECT_SOURCE_DIR}/LibrariesConfig.h.in"
"${PROJECT_BINARY_DIR}/LibrariesConfig.h"
)

install (FILES "DataExchange/Interfaces/IHistory.h"
DESTINATION include/DataExchange/Interfaces)
1 change: 1 addition & 0 deletions SimulationRuntime/cpp/Source/LibrariesConfig.h.in
@@ -1,3 +1,4 @@

#define EULER_LIB "@EULER_LIB@"
#define SETTINGSFACTORY_LIB "@SETTINGSFACTORY_LIB@"
#define MODELICASYSTEM_LIB "@MODELICASYSTEM_LIB@"
Expand Up @@ -6,8 +6,11 @@ add_library(Math SHARED ArrayOperations.cpp )


install (TARGETS Math DESTINATION bin)


install (FILES Functions.h
ArrayOperations.h
DESTINATION include/Math/Implementation)
install (FILES ../Interfaces/ILapack.h
DESTINATION include/Math/Interfaces)



Expand Down
Expand Up @@ -2,7 +2,7 @@

#include <math.h> ///< mathematical expressions
#include <stdlib.h>
#include "../Interfaces/ILapack.h" ///< For the use of DGESV, etc.
#include "Math/Interfaces/ILapack.h" ///< For the use of DGESV, etc.
#include <limits>
/*****************************************************************************/
/**
Expand Down
8 changes: 0 additions & 8 deletions SimulationRuntime/cpp/Source/Math/Implementation/stdafx.cpp

This file was deleted.

Expand Up @@ -9,7 +9,8 @@ target_link_libraries( SettingsFactory ${Boost_LIBRARIES})
install (TARGETS SettingsFactory DESTINATION bin)
install (FILES "../Interfaces/GlobalSettings.xml"
DESTINATION bin/config)

install (FILES "../Interfaces/IGlobalSettings.h"
DESTINATION include/SettingsFactory/Interfaces)



Expand Down
Expand Up @@ -3,7 +3,7 @@
//#define BOOST_EXTENSION_GLOBALSETTINGS_DECL BOOST_EXTENSION_EXPORT_DECL
#include "Factory.h"
#include "GlobalSettings.h"
#include "../../Solver/Interfaces/ISolverSettings.h"
#include "Solver/Interfaces/ISolverSettings.h"
#include "LibrariesConfig.h"

SettingsFactory::SettingsFactory(void)
Expand Down
@@ -1,7 +1,7 @@
#pragma once


#include "../Interfaces/ISettingsFactory.h"
#include "SettingsFactory/Interfaces/ISettingsFactory.h"

class /*BOOST_EXTENSION_SETTINGSFACTORY_DECL*/ SettingsFactory : public ISettingsFactory
{
Expand Down

0 comments on commit ff321a5

Please sign in to comment.