Skip to content

Commit

Permalink
Remove issue with windows manifests and scaling
Browse files Browse the repository at this point in the history
Old manifest was dragging in a 32bit version of comctl
which obviously couldn't load in a 64bit process...

Also fixed the issue with display scaling!
  • Loading branch information
peterix committed Jun 6, 2023
1 parent 4b3d4ea commit 0b7bac9
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 103 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -38,3 +38,6 @@ tags
branding/
secrets/
run/

notsecrets/windows_metafile.rc
notsecrets/windows.manifest
7 changes: 0 additions & 7 deletions CMakeLists.txt
Expand Up @@ -117,19 +117,12 @@ SET(CMAKE_POSITION_INDEPENDENT_CODE ON)

if(Launcher_EMBED_SECRETS)
add_subdirectory(secrets)
set(RESOURCE_FOLDER "secrets")
else()
add_subdirectory(notsecrets)
set(RESOURCE_FOLDER "notsecrets")
endif()

####################################### Install layout #######################################

set(COMPANY "${Launcher_Copyright}")
set(COPYRIGHT "Copyright 2015-2023 ${Launcher_Copyright}")
set(IDENTIFIER "org.multimc.${Launcher_Name}")
set(DESCRIPTION "${Launcher_Name}: Minecraft launcher and management utility.")

# How to install the build results
if(UNIX AND APPLE)
set(BINARY_DEST_DIR "${Launcher_Name}.app/Contents/MacOS")
Expand Down
22 changes: 9 additions & 13 deletions cmake/QtCommon.cmake
Expand Up @@ -9,27 +9,23 @@ macro(fix_project_version)
endmacro()

macro(add_project_meta FILES_TO_INCLUDE)
if (NOT RESOURCE_FOLDER)
set(RESOURCE_FOLDER branding)
endif()

if (NOT ICON_NAME)
set(ICON_NAME ${PROJECT_NAME})
set(ICON_NAME ${Launcher_Name})
endif()

if (APPLE)
set(ICON_FILE branding/${ICON_NAME}.icns)
set(ICON_FILE ${ICON_NAME}.icns)
elseif (WIN32)
set(ICON_FILE branding/${ICON_NAME}.ico)
set(ICON_FILE ${ICON_NAME}.ico)
endif()

if (WIN32)
set(WIN_MANIFEST_IDENTIFIER ${IDENTIFIER})
set(WIN_MANIFEST_IDENTIFIER ${Launcher_Identifier})
configure_file("${PROJECT_SOURCE_DIR}/cmake/windows_metafile.rc.in"
"windows_metafile.rc"
"${CMAKE_CURRENT_SOURCE_DIR}/windows_metafile.rc"
)
configure_file("${PROJECT_SOURCE_DIR}/cmake/windows.manifest.in"
"windows.manifest"
"${CMAKE_CURRENT_SOURCE_DIR}/windows.manifest"
)
set(RES_FILES "windows_metafile.rc")
set(CMAKE_RC_COMPILER_INIT windres)
Expand All @@ -41,12 +37,12 @@ macro(add_project_meta FILES_TO_INCLUDE)
set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

# Identify MacOS bundle
set(MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME})
set(MACOSX_BUNDLE_BUNDLE_NAME ${Launcher_Name})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
set(MACOSX_BUNDLE_COPYRIGHT ${COPYRIGHT})
set(MACOSX_BUNDLE_GUI_IDENTIFIER ${IDENTIFIER})
set(MACOSX_BUNDLE_COPYRIGHT ${Launcher_Copyright})
set(MACOSX_BUNDLE_GUI_IDENTIFIER ${Launcher_Identifier})
set(MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
endif()

Expand Down
6 changes: 6 additions & 0 deletions cmake/windows.manifest.in
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity name="@WIN_MANIFEST_IDENTIFIER@" type="amd64" version="@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@" />
<asmv3:application>
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
</asmv3:windowsSettings>
</asmv3:application>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
Expand Down
14 changes: 7 additions & 7 deletions cmake/windows_metafile.rc.in
Expand Up @@ -3,7 +3,7 @@
#endif
#include <windows.h>

IDI_ICON1 ICON DISCARDABLE "@ICON_FILE@"
IDI_ICON1 ICON DISCARDABLE "@Launcher_Branding_ICO@"
1 RT_MANIFEST "windows.manifest"

VS_VERSION_INFO VERSIONINFO
Expand All @@ -19,13 +19,13 @@ BEGIN
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "CompanyName", "@COMPANY@"
VALUE "FileDescription", "@DESCRIPTION@"
VALUE "CompanyName", "@Launcher_Copyright@"
VALUE "FileDescription", "@Launcher_Description@"
VALUE "FileVersion", "@PROJECT_VERSION@"
VALUE "LegalCopyright", "@COPYRIGHT@"
VALUE "InternalName", "@PROJECT_NAME@"
VALUE "OriginalFilename", "@PROJECT_NAME@.exe"
VALUE "ProductName", "@PROJECT_NAME@"
VALUE "LegalCopyright", "@Launcher_Copyright_Full@"
VALUE "InternalName", "@Launcher_Name@"
VALUE "OriginalFilename", "@Launcher_Name@.exe"
VALUE "ProductName", "@Launcher_Name@"
VALUE "ProductVersion", "@PROJECT_VERSION@"
END
END
Expand Down
5 changes: 0 additions & 5 deletions launcher/CMakeLists.txt
Expand Up @@ -959,11 +959,6 @@ elseif(UNIX)
)
endif()

