D28444: WIP/RFC: Add ECMCargo module

2020-03-30 Thread Carson Black
cblack created this revision.
cblack added reviewers: Frameworks, Build System.
Herald added projects: Frameworks, Build System.
Herald added subscribers: kde-buildsystem, kde-frameworks-devel.
cblack requested review of this revision.

REVISION SUMMARY
  The ECMCargo module allows for easy usage of Rust projects
  in a CMake project. Usage looks like this:
  
ecm_add_cargo_workspace(
  WORKSPACE_DIRECTORY src/rs/
  WORKSPACE_NAME ikona
  FEATURES with-svgcleaner
  DEPENDS src/rs/src/ikona/icons/mod.rs
  src/rs/src/ikona/icontheme/mod.rs
  src/rs/src/ikona/icons/tests.rs
  src/rs/src/ikona/lib.rs
  src/rs/src/capi/capi.rs
  VENDOR_TARBALL ikona.cargo.vendor.tar.xz
  VENDOR_CONFIG cargo-vendor-config.toml
)
...
target_link_libraries(ikona
  PRIVATE Qt5::Core Qt5::Widgets Qt5::Quick Qt5::Concurrent KF5::I18n 
KF5::Kirigami2 KF5::ConfigWidgets "${ikona_artifacts_dir}/libikonars.so")
  
  Todo:
  
  [ ] More thorough testing
  [ ] Documentation

REPOSITORY
  R240 Extra CMake Modules

BRANCH
  cblack/cargo-integration

REVISION DETAIL
  https://phabricator.kde.org/D28444

AFFECTED FILES
  modules/ECMCargo.cmake

To: cblack, #frameworks, #build_system
Cc: kde-frameworks-devel, kde-buildsystem, LeGast00n, cblack, GB_2, bencreasy, 
michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-03-30 Thread Ilya Bizyaev
IlyaBizyaev added a comment.


  I'm not good at CMake modules, but maybe this code (which I used in a 
project) is useful:
  https://github.com/Devolutions/CMakeRust

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D28444

To: cblack, #frameworks, #build_system
Cc: IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, cblack, 
GB_2, bencreasy, michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-03-30 Thread Aleix Pol Gonzalez
apol added a comment.


  Code per se looks okay, not that I've ever used a rust workspace.
  
  It does need documentation though. See other ECM modules to see what it looks 
like.
  
  I wonder if this is covering a very widespread use-case. If there's just one 
application that needs it, it could make sense to keep it there and once it's 
polished, we put it in ECM to share.

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D28444

To: cblack, #frameworks, #build_system
Cc: apol, IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, 
cblack, GB_2, bencreasy, michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-03-30 Thread Carson Black
cblack added a comment.


  In D28444#638428 , @apol wrote:
  
  > I wonder if this is covering a very widespread use-case. If there's just 
one application that needs it, it could make sense to keep it there and once 
it's polished, we put it in ECM to share.
  
  
  I feel like one of the reasons KDE doesn't use Rust more is that using it in 
the build system side is pain. Case in point: more than half of Ikona's 
CMakeLists.txt is boilerplate dedicated to integrating Rust with the rest of 
the project. I'd like to get this in ECM to lower the barrier for other KDE 
applications and libraries to utilize Rust.

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D28444

To: cblack, #frameworks, #build_system
Cc: apol, IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, 
cblack, GB_2, bencreasy, michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-03-30 Thread Aleix Pol Gonzalez
apol added a comment.


  > I feel like one of the reasons KDE doesn't use Rust more is that using it 
in the build system side is pain. Case in point: more than half of Ikona's 
CMakeLists.txt is boilerplate dedicated to integrating Rust with the rest of 
the project. I'd like to get this in ECM to lower the barrier for other KDE 
applications and libraries to utilize Rust.
  
  Will this make all the boilerplate in ikona disappear?
  
  Should we keep it in Ikona until it's ready for consumption then move it to 
ECM when someone needs it? We release ECM every month so there's not that much 
of downtime in such a case.

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D28444

