QtCreator/QMake - How to add .qmlproject (QtQuick2 UI app) into subdirs .pro project? - qt-creator

I have folders:
dev_root
all.pro
app
app.pro
ext
ext.pro
ui
ui.qmlproject
I have .pro file:
TEMPLATE = subdirs
SUBDIRS += \
app \
ext \
ui
ext.subdir = ext
app.depends = ext
ui.depends = ext
But qmake reports an error:
Could not find .pro file for sub dir 'ui'
How can I add .qmlproject into subdirs .pro project?

A Qt Quick-UI application is just a simple way to run QML files with QML Scene. It has nothing to do with C++ and QMake. Thus is cannot be a subproject of a QMake subdirs-project.

Related

Is there anyway to stop MVSC from creating release and debug folders when using form QtCreator?

Whenever I set my build options in Qt for a specific folder and I compile using MVSC it creates a release and debug folder and puts the output exe file inside that folder. If I compile in linux it usually just puts the final executable file in the folder that I specify. Is there a way to get this last behaviour (that is to stop the creation release and debug folder)?
You can set CONFIG -= debug_and_release in your .pro file and it will stop doing so.
With qmake you can actually specify a destination directory for your binary(ies), and other generated output as well. For example:
DESTDIR = $${OUT_PWD}/bin # this is where the binaries ('target' files) go
OBJECTS_DIR = $${OUT_PWD}/obj # compiled objects
MOC_DIR = $${OUT_PWD}/moc # generated MOC files
UI_DIR = $${OUT_PWD}/ui # generated C++ code from .ui files
RCC_DIR = $${OUT_PWD}/rcc # generated C++ code from .qrc files
OUT_PWD is a built-in variable specifying the current build directory. You could actually use any valid path here.
Reference: http://doc.qt.io/qt-5/qmake-variable-reference.html

No rule to make target 'mesh2D.h', needed by 'all-am'

I have the following project tree :
src
├── Converters
├── datamodel
Inside datamodel/ I have a header that I want to include in a source cpp file inside Converters/.
However I get the following error :
No rule to make target 'mesh2D.h', needed by 'all-am'
This is my automake Makefile.am inside Converters/:
include $(top_srcdir)/adm_local/unix/make_common_start.am
AM_CPPFLAGS+= \
-I$(top_srcdir)/src/datamodel
libSource_SOURCES=\
source.cpp \
source.h
include_HEADERS=\
mesh2D.h
SUBDIRS=
include $(top_srcdir)/adm_local/unix/make_common_end.am
Thanks for your help!
I would move the
include_HEADERS = mesh2D.h
line to datamodel/Makefile.am if you are using recursive make, or
include_HEADERS += %reldir%/mesh2D.h
to datamodel/Makefile-files if you use a single Makefile.am with per-directory includes or
include_HEADERS += datamodel/mesh2D.h
if you are using a single Makefile.am without per-directory includes.
Note that using include_HEADERS will install the mesh2D.h file into /usr/local/include. If mesh2D.h is just needed to compile your program, use noinst_HEADERS instead of include_HEADERS to include mesh2D.h in the distribution tarball (make dist) without installing it (make install).

Appcelerator Alloy how to include lib or component?

I would like to use TiRemoteImage from https://github.com/ulizama/TiRemoteImage
and in my alloy project I have added lib and components folder in app folder. Then I copy the files in TiRemoteImage's Resources/lib and Resources/components folder into my project's lib and components respectively
So my project folder structure looks like this now
app
> assets
> components
> controllers
> lib
> models
> styles
> views
I have then added
var RemoteImage = require('/components/remoteimage');
in index.js and then my app will just crash without any error. Am I including the component correctly?
You are using Alloy framework and the github project is not an alloy project so you have to copy all modules (.js in components and lib ) in /lib folder and change all line of code like : require("/components/module.js") ou require("/lib/module.js") by require("module.js")

Building Shared library including Qt libs via QMake on Windows

I would like to create a Dll on Windows using QMake+mingw, which includes some custom widgets and the dependent Qt libraries (linked into one library). Can this be achieved via QMake?
What I have tried so far:
Creating shared library project, and adding LIBS to .pro file:
QT += widgets
TARGET = testqtdll
TEMPLATE = lib
DEFINES += TESTQTDLL_LIBRARY
SOURCES += testqtdll.cpp widget.cpp
HEADERS += testqtdll.h testqtdll_global.h widget.h
FORMS += widget.ui
LIBS += -lqt5core -lqt5gui -lqt5widgets
This way the resulting dll does not include QT libs.
Creating static library project, and link qt static libs. Then create dll after:
QT += widgets
TARGET = testqtlib
TEMPLATE = lib
CONFIG += staticlib
SOURCES += testqtlib.cpp widget.cpp
HEADERS += testqtlib.h widget.h
FORMS += widget.ui
LIBS += c:/Qt/Static/5.3.1/lib/Qt5Core.a
LIBS += c:/Qt/Static/5.3.1/lib/Qt5Gui.a
LIBS += c:/Qt/Static/5.3.1/lib/Qt5Widgets.a
This way the resulting lib also does not include QT libs.
I found a solution after all. One should use the Qt static build to create such dll. Working project file:
QT += core gui widgets
CONFIG += static dll
TARGET = testqtdll
TEMPLATE = lib
DEFINES += TESTQTDLL_LIBRARY
SOURCES += testqtdll.cpp widget.cpp
HEADERS += testqtdll.h testqtdll_global.h widget.h
FORMS += widget.ui

Gradle: Including an object .o file while building a static library

I'm trying to build a native cpp project with gradle which links against an external .o object file.
Lets call it externalDep.o
What would be the correct gradle syntax so that this object file gets included when I build my static library?
Current my code looks like this
myProj
\
cpp\ headers\ objectFile\
with the headers and cpp for my project with externalDep.o in the objectFile dir since gradle only looks for .cpp and .hpp in cpp and headers
After the cppCompiler args,
libraries {
mylib {
binaries.all {
linker.args "path_to_externalDep.o"
}
}
}
but it does not include this .o file while building the static library
(I'm looking for the equivalent of
Make library source_file(i-k).o externalDep.o
)
Thanks
I had the object file which was external initially in the src dir.
My mistake was trying to set a linker argument to link it.
In the end all I had to do was copy the object file over using a copy task to my cbkbuild/obj/..StaticLibrary/projectCpp folder and it automatically got picked up and linked as a part of ar rcs lib.a objectfiles.o

Resources