if(DEFINED Launcher_APP_BINARY_DEFS)
target_compile_definitions(${Launcher_Name} PRIVATE ${Launcher_APP_BINARY_DEFS})
target_compile_definitions(Launcher_logic PRIVATE ${Launcher_APP_BINARY_DEFS})
endif()

install(TARGETS ${Launcher_Name}
BUNDLE DESTINATION ${BUNDLE_DEST_DIR} COMPONENT Runtime
LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime
Expand Down
28 changes: 17 additions & 11 deletions notsecrets/CMakeLists.txt
Expand Up @@ -5,15 +5,21 @@ target_include_directories(secrets PUBLIC .)

set(Launcher_CommonName "DevLauncher")

set(Launcher_Copyright "MultiMC Contributors" PARENT_SCOPE)
set(Launcher_Domain "multimc.org" PARENT_SCOPE)
set(Launcher_Name "${Launcher_CommonName}" PARENT_SCOPE)
set(Launcher_FSName "devlauncher" PARENT_SCOPE)
set(Launcher_DisplayName "${Launcher_CommonName} 5" PARENT_SCOPE)
set(Launcher_UserAgent "${Launcher_CommonName}/5.0" PARENT_SCOPE)
set(Launcher_ConfigFile "${Launcher_FSName}.cfg" PARENT_SCOPE)
set(Launcher_Git "https://github.com/MultiMC/Launcher" PARENT_SCOPE)
set(Launcher_Copyright "MultiMC Contributors" CACHE INTERNAL "")
set(Launcher_Copyright_Full "Copyright 2015-2023 ${Launcher_Copyright}" CACHE INTERNAL "")
set(Launcher_Domain "multimc.org" CACHE INTERNAL "")
set(Launcher_Name "${Launcher_CommonName}" CACHE INTERNAL "")
set(Launcher_FSName "devlauncher" CACHE INTERNAL "")
set(Launcher_DisplayName "${Launcher_CommonName} 6" CACHE INTERNAL "")
set(Launcher_UserAgent "${Launcher_CommonName}/6.0" CACHE INTERNAL "")
set(Launcher_ConfigFile "${Launcher_FSName}.cfg" CACHE INTERNAL "")
set(Launcher_Git "https://github.com/MultiMC/Launcher" CACHE INTERNAL "")
set(Launcher_Identifier "org.multimc.${Launcher_Name}" CACHE INTERNAL "")
set(Launcher_Description "${Launcher_Name}: Minecraft launcher and management utility." CACHE INTERNAL "")

set(Launcher_Branding_ICNS "notsecrets/Launcher.icns" PARENT_SCOPE)
set(Launcher_Branding_WindowsRC "notsecrets/launcher.rc" PARENT_SCOPE)
set(Launcher_Branding_LogoQRC "notsecrets/logo.qrc" PARENT_SCOPE)
set(Launcher_Branding_ICO "Launcher.ico" CACHE INTERNAL "")
set(Launcher_Branding_ICNS "notsecrets/Launcher.icns" CACHE INTERNAL "")
set(Launcher_Branding_WindowsRC "notsecrets/windows_metafile.rc" CACHE INTERNAL "")
set(Launcher_Branding_LogoQRC "notsecrets/logo.qrc" CACHE INTERNAL "")

add_project_meta(META_FILES_TO_INCLUDE)
31 changes: 0 additions & 31 deletions notsecrets/Launcher.manifest

This file was deleted.

29 changes: 0 additions & 29 deletions notsecrets/launcher.rc

This file was deleted.

0 comments on commit 0b7bac9

Please sign in to comment.