qskinny
qskinny copied to clipboard
CMake support
While QMake is a good build system, CMake is far more feature rich and flexible. Please consider supporting CMake build system as well. After all the default build system for Qt6 is CMake.
While I completely agree with moving to cmake is the right direction - I'm not sure if this should be a high priority. Do you have any limitations with qmake ?
How can I add this library to my Cmake project?
I just came across Qskinny today and love the concept. I've never got along with QML myself (the rest of my team refuse to even try it).
Gotta agree with OP that lack of Cmake support pretty much kills it for us. Qmake is not bad, but I figure most people that want to avoid using QT QML also likely want to avoid Qmake.
qmake is needed for building qskinny ( as long as the cmake migration has not been done ) - but that has no implication for a project using qskinny. Build and install qskinny - like installing a package with your package manager - and then nothing prevents you from using cmake for your project.
qskinny-0.0.0|⇒ pwd
/usr/local/qskinny-0.0.0
qskinny-0.0.0|⇒ ll
总用量 20K
drwxr-xr-x 2 root root 4.0K 6月 24 10:18 bin
drwxr-xr-x 4 root root 4.0K 6月 24 09:21 examples
drwxr-xr-x 2 root root 4.0K 6月 24 10:18 include
drwxr-xr-x 2 root root 4.0K 6月 24 10:18 lib
drwxr-xr-x 4 root root 4.0K 6月 24 09:21 plugins
After I executed make install, some header files were not in this path.
I use cmake. https://qskinny.github.io/docs/tutorials/03-writing-your-first-application/ main.cpp:1:10: error: 'SkinnyFont.h' file not found
cmake_minimum_required(VERSION 3.5)
project(hello-qskinny LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check http://doc.qt.io/qt-5/deployment-android.html for more information.
# They need to be set before the find_package(Qt5 ...) call.
#if(ANDROID)
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
# if (ANDROID_ABI STREQUAL "armeabi-v7a")
# set(ANDROID_EXTRA_LIBS
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
# endif()
#endif()
find_package(Qt5 COMPONENTS Widgets Quick REQUIRED)
include_directories(
/usr/local/qskinny-0.0.0/include
)
if(ANDROID)
add_library(hello-qskinny SHARED
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
else()
add_executable(hello-qskinny
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
endif()
target_link_libraries(hello-qskinny PRIVATE
Qt5::Widgets
Qt5::Quick
/usr/local/qskinny-0.0.0/lib/libqskinny.so
/usr/local/qskinny-0.0.0/example/lib/libqsktestsupport.so)
main.cpp
#include <SkinnyFont.h>
#include <QskWindow.h>
#include <QGuiApplication>
int main( int argc, char* argv[] )
{
QGuiApplication app( argc, argv );
SkinnyFont::init( &app );
QskWindow window;
window.show();
return app.exec();
}
This is a bug in the docs - simply remove the SkinnyFont line.
Everything that is installed below example/ is for running the examples only and f.e libqsktestsupport.so is not supposed to be used in application code.
CMakeList.txt
cmake_minimum_required(VERSION 3.5)
project(hello-qskinny LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check http://doc.qt.io/qt-5/deployment-android.html for more information.
# They need to be set before the find_package(Qt5 ...) call.
#if(ANDROID)
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
# if (ANDROID_ABI STREQUAL "armeabi-v7a")
# set(ANDROID_EXTRA_LIBS
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
# endif()
#endif()
find_package(Qt5 COMPONENTS Widgets Quick REQUIRED)
include_directories(
/usr/local/qskinny-0.0.0/include
)
if(ANDROID)
add_library(hello-qskinny SHARED
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
else()
add_executable(hello-qskinny
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
endif()
target_link_libraries(hello-qskinny PRIVATE
Qt5::Widgets
Qt5::Quick
/usr/local/qskinny-0.0.0/lib/libqskinny.so
)
main.cpp
#include <QskWindow.h>
#include <QskLinearBox.h>
#include <QskTextLabel.h>
#include <QskPushButton.h>
#include <QApplication>
#include "mainwindow.h"
int main( int argc, char* argv[] )
{
QApplication a(argc, argv);
QskWindow w;
w.show();
return a.exec();
}
This time I did not report any errors, but the program ended abnormally. The window did not run successfully. @uwerat
I have updated the tutorial and added support for PREFIX to the project files. The crash might be because of not finding the skin plugins - please check the updated tutorial.
How does cmake add this?
QT_PLUGIN_PATH=/opt/qskinny/plugins
This is a runtime parameter ( environment ) - it has nothing to do with the build system.
The current state of the implementation can now be found here: https://github.com/uwerat/qskinny/tree/cmake After some period of successful testing it will go into master
Unfortunately this branch is more or less a 1:1 translation of the Qskinny qmake project files only, where the magic behind the qmake keywords got lost. So there is still some way to go ...
I am willing to take on this project. My current attempt to install with Cmake went fairly well with some unintended consequences. This was built on Manjaro.
Here is what works:
$ cd qskinny
$ mkdir build
$ cd build
$ cmake ../ && make
$ sudo make install
The sudo make install did install the libraries however they were not namespaced correctly under a qskinny-0.0.0
directory:
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libqskinny.so.0.8.0
-- Installing: /usr/local/lib/libqskinny.so.0.8
-- Installing: /usr/local/lib/libqskinny.so
-- Installing: /usr/local/include/QskArcMetrics.h
-- Installing: /usr/local/include/QskAspect.h
-- Installing: /usr/local/include/QskBoxBorderColors.h
-- Installing: /usr/local/include/QskBoxBorderMetrics.h
-- Installing: /usr/local/include/QskBoxShapeMetrics.h
-- Installing: /usr/local/include/QskBoxHints.h
-- Installing: /usr/local/include/QskFunctions.h
-- Installing: /usr/local/include/QskGlobal.h
-- Installing: /usr/local/include/QskGradient.h
-- Installing: /usr/local/include/QskGradientDirection.h
-- Installing: /usr/local/include/QskGradientStop.h
-- Installing: /usr/local/include/QskGraduation.h
-- Installing: /usr/local/include/QskGraduationMetrics.h
-- Installing: /usr/local/include/QskHctColor.h
-- Installing: /usr/local/include/QskIntervalF.h
-- Installing: /usr/local/include/QskLabelData.h
-- Installing: /usr/local/include/QskMargins.h
-- Installing: /usr/local/include/QskMetaFunction.h
-- Installing: /usr/local/include/QskMetaFunction.hpp
-- Installing: /usr/local/include/QskMetaInvokable.h
-- Installing: /usr/local/include/QskNamespace.h
-- Installing: /usr/local/include/QskObjectCounter.h
-- Installing: /usr/local/include/QskPlacementPolicy.h
-- Installing: /usr/local/include/QskPlatform.h
-- Installing: /usr/local/include/QskRgbValue.h
-- Installing: /usr/local/include/QskShadowMetrics.h
-- Installing: /usr/local/include/QskSizePolicy.h
-- Installing: /usr/local/include/QskStateCombination.h
-- Installing: /usr/local/include/QskStippleMetrics.h
-- Installing: /usr/local/include/QskTextColors.h
-- Installing: /usr/local/include/QskTextOptions.h
-- Installing: /usr/local/include/QskTickmarks.h
-- Installing: /usr/local/include/QskColorFilter.h
-- Installing: /usr/local/include/QskGraphic.h
-- Installing: /usr/local/include/QskGraphicImageProvider.h
-- Installing: /usr/local/include/QskGraphicIO.h
-- Installing: /usr/local/include/QskGraphicPaintEngine.h
-- Installing: /usr/local/include/QskGraphicProvider.h
-- Installing: /usr/local/include/QskGraphicProviderMap.h
-- Installing: /usr/local/include/QskGraphicTextureFactory.h
-- Installing: /usr/local/include/QskIcon.h
-- Installing: /usr/local/include/QskPainterCommand.h
-- Installing: /usr/local/include/QskStandardSymbol.h
-- Installing: /usr/local/include/QskArcNode.h
-- Installing: /usr/local/include/QskBasicLinesNode.h
-- Installing: /usr/local/include/QskBoxNode.h
-- Installing: /usr/local/include/QskBoxClipNode.h
-- Installing: /usr/local/include/QskBoxFillNode.h
-- Installing: /usr/local/include/QskBoxRectangleNode.h
-- Installing: /usr/local/include/QskBoxRenderer.h
-- Installing: /usr/local/include/QskBoxMetrics.h
-- Installing: /usr/local/include/QskBoxBasicStroker.h
-- Installing: /usr/local/include/QskBoxGradientStroker.h
-- Installing: /usr/local/include/QskBoxColorMap.h
-- Installing: /usr/local/include/QskBoxShadowNode.h
-- Installing: /usr/local/include/QskColorRamp.h
-- Installing: /usr/local/include/QskFillNode.h
-- Installing: /usr/local/include/QskGraduationNode.h
-- Installing: /usr/local/include/QskGraduationRenderer.h
-- Installing: /usr/local/include/QskGraphicNode.h
-- Installing: /usr/local/include/QskTreeNode.h
-- Installing: /usr/local/include/QskLinesNode.h
-- Installing: /usr/local/include/QskPaintedNode.h
-- Installing: /usr/local/include/QskPlainTextRenderer.h
-- Installing: /usr/local/include/QskRichTextRenderer.h
-- Installing: /usr/local/include/QskSGNode.h
-- Installing: /usr/local/include/QskStrokeNode.h
-- Installing: /usr/local/include/QskStippledLineRenderer.h
-- Installing: /usr/local/include/QskShapeNode.h
-- Installing: /usr/local/include/QskGradientMaterial.h
-- Installing: /usr/local/include/QskTextNode.h
-- Installing: /usr/local/include/QskTextRenderer.h
-- Installing: /usr/local/include/QskTextureRenderer.h
-- Installing: /usr/local/include/QskVertex.h
-- Installing: /usr/local/include/QskAbstractButton.h
-- Installing: /usr/local/include/QskAnimationHint.h
-- Installing: /usr/local/include/QskAnimator.h
-- Installing: /usr/local/include/QskMainView.h
-- Installing: /usr/local/include/QskBoundedControl.h
-- Installing: /usr/local/include/QskBoundedInput.h
-- Installing: /usr/local/include/QskBoundedRangeInput.h
-- Installing: /usr/local/include/QskBoundedValueInput.h
-- Installing: /usr/local/include/QskBox.h
-- Installing: /usr/local/include/QskBoxSkinlet.h
-- Installing: /usr/local/include/QskCheckBox.h
-- Installing: /usr/local/include/QskCheckBoxSkinlet.h
-- Installing: /usr/local/include/QskComboBox.h
-- Installing: /usr/local/include/QskComboBoxSkinlet.h
-- Installing: /usr/local/include/QskControl.h
-- Installing: /usr/local/include/QskDrawer.h
-- Installing: /usr/local/include/QskDrawerSkinlet.h
-- Installing: /usr/local/include/QskEvent.h
-- Installing: /usr/local/include/QskFlickAnimator.h
-- Installing: /usr/local/include/QskFocusIndicator.h
-- Installing: /usr/local/include/QskFocusIndicatorSkinlet.h
-- Installing: /usr/local/include/QskGesture.h
-- Installing: /usr/local/include/QskGestureRecognizer.h
-- Installing: /usr/local/include/QskGraphicLabel.h
-- Installing: /usr/local/include/QskGraphicLabelSkinlet.h
-- Installing: /usr/local/include/QskHintAnimator.h
-- Installing: /usr/local/include/QskInputGrabber.h
-- Installing: /usr/local/include/QskListView.h
-- Installing: /usr/local/include/QskListViewSkinlet.h
-- Installing: /usr/local/include/QskMenu.h
-- Installing: /usr/local/include/QskMenuSkinlet.h
-- Installing: /usr/local/include/QskObjectTree.h
-- Installing: /usr/local/include/QskPageIndicator.h
-- Installing: /usr/local/include/QskPageIndicatorSkinlet.h
-- Installing: /usr/local/include/QskPanGestureRecognizer.h
-- Installing: /usr/local/include/QskPopup.h
-- Installing: /usr/local/include/QskPopupSkinlet.h
-- Installing: /usr/local/include/QskProgressBar.h
-- Installing: /usr/local/include/QskProgressBarSkinlet.h
-- Installing: /usr/local/include/QskProgressIndicator.h
-- Installing: /usr/local/include/QskProgressIndicatorSkinlet.h
-- Installing: /usr/local/include/QskProgressRing.h
-- Installing: /usr/local/include/QskProgressRingSkinlet.h
-- Installing: /usr/local/include/QskPushButton.h
-- Installing: /usr/local/include/QskPushButtonSkinlet.h
-- Installing: /usr/local/include/QskQuick.h
-- Installing: /usr/local/include/QskQuickItem.h
-- Installing: /usr/local/include/QskRadioBox.h
-- Installing: /usr/local/include/QskRadioBoxSkinlet.h
-- Installing: /usr/local/include/QskScrollArea.h
-- Installing: /usr/local/include/QskScrollBox.h
-- Installing: /usr/local/include/QskScrollView.h
-- Installing: /usr/local/include/QskScrollViewSkinlet.h
-- Installing: /usr/local/include/QskSegmentedBar.h
-- Installing: /usr/local/include/QskSegmentedBarSkinlet.h
-- Installing: /usr/local/include/QskSeparator.h
-- Installing: /usr/local/include/QskSeparatorSkinlet.h
-- Installing: /usr/local/include/QskSetup.h
-- Installing: /usr/local/include/QskShortcutMap.h
-- Installing: /usr/local/include/QskSimpleListBox.h
-- Installing: /usr/local/include/QskSkin.h
-- Installing: /usr/local/include/QskSkinFactory.h
-- Installing: /usr/local/include/QskSkinHintTable.h
-- Installing: /usr/local/include/QskSkinHintTableEditor.h
-- Installing: /usr/local/include/QskSkinManager.h
-- Installing: /usr/local/include/QskSkinStateChanger.h
-- Installing: /usr/local/include/QskSkinTransition.h
-- Installing: /usr/local/include/QskSkinlet.h
-- Installing: /usr/local/include/QskSkinnable.h
-- Installing: /usr/local/include/QskSlider.h
-- Installing: /usr/local/include/QskSliderSkinlet.h
-- Installing: /usr/local/include/QskStatusIndicator.h
-- Installing: /usr/local/include/QskStatusIndicatorSkinlet.h
-- Installing: /usr/local/include/QskSpinBox.h
-- Installing: /usr/local/include/QskSpinBoxSkinlet.h
-- Installing: /usr/local/include/QskSubWindowArea.h
-- Installing: /usr/local/include/QskSubWindowAreaSkinlet.h
-- Installing: /usr/local/include/QskSubWindow.h
-- Installing: /usr/local/include/QskSubWindowSkinlet.h
-- Installing: /usr/local/include/QskSwitchButton.h
-- Installing: /usr/local/include/QskSwitchButtonSkinlet.h
-- Installing: /usr/local/include/QskSwipeView.h
-- Installing: /usr/local/include/QskTabBar.h
-- Installing: /usr/local/include/QskTabButton.h
-- Installing: /usr/local/include/QskTabButtonSkinlet.h
-- Installing: /usr/local/include/QskTabView.h
-- Installing: /usr/local/include/QskTabViewSkinlet.h
-- Installing: /usr/local/include/QskTextInput.h
-- Installing: /usr/local/include/QskTextInputSkinlet.h
-- Installing: /usr/local/include/QskTextLabel.h
-- Installing: /usr/local/include/QskTextLabelSkinlet.h
-- Installing: /usr/local/include/QskVariantAnimator.h
-- Installing: /usr/local/include/QskWindow.h
-- Installing: /usr/local/include/QskGridBox.h
-- Installing: /usr/local/include/QskGridLayoutEngine.h
-- Installing: /usr/local/include/QskIndexedLayoutBox.h
-- Installing: /usr/local/include/QskLayoutChain.h
-- Installing: /usr/local/include/QskLayoutEngine2D.h
-- Installing: /usr/local/include/QskLayoutElement.h
-- Installing: /usr/local/include/QskLayoutMetrics.h
-- Installing: /usr/local/include/QskLinearBox.h
-- Installing: /usr/local/include/QskLinearLayoutEngine.h
-- Installing: /usr/local/include/QskStackBoxAnimator.h
-- Installing: /usr/local/include/QskStackBox.h
-- Installing: /usr/local/include/QskDialog.h
-- Installing: /usr/local/include/QskDialogButton.h
-- Installing: /usr/local/include/QskDialogButtonBox.h
-- Installing: /usr/local/include/QskDialogSubWindow.h
-- Installing: /usr/local/include/QskDialogWindow.h
-- Installing: /usr/local/include/QskMessageSubWindow.h
-- Installing: /usr/local/include/QskMessageWindow.h
-- Installing: /usr/local/include/QskSelectionSubWindow.h
-- Installing: /usr/local/include/QskSelectionWindow.h
-- Installing: /usr/local/include/QskTextPredictor.h
-- Installing: /usr/local/include/QskInputContext.h
-- Installing: /usr/local/include/QskInputPanel.h
-- Installing: /usr/local/include/QskInputPanelBox.h
-- Installing: /usr/local/include/QskInputPredictionBar.h
-- Installing: /usr/local/include/QskVirtualKeyboard.h
-- Installing: /usr/local/plugins/skins/libsquiekskin.so
-- Set non-toolchain portion of runtime path of "/usr/local/plugins/skins/libsquiekskin.so" to "${ORIGIN}/../../lib"
-- Installing: /usr/local/plugins/skins/libmaterial3skin.so
-- Set non-toolchain portion of runtime path of "/usr/local/plugins/skins/libmaterial3skin.so" to "${ORIGIN}/../../lib"
-- Installing: /usr/local/plugins/skins/libfluent2skin.so
-- Set non-toolchain portion of runtime path of "/usr/local/plugins/skins/libfluent2skin.so" to "${ORIGIN}/../../lib"
-- Installing: /usr/local/lib/libqskqmlexport.so.0.8.0
-- Installing: /usr/local/lib/libqskqmlexport.so.0.8
-- Set non-toolchain portion of runtime path of "/usr/local/lib/libqskqmlexport.so.0.8.0" to "${ORIGIN}"
-- Installing: /usr/local/lib/libqskqmlexport.so
-- Installing: /usr/local/include/QskQml.h
-- Installing: /usr/local/plugins/platforminputcontexts/libqskinputcontext.so
-- Set non-toolchain portion of runtime path of "/usr/local/plugins/platforminputcontexts/libqskinputcontext.so" to "${ORIGIN}/../../lib"
-- Installing: /usr/local/bin/svg2qvg
As well as adding /usr/local/plugins
directory which seems non-standard (but I honestly do not know).
I will attach the full build sequence log file as well.
It seems this only needs a few tweaks such as setting proper paths, though I have not tested importing the code into my application yet.
Looking at Cmake docs, it looks like one or more of the following variables need to be set:
install(TARGETS <target>... [EXPORT <export-name>]
[RUNTIME_DEPENDENCIES <arg>...|RUNTIME_DEPENDENCY_SET <set-name>]
[<artifact-option>...]
[<artifact-kind> <artifact-option>...]...
[INCLUDES DESTINATION [<dir> ...]]
)
...
install(TARGETS ${target}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qskinny
)
https://cmake.org/cmake/help/latest/command/install.html#targets
Obviously this will vary per platform but the common install paths seem to be:
/usr/local/lib/qskinny/
/usr/local/include/qskinny/
For example:
/usr/local/lib/qskinny/libqskinny.so.0.8.0
/usr/local/lib/qskinny/libqskinny.so.0.8
/usr/local/lib/qskinny/libqskinny.so
...
/usr/local/include/qskinny/QskArcMetrics.h
/usr/local/include/qskinny/QskAspect.h
/usr/local/include/qskinny/QskBoxBorderColors.h
/usr/local/include/qskinny/QskBoxBorderMetrics.h
/usr/local/include/qskinny/QskBoxShapeMetrics.h
/usr/local/include/qskinny/QskBoxHints.h
...
/usr/local/lib/qskinny/plugins/skins/libfluent2skin.so
/usr/local/lib/qskinny/bin/svg2qvg
We are using cmake since quite some time - this issue has been forgotten to be closed.
However not all details have been solved - mostly about installation and using the installed libs - and I would be glad if you could have a look at it: https://github.com/uwerat/qskinny/issues?q=is%3Aissue+is%3Aopen+label%3Acmake
Yes I can take a look. I already edited my previous response a few times with the correct information (the cmake docs are dense). I think I have a solution and I will take a look at the other issues as well.
Would you like me to to create a new issue for CMake install paths instead of bumping this one?
This issue is kind of related to the installation topic: https://github.com/uwerat/qskinny/issues/292 Please continue there.