Here’s a checklist what must be done, to use Xtend to generate C++ sources.
QtC meets Eclipse … C++ meets Java 😉
Each QtC project has a corresponding Eclipse project.
Let’s take a look at the filestructure.
The Eclipse Project
Here’s the Eclipse Application and the cloned GitHub repo with ekkesMobileDSL. Also for each project there are the runtime-<myproject> configurations and also the Eclipse workspace,
The QtCreator Project
Inside the cpp src folder there’s a gen folder where all generated sources will be stored.
Inside the gen-model
folder the DTO model (<myProject>.dtos
) is stored:
Start the Eclipse App and select your workspace.
Select an existing Run Configuration or create a new one / duplicate an existing one.
Run as Run Configuration
Right-Click on org.ekkescorner.dtos.dtodsl.ui
If there is already a Run Configuration for your project, you can select the config – otherwise create or manage your configuration.
Select an existing Run Configuration
Select your project from the list and hit RUN.
Manage Run Configurations
Create a new Eclipse Application or duplicate an existing one.
Enter the name of the project. Then hit Apply Button.
Check VM Args
If there’s no -Xmx arg or another value, please enter -Xmx4096m
Run the new or duplicated Config
Now a new Eclipse Runtime isa started on top of your Eclipse IDE.
Close the Welcome Page
Create a Plug-in Project
Name the Plug-in project
Finish the Plug-in Project
Hit the Finish Button
Do NOT open Plug-in Perspective !
Add Dependencies to Plug-in Project
Select DTO Plugin
Hit Add Button.
Save the Plug-in Project
Switch AUTO BUILD OFF
On src: NEW OTHER
Right-click on the src folder
On src: NEW OTHER GENERAL FOLDER
Hit NEXT
Link to folder gen-model
Tap on Advanced, select Link to alternate location. This is where the magic between QtC project and Eclipse project happens.
Hit Finish
On Project: NEW OTHER
Now do a right-click on the top level of the project:
On Project: NEW OTHER GENERAL FOLDER
Hit NEXT
Link to folder gen
Again tap on Advanced and Link to alternate location, the cpp/gen
folder in QtC project.
Hit Finish.
First time Open DTOS
Now in the Project Explorer you’ll find the <myProject>.dtos data model.
Double-click and Open the .dtos file
Convert to XTEXT – YES
it YES to convert the Plug-in Project to an Xtext Project.
Switch AUTO BUILD ON
Now we can switch the Auto Build on again.
Control generated sources
Take a look into the (linked) gen folder, if sources are generated.
Check GIT
If this is a converted project from Qt 5.15 with an older Eclipse to Qt 6.6 with Eclipse DSL from June 2023, it’s a good idea to check if the new generated files are identical and nothing changed:
Mission completed 🙂
You must be logged in to post a comment.