source: branches/dev-5819/RuntimeLibrary/CMakeLists.txt @ 13800

Last change on this file since 13800 was 13800, checked in by randersson, 8 weeks ago

#5819 Merged trunk into branch

File size: 3.6 KB
Line 
1#    Copyright (C) 2014 Modelon AB
2
3#    This program is free software: you can redistribute it and/or modify
4#    it under the terms of the GNU General Public License version 3 as published
5#    by the Free Software Foundation, or optionally, under the terms of the
6#    Common Public License version 1.0 as published by IBM.
7
8#    This program is distributed in the hope that it will be useful,
9#    but WITHOUT ANY WARRANTY; without even the implied warranty of
10#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11#    GNU General Public License, or the Common Public License, for more details.
12
13#    You should have received copies of the GNU General Public License
14#    and the Common Public License along with this program.  If not,
15#    see <http://www.gnu.org/licenses/> or
16#    <http://www.ibm.com/developerworks/library/os-cpl.html/> respectively.
17
18# NOTE: CMake 2.8.6 is required since this is the version used in development.
19# The script is KNOWN NOT TO WORK WITH 2.8.3 and below (ExternalProject
20# interface changes). CMake 2.8.4 and 2.8.5 are not tested.
21cmake_minimum_required (VERSION 2.8.6 FATAL_ERROR)
22
23project (SimulationRuntime)
24
25#Inputs through flags
26add_definitions(-DTOP_SRC)
27add_definitions(-DSUNDIALS_HOME)
28add_definitions(-DMINPACK_HOME)
29if(NOT TOP_SRC)
30    set(TOP_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../)
31    message(STATUS "TOP_SRC was not defined, using ${TOP_SRC}")
32endif()
33
34if(NOT MINPACK_HOME)
35    set(MINPACK_HOME ${TOP_SRC}/ThirdParty/Minpack/cminpack-1.3.2/)
36    message(STATUS "MINPACK_HOME was not defined, using ${MINPACK_HOME}")
37endif()
38include_directories(${MINPACK_HOME})
39
40# Get the JModelica install directory
41if(CMAKE_INSTALL_DIR)
42    set(JMODELICA_INSTALL_DIR ${CMAKE_INSTALL_DIR})
43else()
44    set(JMODELICA_INSTALL_DIR ${TOP_SRC}/../install)
45    message(STATUS "Install dir not defined, using ${JMODELICA_INSTALL_DIR}")
46endif()   
47message(STATUS JMODELICA_INSTALL_DIR=${JMODELICA_INSTALL_DIR})
48
49#Make the directory for header files to be installed in.
50set(RTLIB_INCLUDE_DIR ${JMODELICA_INSTALL_DIR}/include/RuntimeLibrary)
51install(CODE "file(MAKE_DIRECTORY $ENV{DESTDIR}${RTLIB_INCLUDE_DIR})")
52               
53#Make the directory for lib files to be installed in.
54# Add spaces around CMAKE_C_FLAGS so that we can check for " -m64 " with spaces around it
55if(" ${CMAKE_C_FLAGS} " MATCHES " -m64 ")
56    set(RTLIB_LIB_DIR ${JMODELICA_INSTALL_DIR}/lib/RuntimeLibrary64)
57    set(RTLIB_BIN_DIR ${JMODELICA_INSTALL_DIR}/bin64)
58else()
59    set(RTLIB_LIB_DIR ${JMODELICA_INSTALL_DIR}/lib/RuntimeLibrary)
60    set(RTLIB_BIN_DIR ${JMODELICA_INSTALL_DIR}/bin)
61endif()
62install(CODE "file(MAKE_DIRECTORY $ENV{DESTDIR}${RTLIB_LIB_DIR})")
63
64if(NOT(WIN32 OR CYGWIN OR APPLE))
65    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
66    SET(WITH_PIC ON)
67elseif(MSVC)
68    add_definitions(/D _CRT_SECURE_NO_WARNINGS)
69endif()
70
71#Including Sundials.
72message(STATUS SUNDIALS_HOME=${SUNDIALS_HOME})
73include_directories(${SUNDIALS_HOME}/include)
74
75set(RuntimeLibrary_BUILD ${SimulationRuntime_BINARY_DIR})
76
77#Add jmi
78add_subdirectory(src/jmi)
79
80#Add fmi2
81include_directories(src/jmi)
82add_subdirectory(src/fmi2)
83
84#Add fmi1_me
85add_subdirectory(src/fmi1_me)
86
87#Add fmi1_cs
88include_directories(src/fmi1_me)
89add_subdirectory(src/fmi1_cs)
90
91#Add modules
92include_directories(src/jmi/module_include)
93add_subdirectory(src/modules)
94
95#Add evaluator
96include_directories(src/evaluator)
97add_subdirectory(src/evaluator)
98
99if(EXTRA_RUNTIME_MODULES)
100    set(index 1)
101    foreach(module ${EXTRA_RUNTIME_MODULES})
102        add_subdirectory(${module} "extra${index}")
103        math(EXPR index "${index}+1")
104    endforeach()
105endif()
106
Note: See TracBrowser for help on using the repository browser.