I want to create a CMake project that contains only a QML (dll/dylib or static) library (resources included).
My idea is to create a core QML library with all my stuff (custom components, style, theme, core icons, etc) and import it when needed in all my projects (like a .lib or a dll/dylib).
At the same time, I would not want to change the components resources path in the top level project.
I'm using Qt DesignStudio and Qt Creator for Qt 6.2.x.
Right now, I have created a folder into the import folder, adding this in the CMakeLists.txt
add_subdirectory(MyFrontEndCoreLib)
Then, I have added a UICoreComponents and an Image folders into MyFrontEndCoreLib folder.
The CMakeLists.txt file into the UICoreComponents is the following:
qt_add_library(MyFrontEndCoreLib_UICoreComponents STATIC)
qt6_add_qml_module(MyFrontEndCoreLib_UICoreComponents
URI "MyFrontEndCoreLib.UICoreComponents"
VERSION 1.0
QML_FILES
IconLabel.qml
BorderedRectangle.qml
MyButton.qml
)
But I have no clue how to include this code/files into a library.
Thank you in advance
Related
I have an Ubuntu environment + Qt.
I have libraries project and UI project
How do I load both of them such that I can accept input via UI project,
and then once the library is called on UI project, I can step through the library project.
In short I can debug both UI and library.
I added the static library file path on *.pro file but I think linking is incorrect.
I really have no idea on how to do this, I appreciate your help.
I have an application where I am compiling against the libraries Qt (5.11) and Paraview (5.6). I am developing in C++ and I am also coding in Eclipse.
Yes, I am aware that Paraview is more of an application then a library. However, I will be using it as a library to intergrate Paraview in my application in order to visualize some data. I could use QT creator and that would take care of the QT library. However, I am not very familiar with QT creator as an IDE and my entire workflow has been based around eclipse. For this, I would like to utilize components that I am familiar with.
Now, as many of you know, the QT library is large, very large. So is Paraview. I could create a search path for each folder containing the header files I need in the C++ include settings. If I go in this direction, then my library search path will be long, very long. Also, there might be a situation where I need to change computers (for whatever reason), I would then need to edit the search paths for the new computer and that will take time.I had thought that I could only include the paths to the include files that I needed. And I have started to do that. However, when I compile my application, I noticed that the libraries would use include files that are located in a directory that Eclipse is not even searching in. At the end of the day, I would need to include all of the directories to which the header files are stored in.
I was wondering if there might be a better method to reference all of the files that my project needs? Both come with make files (I believe that Qt includes a QMake file?). Is there a simpler method to include all of the files instead of editing the C++ include path for eclipse? I did see an option for QMake in Eclipse, is there anything that I can do with that feature to compile to QT library with my application?
Thank you and any feedback is appreciated. Also, feel free to suggest edits or clarification so that my description is clear.
Note some good practices when working with eclipse and qt or other large library.
Include the directories with a headers
If you use option "Generate Makefile automatically", add group include path with GUI Eclipse:
copy the directories with a headers (via system explorer);
go to project properties/C/C++Build/Settings/Tool Settings/GCC C++
Compiler/Includes.
paste directories (Ctrl+V) into "Include paths" list.
If you are using a qt-eclipse-integration plugin, you can add folders via the Discovered scanner configuration. You can find it if open: project properties/C/C++ Include Paths and Symbols/Add Contributed...
Create new project
if you already have a customized project, you can use it as a template:
make a copy of the customized project and name "mytempate";
delete all files from "mytempate".
When you want to create a new project, copy the template and specify (in the copy dialog) the path where the source codes are located.
Now you have a finished new project with settings and code.
Change computers
Use one of the ways:
1. Export C/C++ project settings for use in another workspace via project properties/C/C++ General/Paths and symbols/Includes/Export Settings...
2. Pack in the archive eclipse and workspace and copy your another computer.
Let's say I have such project dependencies:
SerialPortDemo (EXE) --> SerialPort (DLL) -> ByteIo (DLL).
XYZ-App (EXE) -> XYZ-Lib (DLL) -> ByteIo (DLL)
Each DLL project has two folders, include and src. include contains the public interface header(s) and src/ the implementation along with the non-public headers.
Being used to CMake's target_include_directories with its PUBLIC, PRIVATE and INTERFACE keywords, I'd like to tell the ByteIo project if and which directory its consumers have to add to their own list of include directories in order to use the ByteIo project. The same applies to the linked libraries - again, just like target_link_libraries in CMake.
Right now I am forced to add ByteIo's include directory manually to each and every project directly or indirectly depending on ByteIo's headers. For example, the class SerialPort in the SerialPort.dll project subclasses ByteIo defined in the ByteIo.ddl project and therefore the project SerialPortDemo.exe has to add the (public) include paths of both projects, ByteIo and SerialPort.
Even for the tiny example above (SerialPortDemo, SerialPort, XYZ-App and XYZ-Lib) this is a huge waste of time and very error-prone.
Does not work:
Option sets: Too limited to be of use as the relative include path needs to change according to the location of the consumer project of a DLL project. The only workaround I could come up so far is to add full paths to the include path list in the option set - which is unacceptable.
Environment Variables: Not an acceptable solution, as it forces me to check out the projects on a very specific location and/or denies me the possibility to have the project checked out multiple times on the same machine.
Does Embarcadero C++Builder XE8 offer a sane, maintainable solution to this problem?
Right now I am forced to add ByteIo's include directory manually to each and every project directly or indirectly depending on ByteIo.
You only need to add it for projects that directly depend on ByteIo (SerialPort and XYZ-Lib). There is no reason for other projects (SerialPortDemo and XYZ-App) to have any reference to ByteIo at all.
Does Embarcadero C++Builder XE8 offer a solution to problem?
One thing that comes to mind is to create an Option Set that contains your shared settings, like the path to the ByteIo folders, and save it to an .optset file. Then you can apply that Option Set to each project as needed. You can import the .optset file directly into a project, overwriting its current configuration. Or you can create a reference to the .optset file so that multiple projects can share it.
If that does not work, you can always create a custom Environment Variable that points it at ByteIO's include folder, and then add that variable to the includes path of each project.
All my source files are stored in one project (physical) directory. Qt creator shows this files in 3 folders: Headers (for *.hpp and *.h), Sources (for *.cpp and *.c) and Forms (for *.ui). But I would like to have a few another logical folder. For example I would like to create logical folder "protocol" logically containing *.hpp and *.cpp files which maintain network connection and so on. I don't want to create a new folder on my disk for these files. I want only logical one in Qt Creator. Is it possible?
One more reason why I need these logical folders is that I would like to see often used files in one place
QtCreator 3.0 has QBS support, a build system that will supersede qmake.
It has Group of files, which is displayed as a virtual folder.
Anyway, having too much files in one folder is always annoying and a bad practice.
By using prefix property of Group you can easily change the path of files.
For qmake projects, the only way it's possible, unfortunately, is by tweaking Qt Creator project manager plugin sources.
Remember that Qt Creator doesn't manage any of those files by itself. The file lists are extracted from project file(s) by a project manager plugin. If/when a plugin adds them, they are added to the project file(s).
You're most likely using the qmake project manager. A "simple" way to do it would be to extract the file grouping from variables with a common prefix. Let's say the intersection of each QTC_Foo with union of HEADERS and SOURCES would be displayed in Foo group.
I think it might be simple to implement, so I might come up with a patch later in this answer. The first step for you is downloading and compiling Qt Creator :)
So I'm playing around with an ActionScript library (Flare, to be specific) in Flex Builder 3. I'd like to have this functionality available to all projects in my workspace without having to copy it to every one. What's the easiest way to do this?
I'm not sure this is the best way, but you can link to a folder or file from within a project. You right-click on the project, and choose "New <whatever>" and click on the Advanced button to access the link functionality. From there, you can use the file navigator to choose a file or folder. Afterwards it will show up in the project properties under the build path (the tab for library paths).
We use this because we split off a large chunk of our code into a separate library project, but that code still references a ton of image files in the original projects root directory. So we create a link to that image directory and all is well again. Maybe this will help you also.
We have a shared folder "flex" that we place our common libs. In the properties for the project, under flex build path, set the library path to your location for flare.