Copperspice 1.6 and Qt Creator 4.11 (Beta)

Discuss issues related to installing or building
Post Reply
CandL
Posts: 49
Joined: Mon Oct 14 2019 6:37 pm

Copperspice 1.6 and Qt Creator 4.11 (Beta)

Post by CandL »

So I saw that there are new binaries. Decided to try them out with Qt Creator.

I followed the instructions and could build a "Hello world" app in Qt Creator using CMake.

I then tried adding a QString so I added #include <QString>. Qt Creator complains it cannot find QString , so I look back at my earlier CMake and Qt work and see that it needed a "find_package(Qt5Core REQUIRED)"

Or more generally:
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Concurrent REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
find_package(Qt5Svg REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Test REQUIRED)
find_package(Qt5Sql REQUIRED)

Basically for every QT+= module in the .pro file there is the corresponding find_package. Is this the case for Copperspice?

So the next question is once I start using the drag'n drop issues with Qt Creator.. what is the role of Peppermill in this process. Does Peppermill need to be run in CMake?

And finally should these dll's be compatible with MSVS? If so what versions 2015/2017/2019?

You are also suggesting setting C++ std to 17 in the cmake. Is this really necessary? Could I get by using C++ 11 inside my CMake? Remember most C++ coders on a scale of 1-10 are a 5 or less, while you guys are 9+. C++17 will scare them the newer guys.
ansel
Posts: 152
Joined: Fri Apr 10 2015 8:23 am

Re: Copperspice 1.6 and Qt Creator 4.11 (Beta)

Post by ansel »

I then tried adding a QString so I added #include <QString>. Qt Creator complains it cannot find QString.
Please be aware that we are not Qt 5 so none of their build file syntax will be applicable. Have a look at the two CMake files for our KitchenSink demo application:
https://github.com/copperspice/kitchensink/blob/master/CMakeLists.txt
https://github.com/copperspice/kitchensink/blob/master/src/CMakeLists.txt
What is the role of Peppermill
Information about PepperMill is provided in the overview documentation: https://www.copperspice.com/docs/cs_overview/peppermill.html

Should these dll's be compatible with MSVS?
These DLLs were build with MinGW. If you want MSVC prebuilt binaries please look at the NuGet packages for CopperSpice.
Suggesting setting C++ std to 17 in the cmake files
This is not a suggestion, but a requirement. We moved from C++11 to C++14 over two years ago due to problems with type traits, and in September of this year at CppCon the team elected to move to C++17 since there are a vast number of features provided in this version of the standard.

Switching your compiler to C++17 mode does not mean your code needs to use structured bindings or fold expressions. However, these and many others are used internally in CopperSpice, which is actually what you want so the libraries are more efficient.
Ansel Sermersheim
CopperSpice Cofounder
CandL
Posts: 49
Joined: Mon Oct 14 2019 6:37 pm

Re: Copperspice 1.6 and Qt Creator 4.11 (Beta)

Post by CandL »

Ok Ansel ... I think you FINALLY solved one issue :)

If you want MSVS binaries you have to use NUGET.

Having read over your web pages multiple times, and hearing you build with MSVS I could never find where to get the MSVS binaries. Now all I have to do is learn nuget. If I have this correct, might I suggest a note on this page: https://download.copperspice.com/copperspice/binary/cs-1.6/ and the 1.5 version.

I am afraid I am much more like Barbra then most MSVS developers... I ONLY use MS compilers and debuggers, I don't use their IDE unless forced. Guess this comes from being an older developer.... yes I remember when a Vax 11-780 was brand new.

Give me a command line window, a decent editor (eclipse/Qt Creator/notepad++), CMake/Ninja and I am ready to work.

Back to the find_package(Qt5Widgets REQUIRED) and the Qt5 comments ... I did in fact use the "HelloLunch" example CMakelists.txt file. This is when I got the could not find the include file error. Are you saying that the "find_package(CopperSpice REQUIRED)" CMake entry is all that is required for Qt Creator to resolve: QtCore QtGui QtMultimedia QtNetwork QtOpenGL QtScript QtSql QtSvg QtWebKit QtXml QtXmlPatterns?

Trying to resolve this, I recalled that Qt required the individual call out of :
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Concurrent REQUIRED)
...

Now maybe all of this gets resolved as I switch to the NUGET package.

And finally Qt Creator/Copperspice/Peppermill ... Lets say I use Qt Creator to add a new GUI window that introduces new *.ui file. In Qt this file would get moc'd and added to the build sequence. (With a quick qmake run, which is often missed by new people)

If I understand correctly adding a Peppermill step to CMakelists.txt should be able to convert and new *.ui files into updated .h files? ( would need to update the Cmakelists.txt file and re-reun cmake)
CandL
Posts: 49
Joined: Mon Oct 14 2019 6:37 pm

Re: Copperspice 1.6 and Qt Creator 4.11 (Beta)

Post by CandL »

Yet another update .... built my first running Copperspice app using MSVS.

Code: Select all

