Re: [Qt-creator] Bundling clang (for code model) with qt-creator package

2016-12-12 Thread Andrzej Telszewski

On 12/12/16 11:28, Eike Ziller wrote:


On Dec 12, 2016, at 3:13 AM, Andrzej Telszewski  wrote:

When it comes to build_clang.py, this script expects some environment 
variables, like PKG_NODE_ROOT, CLANG_BRANCH, and more:
1. Where do they come from? How can I get them? :-)


They are defined as part of our build setup which is not publicly shared.



Well, maybe one day you'll release it :-)


2. How can I determine which exact versions of software and any other flags you 
used to create the given QTC release?


It would probably be nice to define LLVM_REVISION and CLANG_REVISION within the 
Qt Creator repository. These will usually be the release sha1s from a 
llvm/clang release.



That's a good idea.
You could also provide information on other important components (if 
there are any, qbs definitely).


I know it's possible to gather this information, but it's really 
frustrating having to dig through all the different sources.


A file or release notes section containing the list of different 
components together with actual versions would be invaluable.
And when I say a list, I mean it ;-) Having to read different sections 
of release notes to pick the versions is not pleasant at all ;-)


I believe you could automate such a process without bigger pain (or do 
you? ;-)).



Questions:
1. In deployqt.py, you tweak rpath-s, but I found that simply copying libclang 
into /tmp/qtc-ins/usr/lib/qtcreator just works. So is this step necessary?


It was necessary once upon a time, I haven’t checked if it still is.



OK. It works for me without any rpath voodoo.

That is what it looks like (from installed package):
$ patchelf --print-rpath /usr/libexec/qtcreator/clangbackend
$ORIGIN/../../lib64/qtcreator:$ORIGIN/../../lib64/qtcreator/plugins:$ORIGIN:$ORIGIN/..:$ORIGIN/../lib64/qtcreator:/tmp/slackrepo-desktop/qt-creator-opensource-src-4.2.0-rc1/llvm-ins/lib

My guess is that libclang.so is immediately found by means of:
$ORIGIN/../../lib64/qtcreator


General question:
Have I missed something? ;-)


I don’t see anything obviously wrong ;)



Nice to hear :-)

On 12/12/16 11:39, Nikolai Kosjar wrote:

On 12/12/2016 03:13 AM, Andrzej Telszewski wrote:

*1) Configure, build and temporarily install LLVM:*

$ cmake \
-DCMAKE_INSTALL_PREFIX=/tmp/llvm-ins \
-DCMAKE_BUILD_TYPE=Release \
-G "Unix Makefiles" \
-DLLVM_BUILD_TOOLS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_TARGETS_TO_BUILD="X86" \
..
  $ make
  $ make install
  $ # We disabled building of all the tools, but we still need some.
  $ make llvm-config
  $ cp -a bin/llvm-config /tmp/llvm-ins/bin

Questions:
2. As you can see, I passed some additional flags (not found in
build_clang.py), like -DLLVM_BUILD_TOOLS=OFF, mainly to shorten the
build time. Can you think of any troubles I might get with the cmake
configuration as you see above?


I'm not know what exactly LLVM_BUILD_TOOLS=OFF excludes. But at least the clang soures 
are located in a "tools" directory within LLVM (${LLVM_SOURCE}/tools/clang), so 
you might want to double check whether the clang executable was really build (needed for 
the clang static analyzer).



Neither do I know exactly what is excluded, but:
1) clang executable (and library) *is* built,
2) llvm-config *is not* built.

For llvm-config you can see that I actually had to invoke separate make 
and also had to install it by hand.


After a bit of testing, I ended up with the following:
$ cmake \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_INSTALL_PREFIX=$LLVM_INSTALL_ROOT \
-DCMAKE_BUILD_TYPE=Release \
-G "Unix Makefiles" \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_TARGETS_TO_BUILD="X86" \
..

It turns out that LLVM_BUILD_TOOLS=OFF, LLVM_INCLUDE_EXAMPLES=OFF and 
LLVM_INCLUDE_TESTS=OFF saves me only ~5 minutes out of the ~60 minutes 
total build time of LLVM/Clang. So it's not worth specifying those and 
having to perform "by hand" steps later on.


