KDEConnect/Build Windows: Difference between revisions

From KDE Community Wiki
No edit summary
(Change Telegram link to Matrix)
 
(39 intermediate revisions by 4 users not shown)
Line 1: Line 1:
KDE Connect works quite well on Windows, with all plugins ported over from the OG Linux app.


{{Warning|This is an unfinished article}}
<div>__TOC__</div>


== Get a compiler ==
The environment for KDE Connect on Windows simply consists of two parts- A compiler of choice and a build system.
While we do have a couple of options for the compiler, our recommended build system is [https://community.kde.org/Craft Craft].
This is a comprehensive build guide. However, you should definitely refer to Craft's documentation
for further information on using the build system in your development environment!


== -1. DEVELOPER RECOMMENDATIONS ==
=== Choose your compiler ===
In case you get stuck, check out these recommendations for the build process.
<p align = "center"> [https://community.kde.org/KDEConnect/Build_Windows#MSVC '''MSVC'''] (full-support) | [https://community.kde.org/KDEConnect/Build_Windows#minGW '''minGW'''] (partial support) </p>


* As a developer you'd naturally want to be able to test out all the features offered by KDE Connect. Right now '''MSVC does the best job as a compiler''', so you may choose that.
Right now, '''MSVC''' does the best job as a compiler for KDE Connect for Windows.
* We recommend to '''install Craft in <code>C:/</code> [default]'''
* Check out Craft docs for more help on how to use it.


__TOC__
==== MSVC ====


== 0. SETTING UP ENVIRONMENT ==
# Install Visual Studio 2019 (Community) from [https://visualstudio.microsoft.com/downloads/ '''here'''] and select '''Desktop development with C++'''.
The environment for KDE Connect on Windows simply consists of two parts- A compiler of choice and a build system. While we do have a couple of options for the compiler, our recommended build system is [https://community.kde.org/Craft Craft]. While this is an all-in-one build guide, you should definitely refer to Craft's documentation for further information on using the build system in your development environment!
# Install these packages.
#:[[File:kdeconnect_win01.jpeg | Select these components]]
#:<syntaxhighlight>
* Just-in-Time debugger
* VC++ 2019 version
* C++ profiling tools
* Windows 10 SDK
* Visual C++ tools for CMake
* Visual C++ ATL for x86 and x64
* Test Adapter for Boost.Test
* Test Adapter for Google Test
</syntaxhighlight>


Choose your compiler of choice:-
==== minGW ====
<p align = "center"> [https://community.kde.org/KDEConnect/Build_Windows#0.1_Installing_MSVC '''MSVC'''] (full-support) | [https://community.kde.org/KDEConnect/Build_Windows#0.2_Installing_MinGW-w64 '''MinGW-w64'''] (partial support) </p>


=== 0.1 Installing MSVC ===
# Install MinGW-w64 through the GUI installer located [http://www.mingw.org/wiki/Getting_Started here].
# While installing Craft, select '''Mingw-w64''' as your compiler.


1. Install Visual Studio 2019 (Community) from [https://visualstudio.microsoft.com/downloads/ '''here'''] and select '''Desktop development with C++'''.
Note that due to the lacking of some definitions in the minGW headers, some plugins could not be compiled with all functions on Windows using MinGW.
Patches are certainly welcome!


2. Install these packages.
=== Install Craft ===


[[File:kdeconnect_win01.jpeg | Select these components]]
# Call the following commands in a Powershell window with ''Administrator Privileges''
 
#:<syntaxhighlight lang="powershell">
** Just-in-Time debugger
** VC++ 2019 version
** C++ profiling tools
** Windows 10 SDK
** Visual C++ tools for CMake
** Visual C++ ATL for x86 and x64
** Test Adapter for Boost.Test
** Test Adapter for Google Test
 
=== 0.2 Installing MinGW-w64 ===
 
1. Install MinGW-w64 through the GUI installer located [http://www.mingw.org/wiki/Getting_Started here].
 
2. While installing Craft, feel free to select '''Mingw-w64''' as your compiler!
 
Afterwards, there is no difference in the commands used in the development.
Note that due to the lacking of some definitions in MinGW provided header file, some plugins could not be compiled with all functions on Windows using MinGW.
 
'''This is still an experimental feature, and you might need some developer know-how to get past any build problems.'''
 
 
=== 0.X Installing Craft ===
 
1. Call the following commands in a Powershell window with ''Administrator Privileges''
 
 
<pre>
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/KDE/craft/master/setup/install_craft.ps1'))
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/KDE/craft/master/setup/install_craft.ps1'))
</pre>
</syntaxhighlight>
 
# During command 2, select '''Visual Studio 19''' if you chose MSVC earlier, otherwise '''Mingw-w64''' as your compiler.
 
#:[[File:kdeconnect_win02.jpeg|INSTALLATION 1]]
2. During command 2, select '''Visual Studio 19''' if you chose MSVC earlier, otherwise '''Mingw-w64''' as your compiler.
#:<syntaxhighlight lang="powershell">
 
Select compiler
[[File:kdeconnect_win02.jpeg|INSTALLATION 1]]
 
<pre>Select compiler
[0] Mingw-w64, [1] Microsoft Visual Studio 2017, [2] Microsoft Visual Studio 2019 (default is Microsoft Visual Studio 2017): 2
[0] Mingw-w64, [1] Microsoft Visual Studio 2017, [2] Microsoft Visual Studio 2019 (default is Microsoft Visual Studio 2017): 2
Select architecture
Select architecture
[0] x86 [1] x64 (Default is x64): 1
[0] x86 [1] x64 (Default is x64): 1
</pre>
</syntaxhighlight>
 
# When the installation is done, note the Environment variables to match the ones in the top of this image:-  
 
#:[[File:kdeconnect_win03.jpeg|env vars]]
3. When installation is done, note the Environment variables to match the ones in top of this image:-  
#:<syntaxhighlight lang="powershell">
 
[[File:kdeconnect_win03.jpeg|env vars]]
 
<pre>
[Environment]
[Environment]
PATH=
PATH=
Line 81: Line 63:
ABI                  : windows-msvc2019_64-c1
ABI                  : windows-msvc2019_64-c1
Download directory  : C:\CraftRoot\download
Download directory  : C:\CraftRoot\download
</pre>
</syntaxhighlight>


 
== Build KDE Connect ==
== 1. BUILDING KDE CONNECT OUT OF LATEST SOURCE CODE==


Craft has automated most of the redundant parts of the build process and exposed just the really useful parameters like ''which version to build'', ''where to install'' ''et al''.
Craft has automated most of the redundant parts of the build process and exposed just the really useful parameters like ''which version to build'', ''where to install'' ''et al''.


1. Open '''Craft CraftRoot''' from search (in taskbar).
# Open '''Craft CraftRoot''' from search (in taskbar).
# Head over to [https://community.kde.org/KDEConnect/Build_Craft this link] for further instructions.


2. Run the following commands now.
== [OPTIONAL] Build a redistributable installer ==


# Open <code>CraftRoot/etc/CraftSettings.ini</code>
# To make an EXE installer, set <code>PackageType</code> to <code>NullsoftInstallerPackager</code>. <br/>
#:TO make an AppX installer, set <code>PackageType</code> to <code>AppxPackager</code>.
# Now you can use the <code>--package</code> flag to build to instruct Craft to build an installer.
#:<syntaxhighlight lang="sh">
craft --package kdeconnect-kde
</syntaxhighlight>


<pre>
'''Note''': The output files are saved in: <code>CraftRoot/tmp/</code>


REM First, we set the various dependencies of kdeconnect-kde to be installed from the code in master branch.
== FAQs : FREQUENTLY ASKED QUESTIONS ==


craft --set version=master kdeconnect-kde
We are only human! There are many questions that we face commonly, during DevSprints and during the onboarding of new contributors. Just skim through all the commonly asked questions so you don't have to ask around like others had to.
craft --set version=master craft
craft --set version=master kde/frameworks/tier3
craft --set version=master dev-utils/snoretoast
craft --set version=master kde/frameworks/tier1/sonnet
craft --set version=master libs/libssh2
craft --set version=master kde/frameworks/tier3/kio
craft --set version=master kde/kdenetwork/kio-extras
craft --set version=master kde/frameworks/tier1/kcoreaddons
craft --set version=master kde/frameworks/tier2/kauth
craft --set version=master kde/frameworks/extra-cmake-modules
craft --set version=master kde/frameworks/tier1/kwindowsystem
craft --set version=master kde/frameworks/tier1/kconfig
craft --set version=master kde/frameworks/tier1/kcodecs
craft --set version=master kde/frameworks/tier1/kwidgetsaddons
craft --set version=master kde/frameworks/tier1/kitemviews
craft --set version=master kde/frameworks/tier1/kguiaddons
craft --set version=master kde/frameworks/tier2/kcrash
craft --set version=master kde/frameworks/tier1/kdbusaddons
craft --set version=master kde/frameworks/tier2/kdoctools
craft --set version=master kde/frameworks/tier1/karchive
craft --set version=master kde/frameworks/tier2/kcompletion
craft --set version=master kde/frameworks/tier3/kiconthemes
craft --set version=master kde/frameworks/tier1/solid
craft --set version=master kde/pim/kcontacts


REM Now we install kdeconnect-kde within CraftRoot.
# '''I don't get the notification buttons, and the application name in the notifications is weird (something like <code>kdeconnect.daemon</code>. How do I fix it?'''
 
#:Just run this command:
craft -i kdeconnect-kde
#:<syntaxhighlight lang="dosbatch">
</pre>
 
== 3. BUILDING A SHARE-ABLE INSTALLER ==
 
Choose your package of choice:-
<p align = "center"> [https://community.kde.org/KDEConnect/Build_Windows#3.1_creating_a_desktop_application_.exe_setup '''.EXE Setup'''] (full-support) | [https://community.kde.org/KDEConnect/Build_Windows#3.2_creating_a_Windows_App_.Appx_package '''.Appx package for Windows Store'''] (partial support) </p>
 
 
 
=== 3.1 creating a desktop application <code>.exe</code> setup ===
 
0. Make sure PackageType is set as <code>PackageType = NullsoftInstallerPackager</code> in <code>CraftRoot/etc/CraftSettings.ini</code>.
 
1. To create an installable setup, you need [https://sourceforge.net/projects/nsis/ '''NSIS- a open source system to create Windows installers''']. Install it by this command: <code>craft nsis</code>
 
 
[[File:kdeconnect_win04.jpeg|install NSIS]]
 
 
=== 3.2 creating a Windows App <code>.Appx</code> package ===
 
0. Make sure PackageType is set as <code>PackageType = AppxPackager</code> in <code>CraftRoot/etc/CraftSettings.ini</code>.
 
=== 3.X Packaging through Craft ===
 
1. Now you can use the <code>--package</code> flag to build an installer. Run this in '''Craft CraftRoot'''.
<pre>
craft --package extragear/kdeconnect-kde
</pre>
 
'''Note''': The output files are saved here: <code>C:\CraftRoot\tmp\</code>
 
== FAQs : Frequently Asked Questions ==
 
We are only human! There are many doubts that we face commonly, during DevSprints and during onboarding of new contributors. We'd like to expedite this process for you by enlisting all the commonly asked questions in one place so you don't have to ask around like others had to!
 
'''1. I see double plugins in my installed KDE Connect. How do I fix it?'''
 
Simple! Just rename your <code>CraftRoot/</code> folder to something different. Even <code>CraftRoot1/</code> will work! It's the design of the Craft-made packages that force installed applications to look in <code>CraftRoot/</code> for the plugins first and then into their own installation folder.
 
 
'''2. I don't get the notification buttons, and the application name in the notifications is weird (something like <code>kdeconnect.daemon</code>. How do I fix it?'''
 
Again, Simple! Just run this command, and you should be golden.
<pre>
C:\CraftRoot\bin\SnoreToast.exe -install "KDE Connect DEV" "C:/CraftRoot/bin/kdeconnectd.exe" "kdeconnect.daemon"
C:\CraftRoot\bin\SnoreToast.exe -install "KDE Connect DEV" "C:/CraftRoot/bin/kdeconnectd.exe" "kdeconnect.daemon"


</pre>
</syntaxhighlight>
A detailed explanation is available on my blog [https://journal.piyush.tech/gsoc_milestone_1/ here] and also in the code of SnoreToast backend for KNotifications [https://cgit.kde.org/knotifications.git/tree/src/notifybysnore.cpp#n32 here].
#:A detailed explanation is available [https://taskmaster9001.wordpress.com/2019/06/07/gsoc19-milestone-1/ here] and also in the code of Windows 10 backend for KNotifications [https://github.com/KDE/knotifications/blob/master/src/notifybysnore.cpp#L33 here].
 
# '''How can I contact the KDE Connect team? I'd like to talk to the team about an issue/ suggestion.'''
'''3. How can I contact you? I'd like to talk to the team about an issue/ suggestion.'''
#:
 
#:* Matrix: You can find a link to our Matrix room [https://community.kde.org/Matrix here].
* Telegram: You can find a link to our Telegram group [https://community.kde.org/Telegram here].
#:* IRC on Libera Chat: #kdeconnect
* IRC on Freenode: #kdeconnect
#:* Mailing List: [https://mail.kde.org/mailman/listinfo/kdeconnect https://mail.kde.org/mailman/listinfo/kdeconnect]
* Mailing List: [https://mail.kde.org/mailman/listinfo/kdeconnect https://mail.kde.org/mailman/listinfo/kdeconnect]
#:* email ID: [email protected]
* email ID: [email protected]




''Be sure to tell us if you got stuck somewhere in the process of setting up the developer environment. You can [mailto:[email protected] mail us.] Yes we read the mails!'' 😜
''Be sure to let us know if you got stuck somewhere in the process of setting up the developer environment. You can [mailto:[email protected] mail us]. Yes, we read the mails!''

Latest revision as of 16:58, 22 August 2023

KDE Connect works quite well on Windows, with all plugins ported over from the OG Linux app.

Get a compiler

The environment for KDE Connect on Windows simply consists of two parts- A compiler of choice and a build system. While we do have a couple of options for the compiler, our recommended build system is Craft. This is a comprehensive build guide. However, you should definitely refer to Craft's documentation for further information on using the build system in your development environment!

Choose your compiler

MSVC (full-support) | minGW (partial support)

Right now, MSVC does the best job as a compiler for KDE Connect for Windows.

MSVC

  1. Install Visual Studio 2019 (Community) from here and select Desktop development with C++.
  2. Install these packages.
    Select these components
    * Just-in-Time debugger
    * VC++ 2019 version
    * C++ profiling tools
    * Windows 10 SDK
    * Visual C++ tools for CMake
    * Visual C++ ATL for x86 and x64
    * Test Adapter for Boost.Test
    * Test Adapter for Google Test

minGW

  1. Install MinGW-w64 through the GUI installer located here.
  2. While installing Craft, select Mingw-w64 as your compiler.

Note that due to the lacking of some definitions in the minGW headers, some plugins could not be compiled with all functions on Windows using MinGW. Patches are certainly welcome!

Install Craft

  1. Call the following commands in a Powershell window with Administrator Privileges
    Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
    iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/KDE/craft/master/setup/install_craft.ps1'))
    
  2. During command 2, select Visual Studio 19 if you chose MSVC earlier, otherwise Mingw-w64 as your compiler.
    INSTALLATION 1
    Select compiler
    [0] Mingw-w64, [1] Microsoft Visual Studio 2017, [2] Microsoft Visual Studio 2019 (default is Microsoft Visual Studio 2017): 2
    Select architecture
    [0] x86 [1] x64 (Default is x64): 1
    
  3. When the installation is done, note the Environment variables to match the ones in the top of this image:-
    env vars
    [Environment]
    PATH=
    
    Craft                : C:\CraftRoot
    Version              : master
    ABI                  : windows-msvc2019_64-c1
    Download directory   : C:\CraftRoot\download
    

Build KDE Connect

Craft has automated most of the redundant parts of the build process and exposed just the really useful parameters like which version to build, where to install et al.

  1. Open Craft CraftRoot from search (in taskbar).
  2. Head over to this link for further instructions.

[OPTIONAL] Build a redistributable installer

  1. Open CraftRoot/etc/CraftSettings.ini
  2. To make an EXE installer, set PackageType to NullsoftInstallerPackager.
    TO make an AppX installer, set PackageType to AppxPackager.
  3. Now you can use the --package flag to build to instruct Craft to build an installer.
    craft --package kdeconnect-kde
    

Note: The output files are saved in: CraftRoot/tmp/

FAQs : FREQUENTLY ASKED QUESTIONS

We are only human! There are many questions that we face commonly, during DevSprints and during the onboarding of new contributors. Just skim through all the commonly asked questions so you don't have to ask around like others had to.

  1. I don't get the notification buttons, and the application name in the notifications is weird (something like kdeconnect.daemon. How do I fix it?
    Just run this command:
    C:\CraftRoot\bin\SnoreToast.exe -install "KDE Connect DEV" "C:/CraftRoot/bin/kdeconnectd.exe" "kdeconnect.daemon"
    
    A detailed explanation is available here and also in the code of Windows 10 backend for KNotifications here.
  2. How can I contact the KDE Connect team? I'd like to talk to the team about an issue/ suggestion.


Be sure to let us know if you got stuck somewhere in the process of setting up the developer environment. You can mail us. Yes, we read the mails!