diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2020-05-04 08:45:19 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2020-05-07 14:39:22 +0200 |
commit | 94d67073e51dd664a28f4e590ccc6ce9f654af47 (patch) | |
tree | 04fb84502a7cf0f74a753115fc463f8339b6a203 /modules/TDEMacros.cmake | |
parent | 6b58614fc45d23e442c2c1f468dc51c239ce38b4 (diff) | |
download | tde-cmake-94d67073e51dd664a28f4e590ccc6ce9f654af47.tar.gz tde-cmake-94d67073e51dd664a28f4e590ccc6ce9f654af47.zip |
Replace the remaining KDE3 macros.
+ Targets are created to generate files, not just commands.
+ Generating kidl files is created as a separate targets.
+ Headers are added to the list of generated files.
+ This allows for more accurate dependency determination.
+ This prevents files generation from being repeated.
+ This prevents the occasional FTBFS during a parallel build.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 5cd16d6fb9d4917676e165655e91d75f36339c4c)
Diffstat (limited to 'modules/TDEMacros.cmake')
-rw-r--r-- | modules/TDEMacros.cmake | 145 |
1 files changed, 141 insertions, 4 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index b451731..03120d1 100644 --- a/modules/TDEMacros.cmake +++ b/modules/TDEMacros.cmake @@ -15,7 +15,6 @@ # ################################################# -include( KDE3Macros ) # we will need this module for a while include( CheckCXXCompilerFlag ) @@ -476,6 +475,144 @@ endmacro( tde_automoc ) ################################################# ##### +##### tde_create_dcop_kidl + +macro( tde_create_dcop_kidl _kidl _kidl_source ) + + get_filename_component( _kidl_source ${_kidl_source} ABSOLUTE ) + get_filename_component( _kidl_basename ${_kidl_source} NAME_WE ) + set( _kidl_output ${CMAKE_CURRENT_BINARY_DIR}/${_kidl_basename}.kidl ) + file( RELATIVE_PATH _kidl_target "${CMAKE_BINARY_DIR}" "${_kidl_output}" ) + string( REPLACE "/" "+" _kidl_target "${_kidl_target}" ) + + if( NOT TARGET ${_kidl_target} ) + add_custom_command( + OUTPUT ${_kidl_output} + COMMAND ${KDE3_DCOPIDL_EXECUTABLE} + ARGS ${_kidl_source} > ${_kidl_output} + DEPENDS ${_kidl_source} + ) + add_custom_target( ${_kidl_target} DEPENDS ${_kidl_output} ) + if( NOT TDE_FOUND ) + add_dependencies( ${_kidl_target} dcopidl ) + endif( ) + endif( ) + + set( ${_kidl} ${_kidl_output} ) + +endmacro( tde_create_dcop_kidl ) + + +################################################# +##### +##### tde_add_dcop_skels + +macro( tde_add_dcop_skels _sources ) + foreach( _current_FILE ${ARGN} ) + + get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE ) + get_filename_component( _basename ${_tmp_FILE} NAME_WE ) + + set( _skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp ) + file( RELATIVE_PATH _skel_target "${CMAKE_BINARY_DIR}" "${_skel}" ) + string( REPLACE "/" "+" _skel_target "${_skel_target}" ) + + tde_create_dcop_kidl( _kidl ${_tmp_FILE} ) + + if( NOT TARGET ${_skel_target} ) + add_custom_command( + OUTPUT ${_skel} + COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} + ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl} + DEPENDS ${_kidl_target} + ) + add_custom_target( ${_skel_target} DEPENDS ${_skel} ) + if( NOT TDE_FOUND ) + add_dependencies( ${_skel_target} dcopidl2cpp ) + endif( ) + endif( ) + + list( APPEND ${_sources} ${_skel} ) + + endforeach( _current_FILE ) +endmacro( tde_add_dcop_skels ) + + +################################################# +##### +##### tde_add_dcop_stubs + +macro( tde_add_dcop_stubs _sources ) + foreach( _current_FILE ${ARGN} ) + + get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE ) + get_filename_component( _basename ${_tmp_FILE} NAME_WE ) + + set( _stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp ) + set( _stub_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.h ) + file( RELATIVE_PATH _stub_target "${CMAKE_BINARY_DIR}" "${_stub_CPP}" ) + string( REPLACE "/" "+" _stub_target "${_stub_target}" ) + + tde_create_dcop_kidl( _kidl ${_tmp_FILE} ) + + if( NOT TARGET ${_stub_target} ) + add_custom_command( + OUTPUT ${_stub_CPP} ${_stub_HEADER} + COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE} + ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl} + DEPENDS ${_kidl_target} + ) + add_custom_target( ${_stub_target} DEPENDS ${_stub_CPP} ${_stub_HEADER} ) + if( NOT TDE_FOUND ) + add_dependencies( ${_stub_target} dcopidl2cpp ) + endif( ) + endif( ) + + list( APPEND ${_sources} ${_stub_CPP} ) + + endforeach( _current_FILE ) +endmacro( tde_add_dcop_stubs ) + + +################################################# +##### +##### tde_add_kcfg_files + +macro( tde_add_kcfg_files _sources ) + foreach( _current_FILE ${ARGN} ) + + get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE ) + get_filename_component( _basename ${_tmp_FILE} NAME_WE ) + + file( READ ${_tmp_FILE} _contents ) + string( REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}" ) + + set( _src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp ) + set( _header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h ) + file( RELATIVE_PATH _kcfg_target "${CMAKE_BINARY_DIR}" "${_src_FILE}" ) + string( REPLACE "/" "+" _kcfg_target "${_kcfg_target}" ) + + if( NOT TARGET ${_kcfg_target} ) + add_custom_command( + OUTPUT ${_src_FILE} ${_header_FILE} + COMMAND ${KDE3_KCFGC_EXECUTABLE} + ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE} + DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} + ) + add_custom_target( ${_kcfg_target} DEPENDS ${_src_FILE} ${_header_FILE} ) + if( NOT TDE_FOUND ) + add_dependencies( ${_kcfg_target} tdeconfig_compiler ) + endif( ) + endif( ) + + list( APPEND ${_sources} ${_src_FILE} ) + + endforeach( _current_FILE ) +endmacro( tde_add_kcfg_files ) + + +################################################# +##### ##### __tde_internal_process_sources macro( __tde_internal_process_sources _sources ) @@ -498,15 +635,15 @@ macro( __tde_internal_process_sources _sources ) # handle .skel files elseif( ${_ext} STREQUAL ".skel" ) - kde3_add_dcop_skels( ${_sources} ${_path}/${_name}.h ) + tde_add_dcop_skels( ${_sources} ${_path}/${_name}.h ) # handle .stub files elseif( ${_ext} STREQUAL ".stub" ) - kde3_add_dcop_stubs( ${_sources} ${_path}/${_name}.h ) + tde_add_dcop_stubs( ${_sources} ${_path}/${_name}.h ) # handle .kcfgc files elseif( ${_ext} STREQUAL ".kcfgc" ) - kde3_add_kcfg_files( ${_sources} ${_arg} ) + tde_add_kcfg_files( ${_sources} ${_arg} ) # handle any other files else( ${_ext} STREQUAL ".ui" ) |