Skip to content

Commit

Permalink
Cleanup/Fixup installation components. (#9639)
Browse files Browse the repository at this point in the history
For now, there are six install components 
  
  - `omc`: the core omc compiler without any simulation runtime, i.e., omc executable and shared libs needed to run it (`libOpenModelicaRuntimeC` and `omcgc`).

  - `simrt`: everything needed to run a simulation using omc. This includes

      - anything installed from `3rdParty` (technically not needed to be distributed but
        we need to clean that later.) EXCEPT `omcgc` (see `omc`).
      - Everything we install from SimulationRuntime/c EXCEPT `libOpenModelicaRuntimeC` (see `omc`)

  - `simrt-cpp`: Everything we install from `SimulationRuntime/cpp`

  - `fmu`: Everything needed to compile an FMU (normal or source FMU) including the simulation runtime source files needed for creating Source-Code FMUs.

  - `gui`: All the gui clients, i.e., anything installed from `OMEdit`, `OMPlot`, `OMShell` and `OMNotebook`. This can be split up later if needed.

  - `omsimulator`: The `OMSimulator` executable and libraries. This should probably be handled in its own repo and added as a dependency here.
  • Loading branch information
mahge committed Nov 1, 2022
1 parent 3be0d5e commit 2c1c44e
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 18 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Expand Up @@ -139,7 +139,11 @@ endif()
## Do not print unnecessary install messages when nothing has actually changed.
set(CMAKE_INSTALL_MESSAGE LAZY)


# Set a 'catch-all' install component "unknown-install-component". If you see some install component under this
# id, then you know that something has not set an install component either explicily on the install() command
# or at higher level using 'set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME <id>)' to cover all install() commands
# issues after it.
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "unknown-install-component")

## Subdirectories ##########################################################################################
omc_add_subdirectory(OMCompiler)
Expand Down
6 changes: 6 additions & 0 deletions OMCompiler/CMakeLists.txt
@@ -1,6 +1,12 @@
cmake_minimum_required(VERSION 3.14)
project(OMCompiler C CXX)

# For now, unless explicitly specified otherwise, we set install component simrt
# for everything installed from the OMCompiler directory. There are some places that
# modify this explictly, e.g., the omc compiler ('COMPONENT omc'), the cpp runtime (simrt-cpp),
# and FMU realted installtions (COMPONENT fmu)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME simrt)

## OPTIONS #################################################################################################

omc_option(OM_OMC_ENABLE_FORTRAN "Enable Fortran support. Fortran is required if you enable IPOPT support." ON)
Expand Down
10 changes: 5 additions & 5 deletions OMCompiler/Compiler/CMakeLists.txt
Expand Up @@ -262,22 +262,22 @@ endif()
# They are part of "compiler" installation component. This means that you can
# install just the files in this component by specifying its name.
install(TARGETS omc OpenModelicaCompiler
COMPONENT compiler)
COMPONENT omc)

# Install the *ModelicaBuiltin files to <library_dir>/omc/ that is where omc.exe expects them to be.
# They are also part of "compiler" installation component.
install(FILES NFFrontEnd/NFModelicaBuiltin.mo
DESTINATION lib/omc
COMPONENT compiler)
COMPONENT omc)
install(FILES FrontEnd/ModelicaBuiltin.mo
DESTINATION lib/omc
COMPONENT compiler)
COMPONENT omc)
install(FILES FrontEnd/MetaModelicaBuiltin.mo
DESTINATION lib/omc
COMPONENT compiler)
COMPONENT omc)
install(FILES FrontEnd/PDEModelicaBuiltin.mo
DESTINATION lib/omc
COMPONENT compiler)
COMPONENT omc)

# Install the scripts to 'share' dir.
install(DIRECTORY scripts
Expand Down
2 changes: 1 addition & 1 deletion OMCompiler/Compiler/boot/CMakeLists.txt
Expand Up @@ -33,7 +33,7 @@ endif()

# OMC will overflow the stack (at least on Windows old OMDev) on very deep recursive calls.
# E.g., try translating the CodegenCpp* tpl files to mo files with
# an omc not compiled without large stack size. The tpl parser is quite recursive and will
# an omc compiled without large stack size. The tpl parser is quite recursive and will
# overflow on parsing comments with very long lines ~300. *CPP tpl files have lines longer
# than that.
if(MINGW)
Expand Down
3 changes: 0 additions & 3 deletions OMCompiler/Compiler/runtime/CMakeLists.txt
Expand Up @@ -13,9 +13,6 @@ if(OM_OMC_USE_LAPACK)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_OLD})
endif()