SLKCFLAGS="-O2 -march=i586 -mtune=i686" for i586 arch
and
SLKCFLAGS="-O2 -fPIC" for x86_64 arch

(I'm on Slackware).


Note also that nowadays Qt Creator's README.md includes instructions to 
get/build llvm/clang:

  http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/README.md
  Section "## Get LLVM/Clang for the Clang Code Model"



Good to know (well, I should know it already, shouldn't I? ;-)).
Thanks.


4. Are there any other flags that would be worth adding? Please note
that I removed -DCMAKE_C_FLAGS and -DCMAKE_CXX_FLAGS for clarity, I
actually have them in my real build/packaging script.


If you find other flags worth adding, share them with us :)



Surely ;-) I did a bit of reading, but haven't found anything 
interesting (other than what I have already mentioned).



Thanks for the help!

--
Best regards,
Andrzej Telszewski
___
Qt-creator mailing list

Re: [Qt-creator] rename ui

2016-12-12 Thread Duane

On 09/12/2016 4:55 PM, Ch'Gans wrote:

On 10 December 2016 at 02:54, Duane  wrote:

I have a QMainWindow based class that I want to rename (cpp/h/ui/class name
etc.)  Is there some howto available for this?


To rename a file in the project view, the file system view or the open
documents view: Right click on a file and choose "rename".
In the code editor, right click on a type name or a variable name,
select, "refactor", then "rename symbol under cursor" (Shift+Control+R
here)




Thanks.  Refactor works well enough to a point.  I go to main.cpp and 
use refactor to rename the main class.  This updates the class in the 
h/cpp files and where it is invoked.  But it doesn't update the class 
name in the ui file or the filenames.


So I have to rename the files manually.  Then go to designer and rename 
the class there, then fix where the #include "ui_classname.h" is used as 
well as any place where it is instantiated.


I was wondering if there was a better way?




___
Qt-creator mailing list
Qt-creator@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qt-creator


Re: [Qt-creator] It would be really cool if... } // comment

2016-12-12 Thread Jason H
> Sent: Monday, December 12, 2016 at 2:41 AM
> From: "Guenter Schwann" 
> To: "Jason H" , qt-creator 
> Subject: Re: [Qt-creator] It would be really cool if... } // comment
>
> Am 09.12.2016 um 19:14 schrieb Jason H:
> > In QML we have lot of closures
> > The bottom of my QML Files is always:
> > }
> > ..}
> > }
> > ..}
> > }
> >
> > It would be cool if it could tie in with the show-whitespace feature and 
> > provide some decoration (not a part of the file)
> >
> > } // Row: buttonRow (id: buttonRow)
> > ..} // Column
> > }  // Flickable
> > ..} //Item
> > } // Rectagle
> >
> > I often use actual comments, but they get messed up via various 
> > modifications
> When a file looks like this, I usually split it up.
> Having smaller files/components helps even more to not mess up.
> Usually my QML files are less than 200 lines.
> 
> On the other hand, this could be used for more stuff than just for 
> items. For functions, switch, ...
> And in C++ for namespaces, classes, #endif, ...


Well, things were "ok" before (that doesn't mean they are good or even right) 
But in regular code, there are many more procedural statements that give away 
what scope you are in. In C++ this is there is generally 2 degrees of immediate 
nesting: class and member function, or if in code, a nested for/if. However in 
declarative code, it's (in my experience) 5 or more. 

I agree it'd be useful everywhere, but QML is what really made it evident that 
there's got to be another way. 

I realize at the top Qt creator tells you the type, but that's not where I'm 
looking when I'm reading code, and it is dependent on cursor position. 

___
Qt-creator mailing list
Qt-creator@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qt-creator


Re: [Qt-creator] Bundling clang (for code model) with qt-creator package

2016-12-12 Thread Nikolai Kosjar

On 12/12/2016 03:13 AM, Andrzej Telszewski wrote:

*1) Configure, build and temporarily install LLVM:*

$ tar xvf llvm-3.9.0.src.tar.xz
$ mv llvm-3.9.0.src llvm-src
$ cd llvm-src/tools
$ tar xvf cfe-3.9.0.src.tar.xz
$ mv cfe-3.9.0.src clang
$ cd -
$ cd llvm-src