To: cblack, #frameworks, #build_system
Cc: apol, IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, 
cblack, GB_2, bencreasy, michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-03-30 Thread Carson Black
cblack added a comment.


  In D28444#638435 , @apol wrote:
  
  > Will this make all the boilerplate in ikona disappear?
  
  
  It'll bring it down to the same level as everything else.

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D28444

To: cblack, #frameworks, #build_system
Cc: apol, IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, 
cblack, GB_2, bencreasy, michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-03-30 Thread Ilya Bizyaev
IlyaBizyaev added a comment.


  In D28444#638430 , @cblack wrote:
  
  > more than half of Ikona's CMakeLists.txt is boilerplate dedicated to 
integrating Rust with the rest of the project
  
  
  I don't understand why your function needs a list of Rust files, even though 
those are already handled by Cargo. Looks boilerplate-ish...

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D28444

To: cblack, #frameworks, #build_system
Cc: apol, IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, 
cblack, GB_2, bencreasy, michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-03-31 Thread Carson Black
cblack added a comment.


  In D28444#638540 , @IlyaBizyaev 
wrote:
  
  > In D28444#638430 , @cblack wrote:
  >
  > > more than half of Ikona's CMakeLists.txt is boilerplate dedicated to 
integrating Rust with the rest of the project
  >
  >
  > I don't understand why your function needs a list of Rust files, even 
though those are already handled by Cargo. Looks boilerplate-ish...
  
  
  CMake needs to know when the Rust source has changed so it can rebuild it

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D28444

To: cblack, #frameworks, #build_system
Cc: apol, IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, 
cblack, GB_2, bencreasy, michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-03-31 Thread Ilya Bizyaev
IlyaBizyaev added a comment.


  In D28444#638877 , @cblack wrote:
  
  > CMake needs to know when the Rust source has changed so it can rebuild it
  
  
  Changes to Rust code need to be tracked by Cargo, not by CMake

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D28444

To: cblack, #frameworks, #build_system
Cc: apol, IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, 
cblack, GB_2, bencreasy, michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-03-31 Thread Carson Black
cblack added a comment.


  In D28444#638988 , @IlyaBizyaev 
wrote:
  
  > In D28444#638877 , @cblack wrote:
  >
  > > CMake needs to know when the Rust source has changed so it can rebuild it
  >
  >
  > Changes to Rust code need to be tracked by Cargo, not by CMake
  
  
  CMake needs to know what files Cargo wants to build in order to invoke it 
only when Rust files change. There's no reason to invoke Cargo every time 
`make` is ran when CMake has the ability to keep track of dirty files.

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D28444

To: cblack, #frameworks, #build_system
Cc: apol, IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, 
cblack, GB_2, bencreasy, michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-03-31 Thread Ilya Bizyaev
IlyaBizyaev added a comment.


  In D28444#639020 , @cblack wrote:
  
  > CMake needs to know what files Cargo wants to build in order to invoke it 
only when Rust files change. There's no reason to invoke Cargo every time 
`make` is ran when CMake has the ability to keep track of dirty files.
  
  
  I disagree here; I'd rather invoke the tool that is meant to do the job than
  a) reimplement tracking in CMake;
  b) duplicate file lists for no real win.
  Extra concerns for the developer, barely any difference for the machine.

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D28444

To: cblack, #frameworks, #build_system
Cc: apol, IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, 
cblack, GB_2, bencreasy, michaelh, ngraham, bruns


D28444: WIP/RFC: Add ECMCargo module

2020-04-05 Thread Carson Black
cblack updated this revision to Diff 79430.
cblack added a comment.


  Address feedback

REPOSITORY
  R240 Extra CMake Modules

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D28444?vs=78925&id=79430

BRANCH
  cblack/cargo-integration

REVISION DETAIL
  https://phabricator.kde.org/D28444

AFFECTED FILES
  modules/ECMCargo.cmake

To: cblack, #frameworks, #build_system
Cc: apol, IlyaBizyaev, kde-frameworks-devel, kde-buildsystem, LeGast00n, 
cblack, GB_2, bencreasy, michaelh, ngraham, bruns