Is there a way to make qmke store qml .cpp files in a directory like mocs or objs? - qmake

I just started using Qt 5.12.4. I've just compiled some working code that uses QML and no the output directory contains a bunch of files that start with qml_[Name of a QML File].cpp
Is there a QMake directive that I can add to the .pro file so that those files will be generated in a specific folder? (Like the MOCS_DIR directive for moc cpp files)

Related

Make Xcode build a C file generated by processing a file with a custom extension

I'm trying to set up Xcode to build generated .c files just like it does for files generated by yacc (*.y) and lex (*.l) files.
Say I have input files with a *.corn extension that are meant to be processed by a tool of mine to create C source files. I then want these C source files to be compiled and linked using the rest of Xcode's mechanisms.
This is exactly what happens to my .y and .l files for yacc and lex. The project target contains only the .y and .l files and the rest happens automatically. Generated .c files get put in the derived files directory and those get compiled and linked automatically.
Here's what I've tried so far:
-If I just add a .corn file to my target, Xcode copies it into the bundle at build time presuming it is a resource. Okay, whatever.
-I then create a custom build rule to handle
Source files with names matching: *.corn
Using Custom Script:
#!/bin/sh
cp "${INPUT_FILE_PATH}" "${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.c"
I have to give it an output file so:
OutputFiles:
${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.c
Note in this case I'm just copying the file as I rename it with .c extension. (As I'm playing around, the .corn file just contains C source.)
So now before the bundle directory even gets created I get the following warning:
unexpected C compiler invocation with specified outputs: 'blahblahblah/Build/Products/Debug-iphonesimulator/MyApp.app/foo.c' (for input: 'blahblahblah/Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyApp.build/DerivedSources/foo.c')
Then after the link phase (sheesh!), the script above runs and I do end up with my foo.c in DERIVED_FILES_DIR. It doesn't get compiled however and notably, foo.corn didn't get copied into the bundle anymore so there's hope.
I've tried a bunch of other stuff, but this is the cleanest I can describe that others can try. Please what is the magic incantation to make this work?!
Note that I've also tried using DERIVED_SOURCES_DIR instead of DERIVED_FILES_DIR.
So I missed two things:
I needed to add the .corn files to the "Compile Sources" build phase.
By adding .corn files to the project/target before the adding the custom build rule, Xcode added the .corn files to the "Copy Bundle Resources" build phase which broke the build.

Automate the process of including generated proto files into an Xcode project

Our iOS app currently is using Google protobuffer gRPC as our API layer to communicate between App and backend. And so we have these .proto files in our backend directory which will be converting to .grpc.swift and .pb.swift files by gRPC-Swift-Plugins and then consumed by the App.
This works okay, but the process of converting is very tedious, and we would like to automate the whole process.
Below is how we're doing it:
Delete previously copied directory, and copy all .proto files from backend (.proto files are maintained by backend devs) to App directory named "Protos" via a shell script
We already set up Build rules and include .proto files in Compile Sources. Following the steps from an answer here on SO
Screenshot of the current setup in Xcode Build Rules:
Whenever we build the project, .pb.swift and .grpc.swift are generated and putting into a directory named "generated" under the "Protos" folder.
Here are the problems:
If the backend added a new .proto files into the source directory, my script will only copy the files into the Protos directory but not included news files in the Compile Sources list.
Similar to the first problem, we need to manually set up Compile Sources in Xcode and that means if a new dev joins our team, he/she also needs to do the same setup again.
We sometimes need to refer to the .grpc.swift and .ph.swift files while coding. But If we add these files into Xcode and build the project again, Xcode will complain that these generated files are there like (Sorry, we're working on a private repo, so the project name and file names are replaced):
Multiple commands produce '${user_path}/${proto_name}.pb.o':
Target '${my_project_name}' (project '${my_project_name}') has compile command for Swift source files
Target '${my_project_name}' (project '${my_project_name}') has compile command for Swift source files
Any answers or comments and suggestions are greatly appreciated!
It's interesting I didn't have those problems with Swift if I use the $DERIVED_FILE_DIR
protoc "$INPUT_FILE_NAME" --swift_out="$DERIVED_FILE_DIR" --proto_path="Your/proto/path"
I don't use the plugin because I've got the plugin installed in my /usr/local/bin
But I have exactly those problems when we use the output for cpp files.

QNX momentics linked source files not compiling

I am creating a QNX port for a Linux application. As a test, i copied all source code and header files into /src/ directrory and built the code. the binary was created, and I was able to execute on target VM. but now I have to create the momentics project inside the project folder, without altering or creating duplicate copies of existing source files.
I found that I can use linked resources. So I followed steps provided here and could add the file to project.
but when I compile the project, it is not taking the linked files.
As one can clearly see the process is directly going to linking stage.
but if I add a new cpp file without linking, only that particular file is getting compiled, not the linked file.
only the new main.cpp is getting compiled.
Can anyone help me to get this project built, only using linked resources?
I was able to use IDE for compiling my writing a Makefile and importing it to IDE.

Where are the opencv2 include files?

I'm struggling to find the include files that should be in a directory names "opencv2"! I've downloaded OpenCV-2.4.0.tar.bz2 from here and extracted the files and ran cmake, which seemed to build the library successfully.
The problem is that under the "include" directory for "opencv2" there seem to be tons of header files missing. The only header file there at the moment is "opencv.hpp", which includes a whole set of other files which aren't there. Does anyone have any idea where I can get these files from?
Thanks!
The header files of the modules are in their own directories. E.g., you can find calib3d.hpp in /modules/calib3d/include/opencv2/calib3d. The Makefile created by CMake knows these addresses, hence when you make install the header files are all copied into /usr/local/include/opencv2.
In case you were using cmake-gui and visual studio on Windows to make opencv (I had 3.4.0), don't forget to build this project:
This will generate all required files in a single folder, so you can easily connect header files:

How to prevent the electron-packager from messing up the paths of the application?

After I compiled the application with electron-packager the application expects files to be in the root folder of the application, whereas they are located in ./app/resources/
How can I change this?
Does your code write to your local project?
You cannot write to your project folder if you package your app with asar.
I advice using appData as your file path.
Example: %appdata%/YourProjectName/something.json

Resources