KDEConnect/Build Windows: Difference between revisions

From KDE Community Wiki
(Add MinGW configuration with Craft)
(Change Telegram link to Matrix)
 
(71 intermediate revisions by 6 users not shown)
Line 1: Line 1:
NOTE: This tutorial assumes Craft is being installed in <code>C:/</code> [default]
KDE Connect works quite well on Windows, with all plugins ported over from the OG Linux app.


== SETTING UP ENVIRONMENT ==
<div>__TOC__</div>


# Install Visual Studio 2017 from [https://visualstudio.microsoft.com/downloads/ here]
== Get a compiler ==
# Install these packages
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!


<pre>Just-in-Time debugger
=== Choose your compiler ===
VC++ 2017 version 15.9
<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>
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
</pre>
[[File:kdeconnect_win01.jpeg | Select these components]]


<ol start="3">
Right now, '''MSVC''' does the best job as a compiler for KDE Connect for Windows.
<li>Call the following commands in a Powershell window with ''Administrator Privileges'' :-</li></ol>


<pre>Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
==== MSVC ====
 
# Install Visual Studio 2019 (Community) from [https://visualstudio.microsoft.com/downloads/ '''here'''] and select '''Desktop development with C++'''.
# 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>
 
==== minGW ====
 
# 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.
 
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 ===
 
# Call the following commands in a Powershell window with ''Administrator Privileges''
#:<syntaxhighlight lang="powershell">
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>
<ol start="4">
# During command 2, select '''Visual Studio 19''' if you chose MSVC earlier, otherwise '''Mingw-w64''' as your compiler.
<li>During command 2, be sure to select '''Visual Studio 17''' as your compiler!
#:[[File:kdeconnect_win02.jpeg|INSTALLATION 1]]
[[File:kdeconnect_win02.jpeg|INSTALLATION 1]]</li></ol>
#:<syntaxhighlight lang="powershell">
 
Select compiler
<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 2015, [2] Microsoft Visual Studio 2017 (default is Microsoft Visual Studio 2015): 2
Select architecture
Select architecture
[0] x86 [1] x64 (Default is x64): 1
[0] x86 [1] x64 (Default is x64): 1
</pre>
</syntaxhighlight>
<ol start="5">
# When the installation is done, note the Environment variables to match the ones in the top of this image:-  
<li>When installation is done, note the Environment variables to match the ones in top of this image:- [[File:kdeconnect_win03.jpeg|env vars]]</li></ol>
#:[[File:kdeconnect_win03.jpeg|env vars]]
 
#:<syntaxhighlight lang="powershell">
<pre>[Environment]
[Environment]
PATH=
PATH=


Craft                             : C:\CraftRoot
Craft               : C:\CraftRoot
Version                         : master
Version             : master
ABI                               : windows-msvc2017_64-c1
ABI                 : windows-msvc2019_64-c1
Download directory  : C:\CraftRoot\download
Download directory  : C:\CraftRoot\download
</pre>
</syntaxhighlight>
 
== Getting the source code and building ==


NOTE : This is a CPU intensive process
== Build KDE Connect ==


# Open a normal Powershell window and call these commands to fire up the <code>Craft</code> environment : <code>C:\CraftRoot\craft\craftenv.ps1</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''.
# To get the latest source and start the building process: <code>craft extragear/kdeconnect-kde</code>


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


# 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>
== [OPTIONAL] Build a redistributable installer ==
[[File:kdeconnect_win04.jpeg|install NSIS]]
# Now you can use the <code>--package</code> flag to build an installable '''.EXE''' out of latest source code available [https://invent.kde.org/kde/kdeconnect-kde here]. The command should look like this: <code>craft --package extragear/kdeconnect-kde</code>


Note the output file here:
# 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>


<code>Output: &quot;C:\CraftRoot\tmp\kdeconnect-kde-master-86e5cd48-windows-msvc2017_64-cl.exe&quot;</code>
'''Note''': The output files are saved in: <code>CraftRoot/tmp/</code>


Great thanks to &lt;TheOneRing_m&gt; (Hannah) on IRC Freenode! She is the maintainer of KDE Craft, and a magician! <span class="emoji" data-emoji="smile">😄</span>
== FAQs : FREQUENTLY ASKED QUESTIONS ==


== SETTING UP ENVIRONMENT of MinGW environment (Experiemental, Option) ==
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.


<ol start="1">
# '''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?'''
<li>Call the following commands in a Powershell window with ''Administrator Privileges'' :-</li></ol>
#:Just run this command:
#:<syntaxhighlight lang="dosbatch">
C:\CraftRoot\bin\SnoreToast.exe -install "KDE Connect DEV" "C:/CraftRoot/bin/kdeconnectd.exe" "kdeconnect.daemon"


<pre>Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
</syntaxhighlight>
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/KDE/craft/master/setup/install_craft.ps1'))
#: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].
</pre>
# '''How can I contact the KDE Connect team? I'd like to talk to the team about an issue/ suggestion.'''
<ol start="2">
#:
<li>During command 2, feel free to select '''Mingw-w64''' as your compiler!
#:* Matrix: You can find a link to our Matrix room [https://community.kde.org/Matrix here].
#:* IRC on Libera Chat: #kdeconnect
#:* Mailing List: [https://mail.kde.org/mailman/listinfo/kdeconnect https://mail.kde.org/mailman/listinfo/kdeconnect]
#:* email ID: [email protected]


<pre>Select compiler
[0] Mingw-w64, [1] Microsoft Visual Studio 2015, [2] Microsoft Visual Studio 2017 (default is Microsoft Visual Studio 2015): 0
Select architecture
[0] x86 [1] x64 (Default is x64): 1
</pre>


Then there is no difference between this way and the one above.
''Be sure to let us know if you got stuck somewhere in the process of setting up the developer environment. You can [mailto:kdeconnect@kde.org mail us]. Yes, we read the mails!''
Note that due to the lacking of some definitions in MinGW provided header file, system volume plugin could not be compiled correctly on Windows using MinGW.
This feature is still an experimental feature.

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!