-
Notifications
You must be signed in to change notification settings - Fork 1
Add support for Windows Store packaging #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
8d64f84
bce00d4
d5b122e
7071072
ec67843
94573d0
e730256
aef949e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| #include <QCoreApplication> | ||
| #include <QCommandLineParser> | ||
| #include <QProcess> | ||
| #include "deployfolder.h" | ||
| #include "common.h" | ||
| #include "systemlibrarydatabase.h" | ||
|
|
@@ -14,6 +15,11 @@ int main(int argc, char** argv) { | |
| parser.addOption({{"q", "qt-path"}, "Path to Qt installation to use", "qt-path"}); | ||
| parser.addOption({{"h", "host-qt-path"}, "When deploying a cross-compiled application, path to Host Qt installation", "host-qt-path"}); | ||
| parser.addOption({{"l", "library-path"}, "Path to search for libraries to deploy (defaults to Program Files)", "library-path"}); | ||
| parser.addPositionalArgument("directory", "Directory containing application to prepare for deployment"); | ||
| parser.addOption({ | ||
| {"a", "appx-output"}, | ||
| "APPX bundle output file", "appx-output" | ||
| }); | ||
| QCommandLineOption helpOption = parser.addHelpOption(); | ||
| parser.parse(a.arguments()); | ||
|
|
||
|
|
@@ -85,7 +91,7 @@ int main(int argc, char** argv) { | |
| QStringList supportLibraryPaths; | ||
|
|
||
| QDir rootProjectDir = deployFolder.destinationDir().absoluteFilePath("./"); | ||
| for (QString markerFile : Common::findInPaths(".cntp-is-support-library", {rootProjectDir.absolutePath()}, true)) { | ||
| for (const QString &markerFile : Common::findInPaths(".cntp-is-support-library", {rootProjectDir.absolutePath()}, true)) { | ||
| QFileInfo markerFileInfo(markerFile); | ||
| QDir libDir = markerFileInfo.dir(); | ||
|
|
||
|
|
@@ -100,11 +106,20 @@ int main(int argc, char** argv) { | |
|
|
||
| output << "Creating System Library Database...\n"; | ||
| output.flush(); | ||
| SystemLibraryDatabase* libraryDatabase = new SystemLibraryDatabase(supportLibraryPaths, sdkVersion, qt6CorePe.targetMachine(), libraryPaths); | ||
| auto* libraryDatabase = new SystemLibraryDatabase(supportLibraryPaths, sdkVersion, qt6CorePe.targetMachine(), libraryPaths); | ||
|
|
||
| output << "Making folder self contained\n"; | ||
| output.flush(); | ||
| deployFolder.makeSelfContained(libraryDatabase); | ||
|
|
||
| if (parser.isSet("appx-output")) { | ||
| QFile::remove(parser.value("appx-output")); | ||
|
|
||
| QProcess makeappxProcess; | ||
| makeappxProcess.setProcessChannelMode(QProcess::ForwardedChannels); | ||
| makeappxProcess.start("makeappx", {"pack", "/d", deployFolder.destinationDir().absolutePath(), "/p", parser.value("appx-output")}); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to be able to make multi-architecture bundles too. Bonus if we can split the architecture-neutral files out as well
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'll need to have some discussions about the multi-architecture bundles once support for cross compiling arm is complete |
||
| makeappxProcess.waitForFinished(-1); | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| include_guard() | ||
|
|
||
| function(cntp_repoversion outvar) | ||
| set(${outvar}_MAJOR 0 PARENT_SCOPE) | ||
| set(${outvar}_MINOR 0 PARENT_SCOPE) | ||
| set(${outvar}_REVISION 0 PARENT_SCOPE) | ||
| set(${outvar}_BUILD 0 PARENT_SCOPE) | ||
|
|
||
| find_program(CNTP_GIT_COMMAND git) | ||
| if(CNTP_GIT_COMMAND) | ||
| execute_process(COMMAND ${CNTP_GIT_COMMAND} describe --abbrev=0 --tags | ||
| OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT | ||
| RESULT_VARIABLE GIT_DESCRIBE_RESULT | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | ||
| if(CNTP_GIT_RESULT EQUAL 0) | ||
| execute_process(COMMAND ${CNTP_GIT_COMMAND} rev-list ${GIT_DESCRIBE_OUTPUT}.. --count | ||
| OUTPUT_VARIABLE GIT_REVLIST_OUTPUT | ||
| RESULT_VARIABLE GIT_DESCRIBE_RESULT | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | ||
| if(CNTP_GIT_RESULT EQUAL 0) | ||
| if(GIT_DESCRIBE_OUTPUT MATCHES "v*") | ||
| string(SUBSTRING ${GIT_DESCRIBE_OUTPUT} 1 -1 GIT_VERSION_STRIPPED) | ||
| string(REGEX REPLACE "\\." ";" GIT_VERSION_PARTS ${GIT_VERSION_STRIPPED}) | ||
|
|
||
| # Default versions to 0 if they can't be found - the list will always have at least 3 elements | ||
| list(APPEND GIT_VERSION_PARTS 0 0 0) | ||
| list(POP_FRONT GIT_VERSION_PARTS ${outvar}_MAJOR ${outvar}_MINOR ${outvar}_REVISION) | ||
|
|
||
| set(${outvar}_MAJOR ${${outvar}_MAJOR} PARENT_SCOPE) | ||
| set(${outvar}_MINOR ${${outvar}_MINOR} PARENT_SCOPE) | ||
| set(${outvar}_REVISION ${${outvar}_REVISION} PARENT_SCOPE) | ||
| set(${outvar}_BUILD ${GIT_REVLIST_OUTPUT} PARENT_SCOPE) | ||
| else() | ||
| message("Cannot determine repo version from Git; last tag does not start with v") | ||
| endif() | ||
| else() | ||
| message("Cannot determine repo version from Git; maybe not a Git repository?") | ||
| endif() | ||
| else() | ||
| message("Cannot determine repo version from Git; maybe not a Git repository?") | ||
| endif() | ||
| else() | ||
| message("Cannot determine repo version because Git is not installed") | ||
| endif() | ||
| endfunction() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| include_guard() | ||
|
|
||
| function(cntp_translate_arch outvar arch) | ||
| if(${arch} STREQUAL "AMD64") | ||
| set(${outvar} "x64" PARENT_SCOPE) | ||
| elseif(${arch} STREQUAL "arm64") | ||
| set(${outvar} "arm64" PARENT_SCOPE) | ||
| else() | ||
| set(${outvar} ${arch} PARENT_SCOPE) | ||
| endif() | ||
| endfunction() | ||
|
|
||
| function(cntp_winappx target appxmanifest) | ||
| if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||
| get_target_property(APPX_DISPLAY_NAME ${target} READABLE_NAME) | ||
| get_target_property(APPX_EXECUTABLE_NAME ${target} OUTPUT_NAME) | ||
|
|
||
| cntp_repoversion(REPOVERSION) | ||
|
|
||
| if(";${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION};$ENV{UCRTVersion};$ENV{WindowsSDKVersion};" MATCHES [=[;(10\.[0-9.]+)[;\]]=]) | ||
| get_filename_component(WINDOWS_KITS_BASE_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE) | ||
| set(WINDOWS_SDK_VERSION ${CMAKE_MATCH_1}) | ||
| endif() | ||
|
|
||
| cntp_translate_arch(CNTP_TARGET_TRANSLATED_ARCH ${CNTP_TARGET_ARCH}) | ||
|
|
||
| string(REGEX REPLACE "\\." ";" APPX_SDK_VERSION_PARTS ${WINDOWS_SDK_VERSION}) | ||
|
|
||
| # Default versions to 0 if they can't be found - the list will always have at least 4 elements | ||
| list(APPEND APPX_SDK_VERSION_PARTS 0 0 0 0) | ||
| list(POP_FRONT APPX_SDK_VERSION_PARTS APPX_SDK_VERSION_MAJOR APPX_SDK_VERSION_MINOR APPX_SDK_VERSION_REVISION APPX_SDK_VERSION_BUILD) | ||
|
|
||
| set(${outvar}_MAJOR ${${outvar}_MAJOR} PARENT_SCOPE) | ||
| set(${outvar}_MINOR ${${outvar}_MINOR} PARENT_SCOPE) | ||
| set(${outvar}_REVISION ${${outvar}_REVISION} PARENT_SCOPE) | ||
| set(${outvar}_BUILD ${GIT_REVLIST_OUTPUT} PARENT_SCOPE) | ||
|
|
||
| set(APPX_EXECUTABLE_NAME ${APPX_EXECUTABLE_NAME}.exe) | ||
| set(APPX_ARCH ${CNTP_TARGET_TRANSLATED_ARCH}) | ||
| set(APPX_VERSION ${REPOVERSION_MAJOR}.${REPOVERSION_MINOR}.${REPOVERSION_REVISION}.0) | ||
| set(APPX_SDK_VERSION ${APPX_SDK_VERSION_MAJOR}.${APPX_SDK_VERSION_MINOR}.${APPX_SDK_VERSION_REVISION}.${APPX_SDK_VERSION_BUILD}) | ||
| configure_file(${appxmanifest} appxmanifest.xml) | ||
| endif() | ||
| endfunction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should generate all the right sizes and assets according to https://learn.microsoft.com/en-us/windows/apps/design/style/iconography/app-icon-construction. We also need to make sure that the sizing is correct