2021-12-05 03:42:48 -06:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/helpers/PyQt6TranslationMacros.cmake)
|
2020-04-24 21:39:29 -04:00
|
|
|
|
|
|
|
|
macro(do_python_project)
|
2021-12-09 19:03:29 -06:00
|
|
|
find_package(Qt6 COMPONENTS Core REQUIRED)
|
2021-12-05 03:42:48 -06:00
|
|
|
find_package(Qt6 COMPONENTS LinguistTools REQUIRED)
|
2021-12-10 13:47:18 -06:00
|
|
|
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
|
2020-04-24 21:39:29 -04:00
|
|
|
|
|
|
|
|
if(${create_translations})
|
2020-11-06 21:19:46 +01:00
|
|
|
|
|
|
|
|
if(EXISTS "${CMAKE_SOURCE_DIR}/__init__.py")
|
|
|
|
|
set(src_dir ${CMAKE_SOURCE_DIR})
|
|
|
|
|
else()
|
|
|
|
|
set(src_dir ${CMAKE_SOURCE_DIR}/src)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
file(GLOB_RECURSE objects LIST_DIRECTORIES true ${src_dir}/*)
|
2020-07-10 14:33:15 -04:00
|
|
|
|
|
|
|
|
set(dirs "")
|
|
|
|
|
foreach(o ${objects})
|
|
|
|
|
if(IS_DIRECTORY ${o})
|
|
|
|
|
list(APPEND dirs ${o})
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
2021-12-09 19:03:29 -06:00
|
|
|
|
|
|
|
|
add_custom_target(translations ALL DEPENDS ${qm_files})
|
2020-07-10 14:33:15 -04:00
|
|
|
|
2021-12-05 03:42:48 -06:00
|
|
|
pyqt6_create_translation(
|
2021-12-09 19:03:29 -06:00
|
|
|
qm_files
|
2021-12-06 23:42:20 -06:00
|
|
|
SRCFILES "${src_dir}" "${dirs}" "${additional_translations}"
|
|
|
|
|
TSFILES ${src_dir}/${PROJECT_NAME}_en.ts
|
|
|
|
|
# OPTIONS "--verbose"
|
2020-04-24 21:39:29 -04:00
|
|
|
)
|
|
|
|
|
|
2021-12-06 23:42:20 -06:00
|
|
|
endif()
|
2020-07-10 14:33:15 -04:00
|
|
|
|
2020-04-24 21:39:29 -04:00
|
|
|
file(GLOB_RECURSE source_files CONFIGURE_DEPENDS *.py)
|
|
|
|
|
|
|
|
|
|
set(input_files
|
|
|
|
|
${source_files}
|
|
|
|
|
${qm_files})
|
|
|
|
|
endmacro()
|