[irrlicht] add feature to support unicode path on windows (#9902)

* [irrlicht] add feature to support unicode path on windows

* use vcpkg_check_features

* fix tools feature
This commit is contained in:
DailyShana 2020-02-14 15:00:31 +08:00 committed by GitHub
parent b9794a59a3
commit 1be75a28bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 26 deletions

View File

@ -8,9 +8,9 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Irrlicht directories # Irrlicht directories
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
set(IRR_ROOT_DIR "")
set(IRR_SRC_DIR "source/Irrlicht") set(IRR_SRC_DIR "source/Irrlicht")
set(IRR_INC_DIR "include") set(IRR_INC_DIR "include")
set(IRR_TOOL_DIR "tools")
# Options # Options
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
@ -19,6 +19,7 @@ if(DEFINED ENV{DXSDK_DIR})
set(DXSDK "ENV{DXSDK_DIR}") set(DXSDK "ENV{DXSDK_DIR}")
endif() endif()
set(IRR_UNICODE_PATH 0 CACHE BOOL "Whether to enable unicode path support on windows")
set(IRR_FAST_MATH 0 CACHE BOOL "Whether to enable fast maths (at the expense of precision)") set(IRR_FAST_MATH 0 CACHE BOOL "Whether to enable fast maths (at the expense of precision)")
set(IRR_SHARED_LIB 1 CACHE BOOL "Whether to generate shared libraries instead of static libraries") set(IRR_SHARED_LIB 1 CACHE BOOL "Whether to generate shared libraries instead of static libraries")
set(IRR_DIRECTX_SDK ${DXSDK} CACHE PATH "Path to the DirectX SDK (for DirectX 9, this folder should contain /Include, /Lib)") set(IRR_DIRECTX_SDK ${DXSDK} CACHE PATH "Path to the DirectX SDK (for DirectX 9, this folder should contain /Include, /Lib)")
@ -43,10 +44,10 @@ glob_c_cpp_sources(IRR_SRC_FILES_INTERFACE ${IRR_INC_DIR})
glob_c_cpp_sources(IRR_SRC_FILES_AESGLADMAN ${IRR_SRC_DIR}/aesGladman) glob_c_cpp_sources(IRR_SRC_FILES_AESGLADMAN ${IRR_SRC_DIR}/aesGladman)
glob_c_cpp_sources(IRR_SRC_FILES_LZMA ${IRR_SRC_DIR}/lzma) glob_c_cpp_sources(IRR_SRC_FILES_LZMA ${IRR_SRC_DIR}/lzma)
glob_c_cpp_sources(IRR_TOOL_FILES_FILE_TO_HEADER ${IRR_ROOT_DIR}/tools/FileToHeader/) glob_c_cpp_sources(IRR_TOOL_FILES_FILE_TO_HEADER ${IRR_TOOL_DIR}/FileToHeader/)
glob_c_cpp_sources(IRR_TOOL_FILES_GUI_EDITOR ${IRR_ROOT_DIR}/tools/GUIEditor/) glob_c_cpp_sources(IRR_TOOL_FILES_GUI_EDITOR ${IRR_TOOL_DIR}/GUIEditor/)
glob_c_cpp_sources(IRR_TOOL_FILES_FONT_TOOL ${IRR_ROOT_DIR}/tools/IrrFontTool/newFontTool/) glob_c_cpp_sources(IRR_TOOL_FILES_FONT_TOOL ${IRR_TOOL_DIR}/IrrFontTool/newFontTool/)
glob_c_cpp_sources(IRR_TOOL_FILES_MESH_CONVERTER ${IRR_ROOT_DIR}/tools/MeshConverter/) glob_c_cpp_sources(IRR_TOOL_FILES_MESH_CONVERTER ${IRR_TOOL_DIR}/MeshConverter/)
# Group files # Group files
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
@ -161,6 +162,12 @@ if(WIN32)
# Multi processor compilation # Multi processor compilation
target_compile_options(Irrlicht PRIVATE /MP) target_compile_options(Irrlicht PRIVATE /MP)
# Unicode
if(${IRR_UNICODE_PATH})
target_compile_definitions(Irrlicht PRIVATE UNICODE _UNICODE)
target_compile_definitions(Irrlicht PUBLIC _IRR_WCHAR_FILESYSTEM)
endif()
# Fast math options # Fast math options
if(${IRR_FAST_MATH}) if(${IRR_FAST_MATH})
target_compile_options(Irrlicht PRIVATE /fp:fast) target_compile_options(Irrlicht PRIVATE /fp:fast)

View File

@ -1,9 +1,12 @@
Source: irrlicht Source: irrlicht
Version: 1.8.4-4 Version: 1.8.4-5
Homepage: http://irrlicht.sourceforge.net Homepage: http://irrlicht.sourceforge.net
Description: Irrlicht lightning fast 3d engine Description: Irrlicht lightning fast 3d engine
Build-Depends: zlib, libpng, bzip2, libjpeg-turbo Build-Depends: zlib, libpng, bzip2, libjpeg-turbo
Feature: unicode
Description: Support unicode path on windows
Feature: fast-fpu Feature: fast-fpu
Description: Enable fast maths (at the expense of precision) Description: Enable fast maths (at the expense of precision)

View File

@ -0,0 +1,13 @@
diff --git a/include/Keycodes.h b/include/Keycodes.h
index e56eca1..57ab312 100644
--- a/include/Keycodes.h
+++ b/include/Keycodes.h
@@ -89,7 +89,7 @@ namespace irr
KEY_KEY_X = 0x58, // X key
KEY_KEY_Y = 0x59, // Y key
KEY_KEY_Z = 0x5A, // Z key
- KEY_LWIN = 0x5B, // Left Windows key (MicrosoftŽ NaturalŽ keyboard)
+ KEY_LWIN = 0x5B, // Left Windows key (MicrosoftÂŽ NaturalÂŽ keyboard)
KEY_RWIN = 0x5C, // Right Windows key (Natural keyboard)
KEY_APPS = 0x5D, // Applications key (Natural keyboard)
KEY_SLEEP = 0x5F, // Computer Sleep key

View File

@ -1,5 +1,3 @@
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE vcpkg_download_distfile(ARCHIVE
URLS "https://downloads.sourceforge.net/project/irrlicht/Irrlicht%20SDK/1.8/1.8.4/irrlicht-1.8.4.zip" URLS "https://downloads.sourceforge.net/project/irrlicht/Irrlicht%20SDK/1.8/1.8.4/irrlicht-1.8.4.zip"
FILENAME "irrlicht-1.8.4.zip" FILENAME "irrlicht-1.8.4.zip"
@ -10,24 +8,21 @@ vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE} ARCHIVE ${ARCHIVE}
REF "1.8.4" REF "1.8.4"
# [NO_REMOVE_ONE_LEVEL] PATCHES
# [WORKING_DIRECTORY <${CURRENT_BUILDTREES_DIR}/src>] "fix-encoding.patch"
# [PATCHES <a.patch>...]
) )
# Copy CMakeLists.txt to the source, because Irrlicht does not have one. # Copy CMakeLists.txt to the source, because Irrlicht does not have one.
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/LICENSE.txt DESTINATION ${SOURCE_PATH}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/LICENSE.txt DESTINATION ${SOURCE_PATH})
set(FAST_MATH FALSE) vcpkg_check_features(
if("fast-fpu" IN_LIST FEATURES) OUT_FEATURE_OPTIONS FEATURE_OPTIONS
set(FAST_MATH TRUE) FEATURES
endif() unicode IRR_UNICODE_PATH
fast-fpu IRR_FAST_MATH
set(BUILD_TOOLS FALSE) tools IRR_BUILD_TOOLS
if("tools" IN_LIST FEATURES) )
set(BUILD_TOOLS TRUE)
endif()
set(SHARED_LIB TRUE) set(SHARED_LIB TRUE)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
@ -39,17 +34,14 @@ vcpkg_configure_cmake(
PREFER_NINJA # Disable this option if project cannot be built with Ninja PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS OPTIONS
-DIRR_SHARED_LIB=${SHARED_LIB} -DIRR_SHARED_LIB=${SHARED_LIB}
-DIRR_FAST_MATH=${FAST_MATH} ${FEATURE_OPTIONS}
-DIRR_BUILD_TOOLS=${BUILD_TOOLS}
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
) )
vcpkg_install_cmake() vcpkg_install_cmake()
vcpkg_fixup_cmake_targets() vcpkg_fixup_cmake_targets()
if(BUILD_TOOLS) if("tools" IN_LIST FEATURES)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/irrlicht/) vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/irrlicht/)
endif() endif()