KDEConnect/Build Windows: Difference between revisions

From KDE Community Wiki
No edit summary
No edit summary
Line 1: Line 1:
Craft is an open source meta build system and package manager. It manages dependencies and builds libraries and applications from source, on Windows, Mac, Linux and FreeBSD.
KDE Connect works quite well on Windows, with all plugins ported over from the OG Linux app.
Visit [https://community.kde.org/Craft here] for more information about Craft.


The development environment is contained within the directory, called '''CraftRoot''' by default, so feel free to experiment with the Craft installation.
<div>__TOC__</div>


<div class="noautonum">__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]. 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!


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


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


Run the following commands now.
==== MSVC ====


<syntaxhighlight lang="sh">
# Install Visual Studio 2019 (Community) from [https://visualstudio.microsoft.com/downloads/ '''here'''] and select '''Desktop development with C++'''.
# Install these packages.


# First, we set the various dependencies of kdeconnect-kde to be installed from the code in the master branch.
[[File:kdeconnect_win01.jpeg | Select these components]]


craft --set version=master kdeconnect-kde
<syntaxhighlight>
craft --set version=master craft
* Just-in-Time debugger
craft --set version=master kirigami
* VC++ 2019 version
craft --set version=master attica
* C++ profiling tools
craft --set version=master kde/frameworks/tier3
* Windows 10 SDK
craft --set version=master dev-utils/snoretoast
* Visual C++ tools for CMake
craft --set version=master kde/frameworks/tier1/sonnet
* Visual C++ ATL for x86 and x64
craft --set version=master libs/libssh2
* Test Adapter for Boost.Test
craft --set version=master kde/frameworks/tier3/kio
* Test Adapter for Google Test
craft --set version=master kde/kdenetwork/kio-extras
</syntaxhighlight>
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 kcontacts
craft --set version=master ki18n
craft --set version=master kjobwidgets
craft --set version=master kpackage
craft --set version=master breeze-icons
craft --set version=master kconfigwidgets


</syntaxhighlight>


==== MinGW-w64 ====


= Build/install KDE Connect =
# 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.


Run the following commands now:
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!


<syntaxhighlight lang="sh">


# Now we install kdeconnect-kde within CraftRoot.
=== Install Craft ===


craft -i kdeconnect-kde
# 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'))
#:</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]]
#:<syntaxhighlight lang="powershell">
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
#:</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]]
#:<syntaxhighlight lang="powershell">
[Environment]
PATH=


# Get qtbase source for debugging
Craft                : C:\CraftRoot
Version              : master
ABI                  : windows-msvc2019_64-c1
Download directory  : C:\CraftRoot\download
#:</syntaxhighlight>


craft --fetch --unpack libs/qt5/qtbase


# If everything went fine, you're ready!
== Build KDE Connect ==


</syntaxhighlight>
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''.


# Open '''Craft CraftRoot''' from search (in taskbar).


= Build with changes to code =
Once you have the terminal open, head over to [https://community.kde.org/KDEConnect/Build_Craft this link] for further instructions.


Remember the source code for kdeconnect-kde is accessible via <code>cs kdeconnect-kde</code>.
== [OPTIONAL] Build a redistributable installer ==
Once you make some changes, run:


# Open <code>CraftRoot/etc/CraftSettings.ini</code>
# To make an EXE setup, set PackageType to <code>NullsoftInstallerPackager</code>. <br/>
TO make an AppX setup, set PackageType 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">
<syntaxhighlight lang="sh">
craft --compile --install --qmerge kdeconnect-kde
craft --package kdeconnect-kde
</syntaxhighlight>
</syntaxhighlight>


This will update the kdeconnect-kde package installed within $CraftRoot.
'''Note''': The output files are saved in: <code>CraftRoot/tmp/</code>
 
Warning: Do not run <code>craft -i kdeconnect-kde</code> ! This command overwrites the installation with a build of kdeconnect-kde from master branch.
 
Visit [https://community.kde.org/Craft here] for more information about Craft.
 
 
= Using an IDE =
Multiple IDEs have been tested to work quite well with Craft. To see available guides, click [https://community.kde.org/Craft#Using_Craft_with_an_IDE here].


== FAQs : FREQUENTLY ASKED QUESTIONS ==


= FAQs =
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.


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.


# ''' What versions of packages did I just install? What version of KDE Connect did I just build?'''
# '''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?'''


At the <code>CraftRoot/</code> prompt, to see the catalog of installed packages, run this command:
Just run this command:
<syntaxhighlight lang="sh">
<syntaxhighlight lang="dosbatch">
craft --print-installed
C:\CraftRoot\bin\SnoreToast.exe -install "KDE Connect DEV" "C:/CraftRoot/bin/kdeconnectd.exe" "kdeconnect.daemon"


</syntaxhighlight>
</syntaxhighlight>


The KDE Connect version will be based on the latest git commit in the repository. To see what is the latest release (latest tag) and any commits since the release, run these commands:
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].
<syntaxhighlight lang="sh">
cd download/git/extragear/kdeconnect-kde
git tag
git log --tags
echo notice the commit date for the latest tag.
echo release v1.3.5 commit date is "May 19 2019"
echo the following will show all the commits since release v1.3.5
echo (assuming the current year is 2019)
git log --since="May 19"


</syntaxhighlight>


# '''How can I contact the KDE Connect team? I'd like to talk to the team about an issue/ suggestion.'''


# '''How can I contact the KDE Connect team? I'd like to talk to the team about an issue/ suggestion.'''


* Telegram: You can find a link to our Telegram group [https://community.kde.org/Telegram here].
* Telegram: You can find a link to our Telegram group [https://community.kde.org/Telegram here].
* IRC on Freenode: #kdeconnect
* IRC on Libera Chat: #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]

Revision as of 02:15, 20 July 2021

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. 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!

Choose your compiler

MSVC (full-support) | MinGW-w64 (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-w64

  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).

Once you have the terminal open, head over to this link for further instructions.

[OPTIONAL] Build a redistributable installer

  1. Open CraftRoot/etc/CraftSettings.ini
  2. To make an EXE setup, set PackageType to NullsoftInstallerPackager.

TO make an AppX setup, set PackageType to AppxPackager.

  1. 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.


  1. How can I contact the KDE Connect team? I'd like to talk to the team about an issue/ suggestion.



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