build simplified: qtermwidget is versioned (libqtermwidget4 for Qt4, 5 for Qt5...). Better cmake support.
This commit is contained in:
+199
-20
@@ -1,32 +1,211 @@
|
||||
###| Cmake qtermwidget |###
|
||||
|
||||
option(BUILD_DESIGNER_PLUGIN "Build Qt4 designer plugin" ON)
|
||||
option(USE_QT5 "Build using Qt5. Default OFF." OFF)
|
||||
option(BUILD_TEST "Build test application. Default OFF." OFF)
|
||||
|
||||
#| Setting required version
|
||||
cmake_minimum_required( VERSION 2.4 )
|
||||
cmake_minimum_required( VERSION 2.8 )
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake )
|
||||
|
||||
#| Project
|
||||
project( qtermwidget )
|
||||
|
||||
#| Library Versioning
|
||||
#| Libraries are not versioned by default
|
||||
set ( qtermwidget_VERSION_MAJOR "0" )
|
||||
set ( qtermwidget_VERSION_MINOR "4" )
|
||||
set ( qtermwidget_VERSION_PATCH "0" )
|
||||
set ( qtermwidget_VERSION
|
||||
"${qtermwidget_VERSION_MAJOR}.${qtermwidget_VERSION_MINOR}.${qtermwidget_VERSION_PATCH}"
|
||||
# Lets start to follow Qt library versioning. 4.x for Qt4, 5.x for Qt5
|
||||
if (USE_QT5)
|
||||
set(QTERMWIDGET_LIBRARY_NAME qtermwidget5)
|
||||
else (USE_QT5)
|
||||
set(QTERMWIDGET_LIBRARY_NAME qtermwidget4)
|
||||
endif (USE_QT5)
|
||||
# just change version for releases
|
||||
set ( QTERMWIDGET_VERSION_MAJOR "0" )
|
||||
set ( QTERMWIDGET_VERSION_MINOR "5" )
|
||||
set ( QTERMWIDGET_VERSION_PATCH "0" )
|
||||
|
||||
set ( QTERMWIDGET_VERSION "${QTERMWIDGET_VERSION_MAJOR}.${QTERMWIDGET_VERSION_MINOR}.${QTERMWIDGET_VERSION_PATCH}" )
|
||||
|
||||
|
||||
include(CheckFunctionExists)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
include_directories( ${CMAKE_SOURCE_DIR}/lib
|
||||
${CMAKE_BINARY_DIR}/lib
|
||||
${CMAKE_BINARY_DIR}
|
||||
)
|
||||
add_definitions( -Wall )
|
||||
|
||||
|
||||
if (USE_QT5)
|
||||
include(qtermwidget5_use)
|
||||
else (USE_QT5)
|
||||
include(qtermwidget4_use)
|
||||
endif (USE_QT5)
|
||||
|
||||
|
||||
# main library
|
||||
|
||||
set(SRCS
|
||||
lib/BlockArray.cpp
|
||||
lib/ColorScheme.cpp
|
||||
lib/Emulation.cpp
|
||||
lib/Filter.cpp
|
||||
lib/History.cpp
|
||||
lib/HistorySearch.cpp
|
||||
lib/KeyboardTranslator.cpp
|
||||
lib/konsole_wcwidth.cpp
|
||||
lib/kprocess.cpp
|
||||
lib/kpty.cpp
|
||||
lib/kptydevice.cpp
|
||||
lib/kptyprocess.cpp
|
||||
lib/Pty.cpp
|
||||
lib/qtermwidget.cpp
|
||||
lib/Screen.cpp
|
||||
lib/ScreenWindow.cpp
|
||||
lib/SearchBar.cpp
|
||||
lib/Session.cpp
|
||||
lib/ShellCommand.cpp
|
||||
lib/TerminalCharacterDecoder.cpp
|
||||
lib/TerminalDisplay.cpp
|
||||
lib/tools.cpp
|
||||
lib/Vt102Emulation.cpp
|
||||
)
|
||||
|
||||
subdirs(
|
||||
lib
|
||||
src
|
||||
# Only the Headers that need to be moc'd go here
|
||||
set(HDRS
|
||||
lib/Emulation.h
|
||||
lib/Filter.h
|
||||
lib/HistorySearch.h
|
||||
lib/kprocess.h
|
||||
lib/kptydevice.h
|
||||
lib/kptyprocess.h
|
||||
lib/Pty.h
|
||||
lib/qtermwidget.h
|
||||
lib/ScreenWindow.h
|
||||
lib/SearchBar.h
|
||||
lib/Session.h
|
||||
lib/TerminalDisplay.h
|
||||
lib/Vt102Emulation.h
|
||||
)
|
||||
|
||||
# a helper for macosx to build 32/64 bit universals
|
||||
IF (WANT_UNIVERSAL)
|
||||
SET (CMAKE_OSX_ARCHITECTURES "i386;x86_64;")
|
||||
MESSAGE(STATUS "Archs builds: ${CMAKE_OSX_ARCHITECTURES}")
|
||||
ENDIF (WANT_UNIVERSAL)
|
||||
set(UI lib/SearchBar.ui)
|
||||
|
||||
# for distribution
|
||||
set(HDRS_DISTRIB lib/qtermwidget.h )
|
||||
|
||||
# dirs
|
||||
set ( KB_LAYOUT_DIR ${CMAKE_INSTALL_DATADIR}/${QTERMWIDGET_LIBRARY_NAME}/kb-layouts/ )
|
||||
message ( STATUS "Keyboard layouts will be installed in: ${KB_LAYOUT_DIR}" )
|
||||
add_definitions( -DKB_LAYOUT_DIR="${CMAKE_INSTALL_PREFIX}/${KB_LAYOUT_DIR}" )
|
||||
|
||||
set ( COLORSCHEMES_DIR ${CMAKE_INSTALL_DATADIR}/${QTERMWIDGET_LIBRARY_NAME}/color-schemes/ )
|
||||
message ( STATUS "Color schemes will be installed in: ${COLORSCHEMES_DIR}" )
|
||||
add_definitions( -DCOLORSCHEMES_DIR="${CMAKE_INSTALL_PREFIX}/${COLORSCHEMES_DIR}" )
|
||||
|
||||
set(QTERMWIDGET_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${QTERMWIDGET_LIBRARY_NAME})
|
||||
|
||||
#| Defines
|
||||
add_definitions ( -DHAVE_POSIX_OPENPT -DHAVE_SYS_TIME_H )
|
||||
if (APPLE)
|
||||
add_definitions( -DHAVE_UTMPX -D_UTMPX_COMPAT )
|
||||
endif (APPLE)
|
||||
CHECK_FUNCTION_EXISTS(updwtmpx HAVE_UPDWTMPX)
|
||||
if (HAVE_UPDWTMPX)
|
||||
add_definitions( -DHAVE_UPDWTMPX )
|
||||
endif (HAVE_UPDWTMPX)
|
||||
|
||||
|
||||
if (USE_QT5)
|
||||
qt5_wrap_cpp(MOCS ${HDRS})
|
||||
qt5_wrap_ui(UI_SRCS ${UI})
|
||||
set(PKG_CONFIG_REQ "Qt5Core, Qt5Xml, Qt5Widgets")
|
||||
else (USE_QT5)
|
||||
qt4_wrap_cpp(MOCS ${HDRS})
|
||||
qt4_wrap_ui(UI_SRCS ${UI})
|
||||
set(PKG_CONFIG_REQ "QtCore, QtXml")
|
||||
endif (USE_QT5)
|
||||
|
||||
|
||||
add_library(${QTERMWIDGET_LIBRARY_NAME} SHARED ${SRCS} ${MOCS} ${UI_SRCS})
|
||||
target_link_libraries(${QTERMWIDGET_LIBRARY_NAME} ${QTERMWIDGET_QT_LIBRRAIES})
|
||||
set_target_properties( ${QTERMWIDGET_LIBRARY_NAME} PROPERTIES
|
||||
SOVERSION ${QTERMWIDGET_VERSION_MAJOR}
|
||||
VERSION ${QTERMWIDGET_VERSION}
|
||||
)
|
||||
if (APPLE)
|
||||
# this is a must to load the lib correctly
|
||||
set_target_properties( ${QTERMWIDGET_LIBRARY_NAME} PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_LIBDIR} )
|
||||
endif (APPLE)
|
||||
|
||||
install(TARGETS ${QTERMWIDGET_LIBRARY_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(FILES ${HDRS_DISTRIB} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${QTERMWIDGET_LIBRARY_NAME})
|
||||
# keyboard layouts
|
||||
install(DIRECTORY lib/kb-layouts/ DESTINATION ${KB_LAYOUT_DIR} FILES_MATCHING PATTERN "*.keytab" )
|
||||
# color schemes
|
||||
install(DIRECTORY lib/color-schemes/ DESTINATION ${COLORSCHEMES_DIR} FILES_MATCHING PATTERN "*.*schem*")
|
||||
|
||||
include(create_pkgconfig_file)
|
||||
create_pkgconfig_file(${QTERMWIDGET_LIBRARY_NAME}
|
||||
"QTermWidget library for Qt ${QTERMWIDGET_VERSION_MAJOR}.x"
|
||||
${PKG_CONFIG_REQ}
|
||||
${QTERMWIDGET_LIBRARY_NAME}
|
||||
${QTERMWIDGET_VERSION}
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/${QTERMWIDGET_LIBRARY_NAME}-config.cmake.in
|
||||
${CMAKE_BINARY_DIR}/${QTERMWIDGET_LIBRARY_NAME}-config.cmake
|
||||
@ONLY
|
||||
)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/${QTERMWIDGET_LIBRARY_NAME}-config.cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/${QTERMWIDGET_LIBRARY_NAME})
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/cmake/${QTERMWIDGET_LIBRARY_NAME}_use.cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/${QTERMWIDGET_LIBRARY_NAME})
|
||||
# end of main library
|
||||
|
||||
|
||||
# designer plugin
|
||||
if (BUILD_DESIGNER_PLUGIN)
|
||||
message(STATUS "Building Qt designer plugin")
|
||||
|
||||
include_directories(designer
|
||||
${QT_QTDESIGNER_INCLUDE_DIR})
|
||||
|
||||
set(DESIGNER_SRC lib/designer/qtermwidgetplugin.cpp)
|
||||
QT4_WRAP_CPP( DESIGNER_MOC lib/designer/qtermwidgetplugin.h)
|
||||
QT4_ADD_RESOURCES( DESIGNER_QRC lib/designer/qtermwidgetplugin.qrc)
|
||||
|
||||
link_directories(${CMAKE_BINARY_DIR})
|
||||
add_library( qtermwidget4plugin SHARED
|
||||
${DESIGNER_MOC}
|
||||
${DESIGNER_QRC}
|
||||
${DESIGNER_SRC}
|
||||
)
|
||||
add_dependencies(qtermwidget4plugin qtermwidget4)
|
||||
|
||||
target_link_libraries( qtermwidget4plugin
|
||||
${QT_QTCORE_LIBRARY}
|
||||
${QT_QTDESIGNER_LIBRARY}
|
||||
${QT_QTDESIGNERCOMPONENTS_LIBRARY}
|
||||
${QTERMWIDGET_LIBRARY_NAME}
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
# this is a must to load the lib correctly
|
||||
set_target_properties( qtermwidge4tplugin PROPERTIES
|
||||
INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/qt4/plugins/designer )
|
||||
endif (APPLE)
|
||||
|
||||
install( TARGETS qtermwidget4plugin DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/qt4/plugins/designer )
|
||||
|
||||
endif (BUILD_DESIGNER_PLUGIN)
|
||||
|
||||
|
||||
# end of designer plugin
|
||||
|
||||
|
||||
# test application
|
||||
if (BUILD_TEST)
|
||||
set(TEST_SRC src/main.cpp)
|
||||
add_executable(test ${TEST_SRC})
|
||||
add_dependencies(test ${QTERMWIDGET_LIBRARY_NAME})
|
||||
link_directories(${CMAKE_BINARY_DIR})
|
||||
target_link_libraries(test ${QTERMWIDGET_QT_LIBRARIES} ${QTERMWIDGET_LIBRARY_NAME} util)
|
||||
endif (BUILD_TEST)
|
||||
# end of test application
|
||||
|
||||
|
||||
CONFIGURE_FILE(
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# Write a pkg-config pc file for given "name" with "decription"
|
||||
# Arguments:
|
||||
# name: a library name (withoud "lib" prefix and "so" suffixes
|
||||
# desc: a desription string
|
||||
# requires: required libraries
|
||||
# include_rel_dir: include directory, relative to includedir
|
||||
# version: package version
|
||||
#
|
||||
macro (create_pkgconfig_file name desc requires include_rel_dir version)
|
||||
set(_pkgfname "${CMAKE_CURRENT_BINARY_DIR}/${name}.pc")
|
||||
message(STATUS "${name}: writing pkgconfig file ${_pkgfname}")
|
||||
|
||||
file(WRITE "${_pkgfname}"
|
||||
"prefix=${CMAKE_INSTALL_PREFIX}\n"
|
||||
"libdir=\${prefix}/${CMAKE_INSTALL_LIBDIR}\n"
|
||||
"includedir=\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}\n"
|
||||
"\n"
|
||||
"Name: ${name}\n"
|
||||
"Description: ${desc}\n"
|
||||
"Version: ${version}\n"
|
||||
"Requires: ${requires}\n"
|
||||
"Libs: -L\${libdir} -l${name}\n"
|
||||
"Cflags: -I\${includedir} -I\${includedir}/${include_rel_dir}\n"
|
||||
"\n"
|
||||
)
|
||||
|
||||
install(FILES ${_pkgfname} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
endmacro()
|
||||
@@ -0,0 +1,47 @@
|
||||
# - Find the QTermWidget include and library dirs and define a some macros
|
||||
#
|
||||
# The module defines the following variables
|
||||
# QTERMWIDGET_FOUND - Set to TRUE if all of the above has been found
|
||||
#
|
||||
# QTERMWIDGET_INCLUDE_DIR - The QTermWidget include directory
|
||||
#
|
||||
# QTERMWIDGET_INCLUDE_DIRS - The QTermWidget include directory
|
||||
#
|
||||
# QTERMWIDGET_LIBRARIES - The libraries needed to use QTermWidget
|
||||
#
|
||||
# QTERMWIDGET_USE_FILE - The variable QTERMWIDGET_USE_FILE is set which is the path
|
||||
# to a CMake file that can be included to compile qtermwidget
|
||||
# applications and libraries. It sets up the compilation
|
||||
# environment for include directories and populates a
|
||||
# QTERMWIDGET_LIBRARIES variable.
|
||||
#
|
||||
# QTERMWIDGET_QT_LIBRARIES - The Qt libraries needed by QTermWidget
|
||||
#
|
||||
# Typical usage:
|
||||
# option(USE_QT5 "Build using Qt5. Default off" OFF)
|
||||
# if (USE_QT5)
|
||||
# find_package(QTERMWIDGET4)
|
||||
# else()
|
||||
# find_package(QTERMWIDGET5)
|
||||
# endif()
|
||||
#
|
||||
# include(${QTERMWIDGET_USE_FILE})
|
||||
# add_executable(foo main.cpp)
|
||||
# target_link_libraries(foo ${QTERMWIDGET_QT_LIBRARIES} ${QTERMWIDGET_LIBRARIES})
|
||||
|
||||
set(QTERMWIDGET_INCLUDE_DIR @QTERMWIDGET_INCLUDE_DIR@)
|
||||
set(QTERMWIDGET_LIBRARY @QTERMWIDGET_LIBRARY_NAME@)
|
||||
|
||||
set(QTERMWIDGET_LIBRARIES ${QTERMWIDGET_LIBRARY})
|
||||
set(QTERMWIDGET_INCLUDE_DIRS ${QTERMWIDGET_INCLUDE_DIR})
|
||||
|
||||
set(QTERMWIDGET_USE_FILE ${CMAKE_CURRENT_LIST_DIR}/qtermwidget4_use.cmake)
|
||||
set(QTERMWIDGET_FOUND 1)
|
||||
|
||||
set(QTERMWIDGET_VERSION_MAJOR @QTERMWIDGET_VERSION_MAJOR@)
|
||||
set(QTERMWIDGET_VERSION_MINOR @QTERMWIDGET_VERSION_MINOR@)
|
||||
set(QTERMWIDGET_VERSION_PATCH @QTERMWIDGET_VERSION_PATCH@)
|
||||
set(QTERMWIDGET_VERSION @QTERMWIDGET_VERSION@)
|
||||
|
||||
mark_as_advanced(QTERMWIDGET_LIBRARY QTERMWIDGET_INCLUDE_DIR)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
find_package(Qt4 REQUIRED QUIET)
|
||||
include(${QT_USE_FILE})
|
||||
|
||||
set(QTERMWIDGET_QT_LIBRARIES ${QT_LIBRARIES})
|
||||
|
||||
include_directories(${QTERMWIDGET_INCLUDE_DIRS})
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# - Find the QTermWidget include and library dirs and define a some macros
|
||||
#
|
||||
# The module defines the following variables
|
||||
# QTERMWIDGET_FOUND - Set to TRUE if all of the above has been found
|
||||
#
|
||||
# QTERMWIDGET_INCLUDE_DIR - The QTermWidget include directory
|
||||
#
|
||||
# QTERMWIDGET_INCLUDE_DIRS - The QTermWidget include directory
|
||||
#
|
||||
# QTERMWIDGET_LIBRARIES - The libraries needed to use QTermWidget
|
||||
#
|
||||
# QTERMWIDGET_USE_FILE - The variable QTERMWIDGET_USE_FILE is set which is the path
|
||||
# to a CMake file that can be included to compile qtermwidget
|
||||
# applications and libraries. It sets up the compilation
|
||||
# environment for include directories and populates a
|
||||
# QTERMWIDGET_LIBRARIES variable.
|
||||
#
|
||||
# QTERMWIDGET_QT_LIBRARIES - The Qt libraries needed by QTermWidget
|
||||
#
|
||||
# Typical usage:
|
||||
# option(USE_QT5 "Build using Qt5. Default off" OFF)
|
||||
# if (USE_QT5)
|
||||
# find_package(QTERMWIDGET4)
|
||||
# else()
|
||||
# find_package(QTERMWIDGET5)
|
||||
# endif()
|
||||
#
|
||||
# include(${QTERMWIDGET_USE_FILE})
|
||||
# add_executable(foo main.cpp)
|
||||
# target_link_libraries(foo ${QTERMWIDGET_QT_LIBRARIES} ${QTERMWIDGET_LIBRARIES})
|
||||
|
||||
set(QTERMWIDGET_INCLUDE_DIR @QTERMWIDGET_INCLUDE_DIR@)
|
||||
set(QTERMWIDGET_LIBRARY @QTERMWIDGET_LIBRARY_NAME@)
|
||||
|
||||
set(QTERMWIDGET_LIBRARIES ${QTERMWIDGET_LIBRARY})
|
||||
set(QTERMWIDGET_INCLUDE_DIRS ${QTERMWIDGET_INCLUDE_DIR})
|
||||
|
||||
set(QTERMWIDGET_USE_FILE ${CMAKE_CURRENT_LIST_DIR}/qtermwidget5_use.cmake)
|
||||
set(QTERMWIDGET_FOUND 1)
|
||||
|
||||
set(QTERMWIDGET_VERSION_MAJOR @QTERMWIDGET_VERSION_MAJOR@)
|
||||
set(QTERMWIDGET_VERSION_MINOR @QTERMWIDGET_VERSION_MINOR@)
|
||||
set(QTERMWIDGET_VERSION_PATCH @QTERMWIDGET_VERSION_PATCH@)
|
||||
set(QTERMWIDGET_VERSION @QTERMWIDGET_VERSION@)
|
||||
|
||||
mark_as_advanced(QTERMWIDGET_LIBRARY QTERMWIDGET_INCLUDE_DIR)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
add_definitions(${Qt5Core_DEFINITIONS})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
|
||||
set(QTERMWIDGET_QT_LIBRARIES ${Qt5Widgets_LIBRARIES})
|
||||
|
||||
include_directories(${QTERMWIDGET_INCLUDE_DIRS})
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
###| CMAKE qtermwidget/lib |###
|
||||
|
||||
#| 2.6 is out, but most distros only have 2.4
|
||||
cmake_minimum_required ( VERSION 2.4 )
|
||||
include(CheckFunctionExists)
|
||||
|
||||
#| Project
|
||||
project ( qtermwidget )
|
||||
|
||||
|
||||
IF (NOT LIB_SUFFIX)
|
||||
MESSAGE(STATUS "")
|
||||
MESSAGE(STATUS "LIB_SUFFIX variable is not defined. It will be autodetected now.")
|
||||
MESSAGE(STATUS "You can set it manually with -DLIB_SUFFIX=<value> (64 for example)")
|
||||
IF (NOT APPLE)
|
||||
# check 64 bit
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
SET (LIB_SUFFIX "")
|
||||
else (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set (LIB_SUFFIX "64")
|
||||
MESSAGE(STATUS " LIB_SUFFIX is set to '${LIB_SUFFIX}'")
|
||||
endif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
ELSE (NOT APPLE)
|
||||
message(STATUS "LIB_SUFFIX is disabled for APPLE: ${CMAKE_SYSTEM_NAME}")
|
||||
SET (LIB_SUFFIX "")
|
||||
ENDIF (NOT APPLE)
|
||||
# BSD does not use lib64 for 64bit libs
|
||||
IF (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||
message(STATUS "LIB_SUFFIX is disabled for *BSD: ${CMAKE_SYSTEM_NAME}")
|
||||
SET (LIB_SUFFIX "")
|
||||
ENDIF()
|
||||
#
|
||||
MESSAGE(STATUS "")
|
||||
ENDIF (NOT LIB_SUFFIX)
|
||||
|
||||
|
||||
|
||||
|
||||
#| Sources
|
||||
set ( SRCS
|
||||
BlockArray.cpp
|
||||
ColorScheme.cpp
|
||||
Emulation.cpp
|
||||
Filter.cpp
|
||||
History.cpp
|
||||
HistorySearch.cpp
|
||||
KeyboardTranslator.cpp
|
||||
konsole_wcwidth.cpp
|
||||
kprocess.cpp
|
||||
kpty.cpp
|
||||
kptydevice.cpp
|
||||
kptyprocess.cpp
|
||||
Pty.cpp
|
||||
qtermwidget.cpp
|
||||
Screen.cpp
|
||||
ScreenWindow.cpp
|
||||
SearchBar.cpp
|
||||
Session.cpp
|
||||
ShellCommand.cpp
|
||||
TerminalCharacterDecoder.cpp
|
||||
TerminalDisplay.cpp
|
||||
tools.cpp
|
||||
Vt102Emulation.cpp
|
||||
)
|
||||
|
||||
#| Headers
|
||||
#| Only the Headers that need to be moc'd go here
|
||||
set ( HDRS
|
||||
Emulation.h
|
||||
Filter.h
|
||||
HistorySearch.h
|
||||
kprocess.h
|
||||
kptydevice.h
|
||||
kptyprocess.h
|
||||
Pty.h
|
||||
qtermwidget.h
|
||||
ScreenWindow.h
|
||||
SearchBar.h
|
||||
Session.h
|
||||
TerminalDisplay.h
|
||||
Vt102Emulation.h
|
||||
)
|
||||
|
||||
set ( HDRS_DISTRIB
|
||||
${CMAKE_SOURCE_DIR}/lib/qtermwidget.h )
|
||||
|
||||
|
||||
#| Qt4 Required Options
|
||||
add_definitions ( -Wall )
|
||||
find_package ( Qt4 REQUIRED ) # Finds Qt4 on the system
|
||||
include ( ${QT_USE_FILE} ) # Includes Qt4 headers and libraries (the above command is needed first)
|
||||
QT4_WRAP_CPP ( MOC_SRCS ${HDRS} ) # Moc's the headers
|
||||
#include ( ${CMAKE_BINARY_DIR} ) # For including the heades generated by ui files
|
||||
|
||||
QT4_WRAP_UI(UI_SRCS SearchBar.ui)
|
||||
|
||||
#| qtermwidget specific
|
||||
include_directories ( ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) # You mark some of the headers as global, so I just add the source directory to the includes
|
||||
|
||||
|
||||
# dirs
|
||||
set ( SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share )
|
||||
message ( STATUS "Share dire: ${SHARE_DIR}" )
|
||||
|
||||
set ( KB_LAYOUT_DIR ${CMAKE_INSTALL_PREFIX}/share/qtermwidget/kb-layouts/ )
|
||||
message ( STATUS "Keyboard layouts will be installed in: ${KB_LAYOUT_DIR}" )
|
||||
add_definitions( -DKB_LAYOUT_DIR="\\"${KB_LAYOUT_DIR}\\"" )
|
||||
|
||||
set ( COLORSCHEMES_DIR ${CMAKE_INSTALL_PREFIX}/share/qtermwidget/color-schemes/ )
|
||||
message ( STATUS "Color schemes will be insatlled in: ${COLORSCHEMES_DIR}" )
|
||||
add_definitions( -DCOLORSCHEMES_DIR="\\"${COLORSCHEMES_DIR}\\"" )
|
||||
|
||||
#| Defines
|
||||
add_definitions ( -DHAVE_POSIX_OPENPT -DHAVE_SYS_TIME_H )
|
||||
#add_definitions( -DHAVE_GETPT )
|
||||
if (APPLE)
|
||||
add_definitions( -DHAVE_UTMPX -D_UTMPX_COMPAT )
|
||||
endif (APPLE)
|
||||
|
||||
CHECK_FUNCTION_EXISTS(updwtmpx HAVE_UPDWTMPX)
|
||||
if (HAVE_UPDWTMPX)
|
||||
add_definitions( -DHAVE_UPDWTMPX )
|
||||
endif (HAVE_UPDWTMPX)
|
||||
|
||||
|
||||
#| Create the Library
|
||||
#add_library( qtermwidget STATIC ${SRCS} ${MOC_SRCS} )
|
||||
add_library ( qtermwidget SHARED ${SRCS} ${MOC_SRCS} ${UI_SRCS})
|
||||
|
||||
if (APPLE)
|
||||
# this is a must to load the lib correctly
|
||||
set_target_properties( qtermwidget PROPERTIES
|
||||
INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} )
|
||||
endif (APPLE)
|
||||
|
||||
|
||||
#| Set Build Type
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set ( CMAKE_BUILD_TYPE
|
||||
#"release"
|
||||
"relwithdebinfo" # Default
|
||||
#"debug"
|
||||
#"debugfull"
|
||||
)
|
||||
endif (NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
#| Library Properties
|
||||
set_target_properties ( qtermwidget PROPERTIES
|
||||
#OUTPUT_NAME "alternateName"
|
||||
#PREFIX "lib"
|
||||
SOVERSION ${qtermwidget_VERSION_MAJOR}
|
||||
#SUFFIX "so"
|
||||
VERSION ${qtermwidget_VERSION}
|
||||
)
|
||||
|
||||
#| Link Qt4 Libraries
|
||||
target_link_libraries ( qtermwidget ${QT_LIBRARIES} )
|
||||
|
||||
install(TARGETS qtermwidget DESTINATION lib${LIB_SUFFIX})
|
||||
install(FILES ${HDRS_DISTRIB} DESTINATION include)
|
||||
|
||||
# keyboard layouts
|
||||
install(DIRECTORY kb-layouts/ DESTINATION ${KB_LAYOUT_DIR} FILES_MATCHING PATTERN "*.keytab" )
|
||||
# color schemes
|
||||
install(DIRECTORY color-schemes/ DESTINATION ${COLORSCHEMES_DIR} FILES_MATCHING PATTERN "*.*schem*")
|
||||
|
||||
|
||||
#
|
||||
# Qt4 designer plugin
|
||||
#
|
||||
if (BUILD_DESIGNER_PLUGIN)
|
||||
message(STATUS "Building Qt designer plugin")
|
||||
|
||||
include_directories(designer
|
||||
${QT_QTDESIGNER_INCLUDE_DIR})
|
||||
|
||||
set(DESIGNER_SRC designer/qtermwidgetplugin.cpp)
|
||||
QT4_WRAP_CPP( DESIGNER_MOC designer/qtermwidgetplugin.h)
|
||||
QT4_ADD_RESOURCES( DESIGNER_QRC designer/qtermwidgetplugin.qrc)
|
||||
|
||||
link_directories(${CMAKE_BINARY_DIR})
|
||||
add_library( qtermwidgetplugin SHARED
|
||||
${DESIGNER_MOC}
|
||||
${DESIGNER_QRC}
|
||||
${DESIGNER_SRC}
|
||||
)
|
||||
add_dependencies(qtermwidgetplugin qtermwidget)
|
||||
|
||||
target_link_libraries( qtermwidgetplugin
|
||||
${QT_QTCORE_LIBRARY}
|
||||
${QT_QTDESIGNER_LIBRARY}
|
||||
${QT_QTDESIGNERCOMPONENTS_LIBRARY}
|
||||
qtermwidget
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
# this is a must to load the lib correctly
|
||||
set_target_properties( qtermwidgetplugin PROPERTIES
|
||||
INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/qt4/plugins/designer )
|
||||
endif (APPLE)
|
||||
|
||||
#install( TARGETS qtermwidgetplugin DESTINATION ${QT_PLUGINS_DIR}/designer )
|
||||
install( TARGETS qtermwidgetplugin DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/qt4/plugins/designer )
|
||||
|
||||
endif (BUILD_DESIGNER_PLUGIN)
|
||||
@@ -1,13 +0,0 @@
|
||||
# Note some color schemes are deliberately not installed
|
||||
# at present
|
||||
|
||||
install( FILES
|
||||
BlackOnLightYellow.schema
|
||||
BlackOnRandomLight.colorscheme
|
||||
BlackOnWhite.schema
|
||||
GreenOnBlack.colorscheme
|
||||
WhiteOnBlack.schema
|
||||
Linux.colorscheme
|
||||
DarkPastels.colorscheme
|
||||
DESTINATION
|
||||
${DATA_INSTALL_DIR}/konsole )
|
||||
+10
-13
@@ -20,29 +20,26 @@ QString get_kb_layout_dir()
|
||||
QString k(KB_LAYOUT_DIR);
|
||||
QDir d(k);
|
||||
|
||||
// qDebug() << "default KB_LAYOUT_DIR: " << k;
|
||||
qDebug() << "default KB_LAYOUT_DIR: " << k;
|
||||
|
||||
if (d.exists())
|
||||
rval = k.append("/");
|
||||
{
|
||||
rval = k.append("/");
|
||||
return rval;
|
||||
}
|
||||
|
||||
// subdir in the app location
|
||||
d.setPath(QCoreApplication::applicationDirPath() + "/kb-layouts/");
|
||||
//qDebug() << d.path();
|
||||
if (d.exists())
|
||||
rval = QCoreApplication::applicationDirPath() + "/kb-layouts/";
|
||||
return QCoreApplication::applicationDirPath() + "/kb-layouts/";
|
||||
#ifdef Q_WS_MAC
|
||||
d.setPath(QCoreApplication::applicationDirPath() + "/../Resources/kb-layouts/");
|
||||
if (d.exists())
|
||||
rval = QCoreApplication::applicationDirPath() + "/../Resources/kb-layouts/";
|
||||
return QCoreApplication::applicationDirPath() + "/../Resources/kb-layouts/";
|
||||
#endif
|
||||
#ifdef QT_DEBUG
|
||||
if(!rval.isEmpty()) {
|
||||
qDebug() << "Using kb-layouts: " << rval;
|
||||
} else {
|
||||
qDebug() << "Cannot find kb-layouts in any location!";
|
||||
}
|
||||
#endif
|
||||
return rval;
|
||||
qDebug() << "Cannot find KB_LAYOUT_DIR. Default:" << k;
|
||||
return QString();
|
||||
#endif // BUNDLE_KEYBOARDLAYOUTS
|
||||
}
|
||||
|
||||
@@ -85,4 +82,4 @@ QString get_color_schemes_dir()
|
||||
#endif
|
||||
return rval;
|
||||
#endif // BUNDLE_COLORSCHEMES
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
###| CMAKE qtermwidget/src |###
|
||||
|
||||
#| Set required version of cmake
|
||||
cmake_minimum_required ( VERSION 2.4 )
|
||||
|
||||
#| Project
|
||||
project ( test )
|
||||
|
||||
#| Sources
|
||||
set ( SRCS
|
||||
main.cpp
|
||||
)
|
||||
|
||||
#| qtermwidget Library
|
||||
include_directories (
|
||||
${PROJECT_SOURCE_DIR}/../lib
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../lib
|
||||
)
|
||||
|
||||
set(QTERMWIDGET_LIB qtermwidget)
|
||||
link_directories(${PROJECT_BINARY_DIR}/../)
|
||||
|
||||
#| Qt4 Required Options
|
||||
add_definitions ( -Wall )
|
||||
find_package ( Qt4 REQUIRED ) # Finds Qt4 on the system
|
||||
include ( ${QT_USE_FILE} ) # Includes Qt4 headers and libraries (the above command is needed first)
|
||||
QT4_WRAP_CPP ( MOC_SRCS ${HDRS} ) # Moc's the headers
|
||||
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
#| Create the Library
|
||||
add_executable ( test ${SRCS} )
|
||||
|
||||
add_dependencies(test qtermwidget)
|
||||
|
||||
#| Set Build Type
|
||||
set ( CMAKE_BUILD_TYPE
|
||||
#"release"
|
||||
"relwithdebinfo" # Default
|
||||
#"debug"
|
||||
#"debugfull"
|
||||
)
|
||||
|
||||
#| Link Qt4 Libraries
|
||||
target_link_libraries ( test ${QT_LIBRARIES} util )
|
||||
|
||||
#| Link qtermwidget Library
|
||||
target_link_libraries ( test ${QTERMWIDGET_LIB} util )
|
||||
|
||||
Reference in New Issue
Block a user