Skip to content

Commit

Permalink
CMake improvements (#7699)
Browse files Browse the repository at this point in the history
@mahge
[cmake] Notify about slow LAPACK existence check.
cf8fb52

@mahge
[cmake] Remove trailing whitespace
7271dc5

@mahge
[cmake] Update commented out content. For later. …
9318ffb
  - This is about generating OpenModelicaBootstrappingHeader.h
 
@mahge
[cmake] Add new MM files to cmake compilation.
3a785e9
  • Loading branch information
mahge committed Jul 16, 2021
1 parent b1b6796 commit d4b39c9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
3 changes: 3 additions & 0 deletions OMCompiler/Compiler/.cmake/meta_modelica_source_list.cmake
Expand Up @@ -295,6 +295,7 @@ set(OMC_MM_BACKEND_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFCallParameterTree.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFCardinalityTable.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFCeval.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFCheckModel.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFClass.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFClassTree.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFClockKind.mo
Expand All @@ -320,6 +321,7 @@ set(OMC_MM_BACKEND_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFFlatModel.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFFlatten.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFFunctionDerivative.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFFunctionInverse.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFFunction.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFHashTable3.mo
${CMAKE_CURRENT_SOURCE_DIR}/NFFrontEnd/NFHashTableCG.mo
Expand Down Expand Up @@ -377,6 +379,7 @@ set(OMC_MM_BACKEND_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/Script/MMToJuliaUtil.mo
${CMAKE_CURRENT_SOURCE_DIR}/Script/MMToJuliaKeywords.mo
${CMAKE_CURRENT_SOURCE_DIR}/Script/NFApi.mo
${CMAKE_CURRENT_SOURCE_DIR}/Script/Conversion.mo

${CMAKE_CURRENT_SOURCE_DIR}/SimCode/HpcOmSimCodeMain.mo
${CMAKE_CURRENT_SOURCE_DIR}/SimCode/SerializeInitXML.mo
Expand Down
22 changes: 13 additions & 9 deletions OMCompiler/Compiler/boot/CMakeLists.txt
Expand Up @@ -3,7 +3,7 @@ project(bomc)

# OpenModelicaBootstrappingHeader.h should probably be added to source control and
# updated just like the bootstrap-source c files.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tarball-include/OpenModelicaBootstrappingHeader.h
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tarball-include/OpenModelicaBootstrappingHeader.h
${CMAKE_CURRENT_SOURCE_DIR}/../OpenModelicaBootstrappingHeader.h)

file(GLOB BOOTSTRAP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/bootstrap-sources/build/*.c)
Expand Down Expand Up @@ -56,23 +56,27 @@ add_custom_command (
# TARGET bomc
# POST_BUILD

# DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../FrontEnd/Absyn.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../Script/GlobalScript.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../FrontEnd/Values.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../Util/Error.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../Util/Util.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../Util/FMI.mo
# DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../FrontEnd/Absyn.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../Script/GlobalScript.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../FrontEnd/Values.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../Util/ErrorTypes.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../Util/Config.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../Util/Gettext.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../Util/FMI.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../NFFrontEnd/NFType.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../NFFrontEnd/NFExpression.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../NFFrontEnd/NFDimension.mo
# ${CMAKE_CURRENT_SOURCE_DIR}/../GenerateOMCHeader.mos

# # The GenerateOMCHeader.mos script expects us to be in OMCompiler/Compiler folder.
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../


# COMMAND $<TARGET_FILE:bomc> -g=MetaModelica ${CMAKE_CURRENT_SOURCE_DIR}/../GenerateOMCHeader.mos
# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../OpenModelicaBootstrappingHeader.h.new
# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../OpenModelicaBootstrappingHeader.h.new
# ${CMAKE_CURRENT_SOURCE_DIR}/../OpenModelicaBootstrappingHeader.h

# BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/../OpenModelicaBootstrappingHeader.h
# OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/../OpenModelicaBootstrappingHeader.h
# BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/../OpenModelicaBootstrappingHeader.h.new
# COMMENT "Generating ${CMAKE_CURRENT_SOURCE_DIR}/../OpenModelicaBootstrappingHeader.h"
# )
7 changes: 4 additions & 3 deletions OMCompiler/Compiler/runtime/CMakeLists.txt
Expand Up @@ -3,6 +3,7 @@ find_package(Intl REQUIRED)
find_package(Iconv REQUIRED)

if(OMC_USE_LAPACK)
message(STATUS "Looking for LAPACK. This can be slow sometimes. Hang tight!")
find_package(LAPACK REQUIRED)

# Check if our lapack version have the deprecated functions.
Expand Down Expand Up @@ -191,7 +192,7 @@ target_link_libraries(omcgraphstream-boot PUBLIC omc::3rd::netstream)
################################################################################
# This is a lazy approach to generating runtime/config.unix.h and Compiler/Util/Autoconf.mo
# Needs to be refactored quite a bit. The variable names should be updated to be more
# unique and descriptive.
# unique and descriptive.
# However, If I do that I need to update the .in files which means the normal compilation is
# also affected. As a result I would have to change a few things since many things depend on
# the generated output files. For now just mimic the old compilation.
Expand Down Expand Up @@ -256,7 +257,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/revision.h.in ${CMAKE_CURRENT_SOURCE_
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.unix.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.unix.h)


# Generate Autoconf.mo here since we have some of the variables already defined for config.unix.h above.
# Generate Autoconf.mo here since we have some of the variables already defined for config.unix.h above.

if(WIN32)

Expand Down Expand Up @@ -289,6 +290,6 @@ else()
set(RT_LDFLAGS_GENERATED_CODE " -lOpenModelicaRuntimeC -llapack -lblas -lm -lomcgc -lpthread -rdynamic")
set(RT_LDFLAGS_GENERATED_CODE_SIM " -lSimulationRuntimeC -llapack -lblas -lm -lomcgc -lpthread -rdynamic -Wl,--no-undefined")
set(RT_LDFLAGS_GENERATED_CODE_SOURCE_FMU " -llapack -lblas -lm -lpthread -rdynamic -Wl,--no-undefined")

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Util/Autoconf.mo.in ${CMAKE_CURRENT_SOURCE_DIR}/../Util/Autoconf.mo)
endif()

0 comments on commit d4b39c9

Please sign in to comment.