source: branches/dev-5819/Python/src/tests_jmodelica/files/Modelica/Resources/CMakeLists.txt @ 13792

Last change on this file since 13792 was 13792, checked in by aramle, 8 weeks ago

#5819 Adding variable to be able to define Python base dir.

File size: 4.3 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 (TestLibraries)
24
25#Make the directory for header files to be installed in.
26install(CODE "file(MAKE_DIRECTORY $ENV{DESTDIR}${JMODELICA_INSTALL_DIR}/Python/tests_jmodelica/files/Modelica/Resources/Include/)")
27
28#Make the directory for lib files to be installed in.
29if(PYTHON_BASE_DIR)
30    set(TEST_LIBRARY_INSTALL_DIR ${JMODELICA_INSTALL_DIR}/${PYTHON_BASE_DIR}/tests_jmodelica/files/Modelica/Resources/Library/${JM_PLATFORM})
31elseif(" ${JM_PLATFORM} " MATCHES " win64 ")
32    set(TEST_LIBRARY_INSTALL_DIR ${JMODELICA_INSTALL_DIR}/Python_64/tests_jmodelica/files/Modelica/Resources/Library/${JM_PLATFORM})
33else ()
34    set(TEST_LIBRARY_INSTALL_DIR ${JMODELICA_INSTALL_DIR}/Python/tests_jmodelica/files/Modelica/Resources/Library/${JM_PLATFORM})
35endif ()
36install(CODE "file(MAKE_DIRECTORY  $ENV{DESTDIR}${TEST_LIBRARY_INSTALL_DIR})")
37
38#Add test libraries
39include_directories(Include)
40include_directories(${TOP_SRC}/RuntimeLibrary/src/jmi)
41
42set(ADDNUMBERS_Sources
43    src/addNumbers.c
44    Include/addNumbers.h
45)
46
47set(ARRAYFUNCTIONS_Sources
48    src/arrayFunctions.c
49    Include/arrayFunctions.h
50)
51
52set(EXTERNALFUNCTIONSC_Sources
53    src/externalFunctionsC.c
54    Include/externalFunctionsC.h
55)
56
57set(EXTOBJECTS_Sources
58    src/extObjects.c
59    Include/extObjects.h
60)
61
62set(USEMODELICAERROR_Sources
63    src/useModelicaError.c
64    Include/useModelicaError.h
65)
66
67#Don't build Fortran lib if MSVC
68if(NOT MSVC)
69    set(EXTERNALFUNCTIONSFORTRAN_Sources
70        src/externalFunctionsFortran.f
71    )
72endif()
73
74#Build addNumbers library
75add_library(addNumbers STATIC ${ADDNUMBERS_Sources})
76if(NOT MSVC)
77    set_target_properties(addNumbers PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
78endif()
79
80#Build arrayFunctions library
81add_library(arrayFunctions STATIC ${ARRAYFUNCTIONS_Sources})
82if(NOT MSVC)
83    set_target_properties(arrayFunctions PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
84endif()
85
86#Build externalFunctionsC library
87add_library(externalFunctionsC STATIC ${EXTERNALFUNCTIONSC_Sources})
88if(NOT MSVC)
89    set_target_properties(externalFunctionsC PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
90endif()
91
92#Build extObjects library
93add_library(extObjects STATIC ${EXTOBJECTS_Sources})
94if(NOT MSVC)
95    set_target_properties(extObjects PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
96endif()
97
98#Build useModelicaError library
99add_library(useModelicaError STATIC ${USEMODELICAERROR_Sources})
100if(NOT MSVC)
101    set_target_properties(useModelicaError PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
102endif()
103
104#Build externalFunctionsFortran library (if not MSVC)
105if(NOT MSVC)
106    add_library(externalFunctionsFortran STATIC ${EXTERNALFUNCTIONSFORTRAN_Sources})
107endif()
108
109#Install the libraries
110install(TARGETS addNumbers DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
111install(TARGETS arrayFunctions DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
112install(TARGETS externalFunctionsC DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
113install(TARGETS extObjects DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
114install(TARGETS useModelicaError DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
115if(NOT MSVC)
116    install(TARGETS externalFunctionsFortran DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
117endif()
Note: See TracBrowser for help on using the repository browser.