diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aa03421..43fffdf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/cmake/QSkinnyMacros.cmake b/cmake/QSkinnyMacros.cmake index 3a4c18a1..e966cefb 100644 --- a/cmake/QSkinnyMacros.cmake +++ b/cmake/QSkinnyMacros.cmake @@ -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}) diff --git a/cmake/QskBuild.cmake b/cmake/QskBuild.cmake index 9f450f6d..bdf5f698 100644 --- a/cmake/QskBuild.cmake +++ b/cmake/QskBuild.cmake @@ -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) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ede5df3e..fa7b5153 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -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) \ No newline at end of file +if( BUILD_QML_EXPORT ) + add_subdirectory(boxes) + add_subdirectory(buttons) + add_subdirectory(frames) + add_subdirectory(glabels) + add_subdirectory(messageboxQml) +endif() diff --git a/playground/CMakeLists.txt b/playground/CMakeLists.txt index e9f8e1fd..4dab3e0a 100644 --- a/playground/CMakeLists.txt +++ b/playground/CMakeLists.txt @@ -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) diff --git a/playground/shapes/CMakeLists.txt b/playground/shapes/CMakeLists.txt index 954ea987..f9d79131 100644 --- a/playground/shapes/CMakeLists.txt +++ b/playground/shapes/CMakeLists.txt @@ -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() diff --git a/playground/shapes/main.cpp b/playground/shapes/main.cpp index 5d755e5d..bfd57c6a 100644 --- a/playground/shapes/main.cpp +++ b/playground/shapes/main.cpp @@ -7,12 +7,14 @@ #include "GeometricShape.h" #include "Stroke.h" -#include #include #include #include +#ifndef NO_QML + +#include #include 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++";