Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable, build and install the OMShell-terminal. (#9722)
- This offers it as a default-enabled optional component. It can be disabled by specifying ```cmake OM_OMSHELL_ENABLE_TERMINAL=OFF ``` to the CMake configure command.
- Loading branch information
Showing
9 changed files
with
137 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
cmake_minimum_required (VERSION 3.14) | ||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME gui) | ||
|
||
|
||
project(OMShell) | ||
|
||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
set(CMAKE_AUTOUIC ON) | ||
|
||
|
||
find_package(Qt5 COMPONENTS Widgets PrintSupport WebKitWidgets Xml REQUIRED) | ||
## The autotools/Makefiles based OpenModelica build skips omshell-terminal on Windows. | ||
## So we make it default-enabled optional component here as well. In case it needs to be disabled in some cases. | ||
option(OM_OMSHELL_ENABLE_TERMINAL "Enable building the OMShell REPL terminal (in addition to the OMSell GUI)" ON) | ||
|
||
omc_add_subdirectory(OMShell/OMShellGUI) | ||
|
||
if(OM_OMSHELL_ENABLE_TERMINAL) | ||
omc_add_subdirectory(mosh) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
|
||
|
||
# We have our own module for this. CMake does not provide one yet. | ||
find_package(Readline REQUIRED) | ||
|
||
set(OMSHELL_TERMINAL_SOURCES src/mosh.cpp | ||
src/omcinteractiveenvironment.cpp | ||
src/options.cpp) | ||
|
||
add_executable(OMShell-terminal ${OMSHELL_TERMINAL_SOURCES}) | ||
|
||
target_link_libraries(OMShell-terminal PRIVATE OpenModelicaCompiler) | ||
target_link_libraries(OMShell-terminal PRIVATE Readline::Readline) | ||
|
||
install(TARGETS OMShell-terminal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
## This is not fully tested. | ||
## It is used only by the optional (default disabled) OMShell-terminal right now. | ||
|
||
## readline needs curses. If you switch to static versions of readline enable this | ||
## and explicitly add the target_link_libraries down below. | ||
# find_package(Curses REQUIRED) | ||
|
||
# Try finding with PkgConfig to get some hints | ||
find_package(PkgConfig) | ||
pkg_check_modules(PC_Readline QUIET readline) | ||
|
||
# message(STATUS "PC_Readline_LIBRARIES: ${PC_Readline_LIBRARIES}") | ||
# message(STATUS "PC_Readline_INCLUDE_DIRS: ${PC_Readline_INCLUDE_DIRS}") | ||
# message(STATUS "PC_Readline_LIBRARY_DIRS: ${PC_Readline_LIBRARY_DIRS}") | ||
# message(STATUS "PC_Readline_LDFLAGS: ${PC_Readline_LDFLAGS}") | ||
|
||
## Find and set the Readline_INCLUDE_DIR using the info from PkgConfig | ||
find_path(Readline_INCLUDE_DIR | ||
NAMES readline.h | ||
PATHS ${PC_Readline_INCLUDE_DIRS} | ||
PATH_SUFFIXES readline | ||
) | ||
|
||
## Find and set the Readline_LIBRARY using the info from PkgConfig | ||
find_library(Readline_LIBRARY | ||
NAMES readline | ||
PATHS ${PC_Readline_LIBRARY_DIRS} | ||
) | ||
|
||
# message(STATUS "Readline_LIBRARY: ${Readline_LIBRARY}") | ||
# message(STATUS "Readline_VERSION: ${Readline_VERSION}") | ||
|
||
## Handle the standard CMake arguments, e.g REQUIRED, VERSION ... | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(Readline | ||
FOUND_VAR Readline_FOUND | ||
REQUIRED_VARS | ||
Readline_LIBRARY | ||
Readline_INCLUDE_DIR | ||
VERSION_VAR Readline_VERSION | ||
) | ||
|
||
## Add an imported target for the library so we would not have to | ||
## deal with specifying include directories and additional flags manually. | ||
if(Readline_FOUND AND NOT TARGET Readline::Readline) | ||
add_library(Readline::Readline UNKNOWN IMPORTED) | ||
set_target_properties(Readline::Readline PROPERTIES | ||
IMPORTED_LOCATION "${Readline_LIBRARY}" | ||
INTERFACE_COMPILE_OPTIONS "${PC_Readline_CFLAGS_OTHER}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${Readline_INCLUDE_DIR}" | ||
) | ||
# target_link_libraries(Readline::Readline INTERFACE ${CURSES_LIBRARIES}) | ||
endif() | ||
|
||
## compatibility variables | ||
set(Readline_VERSION_STRING ${Readline_VERSION}) | ||
|
||
## Hide some of the variables by default in user interfaces. | ||
## They are just noise most of the time. | ||
mark_as_advanced( | ||
Readline_INCLUDE_DIR | ||
Readline_LIBRARY | ||
) |