From f93532bad30378c422235bd6edf13c74c279ce87 Mon Sep 17 00:00:00 2001 From: Mahder Gebremedhin Date: Mon, 20 Jun 2022 18:19:16 +0200 Subject: [PATCH] Remove unused old CMakefiles. - Now that the MSVC builds that use them are removed we can remove these files. --- OMCompiler/SimulationRuntime/c/CMakeLists.txt | 143 ++++- .../SimulationRuntime/c/cmake_2.8.cmake | 517 ------------------ .../SimulationRuntime/c/cmake_3.14.cmake | 132 ----- .../SimulationRuntime/c/fmi/CMakeLists.txt | 15 - .../c/math-support/CMakeLists.txt | 20 - .../SimulationRuntime/c/meta/CMakeLists.txt | 27 - .../c/simulation/CMakeLists.txt | 31 -- .../c/simulation/results/CMakeLists.txt | 24 - .../c/simulation/solver/CMakeLists.txt | 83 --- .../solver/initialization/CMakeLists.txt | 20 - .../SimulationRuntime/c/util/CMakeLists.txt | 85 --- 11 files changed, 132 insertions(+), 965 deletions(-) delete mode 100644 OMCompiler/SimulationRuntime/c/cmake_2.8.cmake delete mode 100644 OMCompiler/SimulationRuntime/c/cmake_3.14.cmake delete mode 100644 OMCompiler/SimulationRuntime/c/fmi/CMakeLists.txt delete mode 100644 OMCompiler/SimulationRuntime/c/math-support/CMakeLists.txt delete mode 100644 OMCompiler/SimulationRuntime/c/meta/CMakeLists.txt delete mode 100644 OMCompiler/SimulationRuntime/c/simulation/CMakeLists.txt delete mode 100644 OMCompiler/SimulationRuntime/c/simulation/results/CMakeLists.txt delete mode 100644 OMCompiler/SimulationRuntime/c/simulation/solver/CMakeLists.txt delete mode 100644 OMCompiler/SimulationRuntime/c/simulation/solver/initialization/CMakeLists.txt delete mode 100644 OMCompiler/SimulationRuntime/c/util/CMakeLists.txt diff --git a/OMCompiler/SimulationRuntime/c/CMakeLists.txt b/OMCompiler/SimulationRuntime/c/CMakeLists.txt index 054b4ab040f..2e89b32fde2 100644 --- a/OMCompiler/SimulationRuntime/c/CMakeLists.txt +++ b/OMCompiler/SimulationRuntime/c/CMakeLists.txt @@ -1,11 +1,132 @@ -cmake_minimum_required(VERSION 2.6) - -# if OPENMODELICA_NEW_CMAKE_BUILD is defined (in OMCompiler/CMakeLists.txt) -# then we pick up the new cmake source. -# Otherwise we pick the old one which is needed for compilation of -# simulationruntimemsvc and is called from the Makefile.omdev.mingw files -if(OPENMODELICA_NEW_CMAKE_BUILD) - include(cmake_3.14.cmake) -else(OPENMODELICA_NEW_CMAKE_BUILD) - include(cmake_2.8.cmake) -endif(OPENMODELICA_NEW_CMAKE_BUILD) +cmake_minimum_required(VERSION 3.14) + +find_package(LAPACK REQUIRED) + +file(GLOB OMC_SIMRT_UTIL_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/util/*.c) +file(GLOB OMC_SIMRT_UTIL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/util/*.h) + +file(GLOB OMC_SIMRT_META_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/meta/*.c) +file(GLOB OMC_SIMRT_META_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/meta/*.h) + +file(GLOB OMC_SIMRT_GC_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/gc/*.c) +file(GLOB OMC_SIMRT_GC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/gc/*.h) + +file(GLOB_RECURSE OMC_SIMRT_SIMULATION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/simulation/*.c + ${CMAKE_CURRENT_SOURCE_DIR}/simulation/*.cpp) +file(GLOB_RECURSE OMC_SIMRT_SIMULATION_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/simulation/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/simulation/*.hpp) + +file(GLOB OMC_SIMRT_MATH_SUPPORT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/math-support/pivot.c) + +file(GLOB OMC_SIMRT_LINEARIZATION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/linearization/linearize.cpp) +file(GLOB OMC_SIMRT_LINEARIZATION_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/linearization/linearize.h) + +file(GLOB_RECURSE OMC_SIMRT_DATA_RECONCILIATION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dataReconciliation/*.cpp) +file(GLOB_RECURSE OMC_SIMRT_DATA_RECONCILIATION_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dataReconciliation/*.h) + + +file(GLOB_RECURSE OMC_SIMRT_OPTIMIZATION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/optimization/*.c) +file(GLOB_RECURSE OMC_SIMRT_OPTIMIZATION_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/optimization/*.h) + + +# ###################################################################################################################### +# Library: OpenModelicaRuntimeC +add_library(OpenModelicaRuntimeC SHARED) +add_library(omc::simrt::runtime ALIAS OpenModelicaRuntimeC) + +target_sources(OpenModelicaRuntimeC PRIVATE ${OMC_SIMRT_GC_SOURCES} ${OMC_SIMRT_UTIL_SOURCES} ${OMC_SIMRT_META_SOURCES}) +target_include_directories(OpenModelicaRuntimeC PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +# Add the define WIN32_LEAN_AND_MEAN to this lib and anything that links to it. +# The reason is that the define tells windows.h not to include winsock.h. We want +# to use winsock2.h in some 3rdParty libraries and the two can not be used simultaneously. +# winsock2.h is backwards compatible with winsock.h. +target_compile_definitions(OpenModelicaRuntimeC PUBLIC WIN32_LEAN_AND_MEAN) + +target_link_libraries(OpenModelicaRuntimeC PUBLIC OMCPThreads::OMCPThreads) +target_link_libraries(OpenModelicaRuntimeC PUBLIC omc::3rd::omcgc) + +if(MINGW) + target_link_libraries(OpenModelicaRuntimeC PUBLIC dbghelp) + target_link_libraries(OpenModelicaRuntimeC PUBLIC regex) + target_link_options(OpenModelicaRuntimeC PRIVATE -Wl,--export-all-symbols) +elseif(MSVC) + set_target_properties(OpenModelicaRuntimeC PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true) +endif() + +install(TARGETS OpenModelicaRuntimeC) + + +# ###################################################################################################################### +# Library: SimulationRuntimeC +add_library(SimulationRuntimeC SHARED) +add_library(omc::simrt::simruntime ALIAS SimulationRuntimeC) + +target_sources(SimulationRuntimeC PRIVATE ${OMC_SIMRT_SIMULATION_SOURCES} + ${OMC_SIMRT_MATH_SUPPORT_SOURCES} + ${OMC_SIMRT_LINEARIZATION_SOURCES} + ${OMC_SIMRT_DATA_RECONCILIATION_SOURCES}) + +target_link_libraries(SimulationRuntimeC PUBLIC omc::config) +target_link_libraries(SimulationRuntimeC PUBLIC omc::simrt::runtime) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::FMIL::expat) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::sundials::cvode) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::sundials::idas) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::sundials::kinsol) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::sundials::sunlinsolklu) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::sundials::sunlinsollapackdense) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::klu) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::amd) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::btf) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::colamd) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::umfpack) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::config) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::cminpack) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::cdaskr) +target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::lis) +target_link_libraries(SimulationRuntimeC PUBLIC ${LAPACK_LIBRARIES}) + +if(WIN32) + target_link_libraries(SimulationRuntimeC PUBLIC wsock32) +endif() + +if(MINGW) + target_link_options(SimulationRuntimeC PRIVATE -Wl,--export-all-symbols) +elseif(MSVC) + set_target_properties(SimulationRuntimeC PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true) +endif(MINGW) + +if(OM_OMC_ENABLE_IPOPT) + target_sources(SimulationRuntimeC PRIVATE ${OMC_SIMRT_OPTIMIZATION_SOURCES}) + target_compile_definitions(SimulationRuntimeC PRIVATE OMC_HAVE_IPOPT) + target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::ipopt) +endif() + +install(TARGETS SimulationRuntimeC) + + +# ###################################################################################################################### +# include the configuration for (source code) FMI runtime and generate RuntimeSources.mo +# This is separated into another file just for clarity. Once it is cleaned up and organized +# it can be brought back here. +include(cmake/source_code_fmu_config.cmake) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/RuntimeSources.mo.cmake ${CMAKE_CURRENT_SOURCE_DIR}/RuntimeSources.mo) + + + +# ###################################################################################################################### +## Install the header files. This installs the whole directory structure of c/ folder +## which means all headers will be installed keeping the directory structure intact. +## It might install some unneeded headers but it suffices for now. +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + TYPE INCLUDE + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.c.inc" + # To skip the build dir created by the normal Makefiles build system. + PATTERN "build" EXCLUDE + # This is skipped by the makefiles and instead some header files from SimulationRuntime/fmi + # are instead added to c/fmi folders. Until we fix those we keep this for now :( + PATTERN "fmi" EXCLUDE +) + diff --git a/OMCompiler/SimulationRuntime/c/cmake_2.8.cmake b/OMCompiler/SimulationRuntime/c/cmake_2.8.cmake deleted file mode 100644 index 0570ea8d837..00000000000 --- a/OMCompiler/SimulationRuntime/c/cmake_2.8.cmake +++ /dev/null @@ -1,517 +0,0 @@ -# Jens Frenkel, Jens.Frenkel@tu-dresden.de, 2011-10-11 -# CMakefile for compilation of OMC - -# CMAKE -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) - -# PROJECT -PROJECT(SimulationRuntimeC) - -SET(OPENMODELICAHOME $ENV{OPENMODELICAHOME}) -SET(OMC_DEBUG ${OPENMODELICAHOME}/bin/omc.exe) - -# Global Variables -IF(NOT OMCTRUNCHOME) - SET(OMCTRUNCHOME ${CMAKE_CURRENT_SOURCE_DIR}/../../../) -ENDIF (NOT OMCTRUNCHOME) -get_filename_component(OMCTRUNCHOME "${OMCTRUNCHOME}" ABSOLUTE) - -# OMDEV PATH -IF(NOT OMDEV) - SET(OMDEV $ENV{OMDEV}) -ENDIF(NOT OMDEV) - -INCLUDE_DIRECTORIES(${OMDEV}/lib/expat-win32-msvc ${OMDEV}/include/lis ${OMDEV}/include/pthread) -link_directories(${OMDEV}/lib/expat-win32-msvc) -link_directories(${OMDEV}/lib/lapack-win32-msvc) - -IF(MSVC) - SET(Sundials_Path ${OMCTRUNCHOME}/OMCompiler/3rdParty/sundials-5.4.0/build_msvc) -ELSEIF(MSVC) - SET(Sundials_Path ${OMCTRUNCHOME}/OMCompiler/3rdParty/sundials-5.4.0/build) -ENDIF(MSVC) -get_filename_component(Sundials_Path "${Sundials_Path}" ABSOLUTE) - -MESSAGE(STATUS "Sundials path:") -MESSAGE(STATUS "${Sundials_Path}") - -# SUNDIALS Header -FIND_PATH(SUNDIALS_INCLUDE_DIR sundials/sundials_config.h PATHS "${Sundials_Path}/include/sundials") -IF(NOT SUNDIALS_INCLUDE_DIR) - MESSAGE(FATAL_ERROR "Could not find sundials/sundials_config.h in ${Sundials_Path}/include/sundials") -ENDIF() - -MESSAGE(STATUS "Sundials include:") -MESSAGE(STATUS "${SUNDIALS_INCLUDE_DIR}") - -# SUNDIALS Libraires -if(MSVC) - FIND_LIBRARY(SUNDIALS_LIBRARY_CVODE NAMES sundials_cvode PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib) - FIND_LIBRARY(SUNDIALS_LIBRARY_IDA NAMES sundials_ida PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib) - FIND_LIBRARY(SUNDIALS_LIBRARY_NVEC NAMES sundials_nvecserial PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib) - FIND_LIBRARY(SUNDIALS_KINSOL NAMES sundials_kinsol PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib) -else(MSVC) - FIND_LIBRARY(SUNDIALS_LIBRARY_CVODE NAMES libsundials_cvode PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib) - FIND_LIBRARY(SUNDIALS_LIBRARY_IDA NAMES libsundials_ida PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib) - FIND_LIBRARY(SUNDIALS_LIBRARY_NVEC NAMES libsundials_nvecserial PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib) - FIND_LIBRARY(SUNDIALS_KINSOL NAMES libsundials_kinsol PATHS /usr/lib /usr/local/lib $ENV{LIB} $(Sundials_Path)/lib) -endif(MSVC) - -IF(SUNDIALS_INCLUDE_DIR) - - INCLUDE_DIRECTORIES(${SUNDIALS_INCLUDE_DIR}) - - if(SUNDIALS_LIBRARY_CVODE AND - SUNDIALS_LIBRARY_IDA AND - SUNDIALS_LIBRARY_NVEC AND - SUNDIALS_KINSOL) - - SET(SUNDIALS_LIBRARIES ${SUNDIALS_LIBRARY_CVODE} ${SUNDIALS_LIBRARY_IDA} ${SUNDIALS_LIBRARY_NVEC} ${SUNDIALS_KINSOL}) - - ENDIF(SUNDIALS_LIBRARY_CVODE AND - SUNDIALS_LIBRARY_IDA AND - SUNDIALS_LIBRARY_NVEC AND - SUNDIALS_KINSOL) - -ENDIF(SUNDIALS_INCLUDE_DIR) - -# Defines for Visual Studio -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX -D_COMPLEX_DEFINED) - - add_definitions(-DWIN32_LEAN_AND_MEAN) -endif(MSVC) - -# includes -INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/) -INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/3rdParty/gc/include) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/linearization) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/math-support) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/meta) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/meta/gc) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/simulation) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/optimization) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/simulation/results) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/simulation/solver) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/simulation/solver/initialization) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/util) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/dataReconciliation) - -# Subdirectorys -ADD_SUBDIRECTORY(math-support) -ADD_SUBDIRECTORY(meta) -ADD_SUBDIRECTORY(simulation) -ADD_SUBDIRECTORY(util) -ADD_SUBDIRECTORY(fmi) - -# ------------------------------------------------------------- -# MACRO definitions -# ------------------------------------------------------------- - -# Macros to hide/show cached variables. -# These two macros can be used to "hide" or "show" in the -# list of cached variables various variables and/or options -# that depend on other options. -# Note that once a variable is modified, it will preserve its -# value (hidding it merely makes it internal) - -MACRO(HIDE_VARIABLE var) - IF(DEFINED ${var}) - SET(${var} "${${var}}" CACHE INTERNAL "") - ENDIF(DEFINED ${var}) -ENDMACRO(HIDE_VARIABLE) - -MACRO(SHOW_VARIABLE var type doc default) - IF(DEFINED ${var}) - SET(${var} "${${var}}" CACHE "${type}" "${doc}" FORCE) - ELSE(DEFINED ${var}) - SET(${var} "${default}" CACHE "${type}" "${doc}") - ENDIF(DEFINED ${var}) -ENDMACRO(SHOW_VARIABLE) - -# MACRO BUILDMODEL -MACRO(BUILDMODEL model mo dir Flags CSRC) - - - # includes - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/linearization) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/math-support) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/meta) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/meta/gc) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/results) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/solver) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/solver/initialization) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/util) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/dataReconciliation) - - - # OMDEV PATH - IF(NOT OMDEV) - SET(OMDEV $ENV{OMDEV}) - ENDIF(NOT OMDEV) - - INCLUDE_DIRECTORIES(${OMDEV}/lib/expat-win32-msvc) - link_directories(${OMDEV}/lib/expat-win32-msvc) - link_directories(${OMDEV}/lib/lapack-win32-msvc) - - # Variablen fuer openmodelica2sarturis - SET(OMC_CODE ${CMAKE_CURRENT_BINARY_DIR}/${model}.c - ${CMAKE_CURRENT_BINARY_DIR}/${model}_functions.c - ${CMAKE_CURRENT_BINARY_DIR}/${model}_init.txt) - SET(OMC_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${model}.c - # ${CMAKE_CURRENT_BINARY_DIR}/${model}_functions.cpp - ${CMAKE_CURRENT_BINARY_DIR}/${model}_functions.h - ${CMAKE_CURRENT_BINARY_DIR}/${model}_records.c) - - # custom command fuer openmodelicacompiler - ADD_CUSTOM_COMMAND(OUTPUT ${OMC_OUTPUT} - COMMAND ${OMC_DEBUG} ${Flags} +s ${dir}/${mo} Modelica ModelicaServices - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Erzeuge Code fuer ${model} with ${OMC_DEBUG}") - - # target fuer OM_OUTPUT - ADD_CUSTOM_TARGET(${model}codegen ALL DEPENDS ${OMC_OUTPUT}) - - ADD_EXECUTABLE(${model} ${OMC_OUTPUT} ${CSRC}) - TARGET_LINK_LIBRARIES(${model} simulation util math-support results solver meta ModelicaExternalC libexpat initialization lapack_win32_MT) - - # Dependencies - ADD_DEPENDENCIES(${model} ${model}codegen) - - IF(MODELS_INSTALL) - INSTALL(TARGETS ${model} RUNTIME DESTINATION ${MODELS_INSTALL_PATH}) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${model}_init.txt DESTINATION ${MODELS_INSTALL_PATH}) - ENDIF(MODELS_INSTALL) -#ENDFOREACH(model ${model_sources}) -ENDMACRO(BUILDMODEL) - -# MACRO BUILDMODEL -MACRO(BUILDMODELMOS model mos dir Flags CSRC) - -IF(WIN32) - SET(COPY copy) -else(WIN32) - SET(COPY cp) -endif(WIN32) - -IF(SUNDIALS_INCLUDE_DIR AND - SUNDIALS_LIBRARY_CVODE AND - SUNDIALS_LIBRARY_IDA AND - SUNDIALS_LIBRARY_NVEC AND - SUNDIALS_KINSOL) - - INCLUDE_DIRECTORIES(${SUNDIALS_INCLUDE_DIR}) - SET(SUNDIALS_LIBRARIES ${SUNDIALS_LIBRARY_CVODE} ${SUNDIALS_LIBRARY_IDA} ${SUNDIALS_LIBRARY_NVEC} ${SUNDIALS_KINSOL}) - -ENDIF(SUNDIALS_INCLUDE_DIR AND - SUNDIALS_LIBRARY_CVODE AND - SUNDIALS_LIBRARY_IDA AND - SUNDIALS_LIBRARY_NVEC AND - SUNDIALS_KINSOL) - - # includes - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/linearization) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/math-support) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/meta) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/meta/gc) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/ModelicaExternalC) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/results) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/solver) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/solver/initialization) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/util) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/dataReconciliation) - - INCLUDE_DIRECTORIES(${dir}) - - # OMDEV PATH - IF(NOT OMDEV) - SET(OMDEV $ENV{OMDEV}) - ENDIF(NOT OMDEV) - - INCLUDE_DIRECTORIES(${OMDEV}/lib/expat-win32-msvc) - link_directories(${OMDEV}/lib/expat-win32-msvc) - link_directories(${OMDEV}/lib/lapack-win32-msvc) - - # custom command to copy expat.dll file - SET(expat_CODE ${OMDEV}/lib/expat-win32-msvc/libexpat.dll) - STRING(REGEX REPLACE "/" "\\\\" expat_CODE_NEU ${expat_CODE}) - SET(expat_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/libexpat.dll) - STRING(REGEX REPLACE "/" "\\\\" expat_OUTPUT_NEU ${expat_OUTPUT}) - - ADD_CUSTOM_COMMAND(OUTPUT ${expat_OUTPUT} - COMMAND ${COPY} ${expat_CODE_NEU} ${expat_OUTPUT_NEU} - WORKING_DIRECTORY ${dir} - COMMENT "copy file ${expat_CODE_NEU} to ${expat_OUTPUT_NEU}") - # target fuer OM_OUTPUT - ADD_CUSTOM_TARGET(expat${model} ALL DEPENDS ${expat_OUTPUT}) - - - SET(lapack_CODE ${OMDEV}/lib/lapack-win32-msvc/lapack_win32_MT.dll) - STRING(REGEX REPLACE "/" "\\\\" lapack_CODE_NEU ${lapack_CODE}) - SET(lapack_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/lapack_win32_MT.dll) - STRING(REGEX REPLACE "/" "\\\\" lapack_OUTPUT_NEU ${lapack_OUTPUT}) - - ADD_CUSTOM_COMMAND(OUTPUT ${lapack_OUTPUT} ${blas_OUTPUT} ${lapack_OUTPUT} - COMMAND ${COPY} ${lapack_CODE_NEU} ${lapack_OUTPUT_NEU} - WORKING_DIRECTORY ${dir} - COMMENT "copy file ${lapack_CODE_NEU} to ${lapack_OUTPUT_NEU}") - # target fuer OM_OUTPUT - ADD_CUSTOM_TARGET(lapack${model} ALL DEPENDS ${lapack_OUTPUT}) - - - SET(blas_CODE ${OMDEV}/lib/lapack-win32-msvc/blas_win32_MT.dll) - STRING(REGEX REPLACE "/" "\\\\" blas_CODE_NEU ${blas_CODE}) - SET(blas_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/blas_win32_MT.dll) - STRING(REGEX REPLACE "/" "\\\\" blas_OUTPUT_NEU ${blas_OUTPUT}) - - ADD_CUSTOM_COMMAND(OUTPUT ${blas_OUTPUT} ${blas_OUTPUT} ${lapack_OUTPUT} - COMMAND ${COPY} ${blas_CODE_NEU} ${blas_OUTPUT_NEU} - WORKING_DIRECTORY ${dir} - COMMENT "copy file ${blas_CODE_NEU} to ${blas_OUTPUT_NEU}") - # target fuer OM_OUTPUT - ADD_CUSTOM_TARGET(blas${model} ALL DEPENDS ${blas_OUTPUT}) - - SET(OMC_MODELNAME ${model}) - # generate model.mos - - # Variablen fuer openmodelica2sarturis - SET(OMC_CODE ${dir}/${model}.c - ${dir}/${model}_functions.c - ${dir}/${model}_init.txt) - SET(OMC_OUTPUT ${dir}/${model}.c - # ${dir}/${model}_functions.cpp - ${dir}/${model}_functions.h - ${dir}/${model}_records.c) - # custom command fuer openmodelicacompiler - ADD_CUSTOM_COMMAND(OUTPUT ${OMC_OUTPUT} - COMMAND ${OMC_DEBUG} ${Flags} ${mos} - WORKING_DIRECTORY ${dir} - COMMENT "Generating code for ${model} with ${OMC_DEBUG}") - # target fuer OM_OUTPUT - ADD_CUSTOM_TARGET(${model}codegen ALL DEPENDS ${OMC_OUTPUT}) - - ADD_CUSTOM_TARGET(${model}codegencpp ALL DEPENDS ${OMC_OUTPUT}) - - ADD_DEFINITIONS(/TP) - set_source_files_properties(${OMC_OUTPUT} PROPERTIES LANGUAGE CXX) - ADD_EXECUTABLE(${model} ${OMC_OUTPUT} ${CSRC}) - TARGET_LINK_LIBRARIES(${model} simulation util math-support results solver meta ModelicaExternalC libexpat initialization lapack_win32_MT ${SUNDIALS_LIBRARIES}) - - # custom command to copy xml file - SET(XML_CODE ${dir}/${model}_init.xml) - STRING(REGEX REPLACE "/" "\\\\" XML_CODE_NEU ${XML_CODE}) - SET(XML_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/${model}_init.xml) - STRING(REGEX REPLACE "/" "\\\\" XML_OUTPUT_NEU ${XML_OUTPUT}) - ADD_CUSTOM_COMMAND(OUTPUT ${XML_OUTPUT} - COMMAND ${COPY} ${XML_CODE_NEU} ${XML_OUTPUT_NEU} - WORKING_DIRECTORY ${dir} - COMMENT "copy file ${XML_CODE_NEU} to ${XML_OUTPUT_NEU}") - # target fuer OM_OUTPUT - ADD_CUSTOM_TARGET(${model}cp_xml ALL DEPENDS ${XML_OUTPUT}) - - # Dependencies - ADD_DEPENDENCIES(${model}cp_xml ${model}codegen expat${model} lapack${model} blas${model}) - ADD_DEPENDENCIES(${model} ${model}cp_xml) - -#ENDFOREACH(model ${model_sources}) -ENDMACRO(BUILDMODELMOS) - -# MACRO BUILDMODEL -MACRO(BUILDMODELFMU model dir Flags CSRC) - -IF(WIN32) - SET(COPY copy) -else(WIN32) - SET(COPY cp) -endif(WIN32) - -IF(SUNDIALS_INCLUDE_DIR AND - SUNDIALS_LIBRARY_CVODE AND - SUNDIALS_LIBRARY_IDA AND - SUNDIALS_LIBRARY_NVEC AND - SUNDIALS_KINSOL) - - INCLUDE_DIRECTORIES(${SUNDIALS_INCLUDE_DIR}) - SET(SUNDIALS_LIBRARIES ${SUNDIALS_LIBRARY_CVODE} ${SUNDIALS_LIBRARY_IDA} ${SUNDIALS_LIBRARY_NVEC} ${SUNDIALS_KINSOL}) - -ENDIF(SUNDIALS_INCLUDE_DIR AND - SUNDIALS_LIBRARY_CVODE AND - SUNDIALS_LIBRARY_IDA AND - SUNDIALS_LIBRARY_NVEC AND - SUNDIALS_KINSOL) - - # includes - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/linearization) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/math-support) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/meta) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/meta/gc) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/ModelicaExternalC) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/results) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/solver) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/solver/initialization) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/util) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/fmi/export/fmi1) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/dataReconciliation) - - # OMDEV PATH - IF(NOT OMDEV) - SET(OMDEV $ENV{OMDEV}) - ENDIF(NOT OMDEV) - - INCLUDE_DIRECTORIES(${OMDEV}/lib/expat-win32-msvc) - link_directories(${OMDEV}/lib/expat-win32-msvc) - link_directories(${OMDEV}/lib/lapack-win32-msvc) - - SET(OMC_MODELNAME ${model}) - SET(OMC_MODELDIR ${dir}) - # generate model.mos - FIND_FILE(MOSFILE_IN model_fmu.in PATHS ${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c) - CONFIGURE_FILE(${MOSFILE_IN} ${dir}/${model}_FMU.mos) - - # Variablen fuer openmodelica2sarturis - SET(OMC_CODE ${CMAKE_CURRENT_BINARY_DIR}/${model}.c - ${CMAKE_CURRENT_BINARY_DIR}/${model}_functions.c - ${CMAKE_CURRENT_BINARY_DIR}/${model}_init.txt) - SET(OMC_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${model}.c - ${CMAKE_CURRENT_BINARY_DIR}/${model}_FMU.c - # ${CMAKE_CURRENT_BINARY_DIR}/${model}_functions.cpp - ${CMAKE_CURRENT_BINARY_DIR}/${model}_functions.h - ${CMAKE_CURRENT_BINARY_DIR}/${model}_records.c) - # custom command fuer openmodelicacompiler - ADD_CUSTOM_COMMAND(OUTPUT ${OMC_OUTPUT} - COMMAND ${OMC_DEBUG} ${Flags} ${dir}/${model}_FMU.mos - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Erzeuge Code fuer ${model} with ${OMC_DEBUG}") - # target fuer OM_OUTPUT - ADD_CUSTOM_TARGET(${model}codegen ALL DEPENDS ${OMC_OUTPUT}) - - SET(OMC_FMU_CODE ${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/fmi/export/fmi1/fmu1_model_interface.h - ${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/fmi/export/fmi1/fmiModelFunctions.h - ${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/fmi/export/fmi1/fmiModelTypes.h) - - ADD_LIBRARY(${model} SHARED ${OMC_OUTPUT} ${CSRC} ${OMC_FMU_CODE}) - TARGET_LINK_LIBRARIES(${model} simulation util math-support results solver meta ModelicaExternalC libexpat initialization lapack_win32_MT) - - # Dependencies - ADD_DEPENDENCIES(${model} ${model}codegen) - - IF(MODELS_INSTALL) - INSTALL(TARGETS ${model} ARCHIVE DESTINATION ${MODELS_INSTALL_PATH}) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${model}_init.txt DESTINATION ${MODELS_INSTALL_PATH}) - ENDIF(MODELS_INSTALL) -#ENDFOREACH(model ${model_sources}) -ENDMACRO(BUILDMODELFMU) - -# MACRO BUILDMODEL -MACRO(BUILDMODELFMUMOS model mos Flags CSRC) - -IF(WIN32) - SET(COPY copy) -else(WIN32) - SET(COPY cp) -endif(WIN32) - -IF(SUNDIALS_INCLUDE_DIR AND - SUNDIALS_LIBRARY_CVODE AND - SUNDIALS_LIBRARY_IDA AND - SUNDIALS_LIBRARY_NVEC AND - SUNDIALS_KINSOL) - - INCLUDE_DIRECTORIES(${SUNDIALS_INCLUDE_DIR}) - SET(SUNDIALS_LIBRARIES ${SUNDIALS_LIBRARY_CVODE} ${SUNDIALS_LIBRARY_IDA} ${SUNDIALS_LIBRARY_NVEC} ${SUNDIALS_KINSOL}) - -ENDIF(SUNDIALS_INCLUDE_DIR AND - SUNDIALS_LIBRARY_CVODE AND - SUNDIALS_LIBRARY_IDA AND - SUNDIALS_LIBRARY_NVEC AND - SUNDIALS_KINSOL) - - # includes - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/linearization) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/math-support) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/meta) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/meta/gc) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/ModelicaExternalC) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/results) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/solver) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/simulation/solver/initialization) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/util) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/fmi/export) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/c/dataReconciliation) - - # OMDEV PATH - IF(NOT OMDEV) - SET(OMDEV $ENV{OMDEV}) - ENDIF(NOT OMDEV) - - INCLUDE_DIRECTORIES(${OMDEV}/lib/expat-win32-msvc) - link_directories(${OMDEV}/lib/expat-win32-msvc) - link_directories(${OMDEV}/lib/lapack-win32-msvc) - - STRING(REPLACE "." "_" FMU_MODELNAME ${model}) - # generate model.mos - - # Variablen fuer openmodelica2sarturis - SET(OMC_CODE ${CMAKE_CURRENT_BINARY_DIR}/${FMU_MODELNAME}.c - ${CMAKE_CURRENT_BINARY_DIR}/${FMU_MODELNAME}_functions.c - ${CMAKE_CURRENT_BINARY_DIR}/${FMU_MODELNAME}_init.txt) - SET(OMC_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FMU_MODELNAME}.c - ${CMAKE_CURRENT_BINARY_DIR}/${FMU_MODELNAME}_FMU.c - # ${CMAKE_CURRENT_BINARY_DIR}/${FMU_MODELNAME}_functions.cpp - ${CMAKE_CURRENT_BINARY_DIR}/${FMU_MODELNAME}_functions.h - ${CMAKE_CURRENT_BINARY_DIR}/${FMU_MODELNAME}_records.c) - # custom command fuer openmodelicacompiler - ADD_CUSTOM_COMMAND(OUTPUT ${OMC_OUTPUT} - COMMAND ${OMC_DEBUG} ${Flags} ${mos} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Erzeuge Code fuer ${model} with ${OMC_DEBUG} in ${CMAKE_CURRENT_BINARY_DIR}") - # target fuer OM_OUTPUT - ADD_CUSTOM_TARGET(${model}codegen ALL DEPENDS ${OMC_OUTPUT}) - - SET(OMC_FMU_CODE ${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/fmi/export/fmi1/fmu1_model_interface.h - ${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/fmi/export/fmi1/fmiModelFunctions.h - ${OMCTRUNCHOME}/OMCompiler/SimulationRuntime/fmi/export/fmi1/fmiModelTypes.h) - - ADD_DEFINITIONS(/TP ${FMU_MODELNAME}.c) - set_source_files_properties(${OMC_OUTPUT} PROPERTIES LANGUAGE CXX) - ADD_LIBRARY(${model} SHARED ${OMC_OUTPUT} ${CSRC} ${OMC_FMU_CODE}) - TARGET_LINK_LIBRARIES(${model} simulation util math-support results solver meta ModelicaExternalC libexpat initialization lapack_win32_MT ${SUNDIALS_LIBRARIES}) - - # Dependencies - ADD_DEPENDENCIES(${model} ${model}codegen) - - IF(MODELS_INSTALL) - INSTALL(TARGETS ${model} ARCHIVE DESTINATION ${MODELS_INSTALL_PATH}) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/modelDescription.xml DESTINATION ${MODELS_INSTALL_PATH}) - ENDIF(MODELS_INSTALL) -#ENDFOREACH(model ${model_sources}) -ENDMACRO(BUILDMODELFMUMOS) - -# Check if example files are to be exported -SHOW_VARIABLE(MODELS_INSTALL BOOL "Install models" ON) - -# If MODELS are to be exported, check where we should install them. -IF(MODELS_INSTALL) - - SHOW_VARIABLE(MODELS_INSTALL_PATH STRING - "Output directory for installing models files" "${CMAKE_INSTALL_PREFIX}") - - IF(NOT MODELS_INSTALL_PATH) - PRINT_WARNING("The example installation path is empty" - "Example installation path was reset to its default value") - SET(MODELS_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}" CACHE STRING - "Output directory for installing example files" FORCE) - ENDIF(NOT MODELS_INSTALL_PATH) - -ELSE(MODELS_INSTALL) - HIDE_VARIABLE(MODELS_INSTALL_PATH) -ENDIF(MODELS_INSTALL) \ No newline at end of file diff --git a/OMCompiler/SimulationRuntime/c/cmake_3.14.cmake b/OMCompiler/SimulationRuntime/c/cmake_3.14.cmake deleted file mode 100644 index 2e89b32fde2..00000000000 --- a/OMCompiler/SimulationRuntime/c/cmake_3.14.cmake +++ /dev/null @@ -1,132 +0,0 @@ -cmake_minimum_required(VERSION 3.14) - -find_package(LAPACK REQUIRED) - -file(GLOB OMC_SIMRT_UTIL_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/util/*.c) -file(GLOB OMC_SIMRT_UTIL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/util/*.h) - -file(GLOB OMC_SIMRT_META_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/meta/*.c) -file(GLOB OMC_SIMRT_META_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/meta/*.h) - -file(GLOB OMC_SIMRT_GC_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/gc/*.c) -file(GLOB OMC_SIMRT_GC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/gc/*.h) - -file(GLOB_RECURSE OMC_SIMRT_SIMULATION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/simulation/*.c - ${CMAKE_CURRENT_SOURCE_DIR}/simulation/*.cpp) -file(GLOB_RECURSE OMC_SIMRT_SIMULATION_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/simulation/*.h - ${CMAKE_CURRENT_SOURCE_DIR}/simulation/*.hpp) - -file(GLOB OMC_SIMRT_MATH_SUPPORT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/math-support/pivot.c) - -file(GLOB OMC_SIMRT_LINEARIZATION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/linearization/linearize.cpp) -file(GLOB OMC_SIMRT_LINEARIZATION_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/linearization/linearize.h) - -file(GLOB_RECURSE OMC_SIMRT_DATA_RECONCILIATION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dataReconciliation/*.cpp) -file(GLOB_RECURSE OMC_SIMRT_DATA_RECONCILIATION_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/dataReconciliation/*.h) - - -file(GLOB_RECURSE OMC_SIMRT_OPTIMIZATION_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/optimization/*.c) -file(GLOB_RECURSE OMC_SIMRT_OPTIMIZATION_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/optimization/*.h) - - -# ###################################################################################################################### -# Library: OpenModelicaRuntimeC -add_library(OpenModelicaRuntimeC SHARED) -add_library(omc::simrt::runtime ALIAS OpenModelicaRuntimeC) - -target_sources(OpenModelicaRuntimeC PRIVATE ${OMC_SIMRT_GC_SOURCES} ${OMC_SIMRT_UTIL_SOURCES} ${OMC_SIMRT_META_SOURCES}) -target_include_directories(OpenModelicaRuntimeC PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) - -# Add the define WIN32_LEAN_AND_MEAN to this lib and anything that links to it. -# The reason is that the define tells windows.h not to include winsock.h. We want -# to use winsock2.h in some 3rdParty libraries and the two can not be used simultaneously. -# winsock2.h is backwards compatible with winsock.h. -target_compile_definitions(OpenModelicaRuntimeC PUBLIC WIN32_LEAN_AND_MEAN) - -target_link_libraries(OpenModelicaRuntimeC PUBLIC OMCPThreads::OMCPThreads) -target_link_libraries(OpenModelicaRuntimeC PUBLIC omc::3rd::omcgc) - -if(MINGW) - target_link_libraries(OpenModelicaRuntimeC PUBLIC dbghelp) - target_link_libraries(OpenModelicaRuntimeC PUBLIC regex) - target_link_options(OpenModelicaRuntimeC PRIVATE -Wl,--export-all-symbols) -elseif(MSVC) - set_target_properties(OpenModelicaRuntimeC PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true) -endif() - -install(TARGETS OpenModelicaRuntimeC) - - -# ###################################################################################################################### -# Library: SimulationRuntimeC -add_library(SimulationRuntimeC SHARED) -add_library(omc::simrt::simruntime ALIAS SimulationRuntimeC) - -target_sources(SimulationRuntimeC PRIVATE ${OMC_SIMRT_SIMULATION_SOURCES} - ${OMC_SIMRT_MATH_SUPPORT_SOURCES} - ${OMC_SIMRT_LINEARIZATION_SOURCES} - ${OMC_SIMRT_DATA_RECONCILIATION_SOURCES}) - -target_link_libraries(SimulationRuntimeC PUBLIC omc::config) -target_link_libraries(SimulationRuntimeC PUBLIC omc::simrt::runtime) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::FMIL::expat) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::sundials::cvode) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::sundials::idas) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::sundials::kinsol) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::sundials::sunlinsolklu) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::sundials::sunlinsollapackdense) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::klu) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::amd) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::btf) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::colamd) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::umfpack) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::suitesparse::config) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::cminpack) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::cdaskr) -target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::lis) -target_link_libraries(SimulationRuntimeC PUBLIC ${LAPACK_LIBRARIES}) - -if(WIN32) - target_link_libraries(SimulationRuntimeC PUBLIC wsock32) -endif() - -if(MINGW) - target_link_options(SimulationRuntimeC PRIVATE -Wl,--export-all-symbols) -elseif(MSVC) - set_target_properties(SimulationRuntimeC PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true) -endif(MINGW) - -if(OM_OMC_ENABLE_IPOPT) - target_sources(SimulationRuntimeC PRIVATE ${OMC_SIMRT_OPTIMIZATION_SOURCES}) - target_compile_definitions(SimulationRuntimeC PRIVATE OMC_HAVE_IPOPT) - target_link_libraries(SimulationRuntimeC PUBLIC omc::3rd::ipopt) -endif() - -install(TARGETS SimulationRuntimeC) - - -# ###################################################################################################################### -# include the configuration for (source code) FMI runtime and generate RuntimeSources.mo -# This is separated into another file just for clarity. Once it is cleaned up and organized -# it can be brought back here. -include(cmake/source_code_fmu_config.cmake) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/RuntimeSources.mo.cmake ${CMAKE_CURRENT_SOURCE_DIR}/RuntimeSources.mo) - - - -# ###################################################################################################################### -## Install the header files. This installs the whole directory structure of c/ folder -## which means all headers will be installed keeping the directory structure intact. -## It might install some unneeded headers but it suffices for now. -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - TYPE INCLUDE - FILES_MATCHING - PATTERN "*.h" - PATTERN "*.c.inc" - # To skip the build dir created by the normal Makefiles build system. - PATTERN "build" EXCLUDE - # This is skipped by the makefiles and instead some header files from SimulationRuntime/fmi - # are instead added to c/fmi folders. Until we fix those we keep this for now :( - PATTERN "fmi" EXCLUDE -) - diff --git a/OMCompiler/SimulationRuntime/c/fmi/CMakeLists.txt b/OMCompiler/SimulationRuntime/c/fmi/CMakeLists.txt deleted file mode 100644 index 88f77df7c07..00000000000 --- a/OMCompiler/SimulationRuntime/c/fmi/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ - -INCLUDE_DIRECTORIES("${OMCTRUNCHOME}/OMCompiler/3rdParty/FMIL/install_msvc/include") - -# Quellen und Header -SET(fmi_sources FMI1CoSimulation.c FMI1Common.c FMI1ModelExchange.c FMI2Common.c FMI2ModelExchange.c FMICommon.c) - -SET(fmi_headers FMI1Common.h FMI2Common.h FMICommon.h) - -# Library OpenModelicaFMIRuntimeC -ADD_LIBRARY(OpenModelicaFMIRuntimeC ${fmi_sources} ${fmi_headers}) - -# Install -INSTALL(TARGETS OpenModelicaFMIRuntimeC - ARCHIVE DESTINATION lib/omc) - diff --git a/OMCompiler/SimulationRuntime/c/math-support/CMakeLists.txt b/OMCompiler/SimulationRuntime/c/math-support/CMakeLists.txt deleted file mode 100644 index b36241692f3..00000000000 --- a/OMCompiler/SimulationRuntime/c/math-support/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Jens Frenkel, Jens.Frenkel@tu-dresden.de, 2011-10-11 -# CMakefile for compilation of OMC - -# Quellen und Header -SET(math_support_sources pivot.c) - -SET(math_support_headers ) - -# Library util -ADD_LIBRARY(math-support ${math_support_sources} ${math_support_headers}) -#TARGET_LINK_LIBRARIES(util) - -# Install -INSTALL(TARGETS math-support - ARCHIVE DESTINATION lib/omc) - -#INSTALL(FILES ${math_support_headers} DESTINATION include) - -# add tests -#ADD_SUBDIRECTORY(test) diff --git a/OMCompiler/SimulationRuntime/c/meta/CMakeLists.txt b/OMCompiler/SimulationRuntime/c/meta/CMakeLists.txt deleted file mode 100644 index ae270623cf2..00000000000 --- a/OMCompiler/SimulationRuntime/c/meta/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# Sources and Headers -SET(META_SRC meta_modelica_builtin.c - realString.c - meta_modelica_catch.c - meta_modelica.c - meta_modelica_segv.c - ../gc/omc_gc.c) - -SET(META_HFILES meta_modelica_builtin.h - meta_modelica_builtin_boxptr.h - meta_modelica_segv.h - meta_modelica.h - meta_modelica_data.h - meta_modelica_mk_box.h - meta_modelica_segv.h - ../gc/omc_gc.h) - - -# Library meta -add_library(meta ${META_SRC} ${META_HFILES}) -#set_property(TARGET f2c PROPERTY PREFIX lib) - -# Install -INSTALL(TARGETS meta - ARCHIVE DESTINATION lib/omc) -#INSTALL(FILES ${META_HFILES} DESTINATION include/meta) - diff --git a/OMCompiler/SimulationRuntime/c/simulation/CMakeLists.txt b/OMCompiler/SimulationRuntime/c/simulation/CMakeLists.txt deleted file mode 100644 index 3753fd433cc..00000000000 --- a/OMCompiler/SimulationRuntime/c/simulation/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Jens Frenkel, Jens.Frenkel@tu-dresden.de, 2011-10-11 -# CMakefile for compilation of OMC - -# Subdirectorys -#ADD_SUBDIRECTORY(libf2c) -ADD_SUBDIRECTORY(results) -ADD_SUBDIRECTORY(solver) - -# Include Directory of expat -INCLUDE_DIRECTORIES("${OMCTRUNCHOME}/OMCompiler/3rdParty/FMIL/ThirdParty/Expat/expat-2.0.1/lib" "${OMCTRUNCHOME}/OMCompiler/Compiler/runtime/") - -# Quellen und Header -SET(simulation_sources - ../linearization/linearize.cpp - modelinfo.c simulation_info_json.c simulation_input_xml.c socket.cpp - options.c simulation_runtime.cpp simulation_omc_assert.c) - -SET(simulation_headers - modelinfo.h simulation_info_json.h simulation_input_xml.h socket.h options.h simulation_runtime.h - ../linearization/linearize.h ../simulation_data.h ../omc_inline.h ../util/omc_msvc.h ../openmodelica.h ../openmodelica_func.h) - -# Library util -ADD_DEFINITIONS(/DNO_INTERACTIVE_DEPENDENCY) -ADD_LIBRARY(simulation ${simulation_sources} ${simulation_headers}) -#TARGET_LINK_LIBRARIES(util) - -# Install -INSTALL(TARGETS simulation - ARCHIVE DESTINATION lib/omc) - -#INSTALL(FILES ${simulation_headers} DESTINATION include) diff --git a/OMCompiler/SimulationRuntime/c/simulation/results/CMakeLists.txt b/OMCompiler/SimulationRuntime/c/simulation/results/CMakeLists.txt deleted file mode 100644 index ffb06974854..00000000000 --- a/OMCompiler/SimulationRuntime/c/simulation/results/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Jens Frenkel, Jens.Frenkel@tu-dresden.de, 2011-10-11 -# CMakefile for compilation of OMC - -# Quellen und Header -SET(results_sources -simulation_result.cpp simulation_result_ia.cpp simulation_result_plt.cpp -simulation_result_csv.cpp simulation_result_mat4.cpp simulation_result_wall.cpp MatVer4.cpp -) - -SET(results_headers ../../util/read_csv.h -simulation_result.h simulation_result_ia.h simulation_result_plt.h -simulation_result_csv.h simulation_result_mat4.h simulation_result_wall.h MatVer4.h -) - -# Library util -ADD_LIBRARY(results ${results_sources} ${results_headers}) -#TARGET_LINK_LIBRARIES(util) - -# Install -INSTALL(TARGETS results - ARCHIVE DESTINATION lib/omc) - -#INSTALL(FILES ${results_headers} DESTINATION include) - diff --git a/OMCompiler/SimulationRuntime/c/simulation/solver/CMakeLists.txt b/OMCompiler/SimulationRuntime/c/simulation/solver/CMakeLists.txt deleted file mode 100644 index 7ca8093f762..00000000000 --- a/OMCompiler/SimulationRuntime/c/simulation/solver/CMakeLists.txt +++ /dev/null @@ -1,83 +0,0 @@ -# Jens Frenkel, Jens.Frenkel@tu-dresden.de, 2011-10-11 -# CMakefile for compilation of OMC - -ADD_SUBDIRECTORY(initialization) - -INCLUDE_DIRECTORIES( - "${OMCTRUNCHOME}/OMCompiler/Compiler/runtime/" - "${OMCTRUNCHOME}/build/include/omc/c" - "${OMCTRUNCHOME}/build/include/omc/msvc" - "${OMCTRUNCHOME}/build/include/omc/msvc/suitesparse") - -# Sources -SET(solver_sources ../../../../3rdParty/Cdaskr/solver/daux.c - ../../../../3rdParty/Cdaskr/solver/ddaskr.c - ../../../../3rdParty/Cdaskr/solver/dlinpk.c - dassl.c - delay.c - events.c - external_input.c - irksco.c - kinsolSolver.c - linearSolverLapack.c - linearSolverLis.c - linearSolverTotalPivot.c - linearSolverUmfpack.c - linearSystem.c - mixedSearchSolver.c - mixedSystem.c - model_help.c - newtonIteration.c - nonlinearSolverHomotopy.c - nonlinearSolverHybrd.c - nonlinearSolverNewton.c - nonlinearSystem.c - omc_math.c - radau.c - sample.c - solver_main.c - spatialDistribution.c - stateset.c - sundials_error.c - sym_solver_ssc.c) - -# Headers -SET(solver_headers ../../../../3rdParty/Cdaskr/solver/ddaskr_types.h - dassl.h - delay.h - epsilon.h - events.h - external_input.h - irksco.h - kinsolSolver.h - linearSolverLapack.h - linearSolverLis.h - linearSolverTotalPivot.h - linearSolverUmfpack.h - linearSystem.h - mixedSearchSolver.h - mixedSystem.h - model_help.h - newtonIteration.h - nonlinearSolverHomotopy.h - nonlinearSolverHybrd.h - nonlinearSolverNewton.h - nonlinearSystem.h - omc_math.h - radau.h - solver_main.h - spatialDistribution.h - stateset.h - sundials_error.h - sym_solver_ssc.h) - -# Library util -ADD_LIBRARY(solver ${solver_sources} ${solver_headers}) -#TARGET_LINK_LIBRARIES(util) - -# Install -INSTALL(TARGETS solver - ARCHIVE DESTINATION lib/omc) - -#INSTALL(FILES ${solver_headers} DESTINATION include) - diff --git a/OMCompiler/SimulationRuntime/c/simulation/solver/initialization/CMakeLists.txt b/OMCompiler/SimulationRuntime/c/simulation/solver/initialization/CMakeLists.txt deleted file mode 100644 index 83af1590077..00000000000 --- a/OMCompiler/SimulationRuntime/c/simulation/solver/initialization/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Jens Frenkel, Jens.Frenkel@tu-dresden.de, 2011-10-11 -# CMakefile for compilation of OMC - -# Quellen und Header -SET(initialization_sources initialization.c) - -SET(initialization_headers initialization.h) - -INCLUDE_DIRECTORIES("${OMCTRUNCHOME}/OMCompiler/Compiler/runtime/") - -# Library util -ADD_LIBRARY(initialization ${initialization_sources} ${initialization_headers}) -#TARGET_LINK_LIBRARIES(util) - -# Install -INSTALL(TARGETS initialization - ARCHIVE DESTINATION lib/omc) - -#INSTALL(FILES ${initialization_headers} DESTINATION include) - diff --git a/OMCompiler/SimulationRuntime/c/util/CMakeLists.txt b/OMCompiler/SimulationRuntime/c/util/CMakeLists.txt deleted file mode 100644 index c6e7f13141d..00000000000 --- a/OMCompiler/SimulationRuntime/c/util/CMakeLists.txt +++ /dev/null @@ -1,85 +0,0 @@ -# Sources and headers -SET(util_sources ../gc/memory_pool.c - base_array.c - boolean_array.c - division.c - doubleEndedList.c - index_spec.c - integer_array.c - jacobian_util.c - java_interface.c - libcsv.c - list.c - modelica_string_lit.c - modelica_string.c - ModelicaUtilities.c - OldModelicaTables.c - omc_error.c - omc_file.c - omc_init.c - omc_mmap.c - omc_msvc.c - parallel_helper.c - rational.c - read_csv.c - read_matlab4.c - read_write.c - real_array.c - ringbuffer.c - rtclock.c - simulation_options.c - string_array.c - utility.c - varinfo.c - write_csv.c) - - -SET(util_headers ../gc/memory_pool.h - ../ModelicaUtilities.h - base_array.h - boolean_array.h - division.h - doubleEndedList.h - index_spec.h - integer_array.h - jacobian_util.h - java_interface.h - jni_md_solaris.h - jni_md_windows.h - jni_md.h - jni.h - list.h - modelica_string_lit.h - modelica_string.h - modelica.h - omc_error.h - omc_file.h - omc_init.h write_csv.h - omc_mmap.h - parallel_helper.h - rational.h - read_matlab4.h - read_write.h - real_array.h - ringbuffer.h - rtclock.h - simulation_options.h - string_array.h - utility.h - varinfo.h) - -if(MSVC) - INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/OMCompiler/3rdParty/regex-0.12) - SET(util_sources ${util_sources} ${OMCTRUNCHOME}/OMCompiler/3rdParty/regex-0.12/regex.c) - SET(util_headers ${util_headers} ${OMCTRUNCHOME}/OMCompiler/3rdParty/regex-0.12/regex.h) -endif(MSVC) - -# Library util -ADD_LIBRARY(util ${util_sources} ${util_headers}) -#TARGET_LINK_LIBRARIES(util) - -# Install -INSTALL(TARGETS util - ARCHIVE DESTINATION lib/omc) - -#INSTALL(FILES ${util_headers} DESTINATION include)