Discussion:
#Cmake, multiple toolchains, howto simple switch
Mário Oravec
2016-11-16 07:37:31 UTC
Permalink
Hi,

I have cmake project where is
- application target(top/build/app) configured with arm toolchain
- test target(top/build/tests) configured for host
so in my case build folder contents two subfolders one for app and second for tests, here
it is folder structure

top
top/build/app
top/build/tests
top/src/app/CMakeLists.txt
top/src/tests/CMakeLists.txt
top/CMakeLists.txt

I configured from console
top/build/app with arm toolchain
top/build/tests with default host toolchain

in top/CMakeFile I have the following

if(*CMAKE_CROSSCOMPILING*)
add_subdirectory(src/app)
else()
add_subdirectory(src/test)
endif()

Now If I want to compile for app I have to open project configuration and change it to top/
build/app and
If I want to compile for tests I have to open project configuration again and change it to top/
build/tests.

And as you can see changing it is cumbersome and time consuming, especially if you
develop by TDD, there is reason to change targets frequently.

*My question is, is it possible to create some shortcut button on toolbar to be able to
change it by one click?*

Here is my suggestion how I would like it, if I click on target and choose build, kdevelop will
change configuration automatically in background before build, but now it is not possible
because kdevelop present just targets of active configuration.

Thanks for any meaningfull answer,


Br,
MOr
René J.V. Bertin
2016-11-16 08:24:46 UTC
Permalink
Post by Mário Oravec
Here is my suggestion how I would like it, if I click on target and choose build, kdevelop will
change configuration automatically in background before build, but now it is not possible
because kdevelop present just targets of active configuration.
That's going to be complicated: not only would the CMake project manager have to check all build directories for targets, it would also have to figure something out if multiple build directories have the same targets (say if you have 2 build dirs. configured to compare how 2 different compilers deal with the same source code).

A drop-down or sub menu (in the Project menu) could indeed be nice. But it would also be very nice if KDevelop didn't forcibly rerun cmake if you change build directories and the new one already has a compile_commands.json file (i.e. if it wouldn't rerun cmake when you open a project configured for that build dir).

What I find more important though (in terms of priority) is a proper way of configuring the cmake "extra arguments" (but also the install location and build type!!) after you create a project.

R.
Leon Pollak
2016-11-16 09:09:44 UTC
Permalink
Sorry for possible incorrect understanding...:-)

I work in the very similar case and have, IMHO, more important issue:
I do not see a big deal in changing the configuration via menu.
But, what is much ore annoying for me is the necessity to switch the "current
launch configuration".
I think, that it should not be a big issue to make some kind of connection
between the specific configuration and corresponding target/launch.

Thanks.
Post by René J.V. Bertin
Post by Mário Oravec
Here is my suggestion how I would like it, if I click on target and choose
build, kdevelop will
Post by René J.V. Bertin
Post by Mário Oravec
change configuration automatically in background before build, but now it is not possible
because kdevelop present just targets of active configuration.
That's going to be complicated: not only would the CMake project manager
have to check all build directories for targets, it would also have to figure
something out if multiple build directories have the same targets (say if you
have 2 build dirs. configured to compare how 2 different compilers deal with
the same source code).
Post by René J.V. Bertin
A drop-down or sub menu (in the Project menu) could indeed be nice. But it
would also be very nice if KDevelop didn't forcibly rerun cmake if you change
build directories and the new one already has a compile_commands.json file
(i.e. if it wouldn't rerun cmake when you open a project configured for that
build dir).
Post by René J.V. Bertin
What I find more important though (in terms of priority) is a proper way of
configuring the cmake "extra arguments" (but also the install location and
build type!!) after you create a project.
Post by René J.V. Bertin
R.
--
Leon
Mário Oravec
2016-11-16 09:34:50 UTC
Permalink
Hi Leon,

so far I am using the following workaround

in top level CMakeList.txt I put the following targets which are created
for both configurations and right click and build on particular target
does what I want. But would be more beautiful to have some support
in kdevelop

add_custom_target($test-host
WORKING_DIRECTORY top/build/host
# it builds tests
COMMAND make
# it runs tests
COMMAND ./src/test/sb_peripheral_test
COMMENT building tests
)

add_custom_target(app-arm
WORKING_DIRECTORY top/build/app
# it builds app for arm
COMMAND make
COMMENT building target
)

