source: branches/dev-5819/Python/src/tests_jmodelica/files/Modelica/Resources/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: 4.9 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(EVALUATORTESTS_Sources
43    src/evaluatorTests.c
44    Include/evaluatorTests.h
45)
46
47set(ADDNUMBERS_Sources
48    src/addNumbers.c
49    Include/addNumbers.h
50)
51
52set(ARRAYFUNCTIONS_Sources
53    src/arrayFunctions.c
54    Include/arrayFunctions.h
55)
56
57set(EXTERNALFUNCTIONSC_Sources
58    src/externalFunctionsC.c
59    Include/externalFunctionsC.h
60)
61
62set(EXTOBJECTS_Sources
63    src/extObjects.c
64    Include/extObjects.h
65)
66
67set(USEMODELICAERROR_Sources
68    src/useModelicaError.c
69    Include/useModelicaError.h
70)
71
72#Don't build Fortran lib if MSVC
73if(NOT MSVC)
74    set(EXTERNALFUNCTIONSFORTRAN_Sources
75        src/externalFunctionsFortran.f
76    )
77endif()
78
79#Build evaluatorTests library
80add_library(evaluatorTestsShared SHARED ${EVALUATORTESTS_Sources})
81if(NOT MSVC)
82    set_target_properties(evaluatorTestsShared PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
83endif()
84
85#Build addNumbers library
86add_library(addNumbers STATIC ${ADDNUMBERS_Sources})
87add_library(addNumbersShared SHARED ${ADDNUMBERS_Sources})
88if(NOT MSVC)
89    set_target_properties(addNumbers PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
90    set_target_properties(addNumbersShared PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
91endif()
92
93#Build arrayFunctions library
94add_library(arrayFunctions STATIC ${ARRAYFUNCTIONS_Sources})
95if(NOT MSVC)
96    set_target_properties(arrayFunctions PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
97endif()
98
99#Build externalFunctionsC library
100add_library(externalFunctionsC STATIC ${EXTERNALFUNCTIONSC_Sources})
101if(NOT MSVC)
102    set_target_properties(externalFunctionsC PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
103endif()
104
105#Build extObjects library
106add_library(extObjects STATIC ${EXTOBJECTS_Sources})
107if(NOT MSVC)
108    set_target_properties(extObjects PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
109endif()
110
111#Build useModelicaError library
112add_library(useModelicaError STATIC ${USEMODELICAERROR_Sources})
113if(NOT MSVC)
114    set_target_properties(useModelicaError PROPERTIES COMPILE_FLAGS "-Wall -g -std=c89 -pedantic -Werror -O2")
115endif()
116
117#Build externalFunctionsFortran library (if not MSVC)
118if(NOT MSVC)
119    add_library(externalFunctionsFortran STATIC ${EXTERNALFUNCTIONSFORTRAN_Sources})
120endif()
121
122#Install the libraries
123install(TARGETS evaluatorTestsShared DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
124install(TARGETS addNumbers DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
125install(TARGETS addNumbersShared DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
126install(TARGETS arrayFunctions DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
127install(TARGETS externalFunctionsC DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
128install(TARGETS extObjects DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
129install(TARGETS useModelicaError DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
130if(NOT MSVC)
131    install(TARGETS externalFunctionsFortran DESTINATION "${TEST_LIBRARY_INSTALL_DIR}")
132endif()
Note: See TracBrowser for help on using the repository browser.