chore: baseline usable version
This commit is contained in:
102
libs/qwindowkit/qmsetup/cmake/find-modules/VC-LTL.cmake
Normal file
102
libs/qwindowkit/qmsetup/cmake/find-modules/VC-LTL.cmake
Normal file
@@ -0,0 +1,102 @@
|
||||
# https://github.com/Chuyu-Team/VC-LTL5
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
if(NOT MSVC OR DEFINED __VC_LTL_CMAKE_INCLUDE_GUARD)
|
||||
return()
|
||||
endif()
|
||||
set(__VC_LTL_CMAKE_INCLUDE_GUARD 1)
|
||||
|
||||
#
|
||||
# VC-LTL自动化加载配置,建议你将此文件单独复制到你的工程再使用,该文件能自动识别当前环境是否存在VC-LTL,并且自动应用。
|
||||
#
|
||||
# 使用方法:
|
||||
# 1. 在“CMakeLists.txt” 添加 “include("VC-LTL helper for cmake.cmake")”。
|
||||
#
|
||||
# VC-LTL默认搜索顺序
|
||||
# 1. “VC-LTL helper for cmake.cmake”所在根目录,即 ${CMAKE_CURRENT_LIST_DIR}
|
||||
# 2. 当前CMake根目录,即 ${CMAKE_CURRENT_SOURCE_DIR}/VC-LTL
|
||||
# 3. 当前项目根目录,即 ${PROJECT_SOURCE_DIR}/VC-LTL
|
||||
# 4. 当前CMake父目录,即 ${CMAKE_CURRENT_SOURCE_DIR}/../VC-LTL
|
||||
# 5. 当前项目根目录,即 ${PROJECT_SOURCE_DIR}/../VC-LTL
|
||||
# 6. 注册表HKEY_CURRENT_USER\Code\VC-LTL@Root
|
||||
#
|
||||
# 把VC-LTL放在其中一个位置即可,VC-LTL就能被自动引用。
|
||||
#
|
||||
# 如果你对默认搜索顺序不满,你可以修改此文件。你也可以直接指定${VC_LTL_Root}宏更加任性的去加载VC-LTL。
|
||||
#
|
||||
|
||||
#####################################################################VC-LTL设置#####################################################################
|
||||
|
||||
#控制最小兼容系统版本,目前可用版本为5.1.2600.0 6.0.6000.0(默认) 6.2.9200.0 10.0.10240.0 10.0.19041.0
|
||||
#注意:VC-LTL依赖YY-Thunks,否则可能无法兼容早期系统。如果需要支持Windows XP,该值必须为5.1.2600.0。
|
||||
if(NOT DEFINED WindowsTargetPlatformMinVersion)
|
||||
set(WindowsTargetPlatformMinVersion "10.0.19041.0" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
#VC-LTL使用的CRT模式,SupportLTL可能值为:
|
||||
# * false:禁用VC_LTL
|
||||
# * true:默认值,让VC-LTL自动适应。当最小兼容版本>=10.0时使用ucrt模式,其他系统使用msvcrt模式。
|
||||
# * msvcrt:使用msvcrt.dll作为CRT。注意:msvcrt模式可能不完全支持所有ucrt的新功能。比如setloacl不支持UTF8。
|
||||
# * ucrt:使用ucrtbase.dll作为CRT。注意:早期系统可能需要下载VC-LTL.Redist.Dlls.zip,感谢msvcr14x项目提供兼容XP系统的ucrtbase.dll。
|
||||
#如果需要兼容XP时也使用ucrt,请指定SupportLTL=ucrt。
|
||||
#set(SupportLTL "ucrt")
|
||||
|
||||
#(PR#70 引入),默认关,开启后将使用cmake `INTERFACE`能力,然后单独`target_link_directories(工程名称 VC_LTL)` 即可引用
|
||||
#option(VC_LTL_EnableCMakeInterface "VC_LTL_EnableCMakeInterface" on)
|
||||
####################################################################################################################################################
|
||||
|
||||
if(NOT VC_LTL_Root)
|
||||
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/_msvcrt.h)
|
||||
set(VC_LTL_Root ${CMAKE_CURRENT_LIST_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT VC_LTL_Root)
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/VC-LTL/_msvcrt.h)
|
||||
set(VC_LTL_Root ${CMAKE_CURRENT_SOURCE_DIR}/VC-LTL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT VC_LTL_Root)
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/VC-LTL/_msvcrt.h)
|
||||
set(VC_LTL_Root ${PROJECT_SOURCE_DIR}/VC-LTL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT VC_LTL_Root)
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../VC-LTL/_msvcrt.h)
|
||||
set(VC_LTL_Root ${CMAKE_CURRENT_SOURCE_DIR}/../VC-LTL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT VC_LTL_Root)
|
||||
if(EXISTS ${PROJECT_SOURCE_DIR}/../VC-LTL/_msvcrt.h)
|
||||
set(VC_LTL_Root ${PROJECT_SOURCE_DIR}/../VC-LTL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT VC_LTL_Root)
|
||||
EXECUTE_PROCESS(COMMAND reg query "HKEY_CURRENT_USER\\Code\\VC-LTL" -v "Root"
|
||||
OUTPUT_VARIABLE FOUND_FILE
|
||||
ERROR_VARIABLE ERROR_INFO
|
||||
)
|
||||
|
||||
string(REGEX MATCH "[a-zA-Z]:\\\\.+\\\\"
|
||||
FOUND_LTL
|
||||
${FOUND_FILE})
|
||||
if (NOT ${FOUND_LTL} STREQUAL "")
|
||||
set(VC_LTL_Root ${FOUND_LTL})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VC_LTL_Root)
|
||||
string(REGEX MATCH "\\\\\\\\.+\\\\" FOUND_LTL ${FOUND_FILE})
|
||||
if (NOT ${FOUND_LTL} STREQUAL "")
|
||||
set(VC_LTL_Root ${FOUND_LTL})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(VC_LTL_Root)
|
||||
include("${VC_LTL_Root}\\config\\config.cmake")
|
||||
endif()
|
||||
102
libs/qwindowkit/qmsetup/cmake/find-modules/YY-Thunks.cmake
Normal file
102
libs/qwindowkit/qmsetup/cmake/find-modules/YY-Thunks.cmake
Normal file
@@ -0,0 +1,102 @@
|
||||
#[[
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2023 by wangwenx190 (Yuhang Zhao)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
]]
|
||||
|
||||
# https://github.com/Chuyu-Team/YY-Thunks
|
||||
|
||||
if(NOT MSVC OR DEFINED __YY_THUNKS_CMAKE_INCLUDE_GUARD)
|
||||
return()
|
||||
endif()
|
||||
set(__YY_THUNKS_CMAKE_INCLUDE_GUARD 1)
|
||||
|
||||
if(NOT DEFINED YYTHUNKS_TARGET_OS)
|
||||
set(YYTHUNKS_TARGET_OS "Vista" CACHE STRING "Supported values: Vista, WinXP" FORCE)
|
||||
endif()
|
||||
|
||||
set(__yy_thunks_dir "")
|
||||
if(DEFINED ENV{YYTHUNKS_INSTALL_DIR})
|
||||
set(__env "$ENV{YYTHUNKS_INSTALL_DIR}")
|
||||
if(NOT "x${__env}" STREQUAL "x" AND EXISTS "${__env}")
|
||||
set(__yy_thunks_dir "${__env}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if("x${__yy_thunks_dir}" STREQUAL "x")
|
||||
set(__yy_thunks_reg "")
|
||||
cmake_host_system_information(RESULT __yy_thunks_reg
|
||||
QUERY WINDOWS_REGISTRY "HKCU/Code/YY-Thunks"
|
||||
VALUE "Root")
|
||||
if(NOT "x${__yy_thunks_reg}" STREQUAL "x" AND EXISTS "${__yy_thunks_reg}")
|
||||
set(__yy_thunks_dir "${__yy_thunks_reg}")
|
||||
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/YY-Thunks")
|
||||
set(__yy_thunks_dir "${CMAKE_CURRENT_LIST_DIR}/YY-Thunks")
|
||||
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/YY-Thunks")
|
||||
set(__yy_thunks_dir "${CMAKE_CURRENT_SOURCE_DIR}/YY-Thunks")
|
||||
elseif(EXISTS "${PROJECT_SOURCE_DIR}/YY-Thunks")
|
||||
set(__yy_thunks_dir "${PROJECT_SOURCE_DIR}/YY-Thunks")
|
||||
elseif(EXISTS "${CMAKE_SOURCE_DIR}/YY-Thunks")
|
||||
set(__yy_thunks_dir "${CMAKE_SOURCE_DIR}/YY-Thunks")
|
||||
elseif(EXISTS "${CMAKE_SOURCE_DIR}/../YY-Thunks")
|
||||
set(__yy_thunks_dir "${CMAKE_SOURCE_DIR}/../YY-Thunks")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT "x${__yy_thunks_dir}" STREQUAL "x")
|
||||
cmake_path(NORMAL_PATH __yy_thunks_dir OUTPUT_VARIABLE __yy_thunks_dir)
|
||||
endif()
|
||||
|
||||
if(NOT "x${__yy_thunks_dir}" STREQUAL "x" AND EXISTS "${__yy_thunks_dir}")
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(__yy_thunks_arch x64)
|
||||
else()
|
||||
set(__yy_thunks_arch x86)
|
||||
endif()
|
||||
set(__yy_thunks_obj "${__yy_thunks_dir}/objs/${__yy_thunks_arch}/YY_Thunks_for_${YYTHUNKS_TARGET_OS}.obj")
|
||||
cmake_path(NORMAL_PATH __yy_thunks_obj OUTPUT_VARIABLE __yy_thunks_obj)
|
||||
if(EXISTS "${__yy_thunks_obj}")
|
||||
set(YYTHUNKS_FOUND TRUE CACHE BOOL "" FORCE)
|
||||
set(YYTHUNKS_INSTALL_DIR "${__yy_thunks_dir}" CACHE STRING "" FORCE)
|
||||
set(YYTHUNKS_ARCH "${__yy_thunks_arch}" CACHE STRING "" FORCE)
|
||||
set(YYTHUNKS_OBJ_FILE "YY_Thunks_for_${YYTHUNKS_TARGET_OS}.obj" CACHE STRING "" FORCE)
|
||||
set(YYTHUNKS_OBJ_PATH "${__yy_thunks_obj}" CACHE STRING "" FORCE)
|
||||
add_link_options("${__yy_thunks_obj}")
|
||||
message("###################################################################################################")
|
||||
message("# #")
|
||||
message("# ██ ██ ██ ██ ████████ ██ ██ ██ ██ ███ ██ ██ ██ ███████ #")
|
||||
message("# ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ #")
|
||||
message("# ████ ████ █████ ██ ███████ ██ ██ ██ ██ ██ █████ ███████ #")
|
||||
message("# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ #")
|
||||
message("# ██ ██ ██ ██ ██ ██████ ██ ████ ██ ██ ███████ #")
|
||||
message("# #")
|
||||
message("###################################################################################################")
|
||||
message("")
|
||||
message(" YY-Thunks install dir :" ${__yy_thunks_dir})
|
||||
message(" YY-Thunks target platform :" ${YYTHUNKS_TARGET_OS})
|
||||
message(" YY-Thunks obj file path :" ${__yy_thunks_obj})
|
||||
message("")
|
||||
else()
|
||||
message(WARNING "YY-Thunks's obj file is missing!")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Can't locate the YY-Thunks installation directory!")
|
||||
endif()
|
||||
Reference in New Issue
Block a user