mirror of
https://github.com/ModOrganizer2/modorganizer-script_extender_plugin_checker.git
synced 2026-07-27 14:05:49 -07:00
Make some updates to the PyQt5TranslationMacros.cmake to fix compile problems
This commit is contained in:
@@ -61,12 +61,12 @@ function(PYQT5_CREATE_TRANSLATION _qm_files)
|
||||
endif()
|
||||
endforeach()
|
||||
foreach(_ts_file ${_my_tsfiles})
|
||||
set(_lst_file_srcs)
|
||||
if(_my_sources)
|
||||
# Qt made a file listing all sources and used that as an argument, but pylupdate5 doesn't support that.
|
||||
# Qt allowed directories to be listed as sources, but pylupdate5 requires their contents to be listed.
|
||||
get_filename_component(_ts_name ${_ts_file} NAME_WE)
|
||||
set(_ts_lst_file "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lst_file")
|
||||
#set(_ts_lst_file "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lst_file")
|
||||
set(_lst_file_srcs)
|
||||
foreach(_lst_file_src ${_my_sources})
|
||||
if(IS_DIRECTORY ${_lst_file_src})
|
||||
file(GLOB _directory_contents ${_lst_file_src}/*.py ${_lst_file_src}/*.ui)
|
||||
@@ -79,10 +79,43 @@ function(PYQT5_CREATE_TRANSLATION _qm_files)
|
||||
add_custom_command(OUTPUT ${_ts_file}
|
||||
COMMAND ${PYTHON_ROOT}/pylupdate5.bat
|
||||
ARGS ${_lupdate_options} ${_lst_file_srcs} -ts ${_ts_file}
|
||||
DEPENDS ${_lst_file_srcs} ${_ts_lst_file}
|
||||
DEPENDS ${_my_sources}
|
||||
WORKING_DIRECTORY ${PYTHON_ROOT}
|
||||
VERBATIM)
|
||||
endforeach()
|
||||
qt5_add_translation(${_qm_files} ${_my_tsfiles})
|
||||
set(${_qm_files} ${${_qm_files}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(PYQT5_ADD_TRANSLATION _qm_files)
|
||||
set(options)
|
||||
set(oneValueArgs)
|
||||
set(multiValueArgs OPTIONS)
|
||||
|
||||
cmake_parse_arguments(_LRELEASE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
set(_lrelease_files ${_LRELEASE_UNPARSED_ARGUMENTS})
|
||||
|
||||
foreach(_current_FILE ${_lrelease_files})
|
||||
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
|
||||
get_filename_component(qm ${_abs_FILE} NAME_WE)
|
||||
# everything before the last dot has to be considered the file name (including other dots)
|
||||
string(REGEX REPLACE "\\.[^.]*$" "" FILE_NAME ${qm})
|
||||
get_source_file_property(output_location ${_abs_FILE} OUTPUT_LOCATION)
|
||||
if(output_location)
|
||||
file(MAKE_DIRECTORY "${output_location}")
|
||||
set(qm "${output_location}/${FILE_NAME}.qm")
|
||||
else()
|
||||
set(qm "${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.qm")
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${qm}
|
||||
COMMAND ${PYTHON_ROOT}/pylrelease5.bat
|
||||
ARGS ${_LRELEASE_OPTIONS} ${_abs_FILE} -qm ${qm}
|
||||
WORKING_DIRECTORY ${PYTHON_ROOT}
|
||||
DEPENDS ${_abs_FILE} VERBATIM
|
||||
)
|
||||
list(APPEND ${_qm_files} ${qm})
|
||||
endforeach()
|
||||
set(${_qm_files} ${${_qm_files}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user