forked from OpenModelica/OMCompiler-3rdParty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
186 lines (128 loc) · 6.95 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
project(OMCompiler_3rdParty)
# antlr
omc_add_subdirectory(antlr)
add_library(omc::3rd::omantlr3 ALIAS omantlr3)
# CMinpack
omc_add_subdirectory(CMinpack)
add_library(omc::3rd::cminpack ALIAS cminpack)
# # cppzmq
# omc_add_subdirectory(cppzmq)
# FMIL
set (FMILIB_GENERATE_DOXYGEN_DOC OFF CACHE BOOL "Generate doxygen doc target")
set (FMILIB_BUILD_TESTS OFF CACHE BOOL "Build tests")
set (FMILIB_BUILD_SHARED_LIB OFF CACHE BOOL "Build the library as shared (dll/so/dylib).")
omc_add_subdirectory(FMIL)
# For now we deal with FMIL's nonsensical structure here. They really need to
# fix up their structure as a whole! It is quite non-conventional.
# They also need to fix their cmake usage. It is their default build system and it is used in
# very contrived and unusual ways.
# We create a top level 'include' directory that matches their include structure when FMIL is installed-to-be-used.
# This is how every library should be. That way when you install the library you just change the include
# path and every include will be resolved as it was during build time. Ideally it should even be in 'include/FMIL/'
# but hat won't match how they install their files right now.
file(MAKE_DIRECTORY ${FMILibrary_SOURCE_DIR}/include)
# Do not ask me why the fmilib.h is in the cmake.config directory.
file(COPY ${FMILibrary_SOURCE_DIR}/Config.cmake/fmilib.h DESTINATION ${FMILibrary_SOURCE_DIR}/include)
file(COPY ${FMILibrary_SOURCE_DIR}/src/Import/include/FMI DESTINATION ${FMILibrary_SOURCE_DIR}/include)
file(COPY ${FMILibrary_SOURCE_DIR}/src/Import/include/FMI1 DESTINATION ${FMILibrary_SOURCE_DIR}/include)
file(COPY ${FMILibrary_SOURCE_DIR}/src/Import/include/FMI2 DESTINATION ${FMILibrary_SOURCE_DIR}/include)
# This files
file(COPY ${FMILibrary_SOURCE_DIR}/src/Util/include/FMI DESTINATION ${FMILibrary_SOURCE_DIR}/include)
file(COPY ${FMILibrary_SOURCE_DIR}/src/Util/include/FMI1 DESTINATION ${FMILibrary_SOURCE_DIR}/include)
file(COPY ${FMILibrary_SOURCE_DIR}/src/Util/include/FMI2 DESTINATION ${FMILibrary_SOURCE_DIR}/include)
file(COPY ${FMILibrary_SOURCE_DIR}/src/Util/include/JM DESTINATION ${FMILibrary_SOURCE_DIR}/include)
file(COPY ${FMILibrary_SOURCE_DIR}/ThirdParty/FMI/default/FMI1 DESTINATION ${FMILibrary_SOURCE_DIR}/include)
file(COPY ${FMILibrary_SOURCE_DIR}/ThirdParty/FMI/default/FMI2 DESTINATION ${FMILibrary_SOURCE_DIR}/include)
file(COPY ${FMILibrary_BINARY_DIR}/fmilib_config.h DESTINATION ${FMILibrary_SOURCE_DIR}/include)
# We give this new directory as include dir for targets that depend on FMIL.
target_include_directories(fmilib INTERFACE ${FMILibrary_SOURCE_DIR}/include)
add_library(omc::3rd::fmilib::static ALIAS fmilib)
add_library(omc::3rd::FMIL::minizip ALIAS minizip)
# Boehm GC
# We use pthreads API even on Windows
set(CMAKE_USE_PTHREADS_INIT ON)
set(GC_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries")
set(enable_java_finalization OFF CACHE BOOL "Support for java finalization")
set(enable_gcj_support OFF CACHE BOOL "Support for gcj")
set(enable_large_config ON CACHE BOOL "Optimize for large heap or root set")
omc_add_subdirectory(gc)
target_include_directories(omcgc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/gc/include)
# make sure every target that links to gc-lib has its sources
# compiled with -DGC_WIN32_PTHREADS (for pthreads on Windows, i.e., our MingW)
# Or -DGC_THREADS (for auto detection on other systems.)
# On Windows with MinGW OM uses pthreads-win32. GC_WIN32_PTHREADS is required
# to be set explicitly for use of pthreads API on Windows.
if(MINGW)
target_compile_definitions(omcgc PUBLIC GC_WIN32_PTHREADS)
else()
target_compile_definitions(omcgc PUBLIC GC_THREADS)
endif(MINGW)
# Finally add an alias for clarity purposes.
add_library(omc::3rd::omcgc ALIAS omcgc)
# graphstream
omc_add_subdirectory(graphstream)
add_library(omc::3rd::netstream ALIAS netstream)
#libffi
omc_add_subdirectory(libffi)
target_include_directories(ffi INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libffi_cmake/include)
# Currently the libffi setup puts the configure-generated headers in the
# `build directory`/include folder
target_include_directories(ffi INTERFACE ${libffi_BINARY_DIR}/include)
add_library(omc::3rd::ffi ALIAS ffi)
# libzmq
set (ZMQ_BUILD_TESTS OFF CACHE BOOL "Build the tests for ZeroMQ")
set (ZMQ_BUILD_STATIC ON CACHE BOOL "Whether or not to build the static object")
set (ZMQ_BUILD_SHARED OFF CACHE BOOL "Whether or not to build the shared object")
omc_add_subdirectory(libzmq)
add_library(omc::3rd::libzmq ALIAS libzmq-static)
# lpsolve55
if(OMC_USE_LPSOLVE AND OMC_BUILD_LPSOLVE)
omc_add_subdirectory(lpsolve)
add_library(omc::3rd::lpsolve55 ALIAS lpsolve55)
endif()
# metis
omc_add_subdirectory(metis-5.1.0)
add_library(omc::3rd::metis ALIAS metis)
target_include_directories(metis INTERFACE metis-5.1.0/include)
# ModelicaExternalC
omc_add_subdirectory(ModelicaExternalC)
add_library(omc::3rd::Modelica::ExternalC ALIAS ModelicaExternalC)
add_library(omc::3rd::Modelica::MatIO ALIAS ModelicaMatIO)
add_library(omc::3rd::Modelica::IO ALIAS ModelicaIO)
add_library(omc::3rd::Modelica::StandardTables ALIAS ModelicaStandardTables)
omc_add_subdirectory(open62541)
add_library(omc::3rd::opcua ALIAS opcua)
# Intel TBB
# set(TBB_BUILD_TESTS OFF CACHE BOOL "Build TBB tests and enable testing infrastructure")
# set(TBB_BUILD_SHARED OFF CACHE BOOL "Build TBB shared library")
# set(TBB_BUILD_TBBMALLOC OFF CACHE BOOL "Build TBB malloc library")
# set(TBB_BUILD_TBBMALLOC_PROXY OFF CACHE BOOL "Build TBB malloc proxy library")
# omc_add_subdirectory(tbb_cmake)
# add_library(omc::3rd::tbb::static ALIAS tbb_static)
# add_library(omc::3rd::tbb::shared ALIAS tbb)
# # regex
# omc_add_subdirectory(regex-0.12)
# SuiteSparse
omc_add_subdirectory(SuiteSparse-5.8.1)
# add_library(omc::3rd::suitesparse::klu ALIAS klu)
target_include_directories(klu INTERFACE SuiteSparse-5.8.1/KLU/Include)
target_include_directories(amd INTERFACE SuiteSparse-5.8.1/AMD/Include)
target_include_directories(colamd INTERFACE SuiteSparse-5.8.1/COLAMD/Include)
target_include_directories(btf INTERFACE SuiteSparse-5.8.1/BTF/Include)
target_include_directories(suitesparseconfig INTERFACE SuiteSparse-5.8.1/SuiteSparse_config/)
# sundials
set(KLU_LIBRARY klu)
set(AMD_LIBRARY amd)
set(COLAMD_LIBRARY colamd)
set(BTF_LIBRARY btf)
set(SUITESPARSECONFIG_LIBRARY suitesparseconfig)
option(SUNDIALS_KLU_ENABLE "Enable KLU support" ON)
option(SUNDIALS_EXAMPLES_ENABLE_C "Build SUNDIALS C examples" OFF)
option(SUNDIALS_LAPACK_ENABLE "Enable Lapack support" ON)
omc_add_subdirectory(sundials-5.4.0)
# target_include_directories(sundials_cvode_static INTERFACE sundials-5.4.0/include)
# # The sundials_config.h files are generated in the build directory. Add it as an include dir.
# target_include_directories(sundials_cvode_static INTERFACE ${sundials_BINARY_DIR}/include/)
# add_library(omc::3rd::sundials::cvode::static ALIAS sundials_cvode_static)
# target_link_libraries(sundials_sunlinsolklu_static INTERFACE omc::3rd::suitesparse::klu)
# add_library(omc::3rd::sundials::cvode::static ALIAS sundials_sunlinsolklu_static)