mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-06-19 15:13:29 +00:00
Windows updates (better Blender version check, better static linking)
This commit is contained in:
parent
b16174edcd
commit
45fe93ee94
@ -107,8 +107,10 @@ if(WIN32)
|
|||||||
platforms/win/hecl-gui.manifest
|
platforms/win/hecl-gui.manifest
|
||||||
platforms/win/hecl-gui.rc
|
platforms/win/hecl-gui.rc
|
||||||
)
|
)
|
||||||
# FIXME hack to fix static link with outdated Qt cmake files
|
# Check for static linking
|
||||||
target_link_libraries(hecl-gui PRIVATE C:/vcpkg/installed/x64-windows-static/$<$<CONFIG:Debug>:debug/>lib/Qt5VulkanSupport$<$<CONFIG:Debug>:d>.lib)
|
if(NOT "$<TARGET_PROPERTY:hecl-gui,MSVC_RUNTIME_LIBRARY>" MATCHES "DLL$")
|
||||||
|
target_link_libraries(hecl-gui PRIVATE Qt5::QWindowsIntegrationPlugin)
|
||||||
|
endif()
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
target_sources(hecl-gui PRIVATE platforms/mac/mainicon.icns)
|
target_sources(hecl-gui PRIVATE platforms/mac/mainicon.icns)
|
||||||
set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES
|
set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES
|
||||||
|
@ -88,27 +88,40 @@ hecl::SystemString FindBlender(int& major, int& minor) {
|
|||||||
if (!blenderBin)
|
if (!blenderBin)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
hecl::SystemString command = hecl::SystemString(_SYS_STR("\"")) + blenderBin + _SYS_STR("\" --version");
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
FILE* fp = _wpopen(command.c_str(), _SYS_STR("r"));
|
DWORD handle = 0;
|
||||||
|
DWORD infoSize = GetFileVersionInfoSizeW(blenderBin, &handle);
|
||||||
|
|
||||||
|
if (infoSize != NULL) {
|
||||||
|
auto* infoData = new char[infoSize];
|
||||||
|
if (GetFileVersionInfoW(blenderBin, handle, infoSize, infoData)) {
|
||||||
|
UINT size = 0;
|
||||||
|
LPVOID lpBuffer = nullptr;
|
||||||
|
if (VerQueryValueW(infoData, L"\\", &lpBuffer, &size) && size != 0u) {
|
||||||
|
auto* verInfo = static_cast<VS_FIXEDFILEINFO*>(lpBuffer);
|
||||||
|
if (verInfo->dwSignature == 0xfeef04bd) {
|
||||||
|
major = static_cast<int>((verInfo->dwFileVersionMS >> 16) & 0xffff);
|
||||||
|
minor = static_cast<int>((verInfo->dwFileVersionMS >> 0 & 0xffff) * 10 +
|
||||||
|
(verInfo->dwFileVersionLS >> 16 & 0xffff));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete[] infoData;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
hecl::SystemString command = hecl::SystemString(_SYS_STR("\"")) + blenderBin + _SYS_STR("\" --version");
|
||||||
FILE* fp = popen(command.c_str(), "r");
|
FILE* fp = popen(command.c_str(), "r");
|
||||||
#endif
|
|
||||||
char versionBuf[256];
|
char versionBuf[256];
|
||||||
size_t rdSize = fread(versionBuf, 1, 255, fp);
|
size_t rdSize = fread(versionBuf, 1, 255, fp);
|
||||||
versionBuf[rdSize] = '\0';
|
versionBuf[rdSize] = '\0';
|
||||||
#if _WIN32
|
|
||||||
_pclose(fp);
|
|
||||||
#else
|
|
||||||
pclose(fp);
|
pclose(fp);
|
||||||
#endif
|
|
||||||
|
|
||||||
std::cmatch match;
|
std::cmatch match;
|
||||||
if (std::regex_search(versionBuf, match, regBlenderVersion)) {
|
if (std::regex_search(versionBuf, match, regBlenderVersion)) {
|
||||||
major = atoi(match[1].str().c_str());
|
major = atoi(match[1].str().c_str());
|
||||||
minor = atoi(match[2].str().c_str());
|
minor = atoi(match[2].str().c_str());
|
||||||
return blenderBin;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return blenderBin;
|
return blenderBin;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#if _WIN32
|
#if defined(_WIN32) && !defined(_DLL)
|
||||||
|
// Static linking on Windows
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
add_executable(mkqticon mkqticon.c)
|
add_executable(mkqticon mkqticon.c)
|
||||||
target_link_libraries(mkqticon ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
|
target_link_libraries(mkqticon ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||||
target_include_directories(mkqticon PRIVATE ${LIBPNG_INCLUDE_DIR})
|
target_include_directories(mkqticon PRIVATE ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
macro(declare_qticon_target)
|
macro(declare_qticon_target)
|
||||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/hecl-gui/platforms/freedesktop/mainicon_qt.bin
|
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/hecl-gui/platforms/freedesktop/mainicon_qt.bin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user