# find_package(ZLIB REQUIRED) # Not needed. We use the minizip lib from 3rdParty/FMIL instead

# On Win32 we use system UUID lib which is one of the default libs that cmake adds to any target on Win32. On non Win32
# systems we need to link explicitly to uuid. However, there is no FindUUID yet. We can add one later. Instead we use
# find library for now. It should be okay for now since I am guessing uuid headers should be in the default include dirs
Expand Down
28 changes: 21 additions & 7 deletions OMCompiler/SimulationRuntime/c/cmake/source_code_fmu_config.cmake
Expand Up @@ -61,7 +61,9 @@ set(SOURCE_FMU_COMMON_FILES_LIST ./gc/memory_pool.c
foreach(source_file ${SOURCE_FMU_COMMON_FILES_LIST})
list(APPEND SOURCE_FMU_COMMON_FILES_LIST_QUOTED \"${source_file}\")
get_filename_component(DEST_DIR ${source_file} DIRECTORY)
install(FILES ${source_file} DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR})
install(FILES ${source_file}
DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR}
COMPONENT fmu)
endforeach()
string(REPLACE ";" ",\n " SOURCE_FMU_COMMON_FILES "${SOURCE_FMU_COMMON_FILES_LIST_QUOTED}")

Expand Down Expand Up @@ -175,6 +177,7 @@ file(GLOB_RECURSE 3RD_DGESV_HEADERS ${OMCompiler_3rdParty_SOURCE_DIR}/dgesv/incl
install(FILES ${3RD_DGESV_HEADERS}
${3RD_DGESV_FILES}
DESTINATION ${SOURCE_FMU_SOURCES_DIR}/external_solvers
COMPONENT fmu
)

foreach(source_file_full_path ${3RD_DGESV_FILES})
Expand All @@ -192,7 +195,9 @@ set(SOURCE_FMU_NLS_FILES_LIST simulation/solver/nonlinearSolverHomotopy.c simula
foreach(source_file ${SOURCE_FMU_NLS_FILES_LIST})
list(APPEND SOURCE_FMU_NLS_FILES_LIST_QUOTED \"${source_file}\")
get_filename_component(DEST_DIR ${source_file} DIRECTORY)
install(FILES ${source_file} DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR})
install(FILES ${source_file}
DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR}
COMPONENT fmu)
endforeach()
string(REPLACE ";" "," SOURCE_FMU_NLS_FILES "${SOURCE_FMU_NLS_FILES_LIST_QUOTED}")

Expand All @@ -215,6 +220,7 @@ set(3RD_CMINPACK_HEADERS ${OMCompiler_3rdParty_SOURCE_DIR}/CMinpack/cminpack.h
install(FILES ${3RD_CMINPACK_HEADERS}
${3RD_CMINPACK_FMU_FILES}
DESTINATION ${SOURCE_FMU_SOURCES_DIR}/external_solvers
COMPONENT fmu
)

foreach(source_file_full_path ${3RD_CMINPACK_FMU_FILES})
Expand All @@ -232,7 +238,9 @@ set(SOURCE_FMU_LS_FILES_LIST simulation/solver/linearSystem.c simulation/solver/
foreach(source_file ${SOURCE_FMU_LS_FILES_LIST})
list(APPEND SOURCE_FMU_LS_FILES_LIST_QUOTED \"${source_file}\")
get_filename_component(DEST_DIR ${source_file} DIRECTORY)
install(FILES ${source_file} DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR})
install(FILES ${source_file}
DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR}
COMPONENT fmu)
endforeach()
string(REPLACE ";" "," SOURCE_FMU_LS_FILES "${SOURCE_FMU_LS_FILES_LIST_QUOTED}")

Expand All @@ -244,7 +252,9 @@ set(SOURCE_FMU_MIXED_FILES_LIST simulation/solver/mixedSearchSolver.c simulation
foreach(source_file ${SOURCE_FMU_MIXED_FILES_LIST})
list(APPEND SOURCE_FMU_MIXED_FILES_LIST_QUOTED \"${source_file}\")
get_filename_component(DEST_DIR ${source_file} DIRECTORY)
install(FILES ${source_file} DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR})
install(FILES ${source_file}
DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR}
COMPONENT fmu)
endforeach()
string(REPLACE ";" "," SOURCE_FMU_MIXED_FILES "${SOURCE_FMU_MIXED_FILES_LIST_QUOTED}")

Expand All @@ -257,7 +267,9 @@ set(SOURCE_FMU_CVODE_RUNTIME_FILES_LIST simulation/solver/cvode_solver.c simulat
foreach(source_file ${SOURCE_FMU_CVODE_RUNTIME_FILES_LIST})
list(APPEND SOURCE_FMU_CVODE_RUNTIME_FILES_LIST_QUOTED \"${source_file}\")
get_filename_component(DEST_DIR ${source_file} DIRECTORY)
install(FILES ${source_file} DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR})
install(FILES ${source_file}
DESTINATION ${SOURCE_FMU_SOURCES_DIR}/${DEST_DIR}
COMPONENT fmu)
endforeach()
string(REPLACE ";" "," SOURCE_FMU_CVODE_RUNTIME_FILES "${SOURCE_FMU_CVODE_RUNTIME_FILES_LIST_QUOTED}")

Expand All @@ -283,7 +295,8 @@ target_include_directories(SimulationRuntimeFMI PUBLIC ${CMAKE_CURRENT_SOURCE_DI

target_link_libraries(SimulationRuntimeFMI PUBLIC OMCPThreads::OMCPThreads)

install(TARGETS SimulationRuntimeFMI)
install(TARGETS SimulationRuntimeFMI
COMPONENT fmu)


# ######################################################################################################################
Expand All @@ -300,4 +313,5 @@ target_sources(OpenModelicaFMIRuntimeC PRIVATE ${OMC_SIMRT_FMI_SOURCES})
# target_link_libraries(OpenModelicaFMIRuntimeC_base PUBLIC omc::config)
target_link_libraries(OpenModelicaFMIRuntimeC PUBLIC omc::3rd::fmilib)

install(TARGETS OpenModelicaFMIRuntimeC)
install(TARGETS OpenModelicaFMIRuntimeC
COMPONENT fmu)
3 changes: 2 additions & 1 deletion OMCompiler/SimulationRuntime/c/cmake_3.14.cmake
Expand Up @@ -54,7 +54,8 @@ elseif(MSVC)
set_target_properties(OpenModelicaRuntimeC PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true)
endif()

install(TARGETS OpenModelicaRuntimeC)
install(TARGETS OpenModelicaRuntimeC
COMPONENT omc)


# ######################################################################################################################
Expand Down
2 changes: 2 additions & 0 deletions OMCompiler/SimulationRuntime/cpp/cmake_3.14.cmake
Expand Up @@ -9,6 +9,8 @@ set(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_LIBDIR})
# CPP headers are installed in include/omc/cpp for now.
set(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/cpp)

set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME simrt-cpp)



# Boost and a threading library are required for the CPP-runtime.
Expand Down
1 change: 1 addition & 0 deletions OMEdit/CMakeLists.txt
@@ -1,4 +1,5 @@
cmake_minimum_required (VERSION 3.14)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME gui)

project(OMEdit)

Expand Down
1 change: 1 addition & 0 deletions OMNotebook/CMakeLists.txt
@@ -1,4 +1,5 @@
cmake_minimum_required (VERSION 3.14)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME gui)

project(OMNotebook)

Expand Down
1 change: 1 addition & 0 deletions OMPlot/CMakeLists.txt
@@ -1,4 +1,5 @@
cmake_minimum_required (VERSION 3.14)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME gui)

project(OMPlot)

Expand Down
2 changes: 2 additions & 0 deletions OMShell/CMakeLists.txt
@@ -1,4 +1,6 @@
cmake_minimum_required (VERSION 3.14)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME gui)


project(OMShell)

Expand Down
2 changes: 2 additions & 0 deletions omsimulator.cmake
@@ -1,4 +1,6 @@

set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME omsimulator)


include(ExternalProject)
include(ProcessorCount)
Expand Down

0 comments on commit 2c1c44e

Please sign in to comment.