CMake refactoring

This commit is contained in:
2020-09-04 22:31:50 +03:00
parent bd421ff5af
commit c576a14deb
29 changed files with 316 additions and 402 deletions

View File

@@ -1,57 +1,54 @@
cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
project(qad)
set(qad_MAJOR 1)
set(qad_MINOR 9)
set(qad_REVISION 0)
set(qad_SUFFIX )
set(qad_COMPANY SHS)
set(qad_DOMAIN org.SHS)
if ("x${CMAKE_MODULE_PATH}" STREQUAL "x")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
endif()
include(SHSTKMacros)
include(QtWraps)
shstk_begin_project(qad QAD)
include(SHSTKQtMacros)
shstk_qt_founded(QtVersions)
foreach(_v ${_QT_VERSIONS_})
#message("Qt ${_v} -> ${QtVersions}")
option(Qt${_v} "Build for Qt${_v}" ON)
endforeach()
find_package(MinGW REQUIRED)
if (NOT DEFINED ANDROID_PLATFORM)
find_package(OpenGL REQUIRED)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
#include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
if(STATIC_LIB)
set(QAD_LIB_TYPE STATIC)
add_definitions(-DQAD_STATIC_DEFINE)
set(QAD_LIB_TYPE_MSG "Static")
else()
set(QAD_LIB_TYPE SHARED)
set(QAD_LIB_TYPE_MSG "Shared")
endif()
option(UTILS "Build various utils" ${_plugins_default_})
option(DESIGNER_PLUGINS "Build Qt designer plugins" ${_plugins_default_})
set(_QAD_MAJOR 1)
set(_QAD_MINOR 7)
set(_QAD_REVISION 0)
set(_QAD_SUFFIX )
set(_QAD_COMPANY SHS)
set(_QAD_DOMAIN org.SHS)
set(QAD_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/qad/qad_version.h")
set_version(QAD
MAJOR "${_QAD_MAJOR}"
MINOR "${_QAD_MINOR}"
REVISION "${_QAD_REVISION}"
BUILD "${BUILD_NUMBER}"
SUFFIX "${_QAD_SUFFIX}"
OUTPUT "${QAD_VERSION_FILE}")
set_deploy_property(QAD ${QAD_LIB_TYPE}
FULLNAME "${_QAD_DOMAIN}.*"
COMPANY "${_QAD_COMPANY}")
macro(qad_library NAME _MODULES _LIBS)
shstk_qt_project(qad_${NAME} FALSE "qad" "${_MODULES}" "${_LIBS}" ${ARGN})
shstk_qt_install("qad" FALSE qad_${NAME} "${out_HDR}" "${out_QM}")
endmacro()
# Version
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/qad_version.h")
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/qad_version.h")
endif()
#message(STATUS "Building QAD version ${QAD_VERSION} (${QAD_LIB_TYPE})")
macro(qad_application NAME _MODULES _LIBS)
shstk_qt_project(${NAME} TRUE "qad" "${_MODULES}" "${_LIBS}" ${ARGN})
shstk_qt_install("qad" TRUE ${NAME} "" "${out_QM}")
endmacro()
file(GLOB CMAKES "cmake/*.cmake" "cmake/*.in")
macro(qad_plugin NAME _MODULES _LIBS)
shstk_qt_plugin(qad_${NAME} "${_MODULES}" "qad_${NAME};${_LIBS}")
endmacro()
if (LIB)
shstk_install(qad FALSE "" "${QAD_VERSION_FILE}")
if (NOT LOCAL)
file(GLOB CMAKES "cmake/*.cmake" "cmake/*.in")
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
if (WIN32)
install(FILES ${QAD_VERSION_FILE} DESTINATION ${MINGW_INCLUDE}/qad)
else()
install(FILES ${QAD_VERSION_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qad)
endif()
else()
install(FILES ${QAD_VERSION_FILE} DESTINATION include/qad)
endif()
add_subdirectory(libs)
@@ -59,5 +56,21 @@ if (UTILS)
add_subdirectory(utils)
endif()
copy_to_parent(qad_includes)
message("----------QAD----------")
message(" Build for ${QtVersions}")
message(" Linkage: ${qad_LIB_TYPE_MSG}")
message(" Type : ${qad_BUILD_TYPE}")
message(" Install: \"${CMAKE_INSTALL_PREFIX}\"")
message("")
print_list("${_qt_libs}" " Libraries:" " * ")
if (NOT "x${_qt_plugs}" STREQUAL "x")
message("")
print_list("${_qt_plugs}" " Plugins:" " * ")
endif()
if (NOT "x${_qt_apps}" STREQUAL "x")
message("")
print_list("${_qt_apps}" " Applications:" " * ")
endif()
message("-----------------------")
shstk_copy_to_parent()

View File

@@ -1,6 +1,6 @@
#[[
Also create imported targets:
Create imported targets:
* QAD::Utils
* QAD::Widgets
* QAD::Application
@@ -9,6 +9,8 @@ Also create imported targets:
* QAD::SQLTable
* QAD::TouchWidgets
* QAD::Doc
* QAD::PIQt
* QAD::PIQtUtils
These targets include directories and dependencies
@@ -16,157 +18,124 @@ These targets include directories and dependencies
cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
cmake_policy(SET CMP0020 NEW) # Automatically link Qt executables to qtmain target on Windows
if(NOT LIBPROJECT)
if(NOT BUILDING_qad)
find_package(PIP QUIET)
include(QtWraps)
include(SHSTKMacros)
endif()
get_directory_property(hasParent PARENT_DIRECTORY)
shstk_is_parent_exists(hasParent PARENT_DIRECTORY)
set(_SEARCH_DIR)
if(WIN32)
find_package(MinGW REQUIRED)
endif()
set(_QAD_INCDIR)
set(_QAD_LIBDIR)
if(MINGW_INCLUDE)
list(APPEND _QAD_INCDIR "${MINGW_INCLUDE}/qad")
list(APPEND _QAD_LIBDIR "${MINGW_LIB}")
endif()
if(CMAKE_CROSSCOMPILING)
list(APPEND _QAD_INCDIR "${CMAKE_PREFIX_PATH}/include/qad")
list(APPEND _QAD_LIBDIR "${CMAKE_PREFIX_PATH}/lib")
shstk_set_find_dirs(qad)
if (NOT BUILDING_qad)
find_file(QAD_H_INCLUDE "qad_types.h" HINTS ${PIP_DIR}/include/qad ${qad_INCDIR} $ENV{SMSDK_DIR}/include/qad)
#if (DEFINED ANDROID_PLATFORM)
# list(APPEND _PIP_INCDIR ${CMAKE_PREFIX_PATH}/include/qad)
# list(APPEND _PIP_LIBDIR ${CMAKE_PREFIX_PATH}/lib)
# set(QAD_INCLUDES ${ANDROID_SYSTEM_LIBRARY_PATH}/usr/include/qad)
#else()
get_filename_component(QAD_INCLUDES ${QAD_H_INCLUDE} PATH)
#endif()
include_directories(${CMAKE_PREFIX_PATH}/include)
link_directories(${CMAKE_PREFIX_PATH}/lib)
else()
if(NOT WIN32)
list(APPEND _QAD_INCDIR "/usr/include/qad" "/usr/local/include/qad")
list(APPEND _QAD_LIBDIR "/usr/lib" "/usr/local/lib")
endif()
if(APPLE)
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
endif()
set(_SEARCH_DIR ${qad_LIBDIR} $ENV{SMSDK_DIR}/lib)
shstk_find_header(QAD "qad_version.h" "")
endif()
find_file(QAD_H_INCLUDE "qad_types.h" HINTS ${PIP_DIR}/include/qad ${_QAD_INCDIR} $ENV{SMSDK_DIR}/include/qad)
#if (DEFINED ANDROID_PLATFORM)
# set(QAD_INCLUDES ${ANDROID_SYSTEM_LIBRARY_PATH}/usr/include/qad)
#else()
get_filename_component(QAD_INCLUDES ${QAD_H_INCLUDE} PATH)
#endif()
set(_SEARCH_DIR ${_QAD_LIBDIR} $ENV{SMSDK_DIR}/lib)
set(_QAD_LIBS utils widgets application blockview graphic sql_table touch_widgets doc)
set(_ITN_utils "Utils" )
set(_ITN_widgets "Widgets" )
set(_ITN_application "Application" )
set(_ITN_blockview "Blockview" )
set(_ITN_graphic "Graphic" )
set(_ITN_sql_table "SQLTable" )
set(_ITN_touch_widgets "TouchWidgets")
set(_ITN_doc "Doc" )
set(_ITLL_widgets "QAD::Utils")
set(_ITLL_application "QAD::Widgets")
set(_ITLL_blockview "QAD::Widgets")
set(_ITLL_graphic "QAD::Widgets")
set(_ITLL_sql_table "QAD::Widgets")
set(_ITLL_touch_widgets "")
set(_ITLL_doc "")
if(LIBPROJECT)
set(QAD_INCLUDES ${QAD_DIR})
if(QAD_FIND_VERSION VERSION_GREATER QAD_VERSION)
message(FATAL_ERROR "QAD version ${QAD_VERSION} is available, but ${QAD_FIND_VERSION} requested!")
endif()
foreach(_Q ${_QAD_LIBS})
string(TOUPPER ${_Q} _QU)
if(LIBPROJECT)
set(QAD_${_QU}_LIBRARY qad_${_Q})
list(APPEND QAD_INCLUDES ${QAD_DIR}/${_Q})
else()
foreach(_v ${_QT_VERSIONS_})
find_library(QAD${_v}_${_QU}_LIBRARY qad_${_Q}${_v} HINTS ${_SEARCH_DIR})
set(MULTILIB_qad_${_Q}_SUFFIX_Qt${_v} ${_v})
if(hasParent)
set(MULTILIB_qad_${_Q}_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
endif()
#message(STATUS "MULTILIB_qad_${_Q}_SUFFIX_Qt${_v} = ${_v}")
set(__libs "utils;widgets;application;blockview;graphic;sql_table;touch_widgets;doc")
if (PIP_FOUND OR BUILDING_pip)
list(APPEND __libs "piqt;piqt_utils")
endif()
set(__module_utils Utils )
set(__module_widgets Widgets )
set(__module_application Application )
set(__module_blockview Blockview )
set(__module_graphic Graphic )
set(__module_sql_table SQLTable )
set(__module_touch_widgets TouchWidgets )
set(__module_doc Doc )
set(__module_piqt PIQt )
set(__module_piqt_utils PIQtUtils )
foreach (_l ${__libs})
set( __inc_${_l} "")
set(__deps_${_l} "")
set(__libs_${_l} "")
endforeach()
set(__deps_widgets "QAD::Utils")
set(__deps_application "QAD::Widgets")
set(__deps_blockview "QAD::Widgets")
set(__deps_graphic "QAD::Widgets")
set(__deps_sql_table "QAD::Widgets")
set(__deps_piqt "QAD::Widgets;PIP")
set(__deps_piqt_utils "QAD::Blockview;QAD::PIQt")
#message("find QAD ${BUILDING_qad}")
if (BUILDING_qad)
if (NOT SET_TARGETS_qad)
set(SET_TARGETS_qad ON CACHE BOOL "")
#message("create aliases")
foreach(_l ${__libs})
foreach(_v ${_QT_VERSIONS_})
set(_m ${__module_${_l}})
string(REPLACE ":" "_" _m_str "${_m}")
if((NOT TARGET QAD::${_m}${_v}) AND TARGET qad_${_l}${_v})
#message("alias QAD::${_m}${_v} = qad_${_l}${_v}")
set(MULTILIB_qad_${_l}_SUFFIX_Qt${_v} ${_v} CACHE STRING "")
add_library(QAD::${_m}${_v} ALIAS qad_${_l}${_v})
endif()
endforeach()
list(APPEND QT_MULTILIB_LIST QAD::${_m})
endforeach()
endif()
#message(STATUS "Library qad_${_Q}5 (${_QU}) -> ${QAD5_${_QU}_LIBRARY} found in ${_SEARCH_DIR}")
list(APPEND QT_MULTILIB_LIST qad_${_Q})
endforeach()
set(_PIQT_LIBS piqt piqt_utils)
foreach(_Q ${_PIQT_LIBS})
foreach(_v ${_QT_VERSIONS_})
set(MULTILIB_${_Q}_SUFFIX_Qt${_v} ${_v})
if(hasParent)
set(MULTILIB_${_Q}_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
endif()
#message(STATUS "MULTILIB_${_Q}_SUFFIX_Qt${_v} = ${_v}")
endforeach()
#message(STATUS "Library ${_Q}5 (${_QU}) -> ${QAD5_${_QU}_LIBRARY} found in ${_SEARCH_DIR}")
list(APPEND QT_MULTILIB_LIST ${_Q})
endforeach()
set(QAD_FOUND ON CACHE BOOL "")
foreach(_Q ${_QAD_LIBS})
string(TOUPPER ${_Q} _QU)
set(_target QAD::${_ITN_${_Q}})
string(REPLACE ":" "_" _target_str "${_target}")
foreach(_v ${_QT_VERSIONS_})
if(NOT TARGET ${_target}${_v})
set(_link_list)
foreach(_l ${_ITLL_${_Q}})
list(APPEND _link_list ${_l}${_v})
endforeach()
add_library(${_target}${_v} UNKNOWN IMPORTED)
set_target_properties(${_target}${_v} PROPERTIES
IMPORTED_LOCATION "${QAD${_v}_${_QU}_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${QAD_INCLUDES}"
INTERFACE_LINK_LIBRARIES "${_link_list}")
set(MULTILIB_${_target_str}_SUFFIX_Qt${_v} ${_v})
if(hasParent)
set(MULTILIB_${_target_str}_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
else()
#message("create interfaces")
foreach(_l ${__libs})
foreach(_v ${_QT_VERSIONS_})
set(_m ${__module_${_l}})
string(REPLACE ":" "_" _m_str "${_m}")
find_library(QAD_LIBRARY_${_l}${_v} qad_${_l}${_v} HINTS ${qad_LIBDIR})
#message("found ${_l}${_v} = ${QAD_LIBRARY_${_l}${_v}}")
if((NOT TARGET QAD::${_m}${_v}) AND QAD_LIBRARY_${_l}${_v})
#message("imported QAD::${_m}${_v} = ${QAD_LIBRARY_${_l}${_v}}")
set(MULTILIB_qad_${_l}_SUFFIX_Qt${_v} ${_v} CACHE STRING "")
add_library(QAD::${_m}${_v} UNKNOWN IMPORTED)
set(_deps)
foreach (_d ${__deps_${_l}})
if (${_d} MATCHES "QAD::*")
list(APPEND _deps ${_d}${_v})
else()
list(APPEND _deps ${_d})
endif()
endforeach()
set_target_properties(QAD::${_m}${_v} PROPERTIES
IMPORTED_LOCATION "${QAD_LIBRARY_${_l}${_v}}"
INTERFACE_INCLUDE_DIRECTORIES "${QAD_INCLUDES}"
INTERFACE_LINK_LIBRARIES "${_deps}")
endif()
#message(STATUS "add imported ${_target}${_v}")
#message(STATUS "add MULTILIB MULTILIB_${_target_str}_SUFFIX_Qt${_v} ${_v}")
endif()
endforeach()
list(APPEND QT_MULTILIB_LIST QAD::${_m})
endforeach()
list(APPEND QT_MULTILIB_LIST ${_target})
endforeach()
list(APPEND QT_MULTILIB_LIST qglview qglengine_core qglengine_widgets)
foreach(_v ${_QT_VERSIONS_})
find_library(QGLVIEW${_v}_LIBRARY qglview${_v} ${_SEARCH_DIR})
set(MULTILIB_qglview_SUFFIX_Qt${_v} ${_v})
if(hasParent)
set(MULTILIB_qglview_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
endif()
endforeach()
endif()
if(hasParent)
set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE)
endif()
if(NOT LIBPROJECT)
if(NOT QAD_VERSION)
include(CheckSymbolExists)
check_symbol_exists(QAD_VERSION_NAME "${QAD_INCLUDES}/qad_version.h" HAVE_QAD_VERSION)
if (HAVE_QAD_VERSION)
file(STRINGS "${QAD_INCLUDES}/qad_version.h" _VERSION REGEX "^[ \t]*#define[ \t]+QAD_VERSION_NAME+[ \t]+.*$")
string(REGEX MATCH "\".*\"" _VERSION ${_VERSION})
string(LENGTH ${_VERSION} SL)
math(EXPR SL ${SL}-2)
string(SUBSTRING ${_VERSION} 1 ${SL} _VERSION)
set(QAD_VERSION ${_VERSION} CACHE STRING "VERSION")
else()
message(FATAL_ERROR "Can`t find QAD version file!")
endif()
endif()
if(QAD_FIND_VERSION VERSION_GREATER QAD_VERSION)
message(FATAL_ERROR "QAD version ${QAD_VERSION} is available, but ${QAD_FIND_VERSION} requested!")
endif()
if (NOT _QAD_MSG)
set(_QAD_MSG 1 CACHE BOOL "msg_qad" FORCE)
message(STATUS "Found QAD (version \"${QAD_VERSION}\")")
endif()
endif()
set(QAD_FOUND ON CACHE BOOL "")

View File

@@ -1,90 +0,0 @@
macro(_qt_install _TARGET IS_APP _DIR _HDR_VAR _QM_FILES)
sdk_install("${_DIR}" ${IS_APP} "${_TARGET}" "${${_HDR_VAR}}" "${_QM_FILES}")
endmacro()
macro(_qt_plugin NAME _MODULES _LIBS)
if (NOT STATIC_LIB)
if(DESIGNER_PLUGINS)
set(PROJ_NAME ${NAME}_plugin)
include_directories("..")
add_definitions(-DQT_PLUGIN)
add_definitions(-DQT_NO_DEBUG)
add_definitions(-DQT_SHARED)
add_definitions(-DQDESIGNER_EXPORT_WIDGETS)
find_qt(${QtVersions} Core Designer ${_MODULES})
qt_sources(SRC)
qt_wrap(${SRC} CPPS out_CPP QMS out_QM)
qt_add_library(${PROJ_NAME} SHARED out_CPP)
qt_target_link_libraries(${PROJ_NAME} ${_LIBS} ${_${NAME}_PLUGIN_LIBS})
if (WIN32)
qt_install(TARGETS ${PROJ_NAME} RUNTIME DESTINATION QtPlugins/designer)
else()
qt_install(TARGETS ${PROJ_NAME} DESTINATION QtPlugins/designer)
endif()
list(APPEND _qt_plugs ${NAME})
copy_to_parent("")
endif()
endif()
endmacro()
macro(_qt_project NAME IS_APP DOMAIN _MODULES _LIBS)
set(PROJ_NAME ${NAME})
find_qt(${QtVersions} Core ${_MODULES})
qt_sources(SRC)
import_version(${PROJ_NAME} ${DOMAIN})
import_deploy_properties(${PROJ_NAME} ${DOMAIN})
if (${IS_APP})
list(APPEND _qt_apps ${PROJ_NAME})
set_deploy_property(${PROJ_NAME}
LABEL ${PROJ_NAME}
FULLNAME "${_${DOMAIN}_DOMAIN}.${PROJ_NAME}"
INFO "${APP_INFO}"
ICON "${APP_ICON}")
else()
list(APPEND _qt_libs ${PROJ_NAME})
set_deploy_property(${PROJ_NAME} SHARED
LABEL ${PROJ_NAME}
FULLNAME "${_${DOMAIN}_DOMAIN}.${PROJ_NAME}"
INFO "${DOMAIN} ${NAME} library")
endif()
make_rc(${PROJ_NAME} out_RC)
qt_wrap(${SRC} HDRS out_HDR CPPS out_CPP QMS out_QM ${out_RC})
if (${IS_APP})
qt_add_executable(${PROJ_NAME} WIN32 out_CPP ${${DOMAIN}_EXPORT_HEADER} ${ARGN})
else()
qt_add_library(${PROJ_NAME} ${${DOMAIN}_LIB_TYPE} out_CPP ${${DOMAIN}_EXPORT_HEADER} ${ARGN})
if(NOT STATIC_LIB)
qt_target_compile_definitions(${PROJ_NAME} PRIVATE ${DOMAIN}_SHARED_DEFINE)
endif()
qt_generate_export_header(${PROJ_NAME})
list(APPEND out_HDR "${CMAKE_CURRENT_BINARY_DIR}/${PROJ_NAME}_export.h")
endif()
qt_target_link_libraries(${PROJ_NAME} ${_LIBS})
list(APPEND QT_MULTILIB_LIST ${PROJ_NAME})
#message(STATUS "Building ${PROJ_NAME}")
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin")
set(_${NAME}_PLUGIN_LIBS "${_LIBS}")
add_subdirectory(plugin)
endif()
copy_to_parent("")
endmacro()
macro(qad_library NAME _MODULES _LIBS)
_qt_project(qad_${NAME} FALSE "QAD" "${_MODULES}" "${_LIBS}")
_qt_install(qad_${NAME} FALSE "qad" "out_HDR" "out_QM")
endmacro()
macro(qad_application NAME _MODULES _LIBS)
_qt_project(${NAME} TRUE "QAD" "${_MODULES}" "${_LIBS}")
_qt_install(${NAME} TRUE "qad" "" "out_QM")
endmacro()
macro(qad_plugin NAME _MODULES _LIBS)
_qt_plugin(qad_${NAME} "${_MODULES}" "qad_${NAME};${_LIBS}")
endmacro()

View File

@@ -8,6 +8,7 @@ If Qt4/5 found, set
* Qt<4/5>_BIN var to Qt binary dir
* Qt<4/5>_PLUGINS_DIR var to Qt plugins dir
* Qt<4/5>_LANG_DIR var to Qt translations dir
Also set variable SOME_QT_FOUND
@@ -166,6 +167,9 @@ macro(find_qt)
set(Qt${_v}_PLUGINS_DIR)
set(Qt${_v}_LANG_DIR)
endforeach()
if (NOT DEFINED SOME_QT_FOUND)
set(SOME_QT_FOUND 0 CACHE BOOL "")
endif()
set(_NEED_SOME 0)
set(_QUIET)
foreach(_i ${ARGN})
@@ -270,6 +274,7 @@ macro(find_qt)
endif()
foreach(_v ${_QT_VERSIONS_})
if (LOCAL_FOUND${_v})
set(SOME_QT_FOUND 1 CACHE BOOL "" FORCE)
foreach(_p ${Qt${_v}_INCLUDES})
list(APPEND MOC_INC_Qt${_v} "-I${_p}")
#message("${_p}")
@@ -534,7 +539,8 @@ macro(qt_add_library _NAME)
set(_TARGET ${_NAME}${TARGET_SUFFIX_Qt${_v}})
add_library(${_TARGET} ${_PREF} ${_ARGS})
set(_${_NAME}_is_qt 1)
target_include_directories(${_TARGET} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/qt${_v} ${Qt${_v}_INCLUDES})
target_include_directories(${_TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/qt${_v})
target_include_directories(${_TARGET} PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${Qt${_v}_INCLUDES})
__qt_set_defines(${_NAME} ${_TARGET})
#message("add lib: \"${_TARGET}\"")

View File

@@ -1 +1 @@
add_directories_with_include("qad_")
shstk_add_directories_with_include(TRUE "qad_")

View File

@@ -1 +1 @@
qad_library(blockview "Gui;Widgets" "qad_utils;qad_widgets")
qad_library(blockview "Gui;Widgets" "qad_widgets")

View File

@@ -1 +1 @@
qad_library(graphic "Gui;Widgets;OpenGL" "qad_widgets;qad_utils;${OPENGL_LIBRARIES}")
qad_library(graphic "Gui;Widgets;OpenGL" "qad_widgets;${OPENGL_LIBRARIES}")

View File

@@ -50,6 +50,8 @@ Graphic::Graphic(QWidget * parent): QFrame(parent), canvas(0), line_x_min(this),
ui->checkGuides->addAction(ui->actionGuidesFree );
ui->checkGuides->addAction(ui->actionGuidesTraceX);
ui->checkGuides->addAction(ui->actionGuidesTraceY);
ui->buttonAutofit->addAction(ui->actionExpandX);
ui->buttonAutofit->addAction(ui->actionExpandY);
line_x_min.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
line_x_max.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
((QBoxLayout * )ui->widgetLY->layout())->insertWidget(0, &line_y_min);
@@ -593,18 +595,12 @@ void Graphic::setMaxVisibleTime(double val) {
void Graphic::setOnlyExpandY(bool yes) {
only_expand_y = yes;
ui->checkExpandY->blockSignals(true);
ui->checkExpandY->setCheckable(yes);
ui->checkExpandY->blockSignals(false);
ui->actionExpandY->setChecked(yes);
}
void Graphic::setOnlyExpandX(bool yes) {
only_expand_x = yes;
ui->checkExpandX->blockSignals(true);
ui->checkExpandX->setCheckable(yes);
ui->checkExpandX->blockSignals(false);
ui->actionExpandX->setChecked(yes);
}
@@ -655,8 +651,6 @@ void Graphic::setButtons(Graphic::Buttons b) {
ui->buttonAutofit->setVisible(b.testFlag(Autofit));
ui->checkGrid->setVisible(b.testFlag(Grid));
ui->checkGuides->setVisible(b.testFlag(CursorAxis));
ui->checkExpandY->setVisible(b.testFlag(OnlyExpandY));
ui->checkExpandX->setVisible(b.testFlag(OnlyExpandX));
ui->buttonFullscreen->setVisible(b.testFlag(Fullscreen));
ui->checkBorderInputs->setVisible(b.testFlag(BorderInputs));
ui->checkLegend->setVisible(b.testFlag(Legend));
@@ -1791,15 +1785,15 @@ void Graphic::setLegendVisible(bool visible) {
}
void Graphic::on_checkExpandY_toggled(bool checked) {
only_expand_y = checked;
ui->checkExpandY->setIcon(checked ? icon_exp_y : icon_exp_sy);
void Graphic::on_actionExpandX_triggered(bool checked) {
only_expand_x = checked;
ui->actionExpandX->setIcon(checked ? icon_exp_x : icon_exp_sx);
}
void Graphic::on_checkExpandX_toggled(bool checked) {
only_expand_x = checked;
ui->checkExpandX->setIcon(checked ? icon_exp_x : icon_exp_sx);
void Graphic::on_actionExpandY_triggered(bool checked) {
only_expand_y = checked;
ui->actionExpandY->setIcon(checked ? icon_exp_y : icon_exp_sy);
}

View File

@@ -129,8 +129,6 @@ public:
Autofit = 0x01,
Grid = 0x02,
CursorAxis = 0x04,
OnlyExpandY = 0x08,
OnlyExpandX = 0x10,
Fullscreen = 0x20,
BorderInputs = 0x40,
Legend = 0x80,
@@ -423,8 +421,8 @@ protected slots:
void on_buttonSave_clicked() {saveImage();}
void on_checkGrid_toggled(bool checked) {grid = checked; update();}
void on_checkGuides_toggled(bool checked);
void on_checkExpandY_toggled(bool checked);
void on_checkExpandX_toggled(bool checked);
void on_actionExpandX_triggered(bool checked);
void on_actionExpandY_triggered(bool checked);
void on_checkBorderInputs_toggled(bool checked) {setBorderInputsVisible(checked);}
void on_checkLegend_toggled(bool checked) {setLegendVisible(checked);}
void on_checkPause_toggled(bool checked) {setPaused(checked);}
@@ -443,7 +441,6 @@ signals:
void cleared();
void visualRectChanged();
void graphicSettingsChanged();
};

View File

@@ -89,34 +89,6 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="checkExpandY">
<property name="toolTip">
<string>Only expand Y</string>
</property>
<property name="icon">
<iconset resource="qad_graphic.qrc">
<normaloff>:/icons/expand_s_y.png</normaloff>:/icons/expand_s_y.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="checkExpandX">
<property name="toolTip">
<string>Only expand X</string>
</property>
<property name="icon">
<iconset resource="qad_graphic.qrc">
<normaloff>:/icons/expand_s_x.png</normaloff>:/icons/expand_s_x.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="buttonFullscreen">
<property name="toolTip">
@@ -449,6 +421,25 @@
<string>Trace Y</string>
</property>
</action>
<action name="actionExpandX">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Only expand X</string>
</property>
</action>
<action name="actionExpandY">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Only expand Y</string>
</property>
<property name="toolTip">
<string>Only expand Y</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@@ -1 +1,6 @@
piqt_library(piqt "Gui;Positioning" "qad_utils;qad_widgets")
find_package(PIP)
if (PIP_FOUND)
qad_library(piqt "Gui;Positioning" "PIP;qad_widgets")
endif()

View File

@@ -29,14 +29,14 @@
#if QT_VERSION >= 0x050200
# include "pigeoposition.h"
#endif
#include "piqt_export.h"
#include "qad_piqt_export.h"
class QGeoCoordinate;
PIQT_EXPORT const QVariant PI2QVariant(const PIVariant & v);
PIQT_EXPORT const PIVariant Q2PIVariant(const QVariant & v);
QAD_PIQT_EXPORT const QVariant PI2QVariant(const PIVariant & v);
QAD_PIQT_EXPORT const PIVariant Q2PIVariant(const QVariant & v);
//inline const QString PI2QString(const PIString & v) {return QString::fromLocal8Bit(v.data());}
inline const QString PI2QString(const PIString & v) {return QString::fromUtf8(v.dataUTF8());}
@@ -125,20 +125,20 @@ inline PropertyStorage PI2QPropertyStorage(const PIPropertyStorage & props) {
}
PIQT_EXPORT const QAD::Enum PI2QADEnum(const PIVariantTypes::Enum & el);
PIQT_EXPORT const QAD::File PI2QADFile(const PIVariantTypes::File & v);
PIQT_EXPORT const QAD::Dir PI2QADDir(const PIVariantTypes::Dir & v);
PIQT_EXPORT const QAD::IODevice PI2QADIODevice(const PIVariantTypes::IODevice & v);
PIQT_EXPORT const PIVariantTypes::Enum QAD2PIEnum(const QAD::Enum & el);
PIQT_EXPORT const PIVariantTypes::File QAD2PIFile(const QAD::File & v);
PIQT_EXPORT const PIVariantTypes::Dir QAD2PIDir(const QAD::Dir & v);
PIQT_EXPORT const PIVariantTypes::IODevice QAD2PIIODevice(const QAD::IODevice & v);
QAD_PIQT_EXPORT const QAD::Enum PI2QADEnum(const PIVariantTypes::Enum & el);
QAD_PIQT_EXPORT const QAD::File PI2QADFile(const PIVariantTypes::File & v);
QAD_PIQT_EXPORT const QAD::Dir PI2QADDir(const PIVariantTypes::Dir & v);
QAD_PIQT_EXPORT const QAD::IODevice PI2QADIODevice(const PIVariantTypes::IODevice & v);
QAD_PIQT_EXPORT const PIVariantTypes::Enum QAD2PIEnum(const QAD::Enum & el);
QAD_PIQT_EXPORT const PIVariantTypes::File QAD2PIFile(const QAD::File & v);
QAD_PIQT_EXPORT const PIVariantTypes::Dir QAD2PIDir(const QAD::Dir & v);
QAD_PIQT_EXPORT const PIVariantTypes::IODevice QAD2PIIODevice(const QAD::IODevice & v);
//inline const PIVariant QString2PIVariant(const QString & v) {return PIVariant::readFromString(QString2PIString(v));}
#if QT_VERSION >= 0x050200
PIQT_EXPORT const QGeoCoordinate PI2QGeoPosition(const PIGeoPosition & v);
PIQT_EXPORT const PIGeoPosition Q2PIGeoPosition(const QGeoCoordinate & v);
QAD_PIQT_EXPORT const QGeoCoordinate PI2QGeoPosition(const PIGeoPosition & v);
QAD_PIQT_EXPORT const PIGeoPosition Q2PIGeoPosition(const QGeoCoordinate & v);
#endif
template <typename From>

View File

@@ -25,10 +25,10 @@
#include "piconnection.h"
#include "qpiconfig.h"
#include "piqt.h"
#include "piqt_export.h"
#include "qad_piqt_export.h"
class PIQT_EXPORT QPIConnection: public QObject, public PIConnection {
class QAD_PIQT_EXPORT QPIConnection: public QObject, public PIConnection {
Q_OBJECT
PIOBJECT_SUBCLASS(QPIConnection, PIConnection)
public:

View File

@@ -1,9 +1,14 @@
include(PIPMacros)
pip_code_model(CCM "${ROOT_DIR}/pip/libs/main/io_devices/piiodevice.h" "${ROOT_DIR}/pip/libs/main/io_utils/pipacketextractor.h" OPTIONS "-DPIP_EXPORT" "-Es")
piqt_library(piqt_utils "Gui" "qad_utils;qad_widgets;qad_blockview;piqt" ${CCM})
find_package(PIP)
if (PIP_FOUND AND BUILDING_pip)
foreach(_v ${_QT_VERSIONS_})
if (LOCAL_FOUND${_v})
add_dependencies(piqt_utils${_v} pip_cmg)
endif()
endforeach()
project(piqt_utils)
pip_code_model(CCM "${pip_ROOT_SRC}/libs/main/io_devices/piiodevice.h" "${pip_ROOT_SRC}/libs/main/io_utils/pipacketextractor.h" OPTIONS "-DPIP_EXPORT" "-Es" ABSOLUTE)
qad_library(piqt_utils "Gui" "qad_blockview;qad_piqt" ${CCM})
foreach(_v ${_QT_VERSIONS_})
if (LOCAL_FOUND${_v})
add_dependencies(qad_piqt_utils${_v} pip_cmg)
endif()
endforeach()
endif()

View File

@@ -22,7 +22,7 @@
#include <QDialog>
#include "piconnection.h"
#include "piqt_utils_export.h"
#include "qad_piqt_utils_export.h"
namespace Ui {
@@ -33,7 +33,7 @@ class FilterItem;
class DeviceItem;
class SenderItem;
class PIQT_UTILS_EXPORT ConnectionEdit: public QDialog {
class QAD_PIQT_UTILS_EXPORT ConnectionEdit: public QDialog {
Q_OBJECT
public:
explicit ConnectionEdit(QWidget * parent = 0);

View File

@@ -22,14 +22,14 @@
#include "blockview.h"
#include "piconnection.h"
#include "piqt_utils_export.h"
#include "qad_piqt_utils_export.h"
const int __CV_Device = 1;
const int __CV_Filter = 2;
const int __CV_Sender = 3;
class PIQT_UTILS_EXPORT DeviceItem: public BlockItem {
class QAD_PIQT_UTILS_EXPORT DeviceItem: public BlockItem {
public:
DeviceItem();
@@ -55,7 +55,7 @@ protected:
};
class PIQT_UTILS_EXPORT FilterItem: public BlockItem {
class QAD_PIQT_UTILS_EXPORT FilterItem: public BlockItem {
public:
FilterItem();
@@ -85,7 +85,7 @@ protected:
};
class PIQT_UTILS_EXPORT SenderItem: public BlockItem {
class QAD_PIQT_UTILS_EXPORT SenderItem: public BlockItem {
public:
SenderItem();
@@ -105,7 +105,7 @@ protected:
};
class PIQT_UTILS_EXPORT ConnectionView: public BlockView {
class QAD_PIQT_UTILS_EXPORT ConnectionView: public BlockView {
Q_OBJECT
public:
explicit ConnectionView(QWidget * parent = 0);

View File

@@ -23,11 +23,11 @@
#include <QSyntaxHighlighter>
#include <QTextCursor>
#include <QTextCharFormat>
#include "piqt_utils_export.h"
#include "qad_piqt_utils_export.h"
class QTextDocument;
class PIQT_UTILS_EXPORT ConfigHighlighter : public QSyntaxHighlighter
class QAD_PIQT_UTILS_EXPORT ConfigHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
@@ -38,7 +38,7 @@ public:
private:
void highlightBlock(const QString &text);
struct PIQT_UTILS_EXPORT HighlightingRule {
struct QAD_PIQT_UTILS_EXPORT HighlightingRule {
QRegExp pattern;
QTextCharFormat format;
};

View File

@@ -22,14 +22,14 @@
#include <QWidget>
#include "qad_types.h"
#include "piqt_utils_export.h"
#include "qad_piqt_utils_export.h"
class QLineEdit;
class QToolButton;
class IODeviceEditDialog;
class PIQT_UTILS_EXPORT IODeviceEdit: public QWidget {
class QAD_PIQT_UTILS_EXPORT IODeviceEdit: public QWidget {
Q_OBJECT
Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
@@ -61,14 +61,14 @@ signals:
};
class PIQT_UTILS_EXPORT __IODeviceEditRegistrator__ {
class QAD_PIQT_UTILS_EXPORT __IODeviceEditRegistrator__ {
public:
__IODeviceEditRegistrator__();
};
static __IODeviceEditRegistrator__ __iodeviceeditregistrator__;
PIQT_UTILS_EXPORT void QAD_IODevice_toString(const QVariant & v, QString & r);
QAD_PIQT_UTILS_EXPORT void QAD_IODevice_toString(const QVariant & v, QString & r);
#endif // PIQT_IODEVICE_EDIT_H

View File

@@ -23,13 +23,13 @@
#include <QDialog>
#include "qad_types.h"
#include "propertystorage.h"
#include "piqt_utils_export.h"
#include "qad_piqt_utils_export.h"
namespace Ui {
class IODeviceEditDialog;
}
class PIQT_UTILS_EXPORT IODeviceEditDialog: public QDialog {
class QAD_PIQT_UTILS_EXPORT IODeviceEditDialog: public QDialog {
Q_OBJECT
public:
explicit IODeviceEditDialog(QWidget * parent = 0);

View File

@@ -1,6 +1,6 @@
find_package(OpenGL REQUIRED)
_qt_project(qglview FALSE "QAD" "Gui;OpenGL;Xml" "qad_widgets;qad_utils;${OPENGL_LIBRARIES}")
_qt_install(qglview FALSE "qad" "out_HDR" "out_QM")
shstk_qt_project(qglview FALSE "qad" "Gui;OpenGL;Xml" "qad_widgets;qad_utils;${OPENGL_LIBRARIES}")
shstk_qt_install("qad" FALSE qglview "out_HDR" "out_QM")
qt_sources(test_SRC DIR "qglview_test")
qt_wrap(${test_SRC} CPPS test_CPP)

View File

@@ -1 +1 @@
_qt_plugin(qglview "Gui;Widgets;OpenGL" "qglview")
shstk_qt_plugin(qglview "Gui;Widgets;OpenGL" "qglview")

View File

@@ -1243,7 +1243,7 @@ void QCodeEdit::invokeAutoCompletition(bool force) {
hideHelp();
return;
}
acl << wordsCompletitionList(scope.second);
if (word_complet) acl << wordsCompletitionList(scope.second);
QFont bf(font());
bf.setBold(true);
foreach (const ACPair & ac, acl) {
@@ -1274,8 +1274,9 @@ void QCodeEdit::invokeAutoCompletition(bool force) {
completer->setVisible(true);
//qApp->processEvents();
int sz = completer->verticalScrollBar()->width();
for (int i = 0; i < completer->header()->count(); ++i)
sz += qMax<int>(sz, ((QAbstractItemView*)completer)->sizeHintForColumn(i));
sz += ((QAbstractItemView*)completer)->viewport()->width();
// for (int i = 0; i < completer->header()->count(); ++i)
// sz += ((QAbstractItemView*)completer)->sizeHintForColumn(i);
completer->resize(sz, fontHeight() * 16);
} else
completer->hide();

View File

@@ -38,6 +38,7 @@ class QAD_WIDGETS_EXPORT QCodeEdit: public QWidget
Q_PROPERTY(QString text READ text WRITE setText)
Q_PROPERTY(bool showSpaces READ showSpaces WRITE setShowSpaces)
Q_PROPERTY(bool showLineNumbers READ showLineNumbers WRITE setShowLineNumbers)
Q_PROPERTY(bool wordCompletitionEnabled READ wordCompletitionEnabled WRITE setWordCompletitionEnabled)
Q_PROPERTY(QFont editorFont READ editorFont WRITE setEditorFont)
public:
@@ -72,6 +73,8 @@ public:
void registerAutoCompletitionClass(int id, ACClassType ac_class, const QString & name, const QIcon & icon = QIcon()) {ac_classes[id] = ACClass(id, ac_class, name, icon);}
bool wordCompletitionEnabled() const {return word_complet;}
protected:
typedef QPair<QString, QString> StringsPair;
typedef QPair<int, QList<StringsPair> > ACPair;
@@ -111,6 +114,7 @@ private:
QStringList cursor_scope;
int prev_lc, auto_comp_pl, timer, cur_search_ind, pos_press, pos_el_press;
bool spaces_, _ignore_focus_out, _first, _destructor, _replacing;
bool word_complet;
bool eventFilter(QObject * o, QEvent * e);
void showEvent(QShowEvent * );
@@ -163,6 +167,8 @@ public slots:
void searchNext(bool next = true);
void searchPrevious();
void hideSearch();
void setWordCompletitionEnabled(bool on) {word_complet = on;}
signals:
void textChanged();

View File

@@ -1 +1 @@
add_directories("qad_")
shstk_add_directories("")

View File

@@ -1,10 +1,15 @@
project(piconnedit)
if(APPLE)
set(APP_ICON "")
elseif(WIN32)
set(APP_ICON "")
else()
set(APP_ICON "")
find_package(PIP)
if (PIP_FOUND)
project(piconnedit)
if(APPLE)
set(APP_ICON "")
elseif(WIN32)
set(APP_ICON "")
else()
set(APP_ICON "")
endif()
set(APP_INFO "PIConnection GUI editor")
qad_application(piconnedit "Gui;Widgets" "qad_utils;qad_widgets;qad_blockview;qad_piqt_utils")
endif()
set(APP_INFO "PIConnection GUI editor")
piqt_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_blockview;piqt_utils")

View File

@@ -1,4 +0,0 @@
<RCC>
<qresource prefix="/">
</qresource>
</RCC>

View File

@@ -1,10 +1,15 @@
project(pidumper)
if(APPLE)
set(APP_ICON "")
elseif(WIN32)
set(APP_ICON "")
else()
set(APP_ICON "")
find_package(PIP)
if (PIP_FOUND)
project(pidumper)
if(APPLE)
set(APP_ICON "")
elseif(WIN32)
set(APP_ICON "")
else()
set(APP_ICON "")
endif()
set(APP_INFO "PIConnection GUI editor")
qad_application(pidumper "Gui;Widgets" "qad_utils;qad_widgets;qad_piqt_utils")
endif()
set(APP_INFO "PIConnection GUI editor")
piqt_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;piqt_utils")

View File

@@ -1,13 +1,24 @@
project(piintrospector)
if(APPLE)
set(APP_ICON "")
elseif(WIN32)
set(APP_ICON "")
else()
set(APP_ICON "")
find_package(PIP)
if (PIP_FOUND AND BUILDING_pip)
project(piintrospector)
if(APPLE)
set(APP_ICON "")
elseif(WIN32)
set(APP_ICON "")
else()
set(APP_ICON "")
endif()
set(APP_INFO "PIConnection GUI editor")
include(PIPMacros)
set(PII_ROOT "${pip_ROOT_SRC}/libs/main/introspection")
pip_code_model(CCM "${PII_ROOT}/piintrospection_server_p.h" "${PII_ROOT}/piintrospection_threads_p.h" OPTIONS "-DPIP_EXPORT" "-Es" ABSOLUTE)
qad_application(piintrospector "Gui;Widgets" "qad_utils;qad_widgets;qad_application;qad_piqt_utils" ${CCM})
foreach(_v ${_QT_VERSIONS_})
if (LOCAL_FOUND${_v})
add_dependencies(qad_piqt_utils${_v} pip_cmg)
endif()
endforeach()
endif()
set(APP_INFO "PIConnection GUI editor")
include(PIPMacros)
set(PII_ROOT "${ROOT_DIR}/pip/libs/main/introspection")
pip_code_model(CCM "${PII_ROOT}/piintrospection_server_p.h" "${PII_ROOT}/piintrospection_threads_p.h" OPTIONS "-DPIP_EXPORT" "-Es")
piqt_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_application;piqt_utils" ${CCM})

View File

@@ -7,7 +7,7 @@ else()
set(APP_ICON "icons/qpicalculator.png")
endif()
set(APP_INFO "Small calculator ang grapher")
qad_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_graphic;pip;piqt")
qad_application(${PROJECT_NAME} "Gui;Widgets" "qad_utils;qad_widgets;qad_graphic;qad_piqt;pip")
if (Qt5_FOUND)
import_version(${PROJ_NAME}5 ${PROJECT_NAME})
deploy_target(${PROJECT_NAME}5 DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${ROOT_DIR}/release)