Skip to content

Commit

Permalink
build: install msgfmt by vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Serein207 committed Sep 26, 2024
1 parent f971ad1 commit 115a688
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ jobs:
Import-Module (Join-Path $vsPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments '-arch=${{ matrix.msvc_arch }} -host_arch=x64'
$additionalConfigureArgs += '-DPKG_CONFIG_EXECUTABLE:FILEPATH=./build/vcpkg_installed/x64-windows/tools/pkgconf/pkgconf.exe'
$additionalConfigureArgs += '-DMSGFMT_EXECUTABLE:FILEPATH=./build/vcpkg_installed/x64-windows/tools/gettext/bin/msgfmt.exe'
}
if ($vcpkgTargetTriplet) {
$additionalConfigureArgs += "-DVCPKG_TARGET_TRIPLET:STRING=$vcpkgTargetTriplet"
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/3rdpart/sast-link-cxx-sdk/CMakeLists
message(FATAL_ERROR "Git submodule not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.")
endif()

#i18n
# i18n
set(SOURCE_LOCALE_DIR "${CMAKE_SOURCE_DIR}/ui/locale")

# source code
Expand Down
6 changes: 4 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ if (WIN32)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${PROJECT_NAME}> $<TARGET_FILE_DIR:${PROJECT_NAME}> COMMAND_EXPAND_LISTS)
endif()

find_program(MSGFMT_EXECUTABLE msgfmt REQUIRED)

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${SOURCE_LOCALE_DIR}/en/LC_MESSAGES
COMMAND msgfmt ${SOURCE_LOCALE_DIR}/en.po -o ${SOURCE_LOCALE_DIR}/en/LC_MESSAGES/sast-evento.mo
COMMAND ${MSGFMT_EXECUTABLE} ${SOURCE_LOCALE_DIR}/en.po -o ${SOURCE_LOCALE_DIR}/en/LC_MESSAGES/sast-evento.mo
COMMAND ${CMAKE_COMMAND} -E make_directory ${SOURCE_LOCALE_DIR}/zh/LC_MESSAGES
COMMAND msgfmt ${SOURCE_LOCALE_DIR}/zh.po -o ${SOURCE_LOCALE_DIR}/zh/LC_MESSAGES/sast-evento.mo
COMMAND ${MSGFMT_EXECUTABLE} ${SOURCE_LOCALE_DIR}/zh.po -o ${SOURCE_LOCALE_DIR}/zh/LC_MESSAGES/sast-evento.mo
)

add_subdirectory(Tray)
2 changes: 1 addition & 1 deletion src/Infrastructure/Utils/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const std::filesystem::path localePath =
#ifdef EVENTO_DEBUG
LOCALE_DIR;
#else
boost::dll::program_location().parent_path() / "locale";
std::filesystem::path{(boost::dll::program_location().parent_path() / "locale").string()};
#endif // EVENTO_DEBUG

inline struct Settings {
Expand Down
7 changes: 7 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
"nlohmann-json",
"spdlog",
"tomlplusplus",
{
"name": "gettext",
"features": [
"tools"
],
"host": true
},
"gettext-libintl",
{
"name": "pkgconf",
Expand Down

0 comments on commit 115a688

Please sign in to comment.