CMake conversion #4

Merged
MicheleC merged 1 commits from feat/cmake-conv into master 2 years ago
Owner

As per title. Builds and seems to works fine.

In DEB distros, to be built with TDE/tde-packaging#126

As per title. Builds and seems to works fine. In DEB distros, to be built with TDE/tde-packaging#126
MicheleC added 1 commit 2 years ago
892ac39067
CMake conversion.
MicheleC requested review from SlavekB 2 years ago
MicheleC added this to the R14.0.13 release milestone 2 years ago
MicheleC force-pushed feat/cmake-conv from 892ac39067 to 0ce973505b 2 years ago
MicheleC added 1 commit 2 years ago
9d77233671
Use TDE cmake macro to set version
SlavekB requested changes 2 years ago
SlavekB left a comment
Owner

In addition to the comments below, there is a note on all translations:

The CMake code used works well, but as you can see in tde_add_project_translations, we now take into account the variable LINGUAS to influence what translations will be installed. This is mainly used by distributions that build from the source code instead of binary packages. We could consider the way to use tde_add_project_translations to make the behavior identical. This could be achieved for plugins when the translations were placed in a subdirectory according to the name of the generated file. For example plugins/alsa-sound/po/tderadio-alsa-sound/.... Such a location would allow easy use of macro tde_add_project_translations and thus gain the same behavior. For the translation of the application as such, this macro can be used immediately, without the need to change the location.

In addition to the comments below, there is a note on all translations: The CMake code used works well, but as you can see in `tde_add_project_translations`, we now take into account the variable `LINGUAS` to influence what translations will be installed. This is mainly used by distributions that build from the source code instead of binary packages. We could consider the way to use `tde_add_project_translations` to make the behavior identical. This could be achieved for plugins when the translations were placed in a subdirectory according to the name of the generated file. For example `plugins/alsa-sound/po/tderadio-alsa-sound/...`. Such a location would allow easy use of macro `tde_add_project_translations` and thus gain the same behavior. For the translation of the application as such, this macro can be used immediately, without the need to change the location.
CMakeLists.txt Outdated
option( BUILD_ALL "Build all" ON )
option( BUILD_DOC "Build documentation" ${BUILD_ALL} )
option( BUILD_OSS_PLUGIN "Build OSS plugin" ${BUILD_ALL} )
Owner

It is strange that the choice for the OSS module is like BUILD_..., while the choises that relate to other modules such as ALSA and LIRC are like WITH_.... There it makes sense that the choice is BUILD_..._PLUGIN, but it should also be for ALSA and LIRC.

It is strange that the choice for the OSS module is like `BUILD_...`, while the choises that relate to other modules such as ALSA and LIRC are like `WITH_...`. There it makes sense that the choice is `BUILD_..._PLUGIN`, but it should also be for ALSA and LIRC.
MicheleC marked this conversation as resolved
if( WITH_ALSA )
find_package( ALSA )
if( NOT ALSA_FOUND )
message(FATAL_ERROR "\nalsa support is requested, but was not found on your system" )
Owner

Instead of message( FATAL_ERROR ... ) we normally use macro tde_message_fatal( ... ) – see a few lines below.

Instead of `message( FATAL_ERROR ... )` we normally use macro `tde_message_fatal( ... )` – see a few lines below.
Poster
Owner

I will adjust the code.
For info, this was taken from some other TDE modules, so we probably need to do anoverall review at some point.

I will adjust the code. For info, this was taken from some other TDE modules, so we probably need to do anoverall review at some point.
MicheleC marked this conversation as resolved
if( WITH_LIRC )
pkg_search_module( LIRC lirc )
if( NOT LIRC_FOUND )
message(FATAL_ERROR "\nlirc support is requested, but was not found on your system" )
Owner

Instead of message( FATAL_ERROR ... ) we normally use macro tde_message_fatal( ... ) – see a few lines above or below.

Instead of `message( FATAL_ERROR ... )` we normally use macro `tde_message_fatal( ... )` – see a few lines above or below.
MicheleC marked this conversation as resolved
pkg_search_module( SNDFILE sndfile )
if( NOT SNDFILE_FOUND )
tde_message_fatal( "sndfile is requested, but was not found on your system" )
Owner

sndfile seems to be required, not requested.

`sndfile` seems to be required, not requested.
Poster
Owner

Good point, will rephrase the comment

Good point, will rephrase the comment
MicheleC marked this conversation as resolved
config.h.cmake Outdated
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
// Defined if ALSA support found
#cmakedefine HAVE_ALSA
Owner

This is not used because instead of HAVE_ALSA is used in the meaning of BUILD_ALSA. See the first comment.

This is not used because instead of `HAVE_ALSA` is used in the meaning of `BUILD_ALSA`. See the first comment.
MicheleC marked this conversation as resolved
config.h.cmake Outdated
#cmakedefine HAVE_LAME
// Defined if LIRC support found
#cmakedefine HAVE_LIRC
Owner