#include "QString"
#include "QVector"
#include <QtGlobal>

int main()
{
	QString myStr = "Hello from CS";
	QVector<QString> vector;

	vector << "alpha" << "beta" << "delta";
	vector.insert(2, "gamma");

        std::cout << "Hello World!\n"; 
	std::cout << myStr.toStdString() << "\n";
	std::cout << "Qt version:" << qVersion() << "\n";
}
Resulting in:

Code: Select all

Hello World!
Hello from CS
Qt version:1.6.1
Not elegant but it does work ....

So key take-aways:
- MSVS 2017 (15.9.17) x64
- Started with a MSVS Console app ... using MSVS solution files (Could not get nuget to pull Copperspice down when configured to use CMake)
- Built Hello world
- Added the NUGET package "copperspice"
- Added QString/Vector

Now to examine the command lines the MSVS used to compile and link and replicate them in CMake.

This ALL started from the NUGET comment.

I also found that NUGET and Conan are very similar in that they both create a .nuget or .conan dir in your $HOME dir. Exploring them and you see a very similar directory structure.

Now to try this all on MSVS 2019 and see how it behaves.
janwilmans
Posts: 17
Joined: Wed Oct 16 2019 9:33 pm
Contact:

Re: Copperspice 1.6 and Qt Creator 4.11 (Beta)

Post by janwilmans »

Nice to see it works :)
barbara
Posts: 447
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Copperspice 1.6 and Qt Creator 4.11 (Beta)

Post by barbara »

If you want MSVS binaries you have to use NUGET.
If you want to use CopperSpice with MSVC you either build from source or use the nuget packages. Both options work. We are considering other ways to package for MSVC but for now nuget is a good solution.
Now all I have to do is learn nuget.
There is actually almost nothing you need to learn since nuget is built into VS.
I am afraid I am much more like Barbra then most MSVS developers
Just so you know, MSVC is not my environment of choice. I do all my application work using CopperSpice and MinGW. I do not use MSVC for development.

Back to the find_package(Qt5Widgets REQUIRED) and the Qt5 comments
Please be aware that looking at any Qt5 CMake solutions will not apply to CopperSpice and may add some confusion.
I use Qt Creator to add a new GUI window that introduces new *.ui file. In Qt this file would get moc'd and added to the build sequence.
CopperSpice no longer needs moc since it is not required. We redesigned the entire meta object registration system and wrote it in pure C++. If you add a .ui file then you will need to add this to your CMake build file. Please have a look at the CMake files for KitchenSink and you will see how the ui files are handled.
If I understand correctly adding a Peppermill step
PepperMill is a utility you use one time to convert your existing Qt header files to CopperSpice C++ header files. It simply parses your file and changes the syntax of your Signal / Slot macros, properties, etc. You do not run PepperMill on .ui files.

Barbara
barbara
Posts: 447
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Copperspice 1.6 and Qt Creator 4.11 (Beta)

Post by barbara »

Hello World!
Hello from CS
Qt version:1.6.1
I am very glad you were able to build an application with CopperSpice. Please be aware that 1.6.1 is the current version of CopperSpice and is not a version of Qt.

Barbara
CandL
Posts: 49
Joined: Mon Oct 14 2019 6:37 pm

Re: Copperspice 1.6 and Qt Creator 4.11 (Beta)

Post by CandL »

Yup it is NOT Qt, and I should have said "Qversion=" but it gave me the correct answer 1.6.1.

With that response I was confident I was actually using Copperspice and had not backed into a Qt install by mistake.

The discussion on when to run the utility apps needs some clarification. When every you add or change a ui file, or add a new class. or add a resource I think you must re-run the utilities. The use case I have in mind is a Qt Creator IDE developing an app from scratch, with only Copperspice. I have a running app which means I ran the utilities once. Now I add a new C++ class that has a Copperspice UI. Don't I have to re-run the utilities to "adopt" the new ui/rc/class files?

I have also noticed that the utility packages are:
- stored in two locations on windows (Program Files and with the libraries)
- the uic/rcc/l* utilities are binary specific

[attachment removed]
barbara
Posts: 447
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Copperspice 1.6 and Qt Creator 4.11 (Beta)

Post by barbara »

have said "Qversion=" but it gave me the correct answer 1.6.1.
The function is called "qVersion" and returns the version of the CopperSpice library you are running. You need to know the exact spelling of functions, classes, and methods is critical and not optional.
The discussion on when to run the utility apps needs some clarification.
If you are talking about PepperMill then this is only run one single time and never again. The only purpose of PM is to convert syntax of header files for an existing Qt project. If you do not have a Qt app then you never need to run this. In addition, if you want to change the syntax by hand you free to do it and not use PM. As we already mentioned, the .ui files are never converted since the syntax did not change.

Here is the documentation for PepperMill: https://www.copperspice.com/docs/cs_overview/peppermill.html

Please have a look at the following page to see the syntax changes.

https://www.copperspice.com/docs/cs_overview/m_macros_metaobj.html

Barbara
Post Reply