Setting default make options for Qt Creator? - qt

How can i override default make parameters , which is:
make -w
Each time i create a project , i had to modify project settings , adding -j4 to make parameters.
Can i set make -w -j4 by default ?
EDIT
The best way to do this is setting MAKEFLAGS environment variable , i'm picking the only answer as the best only to shut this thread down.
To set this for UNIX, modify the *.desktop file of Qt Creator , prefix the line entitled Exec= with env MAKEFLAGS=-j4 , but be aware that you won't be able to cease building in QtCreator immediately after setting to multithread.

To make it global and permanent go to
Tools > Options > Build & Run > Kits > (pick your toolchain)
and fill your predefined env settings: MAKEFLAGS=-j4

In the qtcreator go to the "Projects tab" and set "Make arguments" as you like:

If you want -jx parameter to be default each time you create a new or open some project, you must add enviroment variable MAKEFLAGS to your system with value -jx.
For example, at ubuntu for 8 - threding compilation this options can be realized by adding
MAKEFLAGS="-j8"
to /etc/enviroments
Result will be:

After attempting implement the fix described in the question I eventually found the following (clearly this in only a solution to linux's that use the freedesktop concept of .desktop files):
The line in "/usr/local/share/applications/Nokia-QtCreator.desktop" was:
Exec=/opt/qtcreator-2.5.2/bin/qtcreator.sh %F
I changed it to:
Exec=env MAKEFLAGS=-j16 /opt/qtcreator-2.5.2/bin/qtcreator.sh %F
And got the functionality requested in the question.
Ok, I have no idea why following the instructions in the question I didn't get there but I didn't. I hope this explanation will help someone.

Related

Failed to create wallet for ton with Fift?

Right now I'm trying to create wallet for TON.
I downloaded and built Fift interpreter an was trying to create new wallet with: ./crypto/fift new-walelt.fif
[ 1][t 0][1559491459.312618017][fift-main.cpp:147] Error interpreting standard preamble file `Fift.fif`: cannot locate file `Fift.fif`
Check that correct include path is set by -I or by FIFTPATH environment variable, or disable standard preamble by -n.
Although my path variable is set. Could anyone please help me with this?
First, locate {{lite-client-source-direcotry}}/crypto/fift
This is not the build directory, that's the directory where are the source files (lite-client that you downloaded). So verify you have that it contains Fift.fif file.
If you installed it in the user working directory, it should be:
~/lite-client/crypto/fift/
Now, you should either set FIFTPATH variable to point to this directory or run fift with -I option:
export FIFTPATH=~/lite-client/crypto/fift/
./crypto/fift new-walelt.fif
Or
./crypto/fift -I~/lite-client/crypto/fift/ new-walelt.fif
Have you tried ./crypto/fift -I<source-directory>/crypto/fift new-wallet.fif instead of setting environment variable? Are Fift.fif and Asm.fif library files inside FIFTPATH?
Make sure you have followed all the instruction written here:
https://test.ton.org/HOWTO.txt
It should work if you do all the above instruction correctly. If not, it might be a bug. Remember that TON is in a very early beta strage. You can submit the issue here:
https://github.com/copperbits/TON/issues
You also can use this:
cd ~/liteclient-build
crypto/fift -I/root/lite-client/crypto/fift/lib -s /root/lite-client/crypto/smartcont/new-wallet.fif -1 wallet_name
Try this (worked for me)
export FIFTPATH=~/lite-client/crypto/fift/lib
./crypto/fift new-wallet.fif

Automatically clearing the screen on recompile in sbt

I am using sbt with the sbt-revolver plugin and I want to clear the terminal screen (^L) when the project is recompiled (~ re-start). How can this be done?
You could define new command clear, which would use jline to clear the screen. Sbt is using jline internally so you shouldn't have to include any extra dependency.
build.sbt
def clearConsoleCommand = Command.command("clear") { state =>
val cr = new jline.console.ConsoleReader()
cr.clearScreen
state
}
val root = project.in(file(".")).settings(commands += clearConsoleCommand)
Now you could run your compile like this ~;clear;compile. This will trigger clear the console followed by compile on each file change (assuming this is what you want).
Another solution, based on #SethTisue answer:
alias clearScreen=eval "\u001B[2J\u001B[0\u003B0H"
This line should be added to ~/.sbtrc, so that sbt will have knowledge of a "clearScreen" command. You can either just invoke the command with ~;clearScreen;compile
Or make an additional alias like alias cc=~;clearScreen;compile
On Twitter, Paul Phillips suggested this method:
alias cc = ~ ;eval "\u001B[2J\u001B[0\u003B0H" ;compile
source: https://twitter.com/extempore2/status/403564233775775744
This specifically helps when you're doing something in continuous mode, ala `compile:
maxErrors := 5
triggeredMessage := Watched.clearWhenTriggered
This works as of 0.13.7. The second line clears the screen before each command runs. The first line limits the number of errors. With this config, you only ever have one screen full of errors to work through. Obviously could adjust maxErrors depending on your sbt window.

Qt internationalization and CMake: how to update *.ts and don't lose them

I'm having this CMakeLists.txt in directory with translation files (*.ts):
SET(TRANSLATIONS
lang_de.ts
lang_en.ts
)
FIND_PACKAGE(Qt5LinguistTools)
QT5_ADD_TRANSLATION(QM_FILES ${TRANSLATIONS})
SET(QM_FILES ${QM_FILES} PARENT_SCOPE)
ADD_CUSTOM_TARGET (translations ALL DEPENDS ${QM_FILES})
It builds *.qm files from specified *.ts.
But I want to improve this and get two custom targets, which won't built automatically.
One for appending new strings from sources into ts files, and one for refreshing ts. The last one would update ts from sources and remove obsolete strings from ts.
I've tried to add this after lines above:
ADD_CUSTOM_TARGET (
ts_append
COMMAND QT5_CREATE_TRANSLATION(QM_FILES ${CMAKE_SOURCE_DIR}/src/app ${TRANSLATIONS} OPTIONS -I ${CMAKE_SOURCE_DIR}/src)
)
ADD_CUSTOM_TARGET (
ts_refresh
COMMAND QT5_CREATE_TRANSLATION(QM_FILES ${CMAKE_SOURCE_DIR}/src/app ${TRANSLATIONS} OPTIONS -no-obsolete -I ${CMAKE_SOURCE_DIR}/src)
)
but it seems I can't use QT5_CREATE_TRANSLATION macro inside custom target, isn't it?
Maybe I'm on wrong way, how would you solve this problem: easy updating of ts and don't lose them after make clean?
To solve the make clean problem, add a sub directory (ADD_SUBDIRECTORY(translations)) and add SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM 1) to the contained CMakeLists.txt.
See here for an example of that.
For the second part of your question there are two possible ways to do it. Either use FILE(WRITE <filename> "QT5_CREATE_TRANSLATION(QM_FILES ${SOURCE_DIR}/src/app ${TRANSLATIONS} OPTIONS -I ${SOURCE_DIR}/src)") and then use COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} -DTRANSLATIONS=${TRANSLATIONS} <filename> in add_custom_target. I doubt there's a good way of retrieving the contents of QM_FILES though.
The second option is creating two additional sub directories, each with a QT5_CREATE_TRANSLATIONS and a ADD_CUSTOM_TARGET call.

