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

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

Reverted changeset:13700. Related to ticket:5837

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