Changeset 88b5250f in OpenModelica


Ignore:
Timestamp:
2020-10-21T14:04:18+02:00 (4 years ago)
Author:
Mahder Gebremedhin <mahder.gebremedhin@…>
Children:
ea3c8823
Parents:
d0e20bb
git-author:
Mahder Gebremedhin <mahder.gebremedhin@…> (10/15/20 10:41:05)
git-committer:
Mahder Gebremedhin <mahder.gebremedhin@…> (10/21/20 14:04:18)
Message:

[cmake] Remove unnecessary package_list file.

  • The list of MM filenames part of the compilation is now generated by cmake itself during build system generation. The file contains a list of just the filenames (no path, no extension) to be read by the simple dep_scanner executable.
  • Add some comments to the CMakeLists file. There needs to be more. Maybe writing a whole standalone documentation can even be better as soon as this is stable.
Location:
OMCompiler/Compiler
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/CMakeLists.txt

    r577c0c0b r88b5250f  
    3030
    3131
    32 add_executable(dep_scanner ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/dep_scanner.cpp)
    33 target_compile_features(dep_scanner PRIVATE cxx_std_11)
    34 
    35 
    36 
    37 
    38 
    3932
    4033macro(add_interface_check_step mo_source_file)
     
    5548    )
    5649
    57     set(OMC_MM_SOURCE_FILES ${OMC_MM_SOURCE_FILES} ${mo_source_file})
     50    set(OMC_MM_SOURCE_FILE_NAMES ${OMC_MM_SOURCE_FILE_NAMES} ${file_name_no_ext})
    5851
    5952    set(OMC_MM_INTERFACE_FILES ${OMC_MM_INTERFACE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${file_name_no_ext}.interface.mo)
     
    124117
    125118
     119
     120# A target to make sure all interfaces have been checked. Interfaces get rechecked if a MM source is
     121# modified. If a source is modified and the interface has NOT actually changed then only the stamp files
     122# are touched to signify time of check. If the interface has CHANGED then the interface file is also
     123# updated which will cause regeneration of dependency information. See the section below.
    126124add_custom_target(INTERFACE_CHECK
    127125                  DEPENDS ${OMC_MM_STAMP_FILES}
    128126                  COMMENT "Checked interfaces of modified MetaModelica sources.")
    129127
     128
     129
     130
     131# Add a small dependency scanner program. This reads a list of list of dependencies and generates
     132# a list of dependents for each entry.
     133add_executable(dep_scanner ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/dep_scanner.cpp)
     134target_compile_features(dep_scanner PRIVATE cxx_std_11)
     135
     136# Write out a new line separated list of all MM source files to a list so that it can be easily
     137# parsed by the small MetaModelica dependency scanner we have now. (c++ code)
     138# The quote "" on ${OMC_MM_SOURCE_FILE_NAMES} is needed to get the ";"s in the list
     139string (REPLACE ";" "\n" OMC_MM_SOURCE_FILE_NAMES_NEW_LINES "${OMC_MM_SOURCE_FILE_NAMES}")
     140file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/mm_source_filenames_list.txt ${OMC_MM_SOURCE_FILE_NAMES_NEW_LINES})
     141
     142# Read the mm_source_filenames_list with the dep scanner. The dep scanner then reads <mm_source>.depends file for the
     143# each mm_source in the list and generates the "reverse dependencies" (dependents) for each source in to <mm_source>.rev_deps.
     144# This means all the files listed in .rev_deps need to be retranslated when <mm_source>.mo is modified.
    130145add_custom_command(
    131146                DEPENDS ${OMC_MM_INTERFACE_FILES}
    132                 COMMAND $<TARGET_FILE:dep_scanner> ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/package_list.txt ${CMAKE_CURRENT_BINARY_DIR}
     147                COMMAND $<TARGET_FILE:dep_scanner> ${CMAKE_CURRENT_BINARY_DIR}/mm_source_filenames_list.txt ${CMAKE_CURRENT_BINARY_DIR}
    133148                COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/dep_scan.stamp
    134149                OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dep_scan.stamp
     
    139154
    140155
     156
     157
     158
    141159add_custom_target(DEPENDENCY_UPDATE
    142160                  DEPENDS ${OMC_REV_DEP_STAMP_FILES}
     
    147165add_dependencies(DEPENDENCY_UPDATE DEPENDENCY_SCAN)
    148166
     167
     168
     169
    149170add_library(OpenModelicaCompiler STATIC ${OMC_C_SOURCE_FILES} .cmake/omc_entry_point.c)
    150171target_compile_definitions(OpenModelicaCompiler PRIVATE ADD_METARECORD_DEFINITIONS=)
     
    153174
    154175
    155 include_regular_expression("^$")
    156176# There is a lonely omc_file.h in Util/. It belongs in runtime/. Remove this when it is moved.
    157177target_include_directories(OpenModelicaCompiler PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Util)
    158 
    159 # include_regular_expression("^.*$" "^$")
    160178
    161179
Note: See TracChangeset for help on using the changeset viewer.