diff --git a/.gitattributes b/.gitattributes index e0a769395..625ecce2c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,5 @@ *.crt text eol=lf *.sh text eol=lf *.patch text eol=lf +*.ts text eol=lf +*.qm binary diff --git a/CMakeLists.txt b/CMakeLists.txt index 830119534..96eac0b04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2128,7 +2128,7 @@ elseif (GUI) message(WARNING "pkg-config (required to search gtk+ path) not found, disabling GUI build") set(GUI off) elseif(USE_QT6) - find_package(Qt6 REQUIRED Widgets Gui LinguistTools) + find_package(Qt6 REQUIRED Widgets Gui OPTIONAL_COMPONENTS LinguistTools) set(GUI_USE_FILE "") set(GUI_INCLUDE_DIRS "") set(GUI_DEFINITIONS "") @@ -4600,24 +4600,28 @@ if (GUI) ${SRC_FILES} ${GUI_USE_FILE} ) - file(GLOB TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/qt6/lang/yass_*.ts") - # Custom target to update .ts files and include new strings from source files - # Depends on Qt's LinguistTools - get_target_property(QT_LUPDATE_EXECUTABLE Qt::lupdate IMPORTED_LOCATION) - add_custom_target(update-ts - COMMAND ${QT_LUPDATE_EXECUTABLE} -extensions cc,cpp,hpp - -locations none - -I "${CMAKE_CURRENT_SOURCE_DIR}/src" - "${CMAKE_CURRENT_SOURCE_DIR}/src/qt6" - -ts ${TS_FILES} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/qt6" - VERBATIM - COMMAND_EXPAND_LISTS) - # Based on https://gist.github.com/giraldeau/546ba5512a74dfe9d8ea0862d66db412 - set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/src/qt6/lang") - qt_add_translation(QM_FILES ${TS_FILES} OPTIONS -removeidentical -silent) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/qt6/lang/lang.qrc" "${CMAKE_CURRENT_BINARY_DIR}/src/qt6/lang/lang.qrc" COPYONLY) - target_sources(${APP_NAME} PRIVATE ${QM_FILES} "${CMAKE_CURRENT_BINARY_DIR}/src/qt6/lang/lang.qrc") + if (NOT CMAKE_CROSSCOMPILING AND TARGET Qt::lupdate) + file(GLOB TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/qt6/lang/yass_*.ts") + # Custom target to update .ts files and include new strings from source files + # Depends on Qt's LinguistTools + get_target_property(QT_LUPDATE_EXECUTABLE Qt::lupdate IMPORTED_LOCATION) + add_custom_target(update-ts + COMMAND ${QT_LUPDATE_EXECUTABLE} -extensions cc,cpp,hpp + -locations none + -I "${CMAKE_CURRENT_SOURCE_DIR}/src" + "${CMAKE_CURRENT_SOURCE_DIR}/src/qt6" + -ts ${TS_FILES} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/qt6" + VERBATIM + COMMAND_EXPAND_LISTS) + # Based on https://gist.github.com/giraldeau/546ba5512a74dfe9d8ea0862d66db412 + set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/src/qt6/lang") + qt_add_translation(QM_FILES ${TS_FILES} OPTIONS -removeidentical -silent) + target_sources(${APP_NAME} PRIVATE ${QM_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/src/qt6/lang/lang.qrc") + else() + file(GLOB QM_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/qt6/lang/yass_*.qm") + target_sources(${APP_NAME} PRIVATE ${QM_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/src/qt6/lang/lang.qrc") + endif() else() add_executable(${APP_NAME} WIN32 ${GUI_OPTIONS} ${SRC_FILES} diff --git a/cmake/platforms/Android.cmake b/cmake/platforms/Android.cmake index e90f4c510..3babd0e5a 100644 --- a/cmake/platforms/Android.cmake +++ b/cmake/platforms/Android.cmake @@ -22,3 +22,12 @@ set(CMAKE_SYSROOT "${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${ANDROID_CURREN set(CMAKE_CXX_COMPILE_OBJECT " -o -c -nostdinc++") string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " -nostdlib++") + +# target environment on the build host system +set(CMAKE_FIND_ROOT_PATH "${CMAKE_SYSROOT}") + +# modify default behavior of FIND_XXX() commands +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/cmake/platforms/FreeBSD.cmake b/cmake/platforms/FreeBSD.cmake index fa48b700d..5cf3f4bcf 100644 --- a/cmake/platforms/FreeBSD.cmake +++ b/cmake/platforms/FreeBSD.cmake @@ -12,3 +12,12 @@ set(CMAKE_RANLIB "${LLVM_SYSROOT}/bin/llvm-ranlib" CACHE FILEPATH "") set(CMAKE_CXX_COMPILER_RANLIB "${LLVM_SYSROOT}/bin/llvm-ranlib" CACHE FILEPATH "") set(CMAKE_SYSROOT "${GCC_SYSROOT}" CACHE STRING "") + +# target environment on the build host system +set(CMAKE_FIND_ROOT_PATH "${GCC_SYSROOT}") + +# modify default behavior of FIND_XXX() commands +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/cmake/platforms/Linux.cmake b/cmake/platforms/Linux.cmake index c71144eaf..17d5c147f 100644 --- a/cmake/platforms/Linux.cmake +++ b/cmake/platforms/Linux.cmake @@ -29,3 +29,12 @@ set(CMAKE_C_FLAGS "${_CMAKE_C_FLAGS_INITIAL} ${COMPILE_FLAGS}" CACHE STRING "" F set(_CMAKE_CXX_FLAGS_INITIAL "${CMAKE_CXX_FLAGS}" CACHE STRING "") set(CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS_INITIAL} ${COMPILE_FLAGS}" CACHE STRING "" FORCE) + +# target environment on the build host system +set(CMAKE_FIND_ROOT_PATH ${GCC_SYSROOT}) + +# modify default behavior of FIND_XXX() commands +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/cmake/platforms/MinGW.cmake b/cmake/platforms/MinGW.cmake index 72eb9535c..11bdbca79 100644 --- a/cmake/platforms/MinGW.cmake +++ b/cmake/platforms/MinGW.cmake @@ -38,7 +38,6 @@ else() set(CMAKE_SYSROOT "${MINGW_SYSROOT}/${GCC_TARGET}" CACHE STRING "") endif() - # target environment on the build host system set(CMAKE_FIND_ROOT_PATH ${LLVM_SYSROOT}/${GCC_TARGET}) @@ -46,3 +45,4 @@ set(CMAKE_FIND_ROOT_PATH ${LLVM_SYSROOT}/${GCC_TARGET}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/cmake/platforms/WinMsvc.cmake b/cmake/platforms/WinMsvc.cmake index 039151cc9..a6a86307e 100644 --- a/cmake/platforms/WinMsvc.cmake +++ b/cmake/platforms/WinMsvc.cmake @@ -341,6 +341,11 @@ set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE) # where is the target environment set (CMAKE_FIND_ROOT_PATH "${WINSDK_BASE}") +# modify default behavior of FIND_XXX() commands +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set (CMAKE_SYSTEM_INCLUDE_PATH "${ATLMFC_INCLUDE}" "${MSVC_INCLUDE}" diff --git a/src/qt6/lang/yass_en.qm b/src/qt6/lang/yass_en.qm new file mode 100644 index 000000000..be651eede --- /dev/null +++ b/src/qt6/lang/yass_en.qm @@ -0,0 +1 @@ +<¸dÊÍ!¿`¡½Ý \ No newline at end of file diff --git a/src/qt6/lang/yass_zh_CN.qm b/src/qt6/lang/yass_zh_CN.qm new file mode 100644 index 000000000..51d68087e Binary files /dev/null and b/src/qt6/lang/yass_zh_CN.qm differ