$ mkdir build
$ cd build
$ cmake \
-DCMAKE_INSTALL_PREFIX=/tmp/llvm-ins \
-DCMAKE_BUILD_TYPE=Release \
-G "Unix Makefiles" \
-DLLVM_BUILD_TOOLS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_TARGETS_TO_BUILD="X86" \
..
  $ make
  $ make install
  $ # We disabled building of all the tools, but we still need some.
  $ make llvm-config
  $ cp -a bin/llvm-config /tmp/llvm-ins/bin
$ cd -

Questions:
1. In build_clang.py, depending on "bitness" (which I guess is x86 vs
x86_64), you set -DLLVM_TARGETS_TO_BUILD=X86 in the case of 32 bits and
-DLLVM_TARGETS_TO_BUILD=AArch64 in the case of 64 bits. Why is it so? In
particular, why AArch64?
2. As you can see, I passed some additional flags (not found in
build_clang.py), like -DLLVM_BUILD_TOOLS=OFF, mainly to shorten the
build time. Can you think of any troubles I might get with the cmake
configuration as you see above?


I'm not know what exactly LLVM_BUILD_TOOLS=OFF excludes. But at least 
the clang soures are located in a "tools" directory within LLVM 
(${LLVM_SOURCE}/tools/clang), so you might want to double check whether 
the clang executable was really build (needed for the clang static 
analyzer).


Except the clang executables and llvm-config no other executable from 
LLVM should be required.



3. Are there any important flags missing compared to the ones generated
by build_clang.py?


No.

Note also that nowadays Qt Creator's README.md includes instructions to 
get/build llvm/clang:


  http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/README.md
  Section "## Get LLVM/Clang for the Clang Code Model"


4. Are there any other flags that would be worth adding? Please note
that I removed -DCMAKE_C_FLAGS and -DCMAKE_CXX_FLAGS for clarity, I
actually have them in my real build/packaging script.


If you find other flags worth adding, share them with us :)


When it comes to build_clang.py, this script expects some environment
variables, like PKG_NODE_ROOT, CLANG_BRANCH, and more:
1. Where do they come from? How can I get them? :-)
2. How can I determine which exact versions of software and any other
flags you used to create the given QTC release?
3. There is apply_patches(): how can I know if you applied some patches
and if so, where can I find them?

*2) Configure, build and temporarily install QTC:*

$ tar xvf qt-creator-opensource-src-4.2.0-rc1.tar.xz
$ cd qt-creator-opensource-src-4.2.0-rc1
$ qmake-qt5 qtcreator.pro \
QTC_PREFIX=/usr \
IDE_LIBRARY_BASENAME=lib \
LLVM_INSTALL_DIR=/tmp/llvm-ins \
QBS_INSTALL_DIR=/usr
$ make
$ make install INSTALL_ROOT=/tmp/qtc-ins
$ make docs
$ make install_docs INSTALL_ROOT=/tmp/qtc-ins

