Skip to content

Commit

Permalink
Merge pull request #486 from Ghabry/icu-windows
Browse files Browse the repository at this point in the history
Support ICU library provided by Windows 10 + Preset updates
  • Loading branch information
carstene1ns authored Oct 14, 2024
2 parents 268873b + c883b80 commit 4d15bee
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 108 deletions.
24 changes: 20 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ option(LIBLCF_ENABLE_BENCHMARKS "Whether to build the benchmarks (default: OFF)"
option(LIBLCF_ENABLE_INSTALL "Whether to add an install target (default: ON)" ${LIBLCF_MAIN_PROJECT})
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Override CMAKE_DEBUG_POSTFIX.")

# Dependencies provided by CMake Presets
list(APPEND CMAKE_PREFIX_PATH "${LIBLCF_PREFIX_PATH_APPEND}")

# C++17 is required
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -348,10 +351,23 @@ target_link_libraries(lcf inih::inih)
# icu
set(LCF_SUPPORT_ICU 0)
if(LIBLCF_WITH_ICU)
find_package(ICU COMPONENTS i18n uc data REQUIRED)
target_link_libraries(lcf ICU::i18n ICU::uc ICU::data)
list(APPEND LIBLCF_DEPS "icu-i18n")
set(LCF_SUPPORT_ICU 1)
find_package(ICU COMPONENTS i18n uc data)
if(ICU_FOUND)
target_link_libraries(lcf ICU::i18n ICU::uc ICU::data)
list(APPEND LIBLCF_DEPS "icu-i18n")
set(LCF_SUPPORT_ICU 1)
else()
if(NOT WIN32)
message(FATAL_ERROR "ICU not found. Use LCF_SUPPORT_ICU=0 to disable ICU support (not recommended).")
endif()

message(STATUS "ICU not found. Using the system library.")
message(STATUS "This build will only work on Windows 10 Version 1903 (May 2019) and newer!")

target_link_libraries(lcf icu)
set(LCF_SUPPORT_ICU 2)
list(APPEND LIBLCF_DEPS "icu")
endif()
endif()

# expat
Expand Down
140 changes: 72 additions & 68 deletions CMakePresets.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 22 additions & 18 deletions builds/cmake/CMakePresets.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"displayName": "Linux",
"toolchainFile": "${sourceDir}/builds/cmake/LinuxToolchain.cmake",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "$env{EASYRPG_BUILDSCRIPTS}/linux-static"
"LIBLCF_PREFIX_PATH_APPEND": "$env{EASYRPG_BUILDSCRIPTS}/linux-static"
}
},
{
"name": "windows-x86",
"displayName": "Windows (x86)",
"name": "windows",
"displayName": "Windows",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x86-windows-static"
"VCPKG_TARGET_TRIPLET": "$env{VSCMD_ARG_TGT_ARCH}-windows-static"
},
"inherits": "win-user"
},
Expand All @@ -39,15 +39,6 @@
},
"inherits": "win-user"
},
{
"name": "windows-x64",
"displayName": "Windows (x64)",
"architecture": "x64",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static"
},
"inherits": "win-user"
},
{
"name": "windows-x64-vs2022",
"displayName": "Windows (x64) using Visual Studio 2022",
Expand All @@ -62,7 +53,7 @@
"name": "macos",
"displayName": "macOS",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "$env{EASYRPG_BUILDSCRIPTS}/osx",
"LIBLCF_PREFIX_PATH_APPEND": "$env{EASYRPG_BUILDSCRIPTS}/osx",
"CMAKE_OSX_DEPLOYMENT_TARGET": "10.9"
},
"condition": {
Expand All @@ -77,7 +68,7 @@
"toolchainFile": "$env{EASYRPG_BUILDSCRIPTS}/emscripten/emsdk-portable/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake",
"cacheVariables": {
"LIBLCF_ENABLE_TOOLS": "OFF",
"CMAKE_PREFIX_PATH": "$env{EASYRPG_BUILDSCRIPTS}/emscripten",
"LIBLCF_PREFIX_PATH_APPEND": "$env{EASYRPG_BUILDSCRIPTS}/emscripten",
"CMAKE_FIND_ROOT_PATH": "$env{EASYRPG_BUILDSCRIPTS}/emscripten"
}
},
Expand All @@ -86,7 +77,8 @@
"displayName": "Nintendo 3DS",
"toolchainFile": "$env{DEVKITPRO}/cmake/3DS.cmake",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "$env{EASYRPG_BUILDSCRIPTS}/3ds"
"LIBLCF_PREFIX_PATH_APPEND": "$env{EASYRPG_BUILDSCRIPTS}/3ds",
"LIBLCF_ENABLE_TOOLS": "OFF"
},
"inherits": "dkp-user"
},
Expand All @@ -95,7 +87,8 @@
"displayName": "Nintendo Switch",
"toolchainFile": "$env{DEVKITPRO}/cmake/Switch.cmake",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "$env{EASYRPG_BUILDSCRIPTS}/switch"
"LIBLCF_PREFIX_PATH_APPEND": "$env{EASYRPG_BUILDSCRIPTS}/switch",
"LIBLCF_ENABLE_TOOLS": "OFF"
},
"inherits": "dkp-user"
},
Expand All @@ -104,7 +97,18 @@
"displayName": "Nintendo Wii",
"toolchainFile": "$env{DEVKITPRO}/cmake/Wii.cmake",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "$env{EASYRPG_BUILDSCRIPTS}/wii"
"LIBLCF_PREFIX_PATH_APPEND": "$env{EASYRPG_BUILDSCRIPTS}/wii",
"LIBLCF_ENABLE_TOOLS": "OFF"
},
"inherits": "dkp-user"
},
{
"name": "wiiu",
"displayName": "Nintendo WiiU",
"toolchainFile": "$env{DEVKITPRO}/cmake/WiiU.cmake",
"cacheVariables": {
"LIBLCF_PREFIX_PATH_APPEND": "$env{EASYRPG_BUILDSCRIPTS}/wiiu",
"LIBLCF_ENABLE_TOOLS": "OFF"
},
"inherits": "dkp-user"
},
Expand Down
Loading

0 comments on commit 4d15bee

Please sign in to comment.