MOr
Post by Leon Pollak
Sorry for possible incorrect understanding...:-)
I do not see a big deal in changing the configuration via menu.
Ok
Post by Leon Pollak
But, what is much ore annoying for me is the necessity to switch the
"current launch configuration".
You mean if you set launch and changes configuration let say to target
the correct launch is not preset as prefered? so you will have to again
choose it from menu?
Post by Leon Pollak
I think, that it should not be a big issue to make some kind of connection
between the specific configuration and corresponding target/launch.
Thanks.
Post by René J.V. Bertin
Post by Mário Oravec
Here is my suggestion how I would like it, if I click on target and choose
build, kdevelop will
Post by René J.V. Bertin
Post by Mário Oravec
change configuration automatically in background before build, but now it
is not possible
Post by René J.V. Bertin
Post by Mário Oravec
because kdevelop present just targets of active configuration.
That's going to be complicated: not only would the CMake project manager
have to check all build directories for targets, it would also have to
figure something out if multiple build directories have the same targets
(say if you have 2 build dirs. configured to compare how 2 different
compilers deal with the same source code).
Post by René J.V. Bertin
A drop-down or sub menu (in the Project menu) could indeed be nice. But it
would also be very nice if KDevelop didn't forcibly rerun cmake if you
change build directories and the new one already has a
compile_commands.json file (i.e. if it wouldn't rerun cmake when you open a
project configured for that build dir).
Post by René J.V. Bertin
What I find more important though (in terms of priority) is a proper way of
configuring the cmake "extra arguments" (but also the install location and
build type!!) after you create a project.
Post by René J.V. Bertin
R.
René J.V. Bertin
2016-11-16 09:39:13 UTC
Permalink
Post by Mário Oravec
so far I am using the following workaround
in top level CMakeList.txt I put the following targets which are created
for both configurations and ...
... this works with any DE that has support for CMake (including the commandline) ;)

R.
Leon Pollak
2016-11-16 09:47:00 UTC
Permalink
Sorry for being not clear enough.
I am speaking about launch targets for debugging, not the compilation.
Post by Mário Oravec
Hi Leon,
so far I am using the following workaround
in top level CMakeList.txt I put the following targets which are created
for both configurations and right click and build on particular target
does what I want. But would be more beautiful to have some support
in kdevelop
add_custom_target($test-host
WORKING_DIRECTORY top/build/host
# it builds tests
COMMAND make
# it runs tests
COMMAND ./src/test/sb_peripheral_test
COMMENT building tests
)
add_custom_target(app-arm
WORKING_DIRECTORY top/build/app
# it builds app for arm
COMMAND make
COMMENT building target
)
MOr
Post by Leon Pollak
Sorry for possible incorrect understanding...:-)
I do not see a big deal in changing the configuration via menu.
Ok
Post by Leon Pollak
But, what is much ore annoying for me is the necessity to switch the
"current launch configuration".
You mean if you set launch and changes configuration let say to target
the correct launch is not preset as prefered? so you will have to again
choose it from menu?
Post by Leon Pollak
I think, that it should not be a big issue to make some kind of connection
between the specific configuration and corresponding target/launch.
Thanks.
Post by René J.V. Bertin
Post by Mário Oravec
Here is my suggestion how I would like it, if I click on target and choose
build, kdevelop will
Post by René J.V. Bertin
Post by Mário Oravec
change configuration automatically in background before build, but now it
is not possible
Post by René J.V. Bertin
Post by Mário Oravec
because kdevelop present just targets of active configuration.
That's going to be complicated: not only would the CMake project manager
have to check all build directories for targets, it would also have to
figure something out if multiple build directories have the same targets
(say if you have 2 build dirs. configured to compare how 2 different
compilers deal with the same source code).
Post by René J.V. Bertin
A drop-down or sub menu (in the Project menu) could indeed be nice. But it
would also be very nice if KDevelop didn't forcibly rerun cmake if you
change build directories and the new one already has a
compile_commands.json file (i.e. if it wouldn't rerun cmake when you open a
project configured for that build dir).
Post by René J.V. Bertin
What I find more important though (in terms of priority) is a proper way of
configuring the cmake "extra arguments" (but also the install location and
build type!!) after you create a project.
Post by René J.V. Bertin
R.
--
Dr.Leon M.Pollak
Director
PLR Information Systems Ltd.
Tel.:+972-98657670 | POB 8130, Giborei Israel 5a,
Fax.:+972-98657621 | Poleg Industrial Zone,
Mob.:+972-544739246 | Netanya, 42504, Israel.
Mário Oravec
2016-11-16 10:03:09 UTC
Permalink
ok Leon, me too, there is only one lunch configurator. You can configure to run
app or debug app. I do not have sufficiont know-how here to help you. I use
debuging rarely, most of the time it is sufficient to run unit tests for me.
And if to come situation to debug I have just one debug lunch <test> and
do not need to change it.