$ # Install LLVM/Clang bits needed for running QTC.
$ mkdir -p /tmp/qtc-ins/usr/libexec/qtcreator/clang/bin
$ cp -a /tmp/llvm-ins/bin/clang
/tmp/qtc-ins/usr/libexec/qtcreator/clang/bin
$ cp -a /tmp/llvm-ins/bin/clang-3.9
/tmp/qtc-ins/usr/libexec/qtcreator/clang/bin
$ mkdir -p /tmp/qtc-ins/usr/lib/qtcreator
$ cp -a /tmp/llvm-ins/lib/libclang.so* /tmp/qtc-ins/usr/lib/qtcreator
$ mkdir -p /tmp/qtc-ins/usr/libexec/qtcreator/clang/lib/clang
$ cp -a /tmp/llvm-ins/lib/clang/*
/tmp/qtc-ins/usr/libexec/qtcreator/clang/lib/clang

Questions:
1. In deployqt.py, you tweak rpath-s, but I found that simply copying
libclang into /tmp/qtc-ins/usr/lib/qtcreator just works. So is this step
necessary? As a side note, I'm only bundling clang, as all the other
libraries (including Qt) are already installed system-wide.

*3. I create the package out of /tmp/qtc-ins and I'm done.*

General question:
Have I missed something? ;-)

Some final notes:
- I'm building on x86_64 system,
- both Clang Code Model and Clang Static Analyzer seem to work just fine
with the described build/install instructions,
- although I tried hard not to make a mistake, there might be some
somewhere. I extracted and tweaked the commands from my build script for
clarity. Anyways, the build and packaging works as expected using my
build script.

I know I asked quite some count of questions.
Thanks in advance for the help!



___
Qt-creator mailing list
Qt-creator@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qt-creator


Re: [Qt-creator] Bundling clang (for code model) with qt-creator package

2016-12-12 Thread Eike Ziller

> On Dec 12, 2016, at 3:13 AM, Andrzej Telszewski  wrote:
> 
> On 31/08/16 09:12, Eike Ziller wrote:
>> The default path that the clang static analyzer checks is 
>> libexec/qtcreator/clang/ (+bin/clang etc)
>> http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/src/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp#n61
> 
>> Our clang build:
>> http://code.qt.io/cgit/qtsdk/qtsdk.git/tree/packaging-tools/build_clang.py
> 
> OK, I finally came to the point where QTC (4.2.0-rc1) does not build against 
> my system LLVM (3.8.0).
> 
> I "parsed" qtsdk/packaging-tools/build_clang.py and 
> qt-creator/scripts/deployqt.py for the clues on how to bundle Clang with QTC 
> and got the idea. It actually seems to be quite simple... once you get the 
> idea.
> 
> I detail my bundling steps below, together with some more questions.
> I actually tested this configuration and it seems to work fine.
> 
> *1) Configure, build and temporarily install LLVM:*

Btw you find the exact builds of LLVM that we use for our packages on
http://download.qt.io/development_releases/prebuilt/libclang/

> 
> $ tar xvf llvm-3.9.0.src.tar.xz
> $ mv llvm-3.9.0.src llvm-src
> $ cd llvm-src/tools
> $ tar xvf cfe-3.9.0.src.tar.xz
> $ mv cfe-3.9.0.src clang
> $ cd -
> $ cd llvm-src
> 
> $ mkdir build
> $ cd build
> $ cmake \
>-DCMAKE_INSTALL_PREFIX=/tmp/llvm-ins \
>-DCMAKE_BUILD_TYPE=Release \
>-G "Unix Makefiles" \
>-DLLVM_BUILD_TOOLS=OFF \
>-DLLVM_INCLUDE_EXAMPLES=OFF \
>-DLLVM_INCLUDE_TESTS=OFF \
>-DLLVM_ENABLE_RTTI=ON \
>-DLLVM_TARGETS_TO_BUILD="X86" \
>..
>  $ make
>  $ make install
>  $ # We disabled building of all the tools, but we still need some.
>  $ make llvm-config
>  $ cp -a bin/llvm-config /tmp/llvm-ins/bin
> $ cd -
> 
> Questions:
> 1. In build_clang.py, depending on "bitness" (which I guess is x86 vs 
> x86_64), you set -DLLVM_TARGETS_TO_BUILD=X86 in the case of 32 bits and 
> -DLLVM_TARGETS_TO_BUILD=AArch64 in the case of 64 bits. Why is it so? In 
> particular, why AArch64?
> 2. As you can see, I passed some additional flags (not found in 
> build_clang.py), like -DLLVM_BUILD_TOOLS=OFF, mainly to shorten the build 
> time. Can you think of any troubles I might get with the cmake configuration 
> as you see above?
> 3. Are there any important flags missing compared to the ones generated by 
> build_clang.py?
> 4. Are there any other flags that would be worth adding? Please note that I 
> removed -DCMAKE_C_FLAGS and -DCMAKE_CXX_FLAGS for clarity, I actually have 
> them in my real build/packaging script.
> 
> When it comes to build_clang.py, this script expects some environment 
> variables, like PKG_NODE_ROOT, CLANG_BRANCH, and more:
> 1. Where do they come from? How can I get them? :-)

They are defined as part of our build setup which is not publicly shared.

> 2. How can I determine which exact versions of software and any other flags 
> you used to create the given QTC release?

It would probably be nice to define LLVM_REVISION and CLANG_REVISION within the 
Qt Creator repository. These will usually be the release sha1s from a 
llvm/clang release.

> 3. There is apply_patches(): how can I know if you applied some patches and 
> if so, where can I find them?

That currently is not used. It was used for 4.1.0 to cherry-pick a single patch 
from llvm 3.9 to 3.8 which fixed an (fatal) issue with static analyzer and msvc.
Again it would probably be best to put any patches that we deem necessary for 
our Qt Creator release into the Qt Creator repository, though we’ll try to not 
need it in any case.

> *2) Configure, build and temporarily install QTC:*
> 
> $ tar xvf qt-creator-opensource-src-4.2.0-rc1.tar.xz
> $ cd qt-creator-opensource-src-4.2.0-rc1
> $ qmake-qt5 qtcreator.pro \
>QTC_PREFIX=/usr \
>IDE_LIBRARY_BASENAME=lib \
>LLVM_INSTALL_DIR=/tmp/llvm-ins \
>QBS_INSTALL_DIR=/usr
> $ make
> $ make install INSTALL_ROOT=/tmp/qtc-ins
> $ make docs
> $ make install_docs INSTALL_ROOT=/tmp/qtc-ins
> 
> $ # Install LLVM/Clang bits needed for running QTC.
> $ mkdir -p /tmp/qtc-ins/usr/libexec/qtcreator/clang/bin
> $ cp -a /tmp/llvm-ins/bin/clang /tmp/qtc-ins/usr/libexec/qtcreator/clang/bin
> $ cp -a /tmp/llvm-ins/bin/clang-3.9 
> /tmp/qtc-ins/usr/libexec/qtcreator/clang/bin
> $ mkdir -p /tmp/qtc-ins/usr/lib/qtcreator
> $ cp -a /tmp/llvm-ins/lib/libclang.so* /tmp/qtc-ins/usr/lib/qtcreator
> $ mkdir -p /tmp/qtc-ins/usr/libexec/qtcreator/clang/lib/clang
> $ cp -a /tmp/llvm-ins/lib/clang/* 
> /tmp/qtc-ins/usr/libexec/qtcreator/clang/lib/clang
> 
> Questions:
> 1. In deployqt.py, you tweak rpath-s, but I found that simply copying 
> libclang into /tmp/qtc-ins/usr/lib/qtcreator just works. So is this step 
> necessary?

It was necessary once upon a time, I haven’t checked if it still is.

> As a side note, I'm only bundling clang, as all the other libraries 
> (including Qt) are already installed system-wide.
> 
> *3. I create the package out of 

Re: [Qt-creator] Build AND deploy shared library

2016-12-12 Thread Eike Ziller

> On Dec 11, 2016, at 4:59 PM, Bob Hood  wrote:
> 
> I'm using Creator 4.0.3.  I'm building a Qt plug-in for my application 
> (separate project), and I want to "deploy" the resulting shared library into 
> a specific location where my main application will be looking for those 
> plug-ins.
> 
> I admit right up front, I'm fairly unknowledgeable about using qmake's 
> INSTALL option.  I've been using the DESTDIR option to direct the output to 
> the correct location, but that directs all build files, not just the 
> resulting shared library file.  I only want the shared library file to be 
> deployed to the target location.
> 
> I've tried adding an INSTALL target to the plug-in's project .pro file, but I 
> don't see a way within Qt Creator to execute that target (ideally, it would 
> automatically execute after the build).

You can add another “make” build step which runs “make install” to your build 
configuration
https://doc.qt.io/qtcreator/creator-build-settings.html#build-steps

Br, Eike

>  I also see the "Deployment" section under "Run", but my INSTALL target is 
> not listed there, and I'm not sure how to set that up.
> 
> Can somebody give me some pointers to having (only) my shared library plug-in 
> file deployed to a target location automatically following a successful build 
> within Qt Creator?
> 
> ___
> Qt-creator mailing list
> Qt-creator@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.zil...@qt.io
http://qt.io
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 
144331 B




___
Qt-creator mailing list
Qt-creator@qt-project.org
http://lists.qt-project.org/mailman/listinfo/qt-creator