more build options ( completely untested for the moment )

This commit is contained in:
Uwe Rathmann 2023-03-31 18:12:38 +02:00
parent 3fd951ab1c
commit bf4ab34ad8
7 changed files with 69 additions and 24 deletions

View File

@ -5,17 +5,34 @@ project(QSkinny
HOMEPAGE_URL "https://github.com/uwerat/qskinny"
VERSION 999.99.9)
option(BUILD_QSKDLL
"Build qskinny as shared library" ON)
# Useful unsupported scenarios:
# - When cross compiling we might want to build the tools only
# - Suppressing
option(BUILD_QSKDLL "Build libs ( not plugins ) as shared library" ON)
option(BUILD_QML_EXPORT "Exporting QSkinny to QML" ON)
option(BUILD_TOOLS "Build qskinny tools" ON)
option(BUILD_INPUTCONTEXT "Build virtual keyboard support" ON)
option(BUILD_EXAMPLES "Build qskinny examples" ON)
option(BUILD_PLAYGROUND "Build qskinny playground" ON)
option(BUILD_SVG2QVG_STANDALONE "Build svg2qvg without qskinny library dependency" ON)
option(ENABLE_PINYIN "UNIX: Enable romanization system for standard mandarin chinese" OFF)
option(ENABLE_HUNSPELL "UNIX: Enable spell checker" OFF)
# we actually want to use cmake_dependent_option - minimum cmake version ??
option( BUILD_SVG2QVG_STANDALONE "Build svg2qvg without qskinny library dependency" ON )
if( NOT BUILD_TOOLS )
set( BUILD_SVG2QVG_STANDALONE OFF )
endif()
if( NOT BUILD_INPUTCONTEXT )
set( ENABLE_PINYIN OFF )
set( ENABLE_HUNSPELL OFF )
endif()
option(ENABLE_ENSURE_SKINS "Examples will load skins manually, when not finding plugins" ON)
if ( NOT ( BUILD_EXAMPLES OR BUILD_PLAYGROUND ) )
set( ENABLE_ENSURE_SKINS OFF )
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@ -28,14 +45,20 @@ include("QskBuild")
add_subdirectory(src)
add_subdirectory(skins)
add_subdirectory(inputcontext)
add_subdirectory(qmlexport)
if(BUILD_QML_EXPORT)
add_subdirectory(qmlexport)
endif()
if(BUILD_INPUTCONTEXT)
add_subdirectory(inputcontext)
endif()
if(BUILD_EXAMPLES OR BUILD_EXAMPLES)
add_subdirectory(support)
endif()
if(BUILD_TOLLS)
if(BUILD_TOOLS)
add_subdirectory(tools)
endif()

View File

@ -73,8 +73,13 @@ function(qsk_example EXAMPLE_NAME)
# not all examples need this one. TODO ...
target_link_libraries(${TARGET_NAME} PRIVATE qsktestsupport)
# only needed, when having QML files, autodetection might be possible
target_link_libraries(${TARGET_NAME} PRIVATE qskqmlexport)
if( BUILD_QML_EXPORT )
# Only needed, when having QML files. Autodetections is possible
# by looking into all '*.qrc' files ( rcc --list *.qrc ) for *.qml
# entries TODO ...
target_link_libraries(${TARGET_NAME} PRIVATE qskqmlexport)
endif()
# for examples with subdirectories
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR})

View File

@ -16,7 +16,7 @@ set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
ADD_DEFINITIONS(-DQT_NO_KEYWORDS)
add_compile_definitions(QT_NO_KEYWORDS)
if ("pedantic" IN_LIST CONFIG)

View File

@ -1,4 +1,3 @@
#c++
add_subdirectory(desktop)
add_subdirectory(gallery)
add_subdirectory(layouts)
@ -10,9 +9,10 @@ add_subdirectory(thumbnails)
add_subdirectory(tabview)
add_subdirectory(iotdashboard)
#qml
add_subdirectory(boxes)
add_subdirectory(buttons)
add_subdirectory(frames)
add_subdirectory(glabels)
add_subdirectory(messageboxQml)
if( BUILD_QML_EXPORT )
add_subdirectory(boxes)
add_subdirectory(buttons)
add_subdirectory(frames)
add_subdirectory(glabels)
add_subdirectory(messageboxQml)
endif()

View File

@ -3,11 +3,17 @@ add_subdirectory(dials)
add_subdirectory(dialogbuttons)
add_subdirectory(gradients)
add_subdirectory(invoker)
add_subdirectory(inputpanel)
add_subdirectory(images)
add_subdirectory(shadows)
add_subdirectory(shapes)
if (BUILD_INPUTCONTEXT)
add_subdirectory(inputpanel)
endif()
if (BUILD_QML_EXPORT)
add_subdirectory(images)
endif()
if (QT_VERSION_MAJOR VERSION_LESS 6)
if(TARGET Qt::WebEngine)
add_subdirectory(webview)

View File

@ -1,5 +1,3 @@
list(APPEND RESOURCES shapes.qrc)
list(APPEND HEADERS
ShapeItem.h
GeometricShape.h
@ -13,4 +11,12 @@ list(APPEND SOURCES
Window.cpp
main.cpp)
if( BUILD_QML_EXPORT )
list(APPEND RESOURCES shapes.qrc)
endif()
qsk_example(shapes)
if( BUILD_QML_EXPORT )
target_compile_definitions(shapes PRIVATE NO_QML)
endif()

View File

@ -7,12 +7,14 @@
#include "GeometricShape.h"
#include "Stroke.h"
#include <QskQml.h>
#include <QskObjectCounter.h>
#include <SkinnyShortcut.h>
#include <QGuiApplication>
#ifndef NO_QML
#include <QskQml.h>
#include <QQmlApplicationEngine>
template< typename T >
@ -44,6 +46,8 @@ static bool doQml( int argc, char* argv[] )
return false;
}
#endif
int main( int argc, char* argv[] )
{
#ifdef ITEM_STATISTICS
@ -53,6 +57,7 @@ int main( int argc, char* argv[] )
QGuiApplication app( argc, argv );
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
#ifndef NO_QML
if ( doQml( argc, argv ) )
{
qDebug() << "Running QML";
@ -66,7 +71,7 @@ int main( int argc, char* argv[] )
return app.exec();
}
else
#endif
{
qDebug() << "Running C++";