init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s

This commit is contained in:
allhaileris
2026-02-16 15:50:16 +03:00
commit afb81b8278
13816 changed files with 3689732 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
# This file is part of Desktop App Toolkit,
# a set of libraries for developing nice desktop applications.
#
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
function(validate_d3d_error text)
if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
message(FATAL_ERROR ${text})
else()
message(WARNING ${text})
endif()
endfunction()
function(validate_d3d_compiler target_name)
if (build_win64)
set(modules_subdir x64)
else()
set(modules_subdir x86)
endif()
set(modules_hash_loc ${CMAKE_BINARY_DIR}/modules/${modules_subdir})
set(modules_debug_loc ${CMAKE_BINARY_DIR}/Debug/modules/${modules_subdir})
set(modules_release_loc ${CMAKE_BINARY_DIR}/Release/modules/${modules_subdir})
set(key_path ${modules_hash_loc}/d3d/d3dcompiler_47)
set(module_debug_path ${modules_debug_loc}/d3d)
set(module_release_path ${modules_release_loc}/d3d)
set(key "")
if (EXISTS ${key_path})
file(READ ${key_path} key)
endif()
string(LENGTH "${key}" key_length)
if (NOT "${key_length}" STREQUAL "32"
OR NOT EXISTS ${module_debug_path}/d3dcompiler_47.dll
OR NOT EXISTS ${module_release_path}/d3dcompiler_47.dll)
set(compiler_path ${cmake_helpers_loc}/win_directx_helper/modules/${modules_subdir}/d3d/d3dcompiler_47.dll)
find_package(Python3 REQUIRED)
execute_process(
COMMAND
${Python3_EXECUTABLE}
${cmake_helpers_loc}/validate_d3d_compiler.py
${compiler_path}
OUTPUT_VARIABLE key
ERROR_VARIABLE error
)
if (NOT "${error}" STREQUAL "")
validate_d3d_error(${error})
return()
endif()
file(MAKE_DIRECTORY ${modules_debug_loc}/d3d)
file(COPY ${compiler_path} DESTINATION ${module_debug_path})
file(MAKE_DIRECTORY ${modules_release_loc}/d3d)
file(COPY ${compiler_path} DESTINATION ${module_release_path})
file(MAKE_DIRECTORY ${modules_hash_loc}/d3d)
file(WRITE ${key_path} ${key})
endif()
target_compile_definitions(${target_name}
PRIVATE
DESKTOP_APP_D3DCOMPILER_HASH=${key}
)
target_link_libraries(${target_name}
PRIVATE
desktop-app::external_openssl
)
endfunction()