display problems of zsh in archlinux

Currently I have installed zsh in archlinux (in gnome 3), and every time when I open the terminal, there are 3 "???" before, then I have to change it manually on the options
Actually I have already set the default locale to UTF-8, and it works in the console before I enter the gnome.But after I enter the gnome interface, it did not work.
After I have changed that, it works, but there is another problem, everytime I type a command and press tab, all the command will be shifted right by 2 words, for example if I type ls, it will display like this:
ls becomes lsls
vim becomes vivim
The first 2 letters cannot be cleared, which is very annoying, can anyone help me about this? Thanks
I finally got how to solve this question
After we enabled the locale in the /etc/locale.gen and use locale-gen to generate it. I have to also set the locale system-wide,
create the /etc/locale.conf file
and set the default locale
localectl set-locale LANG="de_DE.UTF-8"
Then if I exit and log again, the oh-my-zsh will work fine.

no rules to make target 'micaz'

I am a new in Tinyos.
I am following the tinyos Tutorial lesson 3: Mote-mote radio communication.
When I use 'make' to compile the program BlinkToRadio in lesson 3, I got a error message:
make: *** No rule to make target 'micaz'. Stop.
But when I compile the program Blink, it works. So I dont think its the problem in enviorement variables.
Can anyone help me what it the problem.
Thank you!
this is a problem in the file Makefile, in the next code:
COMPONENT=BlinkToRadioAppC
include $(MAKERULES)
sometimes there is a space after $, or some other error.
Are you using sudo when you're trying to build the app? sudo will likely reset all your environment variable while you're using sudo. You can set env_keep in the /etc/sudoers file to keep your $MAKERULES
Defaults env_keep += "MAKERULES"
or you could look at this
Of course, it could be something entirely different....
Have you defined a Makefile? The Makefile for lesson 3 should be:
COMPONENT=BlinkToRadioAppC
include $(MAKERULES)
Have you defined MAKERULES?
You can check the definition of MAKERULES this way:
echo $MAKERULES
If not defined, you can define MAKERULES this way:
export MAKERULES=/opt/tinyos-2.1.0/support/make/MAKERULES
I got the same errors. There are 2 ways to solve it..... Do not run the code as root. This works for sure.
2nd I am not so sure but if at all you want to run as root, try sudo bash and not other commands.
Hope this helps

Resources