Changeset 662060f4 in OpenModelica


Ignore:
Timestamp:
2020-10-21T14:04:16+02:00 (4 years ago)
Author:
Mahder Gebremedhin <mahder.gebremedhin@…>
Children:
0846120c
Parents:
f922c1f
git-author:
Mahder Gebremedhin <mahder.gebremedhin@…> (09/07/20 18:03:20)
git-committer:
Mahder Gebremedhin <mahder.gebremedhin@…> (10/21/20 14:04:16)
Message:

[cmake] Selectively include old/new cmake source.

  • The CMakeLists.txt in SimulationRuntime/c is actually used for compilation of simulationruntimemsvc library. Therefor we need to keep it for now.

To do this we include one of the old or new cmake sources in the
main CMakelists.tx file in c/ folder based on a variable that is
either defined or undefined depening on which compilation
(new cmake or makefile.omdev.mingw) is used.

Location:
OMCompiler
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/CMakeLists.txt

    rb9156e9 r662060f4  
    11cmake_minimum_required(VERSION 3.14)
    22project(OMCompiler)
     3
     4# We use this to selectively include some cmake source files
     5# e.g. simulationRuntime/c/ has two cmake sources that are conditionally
     6# included. The old (cmake 2.8) cmake source in there is used for compilation
     7# of simulationruntimemsvc by the Makefile.omdev.mingw makefiles.
     8set(OPENMODELICA_NEW_CMAKE_BUILD ON)
    39
    410# set(CMAKE_VERBOSE_MAKEFILE ON)
  • OMCompiler/SimulationRuntime/c/CMakeLists.txt

    rb5b95099 r662060f4  
    1 cmake_minimum_required(VERSION 3.14)
     1cmake_minimum_required(VERSION 2.6)
    22
    3 project(SimulationRuntimeC)
    4 
    5 
    6 file(GLOB OMC_SIMRT_UTIL_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/util/*.c)
    7 file(GLOB OMC_SIMRT_UTIL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/util/*.h)
    8 
    9 file(GLOB OMC_SIMRT_META_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/meta/*.c)
    10 file(GLOB OMC_SIMRT_META_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/meta/*.h)
    11 
    12 file(GLOB OMC_SIMRT_GC_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/gc/*.c)
    13 file(GLOB OMC_SIMRT_GC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/gc/*.h)
    14 
    15 file(GLOB OMC_SIMRT_FMI_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/fmi/*.c)
    16 file(GLOB OMC_SIMRT_FMI_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/fmi/*.h)
    17 
    18 
    19 set(libOpenModelicaRuntimeC_BUILD_TYPE STATIC CACHE STRING "Type of OpenModelicaRuntimeC to build")
    20 omc_add_to_report(libOpenModelicaRuntimeC_BUILD_TYPE)
    21 
    22 add_library(OpenModelicaRuntimeC ${libOpenModelicaRuntimeC_BUILD_TYPE}
    23                                     ${OMC_SIMRT_UTIL_SOURCES}
    24                                     ${OMC_SIMRT_META_SOURCES}
    25                                     ${OMC_SIMRT_GC_SOURCES})
    26 target_link_libraries(OpenModelicaRuntimeC PUBLIC omc::3rd::gc regex dbghelp)
    27 target_compile_options(OpenModelicaRuntimeC PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Werror=implicit-function-declaration>)
    28 # target_link_libraries(OpenModelicaRuntimeC PUBLIC $<$<CXX_COMPILER_ID:gcc>:dbghelp>)
    29 
    30 target_include_directories(OpenModelicaRuntimeC INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
    31 
    32 
    33 
    34 set(libOpenModelicaFMIRuntimeC_BUILD_TYPE STATIC CACHE STRING "Type of OpenModelicaFMIRuntimeC to build" FORCE)
    35 omc_add_to_report(libOpenModelicaFMIRuntimeC_BUILD_TYPE)
    36 
    37 add_library(OpenModelicaFMIRuntimeC ${libOpenModelicaFMIRuntimeC_BUILD_TYPE}
    38                                     ${OMC_SIMRT_FMI_SOURCES})
    39 
    40 
    41 target_link_libraries(OpenModelicaFMIRuntimeC PUBLIC omc::3rd::fmilib::shared)
    42 target_link_libraries(OpenModelicaFMIRuntimeC PUBLIC OpenModelicaRuntimeC)
    43 target_compile_options(OpenModelicaFMIRuntimeC PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Werror=implicit-function-declaration>)
    44 
     3# if OPENMODELICA_NEW_CMAKE_BUILD is defined (in OMCompiler/CMakeLists.txt)
     4# then we pick up the new cmake source.
     5# Otherwise we pick the old one which is needed for compilation of
     6# simulationruntimemsvc and is called from the Makefile.omdev.mingw files
     7if(OPENMODELICA_NEW_CMAKE_BUILD)
     8  include(cmake_3.14.cmake)
     9else(OPENMODELICA_NEW_CMAKE_BUILD)
     10  include(cmake_2.8.cmake)
     11endif(OPENMODELICA_NEW_CMAKE_BUILD)
Note: See TracChangeset for help on using the changeset viewer.