MOr
Post by Leon Pollak
Sorry for being not clear enough.
I am speaking about launch targets for debugging, not the compilation.
Post by Mário Oravec
Hi Leon,
so far I am using the following workaround
in top level CMakeList.txt I put the following targets which are created
for both configurations and right click and build on particular target
does what I want. But would be more beautiful to have some support
in kdevelop
add_custom_target($test-host
WORKING_DIRECTORY top/build/host
# it builds tests
COMMAND make
# it runs tests
COMMAND ./src/test/sb_peripheral_test
COMMENT building tests
)
add_custom_target(app-arm
WORKING_DIRECTORY top/build/app
# it builds app for arm
COMMAND make
COMMENT building target
)
MOr
Post by Leon Pollak
Sorry for possible incorrect understanding...:-)
I do not see a big deal in changing the configuration via menu.
Ok
Post by Leon Pollak
But, what is much ore annoying for me is the necessity to switch the
"current launch configuration".
You mean if you set launch and changes configuration let say to target
the correct launch is not preset as prefered? so you will have to again
choose it from menu?
Post by Leon Pollak
I think, that it should not be a big issue to make some kind of connection
between the specific configuration and corresponding target/launch.
Thanks.
Post by René J.V. Bertin
Post by Mário Oravec
Here is my suggestion how I would like it, if I click on target and choose
build, kdevelop will
Post by René J.V. Bertin
Post by Mário Oravec
change configuration automatically in background before build, but
now
it
Post by Mário Oravec
Post by Leon Pollak
is not possible
Post by René J.V. Bertin
Post by Mário Oravec
because kdevelop present just targets of active configuration.
That's going to be complicated: not only would the CMake project manager
have to check all build directories for targets, it would also have to
figure something out if multiple build directories have the same targets
(say if you have 2 build dirs. configured to compare how 2 different
compilers deal with the same source code).
Post by René J.V. Bertin
A drop-down or sub menu (in the Project menu) could indeed be nice.
But
it
Post by Mário Oravec
Post by Leon Pollak
would also be very nice if KDevelop didn't forcibly rerun cmake if you
change build directories and the new one already has a
compile_commands.json file (i.e. if it wouldn't rerun cmake when you
open
a
Post by Mário Oravec
Post by Leon Pollak
project configured for that build dir).
Post by René J.V. Bertin
What I find more important though (in terms of priority) is a proper
way
of
configuring the cmake "extra arguments" (but also the install location and
build type!!) after you create a project.
Post by René J.V. Bertin
R.
René J.V. Bertin
2016-11-16 11:31:57 UTC
Permalink
Post by Mário Oravec
ok Leon, me too, there is only one lunch configurator. You can configure to run
app or debug app.
AFAIK that's not an exclusive or. You get the debug configuration when you start a debug session, or else the run configuration is used.

R.
Mário Oravec
2016-11-16 11:34:36 UTC
Permalink
sorry, yes you right.
Post by René J.V. Bertin
Post by Mário Oravec
ok Leon, me too, there is only one lunch configurator. You can configure
to run app or debug app.
AFAIK that's not an exclusive or. You get the debug configuration when you
start a debug session, or else the run configuration is used.
R.
Leon Pollak
2016-11-16 11:53:35 UTC
Permalink
Sorry, I did not catch:
Is my request to pair the build configuration with the debug launch choose is
acceptable or not?
Again, in my case, I have several build directories for different types of
target machine: PC, ARM, PowerPC.
What I ask is that if I built, let's say ARM the last, the ARM target will be
chosen to be debugged.
Today, the first configured in the list configuration is launched silently,
which confuses me very often, as the first in my case is PC, while, for
example, I am compiling and want to debug ARM.

Thanks.
Post by René J.V. Bertin
Post by Mário Oravec
ok Leon, me too, there is only one lunch configurator. You can configure to run
app or debug app.
AFAIK that's not an exclusive or. You get the debug configuration when you
start a debug session, or else the run configuration is used.
Post by René J.V. Bertin
R.
--
Leon
Mário Oravec
2016-11-17 16:26:40 UTC
Permalink
Post by Leon Pollak
Is my request to pair the build configuration with the debug launch choose
is acceptable or not?
yes it is ok for debuging
Is my request to pair the build configuration with the debug launch choose
is acceptable or not?
Again, in my case, I have several build directories for different types of
target machine: PC, ARM, PowerPC.
What I ask is that if I built, let's say ARM the last, the ARM target will
be chosen to be debugged.
Today, the first configured in the list configuration is launched silently,
which confuses me very often, as the first in my case is PC, while, for
example, I am compiling and want to debug ARM.
Thanks.
Post by Mário Oravec
ok Leon, me too, there is only one lunch configurator. You can configure
to run
Post by Mário Oravec
app or debug app.
AFAIK that's not an exclusive or. You get the debug configuration when you
start a debug session, or else the run configuration is used.
R.
Loading...