source: trunk/RuntimeLibrary/CMakeLists.txt @ 9663

Last change on this file since 9663 was 9663, checked in by Christian Andersson, 3 years ago

Removed further references to CSPARSE (which we do not use). Related to ticket:4975

File size: 3.4 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)
57else()
58    set(RTLIB_LIB_DIR ${JMODELICA_INSTALL_DIR}/lib/RuntimeLibrary)
59endif()
60install(CODE "file(MAKE_DIRECTORY $ENV{DESTDIR}${RTLIB_LIB_DIR})")
61
62if(NOT(WIN32 OR CYGWIN OR APPLE))
63    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
64    SET(WITH_PIC ON)
65elseif(MSVC)
66    add_definitions(/D _CRT_SECURE_NO_WARNINGS)
67endif()
68
69#Including Sundials.
70message(STATUS SUNDIALS_HOME=${SUNDIALS_HOME})
71include_directories(${SUNDIALS_HOME}/include)
72
73set(RuntimeLibrary_BUILD ${SimulationRuntime_BINARY_DIR})
74
75#Add jmi
76add_subdirectory(src/jmi)
77
78#Add fmi2
79include_directories(src/jmi)
80add_subdirectory(src/fmi2)
81
82#Add fmi1_me
83add_subdirectory(src/fmi1_me)
84
85#Add fmi1_cs
86include_directories(src/fmi1_me)
87add_subdirectory(src/fmi1_cs)
88
89#Add modules
90include_directories(src/jmi/module_include)
91add_subdirectory(src/modules)
92
93
94if(EXTRA_RUNTIME_MODULES)
95    set(index 1)
96    foreach(module ${EXTRA_RUNTIME_MODULES})
97        add_subdirectory(${module} "extra${index}")
98        math(EXPR index "${index}+1")
99    endforeach()
100endif()
101
Note: See TracBrowser for help on using the repository browser.