This is not used because instead of HAVE_LIRC is used in the meaning of BUILD_LIRC. See the first comment.

This is not used because instead of `HAVE_LIRC` is used in the meaning of `BUILD_LIRC`. See the first comment.
MicheleC marked this conversation as resolved
recording-monitor.cpp encoder_mp3.cpp encoder_ogg.cpp encoder_pcm.cpp
LINK tderadio-shared ${LAME_LIBRARIES} ${OGG_LIBRARIES} ${VORBIS_LIBRARIES}
${VORBISFILE_LIBRARIES} ${VORBISENC_LIBRARIES} ${SNDFILE_LIBRARIES}
Owner

Incorrect indentation.

Incorrect indentation.
MicheleC marked this conversation as resolved
SOURCES
streaming.cpp streaming-configuration-ui.ui
streaming-configuration.cpp streaming-job.cpp
LINK tderadio-shared
Owner

In other cases there is an empty line in the same situation. Although it is not crucial, it seems good to be consistent.

In other cases there is an empty line in the same situation. Although it is not crucial, it seems good to be consistent.
MicheleC marked this conversation as resolved
##### other data
INSTALL(
FILES tderadio.desktop
Owner

It is advisable to use tde_create_translated_desktop, regardless of the translation using po files is not yet ready.

It is advisable to use `tde_create_translated_desktop`, regardless of the translation using `po` files is not yet ready.
MicheleC marked this conversation as resolved
MicheleC force-pushed feat/cmake-conv from 9d77233671 to b2f3b1c9de 2 years ago
Poster
Owner

All point addressed.

All point addressed.
MicheleC requested review from SlavekB 2 years ago
SlavekB requested changes 2 years ago
SlavekB left a comment
Owner

To install translations, we should take into account the variable LINGUAS. Therefore, either we have to add its processing to CMake rules in all plugins, such as is in tde_add_project_translations macro or change the location of translations in plugins, as mentioned in the previous review.

To install translations, we **should** take into account the variable `LINGUAS`. Therefore, either we have to add its processing to CMake rules in all plugins, such as is in `tde_add_project_translations` macro or change the location of translations in plugins, as mentioned in the previous review.
tde_create_translated_desktop(
SOURCE tderadio.desktop
DESTINATION ${XDG_APPS_INSTALL_DIR}
Owner

The XDG_APPS_INSTALL_DIR path is default. Therefore, the call can be simplified to:

tde_create_translated_desktop( tderadio.desktop )
The `XDG_APPS_INSTALL_DIR` path is default. Therefore, the call can be simplified to: ``` tde_create_translated_desktop( tderadio.desktop ) ```
MicheleC marked this conversation as resolved
file( GLOB _srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po )
if( _srcs )
tde_create_translation( LANG auto OUTPUT_NAME tderadio )
Owner

As I mentioned in the previous review, here instead of the whole proposed code can be used simply:

tde_add_project_translations()
As I mentioned in the previous review, here instead of the whole proposed code can be used simply: ``` tde_add_project_translations() ```
MicheleC marked this conversation as resolved
MicheleC force-pushed feat/cmake-conv from b2f3b1c9de to beeea5e6a6 2 years ago
Poster
Owner

Updated based on the feedback received.

Updated based on the feedback received.
MicheleC requested review from SlavekB 2 years ago
SlavekB reviewed 2 years ago
SlavekB left a comment
Owner

To properly use a variable LINGUAS for plugins translations (and convert-presets), one of the following is needed:

  1. Change the translation location so that they are in the subfolder by name of the target file – for example plugins/alsa-sound/po/tderadio-alsa-sound/, and then can be used macro tde_add_project_translations().

  2. Edit the CMakeLists.txt in all plugins to include the processing of variable LINGUAS such as in tde_add_project_translations – for example in plugins/alsa-sound/po:

  file( GLOB po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po )  
  string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" )

  foreach( _po ${po_files} )
    get_filename_component( _lang ${_po} NAME_WE )
    if( "${_linguas}" MATCHES "^;*$" OR ";${_linguas};" MATCHES ";${_lang};" )
      tde_create_translation( FILES ${_po} LANG ${_lang} OUTPUT_NAME tderadio-alsa-sound )
    endif( )
  endforeach( )
To properly use a variable `LINGUAS` for plugins translations (and `convert-presets`), one of the following is needed: 1. Change the translation location so that they are in the subfolder by name of the target file – for example `plugins/alsa-sound/po/tderadio-alsa-sound/`, and then can be used macro `tde_add_project_translations()`. 2. Edit the CMakeLists.txt in all plugins to include the processing of variable `LINGUAS` such as in `tde_add_project_translations` – for example in `plugins/alsa-sound/po`: ``` file( GLOB po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po ) string( REGEX REPLACE "[ \r\n\t]+" ";" _linguas "$ENV{LINGUAS}" ) foreach( _po ${po_files} ) get_filename_component( _lang ${_po} NAME_WE ) if( "${_linguas}" MATCHES "^;*$" OR ";${_linguas};" MATCHES ";${_lang};" ) tde_create_translation( FILES ${_po} LANG ${_lang} OUTPUT_NAME tderadio-alsa-sound ) endif( ) endforeach( ) ```
MicheleC added 1 commit 2 years ago
8e538efc5c
Use the variable LINGUAS for plugins translations.
Poster
Owner

Thanks for the feedback @SlavekB. PR updated as per option 1. I have made a separate commit since moving files around also affects makefiles.

Thanks for the feedback @SlavekB. PR updated as per option 1. I have made a separate commit since moving files around also affects makefiles.
Owner

Thanks for the feedback @SlavekB. PR updated as per option 1. I have made a separate commit since moving files around also affects makefiles.

Yes, it makes sense and it looks good. The last small thing remains – adjust all CMakeL10n rules and add / for all the names of the catalogs. For example, CATALOG "tderadio-alsa-sound" change to CATALOG "tderdio-alsa-sound/". This ensures that the POT files will be generated into the newly created subfolder.

> Thanks for the feedback @SlavekB. PR updated as per option 1. I have made a separate commit since moving files around also affects makefiles. Yes, it makes sense and it looks good. The last small thing remains – adjust all CMakeL10n rules and add `/` for all the names of the catalogs. For example, `CATALOG "tderadio-alsa-sound"` change to `CATALOG "tderdio-alsa-sound/"`. This ensures that the `POT` files will be generated into the newly created subfolder.
Owner

Thanks for the feedback @SlavekB. PR updated as per option 1. I have made a separate commit since moving files around also affects makefiles.

Oh, I forgot one thing – to avoid losing history in TWTW, we need translations and catalogs first copy to a new location, then edit TWTW configuration and only then remove files from the original location.

> Thanks for the feedback @SlavekB. PR updated as per option 1. I have made a separate commit since moving files around also affects makefiles. Oh, I forgot one thing – to avoid losing history in TWTW, we need translations and catalogs first copy to a new location, then edit TWTW configuration and only then remove files from the original location.
Poster
Owner

Yes, it makes sense and it looks good. The last small thing remains – adjust all CMakeL10n rules and add / for all the names of the catalogs. For example, CATALOG "tderadio-alsa-sound" change to CATALOG "tderdio-alsa-sound/". This ensures that the POT files will be generated into the newly created subfolder.

yeah, my bad for not testing that part :-(

Oh, I forgot one thing – to avoid losing history in TWTW, we need translations and catalogs first copy to a new location, then edit TWTW configuration and only then remove files from the original location.

yes, I may actually do the move of the files first as a separate task, then the cmake conversion on top of that. I will have a look later.

> Yes, it makes sense and it looks good. The last small thing remains – adjust all CMakeL10n rules and add `/` for all the names of the catalogs. For example, `CATALOG "tderadio-alsa-sound"` change to `CATALOG "tderdio-alsa-sound/"`. This ensures that the `POT` files will be generated into the newly created subfolder. yeah, my bad for not testing that part :-( > Oh, I forgot one thing – to avoid losing history in TWTW, we need translations and catalogs first copy to a new location, then edit TWTW configuration and only then remove files from the original location. yes, I may actually do the move of the files first as a separate task, then the cmake conversion on top of that. I will have a look later.
SlavekB reviewed 2 years ago
add_definitions (
-UTQT_NO_ASCII_CAST
Owner

Now I remembered that I saw -UTQT_NO_ASCII_CAST definition in the patch. Therefore, I did a test and it seems that this is not needed.

Now I remembered that I saw `-UTQT_NO_ASCII_CAST` definition in the patch. Therefore, I did a test and it seems that this is not needed.
Poster
Owner

ok, thanks for testing this out. I will update accordingly.

ok, thanks for testing this out. I will update accordingly.
MicheleC marked this conversation as resolved
MicheleC force-pushed feat/cmake-conv from 8e538efc5c to 19e25cb45c 2 years ago
Poster
Owner

Rebased on top of current master and issues mentioned above addressed.

Rebased on top of current master and issues mentioned above addressed.
MicheleC force-pushed feat/cmake-conv from 19e25cb45c to 084a5f7462 2 years ago
MicheleC force-pushed feat/cmake-conv from 084a5f7462 to bc7518bdba 2 years ago
SlavekB approved these changes 2 years ago
SlavekB left a comment
Owner

Everything looks good.

Everything looks good.
MicheleC merged commit bc7518bdba into master 2 years ago
MicheleC deleted branch feat/cmake-conv 2 years ago

Reviewers

SlavekB approved these changes 2 years ago
The pull request has been merged as bc7518bdba.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Reference: TDE/tderadio#4
Loading…
There is no content yet.