source: trunk/Python/src/tests_jmodelica/files/Modelica/Resources/CMakeLists.txt @ 13719

Last change on this file since 13719 was 13719, checked in by Christian Andersson, 2 months ago

Recommitted changeset:13700 to trunk with two bug fixes. Related to ticket:5837

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